GstFlowCombiner

GstFlowCombiner — Utility to combine multiple flow returns into one

Synopsis

#include <gst/base/gstflowcombiner.h>

                    GstFlowCombiner;
GstFlowCombiner *   gst_flow_combiner_new               (void);
void                gst_flow_combiner_free              (GstFlowCombiner *combiner);
GstFlowReturn       gst_flow_combiner_update_flow       (GstFlowCombiner *combiner,
                                                         GstFlowReturn fret);
void                gst_flow_combiner_add_pad           (GstFlowCombiner *combiner,
                                                         GstPad *pad);
void                gst_flow_combiner_remove_pad        (GstFlowCombiner *combiner,
                                                         GstPad *pad);
void                gst_flow_combiner_clear             (GstFlowCombiner *combiner);
void                gst_flow_combiner_reset             (GstFlowCombiner *combiner);
GstFlowReturn       gst_flow_combiner_update_pad_flow   (GstFlowCombiner *combiner,
                                                         GstPad *pad,
                                                         GstFlowReturn fret);

Description

Utility struct to help handling GstFlowReturn combination. Useful for GstElements that have multiple source pads and need to combine the different GstFlowReturn for those pads.

GstFlowCombiner works by using the last GstFlowReturn for all GstPad it has in its list and computes the combined return value and provides it to the caller.

To add a new pad to the GstFlowCombiner use gst_flow_combiner_add_pad(). The new GstPad is stored with a default value of GST_FLOW_OK.

In case you want a GstPad to be removed, use gst_flow_combiner_remove_pad().

Please be aware that this struct isn't thread safe as its designed to be used by demuxers, those usually will have a single thread operating it.

These functions will take refs on the passed GstPads.

Aside from reducing the user's code size, the main advantage of using this helper struct is to follow the standard rules for GstFlowReturn combination. These rules are:

* GST_FLOW_EOS: only if all returns are EOS too * GST_FLOW_NOT_LINKED: only if all returns are NOT_LINKED too * GST_FLOW_ERROR or below: if at least one returns an error return * GST_FLOW_NOT_NEGOTIATED: if at least one returns a not-negotiated return * GST_FLOW_FLUSHING: if at least one returns flushing * GST_FLOW_OK: otherwise

GST_FLOW_ERROR or below, GST_FLOW_NOT_NEGOTIATED and GST_FLOW_FLUSHING are returned immediatelly from the gst_flow_combiner_update_flow() function.

Details

GstFlowCombiner

typedef struct _GstFlowCombiner GstFlowCombiner;

Opaque helper structure to aggregate flow returns.

Since 1.4


gst_flow_combiner_new ()

GstFlowCombiner *   gst_flow_combiner_new               (void);

Creates a new GstFlowCombiner, use gst_flow_combiner_free() to free it.

Returns :

A new GstFlowCombiner

Since 1.4


gst_flow_combiner_free ()

void                gst_flow_combiner_free              (GstFlowCombiner *combiner);

Frees a GstFlowCombiner struct and all its internal data.

combiner :

the GstFlowCombiner to free

Since 1.4


gst_flow_combiner_update_flow ()

GstFlowReturn       gst_flow_combiner_update_flow       (GstFlowCombiner *combiner,
                                                         GstFlowReturn fret);

Computes the combined flow return for the pads in it.

The GstFlowReturn parameter should be the last flow return update for a pad in this GstFlowCombiner. It will use this value to be able to shortcut some combinations and avoid looking over all pads again. e.g. The last combined return is the same as the latest obtained GstFlowReturn.

combiner :

the GstFlowCombiner

fret :

the latest GstFlowReturn received for a pad in this GstFlowCombiner

Returns :

The combined GstFlowReturn

Since 1.4


gst_flow_combiner_add_pad ()

void                gst_flow_combiner_add_pad           (GstFlowCombiner *combiner,
                                                         GstPad *pad);

Adds a new GstPad to the GstFlowCombiner.

combiner :

the GstFlowCombiner

pad :

the GstPad that is being added. [transfer none]

Since 1.4


gst_flow_combiner_remove_pad ()

void                gst_flow_combiner_remove_pad        (GstFlowCombiner *combiner,
                                                         GstPad *pad);

Removes a GstPad from the GstFlowCombiner.

combiner :

the GstFlowCombiner

pad :

the GstPad to remove. [transfer none]

Since 1.4


gst_flow_combiner_clear ()

void                gst_flow_combiner_clear             (GstFlowCombiner *combiner);

Removes all pads from a GstFlowCombiner and resets it to its initial state.

combiner :

the GstFlowCombiner to clear

Since 1.6


gst_flow_combiner_reset ()

void                gst_flow_combiner_reset             (GstFlowCombiner *combiner);

Removes all pads from a GstFlowCombiner and resets it to its initial state.

combiner :

the GstFlowCombiner to clear

Since 1.6


gst_flow_combiner_update_pad_flow ()

GstFlowReturn       gst_flow_combiner_update_pad_flow   (GstFlowCombiner *combiner,
                                                         GstPad *pad,
                                                         GstFlowReturn fret);

Sets the provided pad's last flow return to provided value and computes the combined flow return for the pads in it.

The GstFlowReturn parameter should be the last flow return update for a pad in this GstFlowCombiner. It will use this value to be able to shortcut some combinations and avoid looking over all pads again. e.g. The last combined return is the same as the latest obtained GstFlowReturn.

combiner :

the GstFlowCombiner

pad :

the GstPad whose GstFlowReturn to update

fret :

the latest GstFlowReturn received for a pad in this GstFlowCombiner

Returns :

The combined GstFlowReturn

Since 1.6