summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-06-27 20:29:06 +0200
committerCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-06-28 11:11:52 +0200
commitd49cbe69e13e5e92bb6597238b1b0cfca081f905 (patch)
tree1c90bb6fd23f2d691ba48a31c4a7ac2e20113fe1
parent7274d9f1423a20f140e270f5a43edb6ddc8708b2 (diff)
vdpau: change GstBaseVideoDecoder state api
-rw-r--r--sys/vdpau/basevideodecoder/gstbasevideodecoder.c23
-rw-r--r--sys/vdpau/basevideodecoder/gstbasevideodecoder.h7
-rw-r--r--sys/vdpau/h264/gstvdph264dec.c7
-rw-r--r--sys/vdpau/mpeg/gstvdpmpegdec.c17
4 files changed, 21 insertions, 33 deletions
diff --git a/sys/vdpau/basevideodecoder/gstbasevideodecoder.c b/sys/vdpau/basevideodecoder/gstbasevideodecoder.c
index af9590f32..353badffa 100644
--- a/sys/vdpau/basevideodecoder/gstbasevideodecoder.c
+++ b/sys/vdpau/basevideodecoder/gstbasevideodecoder.c
@@ -669,7 +669,7 @@ gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query)
return res;
}
-static void
+void
gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
{
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);
}
-GstVideoState *
+GstVideoState
gst_base_video_decoder_get_state (GstBaseVideoDecoder * base_video_decoder)
{
- return &base_video_decoder->state;
-
+ return base_video_decoder->state;
}
void
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
@@ -1259,16 +1260,6 @@ gst_base_video_decoder_get_current_frame (GstBaseVideoDecoder *
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 */
static void
gst_base_video_decoder_get_property (GObject * object, guint property_id,
diff --git a/sys/vdpau/basevideodecoder/gstbasevideodecoder.h b/sys/vdpau/basevideodecoder/gstbasevideodecoder.h
index 24907b391..97561824d 100644
--- a/sys/vdpau/basevideodecoder/gstbasevideodecoder.h
+++ b/sys/vdpau/basevideodecoder/gstbasevideodecoder.h
@@ -185,14 +185,13 @@ GstFlowReturn
gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder,
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,
- 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_update_src_caps (GstBaseVideoDecoder *base_video_decoder);
-
G_END_DECLS
#endif
diff --git a/sys/vdpau/h264/gstvdph264dec.c b/sys/vdpau/h264/gstvdph264dec.c
index d3ce20930..ba25dfad3 100644
--- a/sys/vdpau/h264/gstvdph264dec.c
+++ b/sys/vdpau/h264/gstvdph264dec.c
@@ -263,13 +263,12 @@ gst_vdp_h264_dec_idr (GstVdpH264Dec * h264_dec, GstH264Frame * h264_frame)
GstFlowReturn ret;
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,
NULL);
if (ret == GST_FLOW_OK) {
- GstVideoState *state;
+ GstVideoState state;
VdpDecoderProfile profile;
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,
- 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) {
GST_ELEMENT_ERROR (h264_dec, RESOURCE, READ,
("Could not create vdpau decoder"),
diff --git a/sys/vdpau/mpeg/gstvdpmpegdec.c b/sys/vdpau/mpeg/gstvdpmpegdec.c
index e19fb68f2..76154ef5e 100644
--- a/sys/vdpau/mpeg/gstvdpmpegdec.c
+++ b/sys/vdpau/mpeg/gstvdpmpegdec.c
@@ -283,23 +283,22 @@ gst_vdp_mpeg_dec_handle_sequence (GstVdpMpegDec * mpeg_dec,
if (memcmp (&mpeg_dec->stream_info, &stream_info,
sizeof (GstVdpMpegStreamInfo)) != 0) {
- GstVideoState *state;
+ GstVideoState state;
state = gst_base_video_decoder_get_state (base_video_decoder);
- state->width = stream_info.width;
- state->height = stream_info.height;
+ state.width = stream_info.width;
+ state.height = stream_info.height;
- state->fps_n = stream_info.fps_n;
- state->fps_d = stream_info.fps_d;
+ state.fps_n = stream_info.fps_n;
+ state.fps_d = stream_info.fps_d;
- state->par_n = stream_info.par_n;
- state->par_d = stream_info.par_d;
+ state.par_n = stream_info.par_n;
+ 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_update_src_caps (base_video_decoder);
memcpy (&mpeg_dec->stream_info, &stream_info,
sizeof (GstVdpMpegStreamInfo));