From 1e635f682fbc38c78040c8f8bb830a74e515f9dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 15 Jun 2012 16:06:12 +0200 Subject: [PATCH] videodecoder: Add GstVideoDecoder::propose_allocation() vfunc --- gst-libs/gst/video/gstvideodecoder.c | 17 +++++++++++++++++ gst-libs/gst/video/gstvideodecoder.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 14d711b398..b8b3bd97c0 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -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 diff --git a/gst-libs/gst/video/gstvideodecoder.h b/gst-libs/gst/video/gstvideodecoder.h index 2bd2940349..9219ff715b 100644 --- a/gst-libs/gst/video/gstvideodecoder.h +++ b/gst-libs/gst/video/gstvideodecoder.h @@ -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 */