## GstCollectPads2

GstCollectPads2 — manages a set of pads that operate in collect mode

## Synopsis

    #include <gst/base/gstcollectpads2.h>

    struct              GstCollectPads2;
    struct              GstCollectData2;
    void                (*GstCollectData2DestroyNotify)     (GstCollectData2 *data);
    GstFlowReturn       (*GstCollectPads2BufferFunction)    (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             GstBuffer *buffer,
                                                             gpointer user_data);
    gint                (*GstCollectPads2CompareFunction)   (GstCollectPads2 *pads,
                                                             GstCollectData2 *data1,
                                                             GstClockTime timestamp1,
                                                             GstCollectData2 *data2,
                                                             GstClockTime timestamp2,
                                                             gpointer user_data);
    gboolean            (*GstCollectPads2EventFunction)     (GstCollectPads2 *pads,
                                                             GstCollectData2 *pad,
                                                             GstEvent *event,
                                                             gpointer user_data);
    GstFlowReturn       (*GstCollectPads2ClipFunction)      (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             GstBuffer *inbuffer,
                                                             GstBuffer **outbuffer,
                                                             gpointer user_data);
    GstFlowReturn       (*GstCollectPads2Function)          (GstCollectPads2 *pads,
                                                             gpointer user_data);
    enum                GstCollectPads2StateFlags;
    #define             GST_COLLECT_PADS2_STATE             (data)
    #define             GST_COLLECT_PADS2_STATE_IS_SET      (data,
                                                             flag)
    #define             GST_COLLECT_PADS2_STATE_SET         (data,
                                                             flag)
    #define             GST_COLLECT_PADS2_STATE_UNSET       (data,
                                                             flag)
    #define             GST_COLLECT_PADS2_GET_STREAM_LOCK   (pads)
    #define             GST_COLLECT_PADS2_STREAM_LOCK       (pads)
    #define             GST_COLLECT_PADS2_STREAM_UNLOCK     (pads)
    GstCollectPads2 *   gst_collect_pads2_new               (void);
    GstCollectData2 *   gst_collect_pads2_add_pad           (GstCollectPads2 *pads,
                                                             GstPad *pad,
                                                             guint size);
    GstCollectData2 *   gst_collect_pads2_add_pad_full      (GstCollectPads2 *pads,
                                                             GstPad *pad,
                                                             guint size,
                                                             GstCollectData2DestroyNotify destroy_notify,
                                                             gboolean lock);
    gboolean            gst_collect_pads2_remove_pad        (GstCollectPads2 *pads,
                                                             GstPad *pad);
    void                gst_collect_pads2_start             (GstCollectPads2 *pads);
    void                gst_collect_pads2_stop              (GstCollectPads2 *pads);
    guint               gst_collect_pads2_available         (GstCollectPads2 *pads);
    gboolean            gst_collect_pads2_is_active         (GstCollectPads2 *pads,
                                                             GstPad *pad);
    GstFlowReturn       gst_collect_pads2_collect           (GstCollectPads2 *pads);
    GstFlowReturn       gst_collect_pads2_collect_range     (GstCollectPads2 *pads,
                                                             guint64 offset,
                                                             guint length);
    guint               gst_collect_pads2_flush             (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint size);
    GstBuffer *         gst_collect_pads2_peek              (GstCollectPads2 *pads,
                                                             GstCollectData2 *data);
    GstBuffer *         gst_collect_pads2_pop               (GstCollectPads2 *pads,
                                                             GstCollectData2 *data);
    guint               gst_collect_pads2_read              (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint8 **bytes,
                                                             guint size);
    GstBuffer *         gst_collect_pads2_read_buffer       (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint size);
    GstBuffer *         gst_collect_pads2_take_buffer       (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint size);
    void                gst_collect_pads2_set_buffer_function
                                                            (GstCollectPads2 *pads,
                                                             GstCollectPads2BufferFunction func,
                                                             gpointer user_data);
    void                gst_collect_pads2_set_compare_function
                                                            (GstCollectPads2 *pads,
                                                             GstCollectPads2CompareFunction func,
                                                             gpointer user_data);
    void                gst_collect_pads2_set_event_function
                                                            (GstCollectPads2 *pads,
                                                             GstCollectPads2EventFunction func,
                                                             gpointer user_data);
    void                gst_collect_pads2_set_clip_function (GstCollectPads2 *pads,
                                                             GstCollectPads2ClipFunction clipfunc,
                                                             gpointer user_data);
    void                gst_collect_pads2_set_flushing      (GstCollectPads2 *pads,
                                                             gboolean flushing);
    void                gst_collect_pads2_set_function      (GstCollectPads2 *pads,
                                                             GstCollectPads2Function func,
                                                             gpointer user_data);
    void                gst_collect_pads2_set_waiting       (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             gboolean waiting);

## Description

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 `gst_collect_pads2_new()`. A callback should then be installed with `gst_collect_pads2_set_function()`.

- Pads are added to the collection with `gst_collect_pads2_add_pad()`/ `gst_collect_pads2_remove_pad()`. The pad has to be a sinkpad. The chain and event 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 `gst_collect_pads2_pop()` method. One can peek at the data with the `gst_collect_pads2_peek()` function. These functions will return NULL if the pad received an EOS event. When all pads return NULL from a `gst_collect_pads2_peek()`, the element can emit an EOS event itself.

- Data can also be dequeued in byte units using the `gst_collect_pads2_available()`, `gst_collect_pads2_read()` and `gst_collect_pads2_flush()` calls.

- Elements should call `gst_collect_pads2_start()` and `gst_collect_pads2_stop()` in their state change functions to start and stop the processing of the collectpads. The `gst_collect_pads2_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.

- `gst_collect_pads2_collect()` and `gst_collect_pads2_collect_range()` can be used by elements that start a GstTask to drive the collect_pads2. This feature is however not yet implemented.

- `gst_collect_pads2_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.

Last reviewed on 2011-10-28 (0.10.36)

## Details

### struct GstCollectPads2

    struct GstCollectPads2 {
      GstObject      object;

      GSList *data;                  /* list of CollectData items */
    };

Collectpads object.

GstObject `object`; |
GSList *`data`; | GList of GstCollectData2 managed by this GstCollectPads2.

Since 0.10.36

### struct GstCollectData2

    struct GstCollectData2 {
      /* with STREAM_LOCK of @collect */
      GstCollectPads2 	*collect;
      GstPad		*pad;
      GstBuffer		*buffer;
      guint			 pos;
      GstSegment             segment;
    };

Structure used by the collect_pads2.

GstCollectPads2 *`collect`; | owner GstCollectPads2
GstPad *`pad`; | GstPad managed by this data
GstBuffer *`buffer`; | currently queued buffer.
guint `pos`; | position in the buffer
GstSegment `segment`; | last segment received.

Since 0.10.36

### GstCollectData2DestroyNotify ()

    void                (*GstCollectData2DestroyNotify)     (GstCollectData2 *data);

A function that will be called when the GstCollectData2 will be freed. It is passed the pointer to the structure and should free any custom memory and resources allocated for it.

`data` : | the GstCollectData2 that will be freed

Since 0.10.36

### GstCollectPads2BufferFunction ()

    GstFlowReturn       (*GstCollectPads2BufferFunction)    (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             GstBuffer *buffer,
                                                             gpointer user_data);

A function that will be called when a (considered oldest) buffer can be muxed. If all pads have reached EOS, this function is called with NULL `buffer` and NULL `data`.

`pads` : | the GstCollectPads2 that trigered the callback
`data` : | the GstCollectData2 of pad that has received the buffer
`buffer` : | the GstBuffer
`user_data` : | user data passed to `gst_collect_pads2_set_buffer_function()`
Returns : | GST_FLOW_OK for success

Since 0.10.36

### GstCollectPads2CompareFunction ()

    gint                (*GstCollectPads2CompareFunction)   (GstCollectPads2 *pads,
                                                             GstCollectData2 *data1,
                                                             GstClockTime timestamp1,
                                                             GstCollectData2 *data2,
                                                             GstClockTime timestamp2,
                                                             gpointer user_data);

A function for comparing two timestamps of buffers or newsegments collected on one pad.

`pads` : | the GstCollectPads that is comparing the timestamps
`data1` : | the first GstCollectData2
`timestamp1` : | the first timestamp
`data2` : | the second GstCollectData2
`timestamp2` : | the second timestamp
`user_data` : | user data passed to `gst_collect_pads2_set_compare_function()`
Returns : | Integer less than zero when first timestamp is deemed older than the second one. Zero if the timestamps are deemed equally old. Integer greate than zero when second timestamp is deemed older than the first one.

Since 0.10.36

### GstCollectPads2EventFunction ()

    gboolean            (*GstCollectPads2EventFunction)     (GstCollectPads2 *pads,
                                                             GstCollectData2 *pad,
                                                             GstEvent *event,
                                                             gpointer user_data);

A function that will be called after collectpads has processed the event.

`pads` : | the GstCollectPads2 that trigered the callback
`pad` : | the GstPad that received an event
`event` : | the GstEvent received
`user_data` : | user data passed to `gst_collect_pads2_set_event_function()`
Returns : | `TRUE` if the pad could handle the event

Since 0.10.36

### GstCollectPads2ClipFunction ()

    GstFlowReturn       (*GstCollectPads2ClipFunction)      (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             GstBuffer *inbuffer,
                                                             GstBuffer **outbuffer,
                                                             gpointer user_data);

A function that will be called when `inbuffer` is received on the pad managed by `data` in the collecpad object `pads`.

The function should use the segment of `data` and the negotiated media type on the pad to perform clipping of `inbuffer`.

This function takes ownership of `inbuffer` and should output a buffer in `outbuffer` or return `NULL` in `outbuffer` if the buffer should be dropped.

`pads` : | a GstCollectPads2
`data` : | a GstCollectData2
`inbuffer` : | the input GstBuffer
`outbuffer` : | the output GstBuffer
`user_data` : | user data
Returns : | a GstFlowReturn that corresponds to the result of clipping.

Since 0.10.36

### GstCollectPads2Function ()

    GstFlowReturn       (*GstCollectPads2Function)          (GstCollectPads2 *pads,
                                                             gpointer user_data);

A function that will be called when all pads have received data.

`pads` : | the GstCollectPads2 that trigered the callback
`user_data` : | user data passed to `gst_collect_pads2_set_function()`
Returns : | GST_FLOW_OK for success

Since 0.10.36

### enum GstCollectPads2StateFlags

    typedef enum {
      GST_COLLECT_PADS2_STATE_EOS = 1 << 0,
      GST_COLLECT_PADS2_STATE_FLUSHING = 1 << 1,
      GST_COLLECT_PADS2_STATE_NEW_SEGMENT = 1 << 2,
      GST_COLLECT_PADS2_STATE_WAITING = 1 << 3,
      GST_COLLECT_PADS2_STATE_LOCKED = 1 << 4
    } GstCollectPads2StateFlags;

`GST_COLLECT_PADS2_STATE_EOS` | Set if collectdata's pad is EOS.
`GST_COLLECT_PADS2_STATE_FLUSHING` | Set if collectdata's pad is flushing.
`GST_COLLECT_PADS2_STATE_NEW_SEGMENT` | Set if collectdata's pad received a new_segment event.
`GST_COLLECT_PADS2_STATE_WAITING` | Set if collectdata's pad must be waited for when collecting.
`GST_COLLECT_PADS2_STATE_LOCKED` | Set collectdata's pad WAITING state must not be changed. GstCollectPads2StateFlags indicate private state of a collectdata('s pad).

Since 0.10.36

### GST_COLLECT_PADS2_STATE()

    #define GST_COLLECT_PADS2_STATE(data)                 (((GstCollectData2 *) data)->state)

A flags word containing GstCollectPads2StateFlags flags set on this collected pad.

`data` : | a GstCollectData2.

Since 0.10.36

### GST_COLLECT_PADS2_STATE_IS_SET()

    #define GST_COLLECT_PADS2_STATE_IS_SET(data,flag)     !!(GST_COLLECT_PADS2_STATE (data) & flag)

Gives the status of a specific flag on a collected pad.

`data` : | a GstCollectData2.
`flag` : | the GstCollectPads2StateFlags to check.

Since 0.10.36

### GST_COLLECT_PADS2_STATE_SET()

    #define GST_COLLECT_PADS2_STATE_SET(data,flag)        (GST_COLLECT_PADS2_STATE (data) |= flag)

Sets a state flag on a collected pad.

`data` : | a GstCollectData2.
`flag` : | the GstCollectPads2StateFlags to set.

Since 0.10.36

### GST_COLLECT_PADS2_STATE_UNSET()

    #define GST_COLLECT_PADS2_STATE_UNSET(data,flag)      (GST_COLLECT_PADS2_STATE (data) &= ~(flag))

Clears a state flag on a collected pad.

`data` : | a GstCollectData2.
`flag` : | the GstCollectPads2StateFlags to clear.

Since 0.10.36

### GST_COLLECT_PADS2_GET_STREAM_LOCK()

    #define GST_COLLECT_PADS2_GET_STREAM_LOCK(pads) (&((GstCollectPads2 *)pads)->stream_lock)

Get the stream lock of `pads`. The stream lock is used to coordinate and serialize execution among the various streams being collected, and in protecting the resources used to accomplish this.

`pads` : | a GstCollectPads2

Since 0.10.36

### GST_COLLECT_PADS2_STREAM_LOCK()

    #define GST_COLLECT_PADS2_STREAM_LOCK(pads)     (g_static_rec_mutex_lock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads)))

Lock the stream lock of `pads`.

`pads` : | a GstCollectPads2

Since 0.10.36

### GST_COLLECT_PADS2_STREAM_UNLOCK()

    #define GST_COLLECT_PADS2_STREAM_UNLOCK(pads)   (g_static_rec_mutex_unlock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads)))

Unlock the stream lock of `pads`.

`pads` : | a GstCollectPads2

Since 0.10.36

### gst_collect_pads2_new ()

    GstCollectPads2 *   gst_collect_pads2_new               (void);

Create a new instance of GstCollectsPads.

Returns : | a new GstCollectPads2, or NULL in case of an error. MT safe.

Since 0.10.36

### gst_collect_pads2_add_pad ()

    GstCollectData2 *   gst_collect_pads2_add_pad           (GstCollectPads2 *pads,
                                                             GstPad *pad,
                                                             guint size);

Add a pad to the collection of collect pads. The pad has to be a sinkpad. The refcount of the pad is incremented. Use `gst_collect_pads2_remove_pad()` to remove the pad from the collection again.

You specify a size for the returned GstCollectData2 structure so that you can use it to store additional information.

The pad will be automatically activated in push mode when `pads` is started.

This function calls `gst_collect_pads2_add_pad()` passing a value of NULL for destroy_notify and TRUE for locked.

`pads` : | the collectspads to use
`pad` : | the pad to add
`size` : | the size of the returned GstCollectData2 structure
Returns : | a new GstCollectData2 to identify the new pad. Or NULL if wrong parameters are supplied. MT safe.

Since 0.10.36

### gst_collect_pads2_add_pad_full ()

    GstCollectData2 *   gst_collect_pads2_add_pad_full      (GstCollectPads2 *pads,
                                                             GstPad *pad,
                                                             guint size,
                                                             GstCollectData2DestroyNotify destroy_notify,
                                                             gboolean lock);

Add a pad to the collection of collect pads. The pad has to be a sinkpad. The refcount of the pad is incremented. Use `gst_collect_pads2_remove_pad()` to remove the pad from the collection again.

You specify a size for the returned GstCollectData2 structure so that you can use it to store additional information.

You can also specify a GstCollectData2DestroyNotify that will be called just before the GstCollectData2 structure is freed. It is passed the pointer to the structure and should free any custom memory and resources allocated for it.

Keeping a pad locked in waiting state is only relevant when using the default collection algorithm (providing the oldest buffer). It ensures a buffer must be available on this pad for a collection to take place. This is of typical use to a muxer element where non-subtitle streams should always be in waiting state, e.g. to assure that caps information is available on all these streams when initial headers have to be written.

The pad will be automatically activated in push mode when `pads` is started.

`pads` : | the collectspads to use
`pad` : | the pad to add
`size` : | the size of the returned GstCollectData2 structure
`destroy_notify` : | function to be called before the returned GstCollectData2 structure is freed
`lock` : | whether to lock this pad in usual waiting state
Returns : | a new GstCollectData2 to identify the new pad. Or NULL if wrong parameters are supplied. MT safe.

Since 0.10.36

### gst_collect_pads2_remove_pad ()

    gboolean            gst_collect_pads2_remove_pad        (GstCollectPads2 *pads,
                                                             GstPad *pad);

Remove a pad from the collection of collect pads. This function will also free the GstCollectData2 and all the resources that were allocated with `gst_collect_pads2_add_pad()`.

The pad will be deactivated automatically when `pads` is stopped.

`pads` : | the collectspads to use
`pad` : | the pad to remove
Returns : | `TRUE` if the pad could be removed. MT safe.

Since 0.10.36

### gst_collect_pads2_start ()

    void                gst_collect_pads2_start             (GstCollectPads2 *pads);

Starts the processing of data in the collect_pads2.

MT safe.

`pads` : | the collectspads to use

Since 0.10.36

### gst_collect_pads2_stop ()

    void                gst_collect_pads2_stop              (GstCollectPads2 *pads);

Stops the processing of data in the collect_pads2. this function will also unblock any blocking operations.

MT safe.

`pads` : | the collectspads to use

Since 0.10.36

### gst_collect_pads2_available ()

    guint               gst_collect_pads2_available         (GstCollectPads2 *pads);

Query how much bytes can be read from each queued buffer. This means that the result of this call is the maximum number of bytes that can be read from each of the pads.

This function should be called with `pads` STREAM_LOCK held, such as in the callback.

`pads` : | the collectspads to query
Returns : | The maximum number of bytes queued on all pads. This function returns 0 if a pad has no queued buffer. MT safe.

Since 0.10.36

### gst_collect_pads2_is_active ()

    gboolean            gst_collect_pads2_is_active         (GstCollectPads2 *pads,
                                                             GstPad *pad);

Check if a pad is active.

This function is currently not implemented.

`pads` : | the collectspads to use
`pad` : | the pad to check
Returns : | `TRUE` if the pad is active. MT safe.

Since 0.10.36

### gst_collect_pads2_collect ()

    GstFlowReturn       gst_collect_pads2_collect           (GstCollectPads2 *pads);

Collect data on all pads. This function is usually called from a GstTask function in an element.

This function is currently not implemented.

`pads` : | the collectspads to use
Returns : | GstFlowReturn of the operation. MT safe.

Since 0.10.36

### gst_collect_pads2_collect_range ()

    GstFlowReturn       gst_collect_pads2_collect_range     (GstCollectPads2 *pads,
                                                             guint64 offset,
                                                             guint length);

Collect data with `offset` and `length` on all pads. This function is typically called in the getrange function of an element.

This function is currently not implemented.

`pads` : | the collectspads to use
`offset` : | the offset to collect
`length` : | the length to collect
Returns : | GstFlowReturn of the operation. MT safe.

Since 0.10.36

### gst_collect_pads2_flush ()

    guint               gst_collect_pads2_flush             (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint size);

Flush `size` bytes from the pad `data`.

This function should be called with `pads` STREAM_LOCK held, such as in the callback.

`pads` : | the collectspads to query
`data` : | the data to use
`size` : | the number of bytes to flush
Returns : | The number of bytes flushed This can be less than `size` and is 0 if the pad was end-of-stream. MT safe.

Since 0.10.36

### gst_collect_pads2_peek ()

    GstBuffer *         gst_collect_pads2_peek              (GstCollectPads2 *pads,
                                                             GstCollectData2 *data);

Peek at the buffer currently queued in `data`. This function should be called with the `pads` STREAM_LOCK held, such as in the callback handler.

`pads` : | the collectspads to peek
`data` : | the data to use
Returns : | The buffer in `data` or NULL if no buffer is queued. should unref the buffer after usage. MT safe.

Since 0.10.36

### gst_collect_pads2_pop ()

    GstBuffer *         gst_collect_pads2_pop               (GstCollectPads2 *pads,
                                                             GstCollectData2 *data);

Pop the buffer currently queued in `data`. This function should be called with the `pads` STREAM_LOCK held, such as in the callback handler.

`pads` : | the collectspads to pop
`data` : | the data to use
Returns : | The buffer in `data` or NULL if no buffer was queued. You should unref the buffer after usage. MT safe.

Since 0.10.36

### gst_collect_pads2_read ()

    guint               gst_collect_pads2_read              (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint8 **bytes,
                                                             guint size);

Get a pointer in `bytes` where `size` bytes can be read from the given pad data.

This function should be called with `pads` STREAM_LOCK held, such as in the callback.

`pads` : | the collectspads to query
`data` : | the data to use
`bytes` : | a pointer to a byte array
`size` : | the number of bytes to read
Returns : | The number of bytes available for consumption in the memory pointed to by `bytes`. This can be less than `size` and is 0 if the pad is end-of-stream. MT safe.

Since 0.10.36

### gst_collect_pads2_read_buffer ()

    GstBuffer *         gst_collect_pads2_read_buffer       (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint size);

Get a subbuffer of `size` bytes from the given pad `data`.

This function should be called with `pads` STREAM_LOCK held, such as in the callback.

`pads` : | the collectspads to query
`data` : | the data to use
`size` : | the number of bytes to read
Returns : | A sub buffer. The size of the buffer can be less that requested. A return of NULL signals that the pad is end-of-stream. Unref the buffer after use. MT safe.

Since 0.10.36

### gst_collect_pads2_take_buffer ()

    GstBuffer *         gst_collect_pads2_take_buffer       (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             guint size);

Get a subbuffer of `size` bytes from the given pad `data`. Flushes the amount of read bytes.

This function should be called with `pads` STREAM_LOCK held, such as in the callback.

`pads` : | the collectspads to query
`data` : | the data to use
`size` : | the number of bytes to read
Returns : | A sub buffer. The size of the buffer can be less that requested. A return of NULL signals that the pad is end-of-stream. Unref the buffer after use. MT safe.

Since 0.10.36

### gst_collect_pads2_set_buffer_function ()

    void                gst_collect_pads2_set_buffer_function
                                                            (GstCollectPads2 *pads,
                                                             GstCollectPads2BufferFunction func,
                                                             gpointer user_data);

Set the callback function and user data that will be called with the oldest buffer when all pads have been collected.

MT safe.

`pads` : | the collectpads to use
`func` : | the function to set
`user_data` : | user data passed to the function

Since 0.10.36

### gst_collect_pads2_set_compare_function ()

    void                gst_collect_pads2_set_compare_function
                                                            (GstCollectPads2 *pads,
                                                             GstCollectPads2CompareFunction func,
                                                             gpointer user_data);

Set the timestamp comparison function.

MT safe.

`pads` : | the pads to use
`func` : | the function to set
`user_data` : | user data passed to the function

Since 0.10.36

### gst_collect_pads2_set_event_function ()

    void                gst_collect_pads2_set_event_function
                                                            (GstCollectPads2 *pads,
                                                             GstCollectPads2EventFunction func,
                                                             gpointer user_data);

Set the event callback function and user data that will be called after collectpads has processed and event originating from one of the collected pads. If the event being processed is a serialized one, this callback is called with `pads` STREAM_LOCK held, otherwise not. As this lock should be held when calling a number of CollectPads functions, it should be acquired if so (unusually) needed.

MT safe.

`pads` : | the collectspads to use
`func` : | the function to set
`user_data` : | user data passed to the function

Since 0.10.36

### gst_collect_pads2_set_clip_function ()

    void                gst_collect_pads2_set_clip_function (GstCollectPads2 *pads,
                                                             GstCollectPads2ClipFunction clipfunc,
                                                             gpointer user_data);

Install a clipping function that is called right after a buffer is received on a pad managed by `pads`. See GstCollectPad2ClipFunction for more info.

`pads` : | the collectspads to use
`clipfunc` : | clip function to install
`user_data` : | user data to pass to `clip_func`

Since 0.10.36

### gst_collect_pads2_set_flushing ()

    void                gst_collect_pads2_set_flushing      (GstCollectPads2 *pads,
                                                             gboolean flushing);

Change the flushing state of all the pads in the collection. No pad is able to accept anymore data when `flushing` is `TRUE`. Calling this function with `flushing` `FALSE` makes `pads` accept data again. Caller must ensure that downstream streaming (thread) is not blocked, e.g. by sending a FLUSH_START downstream.

MT safe.

`pads` : | the collectspads to use
`flushing` : | desired state of the pads

Since 0.10.36

### gst_collect_pads2_set_function ()

    void                gst_collect_pads2_set_function      (GstCollectPads2 *pads,
                                                             GstCollectPads2Function func,
                                                             gpointer user_data);

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. However, if circumstances are more complicated and/or more control is desired, this sets a callback that will be invoked instead when all the pads added to the collection have buffers queued. Evidently, this callback is not compatible with `gst_collect_pads2_set_buffer_function()` callback. If this callback is set, the former will be unset.

MT safe.

`pads` : | the collectspads to use
`func` : | the function to set
`user_data` : | user data passed to the function

Since 0.10.36

### gst_collect_pads2_set_waiting ()

    void                gst_collect_pads2_set_waiting       (GstCollectPads2 *pads,
                                                             GstCollectData2 *data,
                                                             gboolean 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.

This function should be called with `pads` STREAM_LOCK held, such as in the callback.

MT safe.

`pads` : | the collectspads
`data` : | the data to use
`waiting` : | boolean indicating whether this pad should operate in waiting or non-waiting mode

Since 0.10.36