videodecoder: Add GstVideoDecoder::propose_allocation() vfunc

This commit is contained in:
Sebastian Dröge 2012-06-15 16:06:12 +02:00
parent d155b83d03
commit 1e635f682f
2 changed files with 20 additions and 0 deletions

View 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

View 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 */