[gst-cvs] gst-plugins-bad: vdpau: change GstBaseVideoDecoder state api

Carl-Anton Ingmarsson satis at kemper.freedesktop.org
Mon Jun 28 02:12:21 PDT 2010


Module: gst-plugins-bad
Branch: master
Commit: d49cbe69e13e5e92bb6597238b1b0cfca081f905
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=d49cbe69e13e5e92bb6597238b1b0cfca081f905

Author: Carl-Anton Ingmarsson <ca.ingmarsson at gmail.com>
Date:   Sun Jun 27 20:29:06 2010 +0200

vdpau: change GstBaseVideoDecoder state api

---

 sys/vdpau/basevideodecoder/gstbasevideodecoder.c |   23 ++++++---------------
 sys/vdpau/basevideodecoder/gstbasevideodecoder.h |    7 ++---
 sys/vdpau/h264/gstvdph264dec.c                   |    7 ++---
 sys/vdpau/mpeg/gstvdpmpegdec.c                   |   17 +++++++--------
 4 files changed, 21 insertions(+), 33 deletions(-)

diff --git a/sys/vdpau/basevideodecoder/gstbasevideodecoder.c b/sys/vdpau/basevideodecoder/gstbasevideodecoder.c
index af9590f..353badf 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 24907b3..9756182 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 d3ce209..ba25dfa 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 e19fb68..76154ef 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));





More information about the Gstreamer-commits mailing list