videodecoder: Add GstVideoDecoder::propose_allocation() vfunc
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 15 Jun 2012 14:06:12 +0000 (16:06 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 15 Jun 2012 14:38:16 +0000 (16:38 +0200)
gst-libs/gst/video/gstvideodecoder.c
gst-libs/gst/video/gstvideodecoder.h

index 14d711b..b8b3bd9 100644 (file)
@@ -287,6 +287,8 @@ static gboolean gst_video_decoder_src_event_default (GstVideoDecoder * decoder,
     GstEvent * event);
 static gboolean gst_video_decoder_decide_allocation_default (GstVideoDecoder *
     decoder, GstQuery * query);
+static gboolean gst_video_decoder_propose_allocation_default (GstVideoDecoder *
+    decoder, GstQuery * query);
 
 /* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
  * method to get to the padtemplates */
@@ -339,6 +341,7 @@ gst_video_decoder_class_init (GstVideoDecoderClass * klass)
   klass->sink_event = gst_video_decoder_sink_event_default;
   klass->src_event = gst_video_decoder_src_event_default;
   klass->decide_allocation = gst_video_decoder_decide_allocation_default;
+  klass->propose_allocation = gst_video_decoder_propose_allocation_default;
 }
 
 static void
@@ -1230,6 +1233,13 @@ gst_video_decoder_sink_query (GstPad * pad, GstObject * parent,
       gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
       break;
     }
+    case GST_QUERY_ALLOCATION:{
+      GstVideoDecoderClass *klass = GST_VIDEO_DECODER_GET_CLASS (decoder);
+
+      if (klass->propose_allocation)
+        res = klass->propose_allocation (decoder, query);
+      break;
+    }
     default:
       res = gst_pad_query_default (pad, parent, query);
       break;
@@ -2447,6 +2457,13 @@ gst_video_decoder_decide_allocation_default (GstVideoDecoder * decoder,
   return TRUE;
 }
 
+static gboolean
+gst_video_decoder_propose_allocation_default (GstVideoDecoder * decoder,
+    GstQuery * query)
+{
+  return TRUE;
+}
+
 /**
  * gst_video_decoder_set_src_caps:
  * @decoder: a #GstVideoDecoder
index 2bd2940..9219ff7 100644 (file)
@@ -251,6 +251,8 @@ struct _GstVideoDecoder
  *                     Setup the allocation parameters for allocating output
  *                     buffers. The passed in query contains the result of the
  *                     downstream allocation query.
+ * @propose_allocation: Optional.
+ *                      Propose buffer allocation parameters for upstream elements.
  *
  * Subclasses can override any of the available virtual methods or not, as
  * needed. At minimum @handle_frame needs to be overridden, and @set_format
@@ -297,6 +299,7 @@ struct _GstVideoDecoderClass
 
   gboolean      (*decide_allocation)  (GstVideoDecoder *decoder, GstQuery *query);
 
+  gboolean      (*propose_allocation) (GstVideoDecoder *decoder, GstQuery * query);
 
   /*< private >*/
   /* FIXME before moving to base */