GstBase.FlowCombiner

Fields

None

Methods

class

new ()

add_pad (pad)

clear ()

free ()

ref ()

remove_pad (pad)

reset ()

unref ()

update_flow (fret)

update_pad_flow (pad, fret)

Details

class GstBase.FlowCombiner

Utility struct to help handling Gst.FlowReturn combination. Useful for Gst.Element s that have multiple source pads and need to combine the different Gst.FlowReturn for those pads.

GstBase.FlowCombiner works by using the last Gst.FlowReturn for all Gst.Pad it has in its list and computes the combined return value and provides it to the caller.

To add a new pad to the GstBase.FlowCombiner use GstBase.FlowCombiner.add_pad(). The new Gst.Pad is stored with a default value of Gst.FlowReturn.OK.

In case you want a Gst.Pad to be removed, use GstBase.FlowCombiner.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 Gst.Pad s.

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

Gst.FlowReturn.ERROR or below, Gst.FlowReturn.NOT_NEGOTIATED and Gst.FlowReturn.FLUSHING are returned immediately from the GstBase.FlowCombiner.update_flow() function.

New in version 1.4.

classmethod new()[source]
Returns:

A new GstBase.FlowCombiner

Return type:

GstBase.FlowCombiner

Creates a new GstBase.FlowCombiner, use GstBase.FlowCombiner.free() to free it.

New in version 1.4.

add_pad(pad)[source]
Parameters:

pad (Gst.Pad) – the Gst.Pad that is being added

Adds a new Gst.Pad to the GstBase.FlowCombiner.

New in version 1.4.

clear()[source]

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

New in version 1.6.

free()[source]

Frees a GstBase.FlowCombiner struct and all its internal data.

New in version 1.4.

ref()[source]
Returns:

the GstBase.FlowCombiner.

Return type:

GstBase.FlowCombiner

Increments the reference count on the GstBase.FlowCombiner.

New in version 1.12.1.

remove_pad(pad)[source]
Parameters:

pad (Gst.Pad) – the Gst.Pad to remove

Removes a Gst.Pad from the GstBase.FlowCombiner.

New in version 1.4.

reset()[source]

Reset flow combiner and all pads to their initial state without removing pads.

New in version 1.6.

unref()[source]

Decrements the reference count on the GstBase.FlowCombiner.

New in version 1.12.1.

update_flow(fret)[source]
Parameters:

fret (Gst.FlowReturn) – the latest Gst.FlowReturn received for a pad in this GstBase.FlowCombiner

Returns:

The combined Gst.FlowReturn

Return type:

Gst.FlowReturn

Computes the combined flow return for the pads in it.

The Gst.FlowReturn parameter should be the last flow return update for a pad in this GstBase.FlowCombiner. 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 Gst.FlowReturn.

New in version 1.4.

update_pad_flow(pad, fret)[source]
Parameters:
Returns:

The combined Gst.FlowReturn

Return type:

Gst.FlowReturn

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

The Gst.FlowReturn parameter should be the last flow return update for a pad in this GstBase.FlowCombiner. 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 Gst.FlowReturn.

New in version 1.6.