![]() |
![]() |
![]() |
GStreamer Bad Plugins 1.0 Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
struct GstAggregator; struct GstAggregatorClass; GstFlowReturn gst_aggregator_finish_buffer (GstAggregator *agg
,GstBuffer *buffer
); void gst_aggregator_set_src_caps (GstAggregator *agg
,GstCaps *caps
); gboolean gst_aggregator_iterate_sinkpads (GstAggregator *self
,GstAggregatorPadForeachFunc func
,gpointer user_data
);
Manages a set of pads with the purpose of aggregating their buffers. Control is given to the subclass when all pads have data.
Base class for mixers and muxers. Implementers should at least implement
the aggregate()
vmethod.
When data is queued on all pads, tha aggregate vmethod is called.
One can peek at the data on any given GstAggregatorPad with the
gst_aggregator_pad_get_buffer()
method, and take ownership of it
with the gst_aggregator_pad_steal_buffer()
method. When a buffer
has been taken with steal_buffer()
, a new buffer can be queued
on that pad.
If the subclass wishes to push a buffer downstream in its aggregate
implementation, it should do so through the
gst_aggregator_finish_buffer()
method. This method will take care
of sending and ordering mandatory events such as stream start, caps
and segment.
Same goes for EOS events, which should not be pushed directly by the subclass, it should instead return GST_FLOW_EOS in its aggregate implementation.
struct GstAggregator { GstElement parent; GstPad * srcpad; GstSegment segment; };
Collectpads object.
struct GstAggregatorClass { GstElementClass parent_class; GType sinkpads_type; GstFlowReturn (*flush) (GstAggregator * aggregator); GstFlowReturn (*clip) (GstAggregator * agg, GstAggregatorPad * bpad, GstBuffer * buf, GstBuffer ** outbuf); /* sinkpads virtual methods */ gboolean (*sink_event) (GstAggregator * aggregate, GstAggregatorPad * bpad, GstEvent * event); gboolean (*sink_query) (GstAggregator * aggregate, GstAggregatorPad * bpad, GstQuery * query); /* srcpad virtual methods */ gboolean (*src_event) (GstAggregator * aggregate, GstEvent * event); gboolean (*src_query) (GstAggregator * aggregate, GstQuery * query); gboolean (*src_activate) (GstAggregator * aggregator, GstPadMode mode, gboolean active); GstFlowReturn (*aggregate) (GstAggregator * aggregator); gboolean (*stop) (GstAggregator * aggregator); gboolean (*start) (GstAggregator * aggregator); };
The aggregator base class will handle in a thread-safe way all manners of concurrent flushes, seeks, pad additions and removals, leaving to the subclass the responsibility of clipping buffers, and aggregating buffers in the way the implementor sees fit.
It will also take care of event ordering (stream-start, segment, eos).
Basically, a basic implementation will override aggregate
, and call
_finish_buffer from inside that function.
Optional. The type of the pads that should be created when GstElement.request_new_pad is called. | |
Optional. Called after a succesful flushing seek, once all the flush stops have been received. Flush pad-specific data in GstAggregatorPad->flush. | |
Optional. Called when a buffer is received on a sink pad, the task of clipping it and translating it to the current segment falls on the subclass. | |
Optional. Called when an event is received on a sink pad, the subclass should always chain up. | |
Optional. Called when a query is received on a sink pad, the subclass should always chain up. | |
Optional. Called when an event is received on the src pad, the subclass should always chain up. | |
Optional. Called when a query is received on the src pad, the subclass should always chain up. | |
Optional. Called when the src pad is activated, it will start/stop its pad task right after that call. | |
Mandatory. Called when buffers are queued on all sinkpads. Classes should iterate the GstElement->sinkpads and peek or steal buffers from the GstAggregatorPads. If the subclass returns GST_FLOW_EOS, sending of the eos event will be taken care of. Once / if a buffer has been constructed from the aggregated buffers, the subclass should call _finish_buffer. | |
Optional. Should be linked up first. Called when the element goes from PAUSED to READY. The subclass should free all resources and reset its state. | |
Optional. Should be linked up first. Called when the element goes from READY to PAUSED. The subclass should get ready to process aggregated buffers. |
GstFlowReturn gst_aggregator_finish_buffer (GstAggregator *agg
,GstBuffer *buffer
);
This method will take care of sending mandatory events before pushing the provided buffer.
|
The GstAggregator |
|
the GstBuffer to push. |
void gst_aggregator_set_src_caps (GstAggregator *agg
,GstCaps *caps
);
Sets the caps to be used on the src pad.
|
The GstAggregator |
|
The GstCaps to set later on the src pad. |
gboolean gst_aggregator_iterate_sinkpads (GstAggregator *self
,GstAggregatorPadForeachFunc func
,gpointer user_data
);
Iterate the sinkpads of aggregator to call a function on them.
This method guarantees that func
will be called only once for each
sink pad.
|
The GstAggregator |
|
The function to call. |
|
The data to pass to func . |