vdpau: change GstBaseVideoDecoder state api

This commit is contained in:
Carl-Anton Ingmarsson 2010-06-27 20:29:06 +02:00
parent 7274d9f142
commit d49cbe69e1
4 changed files with 21 additions and 33 deletions

View file

@ -669,7 +669,7 @@ gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query)
return res; return res;
} }
static void void
gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
{ {
GstCaps *caps; GstCaps *caps;
@ -1223,19 +1223,20 @@ gst_base_video_decoder_frame_start (GstBaseVideoDecoder * base_video_decoder,
base_video_decoder->frame_offset = GST_BUFFER_OFFSET (buf); base_video_decoder->frame_offset = GST_BUFFER_OFFSET (buf);
} }
GstVideoState * GstVideoState
gst_base_video_decoder_get_state (GstBaseVideoDecoder * base_video_decoder) gst_base_video_decoder_get_state (GstBaseVideoDecoder * base_video_decoder)
{ {
return &base_video_decoder->state; return base_video_decoder->state;
} }
void void
gst_base_video_decoder_set_state (GstBaseVideoDecoder * base_video_decoder, gst_base_video_decoder_set_state (GstBaseVideoDecoder * base_video_decoder,
GstVideoState * state) GstVideoState state)
{ {
memcpy (&base_video_decoder->state, state, sizeof (*state)); base_video_decoder->state = state;
base_video_decoder->have_src_caps = FALSE;
gst_base_video_decoder_set_src_caps (base_video_decoder);
} }
void void
@ -1259,16 +1260,6 @@ gst_base_video_decoder_get_current_frame (GstBaseVideoDecoder *
return base_video_decoder->current_frame; return base_video_decoder->current_frame;
} }
void
gst_base_video_decoder_update_src_caps (GstBaseVideoDecoder *
base_video_decoder)
{
g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (base_video_decoder));
base_video_decoder->have_src_caps = FALSE;
gst_base_video_decoder_set_src_caps (base_video_decoder);
}
/* GObject vmethod implementations */ /* GObject vmethod implementations */
static void static void
gst_base_video_decoder_get_property (GObject * object, guint property_id, gst_base_video_decoder_get_property (GObject * object, guint property_id,

View file

@ -185,14 +185,13 @@ GstFlowReturn
gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder, gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder,
GstVideoFrame **new_frame); GstVideoFrame **new_frame);
GstVideoState * gst_base_video_decoder_get_state (GstBaseVideoDecoder *base_video_decoder); GstVideoState gst_base_video_decoder_get_state (GstBaseVideoDecoder *base_video_decoder);
void gst_base_video_decoder_set_state (GstBaseVideoDecoder *base_video_decoder, void gst_base_video_decoder_set_state (GstBaseVideoDecoder *base_video_decoder,
GstVideoState *state); GstVideoState state);
void gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder);
void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder); void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder);
void gst_base_video_decoder_update_src_caps (GstBaseVideoDecoder *base_video_decoder);
G_END_DECLS G_END_DECLS
#endif #endif

View file

@ -263,13 +263,12 @@ gst_vdp_h264_dec_idr (GstVdpH264Dec * h264_dec, GstH264Frame * h264_frame)
GstFlowReturn ret; GstFlowReturn ret;
GstVdpDevice *device; GstVdpDevice *device;
gst_base_video_decoder_update_src_caps (GST_BASE_VIDEO_DECODER (h264_dec)); gst_base_video_decoder_set_src_caps (GST_BASE_VIDEO_DECODER (h264_dec));
ret = gst_vdp_decoder_get_device (GST_VDP_DECODER (h264_dec), &device, ret = gst_vdp_decoder_get_device (GST_VDP_DECODER (h264_dec), &device,
NULL); NULL);
if (ret == GST_FLOW_OK) { if (ret == GST_FLOW_OK) {
GstVideoState *state; GstVideoState state;
VdpDecoderProfile profile; VdpDecoderProfile profile;
VdpStatus status; VdpStatus status;
@ -299,7 +298,7 @@ gst_vdp_h264_dec_idr (GstVdpH264Dec * h264_dec, GstH264Frame * h264_frame)
} }
status = device->vdp_decoder_create (device->device, profile, status = device->vdp_decoder_create (device->device, profile,
state->width, state->height, seq->num_ref_frames, &h264_dec->decoder); state.width, state.height, seq->num_ref_frames, &h264_dec->decoder);
if (status != VDP_STATUS_OK) { if (status != VDP_STATUS_OK) {
GST_ELEMENT_ERROR (h264_dec, RESOURCE, READ, GST_ELEMENT_ERROR (h264_dec, RESOURCE, READ,
("Could not create vdpau decoder"), ("Could not create vdpau decoder"),

View file

@ -283,23 +283,22 @@ gst_vdp_mpeg_dec_handle_sequence (GstVdpMpegDec * mpeg_dec,
if (memcmp (&mpeg_dec->stream_info, &stream_info, if (memcmp (&mpeg_dec->stream_info, &stream_info,
sizeof (GstVdpMpegStreamInfo)) != 0) { sizeof (GstVdpMpegStreamInfo)) != 0) {
GstVideoState *state; GstVideoState state;
state = gst_base_video_decoder_get_state (base_video_decoder); state = gst_base_video_decoder_get_state (base_video_decoder);
state->width = stream_info.width; state.width = stream_info.width;
state->height = stream_info.height; state.height = stream_info.height;
state->fps_n = stream_info.fps_n; state.fps_n = stream_info.fps_n;
state->fps_d = stream_info.fps_d; state.fps_d = stream_info.fps_d;
state->par_n = stream_info.par_n; state.par_n = stream_info.par_n;
state->par_d = stream_info.par_d; state.par_d = stream_info.par_d;
state->interlaced = stream_info.interlaced; state.interlaced = stream_info.interlaced;
gst_base_video_decoder_set_state (base_video_decoder, state); gst_base_video_decoder_set_state (base_video_decoder, state);
gst_base_video_decoder_update_src_caps (base_video_decoder);
memcpy (&mpeg_dec->stream_info, &stream_info, memcpy (&mpeg_dec->stream_info, &stream_info,
sizeof (GstVdpMpegStreamInfo)); sizeof (GstVdpMpegStreamInfo));