mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
aggregator: add finish_buffer() vfunc
So subclasses can override the finish behaviour and/or decorate or modify buffers before they get pushed out. https://bugzilla.gnome.org/show_bug.cgi?id=760981
This commit is contained in:
parent
e9483fbffb
commit
76b54099bd
2 changed files with 34 additions and 12 deletions
|
@ -539,17 +539,8 @@ gst_aggregator_set_src_caps (GstAggregator * self, GstCaps * caps)
|
|||
GST_PAD_STREAM_UNLOCK (self->srcpad);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_aggregator_finish_buffer:
|
||||
* @self: The #GstAggregator
|
||||
* @buffer: (transfer full): the #GstBuffer to push.
|
||||
*
|
||||
* This method will push the provided output buffer downstream. If needed,
|
||||
* mandatory events such as stream-start, caps, and segment events will be
|
||||
* sent before pushing the buffer.
|
||||
*/
|
||||
GstFlowReturn
|
||||
gst_aggregator_finish_buffer (GstAggregator * self, GstBuffer * buffer)
|
||||
static GstFlowReturn
|
||||
gst_aggregator_default_finish_buffer (GstAggregator * self, GstBuffer * buffer)
|
||||
{
|
||||
gst_aggregator_push_mandatory_events (self);
|
||||
|
||||
|
@ -567,6 +558,25 @@ gst_aggregator_finish_buffer (GstAggregator * self, GstBuffer * buffer)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_aggregator_finish_buffer:
|
||||
* @aggregator: The #GstAggregator
|
||||
* @buffer: (transfer full): the #GstBuffer to push.
|
||||
*
|
||||
* This method will push the provided output buffer downstream. If needed,
|
||||
* mandatory events such as stream-start, caps, and segment events will be
|
||||
* sent before pushing the buffer.
|
||||
*/
|
||||
GstFlowReturn
|
||||
gst_aggregator_finish_buffer (GstAggregator * aggregator, GstBuffer * buffer)
|
||||
{
|
||||
GstAggregatorClass *klass = GST_AGGREGATOR_GET_CLASS (aggregator);
|
||||
|
||||
g_assert (klass->finish_buffer != NULL);
|
||||
|
||||
return klass->finish_buffer (aggregator, buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_push_eos (GstAggregator * self)
|
||||
{
|
||||
|
@ -2233,6 +2243,8 @@ gst_aggregator_class_init (GstAggregatorClass * klass)
|
|||
GST_DEBUG_CATEGORY_INIT (aggregator_debug, "aggregator",
|
||||
GST_DEBUG_FG_MAGENTA, "GstAggregator");
|
||||
|
||||
klass->finish_buffer = gst_aggregator_default_finish_buffer;
|
||||
|
||||
klass->sink_event = gst_aggregator_default_sink_event;
|
||||
klass->sink_query = gst_aggregator_default_sink_query;
|
||||
|
||||
|
|
|
@ -159,6 +159,13 @@ struct _GstAggregator
|
|||
* clipping of input buffer. This function takes ownership of
|
||||
* buf and should output a buffer or return NULL in
|
||||
* if the buffer should be dropped.
|
||||
* @finish_buffer: Optional.
|
||||
* Called when a subclass calls gst_aggregator_finish_buffer()
|
||||
* from their aggregate function to push out a buffer.
|
||||
* Subclasses can override this to modify or decorate buffers
|
||||
* before they get pushed out. This function takes ownership
|
||||
* of the buffer passed. Subclasses that override this method
|
||||
* should always chain up to the parent class virtual method.
|
||||
* @sink_event: Optional.
|
||||
* Called when an event is received on a sink pad, the subclass
|
||||
* should always chain up.
|
||||
|
@ -231,6 +238,9 @@ struct _GstAggregatorClass {
|
|||
GstAggregatorPad * aggregator_pad,
|
||||
GstBuffer * buf);
|
||||
|
||||
GstFlowReturn (*finish_buffer) (GstAggregator * aggregator,
|
||||
GstBuffer * buffer);
|
||||
|
||||
/* sinkpads virtual methods */
|
||||
gboolean (*sink_event) (GstAggregator * aggregator,
|
||||
GstAggregatorPad * aggregator_pad,
|
||||
|
@ -300,7 +310,7 @@ struct _GstAggregatorClass {
|
|||
************************/
|
||||
|
||||
GST_EXPORT
|
||||
GstFlowReturn gst_aggregator_finish_buffer (GstAggregator * self,
|
||||
GstFlowReturn gst_aggregator_finish_buffer (GstAggregator * aggregator,
|
||||
GstBuffer * buffer);
|
||||
|
||||
GST_EXPORT
|
||||
|
|
Loading…
Reference in a new issue