basevideo: Add the caps to the GstVideoState and clean up caps/codec_data properly
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 27 Jun 2011 07:41:40 +0000 (09:41 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sat, 9 Jul 2011 09:02:01 +0000 (11:02 +0200)
Having access to the caps in ::set_format can be useful if
non-standard caps fields like the h264 alignment must be accessed.

gst-libs/gst/video/gstbasevideocodec.c
gst-libs/gst/video/gstbasevideocodec.h
gst-libs/gst/video/gstbasevideodecoder.c

index f2d4ee6ca629df1e265da89f01aa9ab489def95c..c605b39bf0ae6e573061c9e7adf6e841d68bb9e3 100644 (file)
@@ -114,6 +114,9 @@ gst_base_video_codec_reset (GstBaseVideoCodec * base_video_codec)
 
   base_video_codec->bytes = 0;
   base_video_codec->time = 0;
+
+  gst_buffer_replace (&base_video_codec->state.codec_data, NULL);
+  gst_caps_replace (&base_video_codec->state.caps, NULL);
 }
 
 static void
index e9431e20abf64805be95ca316ec265505ce34845..2fa6015d97c2e349743ea3de94701b999be45829 100644 (file)
@@ -86,6 +86,7 @@ typedef struct _GstBaseVideoCodecClass GstBaseVideoCodecClass;
 
 struct _GstVideoState
 {
+  GstCaps *caps;
   GstVideoFormat format;
   int width, height;
   int fps_n, fps_d;
index 81c84beb991af07423c83c5b3b29684c6a5b77ec..4f1e8e15557c4fedb665a229bbfde493ba73ebf3 100644 (file)
@@ -255,8 +255,12 @@ gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps)
 
   state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state;
 
+  gst_buffer_replace (&state->codec_data, NULL);
+  gst_caps_replace (&state->caps, NULL);
   memset (state, 0, sizeof (GstVideoState));
 
+  state->caps = gst_caps_ref (caps);
+
   structure = gst_caps_get_structure (caps, 0);
 
   gst_video_format_parse_caps (caps, NULL, &state->width, &state->height);