vdpau: change GstBaseVideoDecoder state api
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
Sun, 27 Jun 2010 18:29:06 +0000 (20:29 +0200)
committerCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
Mon, 28 Jun 2010 09:11:52 +0000 (11:11 +0200)
sys/vdpau/basevideodecoder/gstbasevideodecoder.c
sys/vdpau/basevideodecoder/gstbasevideodecoder.h
sys/vdpau/h264/gstvdph264dec.c
sys/vdpau/mpeg/gstvdpmpegdec.c

index af9590f..353badf 100644 (file)
@@ -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,
index 24907b3..9756182 100644 (file)
@@ -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
index d3ce209..ba25dfa 100644 (file)
@@ -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"),
index e19fb68..76154ef 100644 (file)
@@ -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));