Manages a set of pads that operate in collect mode.
This means that control is given to the manager of this object when all pads have data.
* Collectpads are created with CollectPads. A
callback should then be installed with set_function.
* Pads are added to the collection with add_pad/
remove_pad. The pad has to be a sinkpad. When added, the
chain, event and query functions of the pad are overridden. The element_private of the pad is used to store private information for the
collectpads.
* For each pad, data is queued in the _chain function or by performing a pull_range.
* When data is queued on all pads in waiting mode, the callback function is called.
* Data can be dequeued from the pad with the pop method. One
can peek at the data with the peek function. These functions
will return null
if the pad received an EOS event. When all pads return null
from a
peek, the element can emit an EOS event itself.
* Data can also be dequeued in byte units using the available
, read_buffer and
flush calls.
* Elements should call start and
stop in their state change functions to start and stop the
processing of the collectpads. The stop call should be called
before calling the parent element state change function in the PAUSED_TO_READY state change to ensure no pad is blocked and the element can
finish streaming.
* set_waiting sets a pad to waiting or non-waiting
mode. CollectPads element is not waiting for data to be collected on non-waiting pads. Thus these pads may but need not have data when the
callback is called. All pads are in waiting mode by default.
- public unowned CollectData? add_pad (Pad pad, uint size, CollectDataDestroyNotify destroy_notify, bool @lock)
Add a pad to the collection of collect pads.
- public uint available ()
Query how much bytes can be read from each queued buffer.
- public FlowReturn clip_running_time (CollectData cdata, Buffer buf, out Buffer outbuf, void* user_data)
Convenience clipping function that converts incoming buffer's timestamp to
running time, or clips the buffer if outside configured segment.
- public bool event_default (CollectData data, Event event, bool discard)
Default CollectPads event handling that elements
should always chain up to to ensure proper operation.
- public uint flush (CollectData data, uint size)
Flush size
bytes from the pad data
.
- public Buffer? peek (CollectData data)
Peek at the buffer currently queued in data
.
- public Buffer? pop (CollectData data)
Pop the buffer currently queued in data
.
- public bool query_default (CollectData data, Query query, bool discard)
Default CollectPads query handling that elements
should always chain up to to ensure proper operation.
- public Buffer? read_buffer (CollectData data, uint size)
Get a subbuffer of size
bytes from the given pad data
.
- public bool remove_pad (Pad pad)
Remove a pad from the collection of collect pads.
- public void set_buffer_function (CollectPadsBufferFunction func)
Set the callback function and user data that will be called with the oldest
buffer when all pads have been collected, or null
on EOS.
- public void set_clip_function (CollectPadsClipFunction clipfunc)
Install a clipping function that is called right after a buffer is received
on a pad managed by this.
- public void set_compare_function (CollectPadsCompareFunction func)
Set the timestamp comparison function.
- public void set_event_function (CollectPadsEventFunction func)
Set the event callback function and user data that will be called when
collectpads has received an event originating from one of the collected pads.
- public void set_flush_function (CollectPadsFlushFunction func)
Install a flush function that is called when the internal state of all pads
should be flushed as part of flushing seek handling.
- public void set_flushing (bool flushing)
Change the flushing state of all the pads in the collection.
- public void set_function (CollectPadsFunction func)
CollectPads provides a default collection algorithm that will determine the
oldest buffer available on all of its pads, and then delegate to a configured callback.
- public void set_query_function (CollectPadsQueryFunction func)
Set the query callback function and user data that will be called after
collectpads has received a query originating from one of the collected pads.
- public void set_waiting (CollectData data, bool waiting)
Sets a pad to waiting or non-waiting mode, if at least this pad has not been
created with locked waiting state, in which case nothing happens.
- public bool src_event_default (Pad pad, Event event)
Default CollectPads event handling for the src
pad of elements.
- public void start ()
Starts the processing of data in the collect_pads.
- public void stop ()
Stops the processing of data in the collect_pads.
- public Buffer? take_buffer (CollectData data, uint size)
Get a subbuffer of size
bytes from the given pad data
.