[MOVED FROM BAD 072/134] basevideodecoder: invoke subclass start method at state...
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Tue, 29 Mar 2011 08:41:54 +0000 (10:41 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 16 Sep 2012 13:27:15 +0000 (15:27 +0200)
While this changes API slightly (e.g. actually uses set_format now), which is OK
for unstable API, it has following merits:
* symmetric w.r.t. stop at state change
* in line with other base class practice
* otherwise no subclass method at state change (global activation time)
Moreover, subclassese are either unaffected or trivially adjusted accordingly.

ext/vp8/gstvp8dec.c

index 83a06b3..9b24dbd 100644 (file)
@@ -98,6 +98,8 @@ static void gst_vp8_dec_get_property (GObject * object, guint prop_id,
 
 static gboolean gst_vp8_dec_start (GstBaseVideoDecoder * decoder);
 static gboolean gst_vp8_dec_stop (GstBaseVideoDecoder * decoder);
+static gboolean gst_vp8_dec_set_format (GstBaseVideoDecoder * decoder,
+    GstVideoState * state);
 static gboolean gst_vp8_dec_reset (GstBaseVideoDecoder * decoder);
 static GstFlowReturn gst_vp8_dec_parse_data (GstBaseVideoDecoder * decoder,
     gboolean at_eos);
@@ -175,6 +177,7 @@ gst_vp8_dec_class_init (GstVP8DecClass * klass)
   base_video_decoder_class->start = gst_vp8_dec_start;
   base_video_decoder_class->stop = gst_vp8_dec_stop;
   base_video_decoder_class->reset = gst_vp8_dec_reset;
+  base_video_decoder_class->set_format = gst_vp8_dec_set_format;
   base_video_decoder_class->parse_data = gst_vp8_dec_parse_data;
   base_video_decoder_class->handle_frame = gst_vp8_dec_handle_frame;
 
@@ -275,6 +278,17 @@ gst_vp8_dec_stop (GstBaseVideoDecoder * base_video_decoder)
 }
 
 static gboolean
+gst_vp8_dec_set_format (GstBaseVideoDecoder * decoder, GstVideoState * state)
+{
+  GstVP8Dec *gst_vp8_dec = GST_VP8_DEC (decoder);
+
+  GST_DEBUG_OBJECT (gst_vp8_dec, "set_format");
+  gst_vp8_dec->decoder_inited = FALSE;
+
+  return TRUE;
+}
+
+static gboolean
 gst_vp8_dec_reset (GstBaseVideoDecoder * base_video_decoder)
 {
   GstVP8Dec *decoder;