GstBase.BaseTransformClass

Fields

Name

Type

Access

Description

accept_caps

object

r

Optional. Subclasses can override this method to check if caps can be handled by the element. The default implementation might not be the most optimal way to check this in all cases.

before_transform

object

r

Optional. This method is called right before the base class will start processing. Dynamic properties or other delayed configuration could be performed in this method.

copy_metadata

object

r

Optional. Copy the metadata from the input buffer to the output buffer. The default implementation will copy the flags, timestamps and offsets of the buffer.

decide_allocation

object

r

Setup the allocation parameters for allocating output buffers. The passed in query contains the result of the downstream allocation query. This function is only called when not operating in passthrough mode. The default implementation will remove all memory dependent metadata. If there is a filter_meta method implementation, it will be called for all metadata API in the downstream query, otherwise the metadata API is removed.

filter_meta

object

r

Return True if the metadata API should be proposed in the upstream allocation query. The default implementation is None and will cause all metadata to be removed.

fixate_caps

object

r

Optional. Given the pad in this direction and the given caps, fixate the caps on the other pad. The function takes ownership of othercaps and returns a fixated version of othercaps. othercaps is not guaranteed to be writable.

generate_output

object

r

Called after each new input buffer is submitted repeatedly until it either generates an error or fails to generate an output buffer. The default implementation takes the contents of the queued_buf variable, generates an output buffer if needed by calling the class prepare_output_buffer, and then calls either transform or transform_ip. Elements that don’t do 1-to-1 transformations of input to output buffers can either return GST_BASE_TRANSFORM_FLOW_DROPPED or simply not generate an output buffer until they are ready to do so.

get_unit_size

object

r

Required if the transform is not in-place. Get the size in bytes of one unit for the given caps.

parent_class

Gst.ElementClass

r

Element parent class

passthrough_on_same_caps

bool

r

If set to True, passthrough mode will be automatically enabled if the caps are the same. Set to False by default.

prepare_output_buffer

object

r

Optional. Subclasses can override this to do their own allocation of output buffers. Elements that only do analysis can return a subbuffer or even just return a reference to the input buffer (if in passthrough mode). The default implementation will use the negotiated allocator or bufferpool and transform_size to allocate an output buffer or it will return the input buffer in passthrough mode.

propose_allocation

object

r

Propose buffer allocation parameters for upstream elements. This function must be implemented if the element reads or writes the buffer content. The query that was passed to the decide_allocation is passed in this method (or None when the element is in passthrough mode). The default implementation will pass the query downstream when in passthrough mode and will copy all the filtered metadata API in non-passthrough mode.

query

object

r

Optional. Handle a requested query. Subclasses that implement this must chain up to the parent if they didn’t handle the query

set_caps

object

r

Allows the subclass to be notified of the actual caps set.

sink_event

object

r

Optional. Event handler on the sink pad. The default implementation handles the event and forwards it downstream.

src_event

object

r

Optional. Event handler on the source pad. The default implementation handles the event and forwards it upstream.

start

object

r

Optional. Called when the element starts processing. Allows opening external resources.

stop

object

r

Optional. Called when the element stops processing. Allows closing external resources.

submit_input_buffer

object

r

Function which accepts a new input buffer and pre-processes it. The default implementation performs caps (re)negotiation, then QoS if needed, and places the input buffer into the queued_buf member variable. If the buffer is dropped due to QoS, it returns GST_BASE_TRANSFORM_FLOW_DROPPED. If this input buffer is not contiguous with any previous input buffer, then is_discont is set to True.

transform

object

r

Required if the element does not operate in-place. Transforms one incoming buffer to one outgoing buffer. The function is allowed to change size/timestamp/duration of the outgoing buffer.

transform_caps

object

r

Optional. Given the pad in this direction and the given caps, what caps are allowed on the other pad in this element ?

transform_ip

object

r

Required if the element operates in-place. Transform the incoming buffer in-place.

transform_ip_on_passthrough

bool

r

If set to True, transform_ip will be called in passthrough mode. The passed buffer might not be writable. When False, neither transform nor transform_ip will be called in passthrough mode. Set to True by default.

transform_meta

object

r

Optional. Transform the metadata on the input buffer to the output buffer. By default this method copies all meta without tags. Subclasses can implement this method and return True if the metadata is to be copied.

transform_size

object

r

Optional. Given the size of a buffer in the given direction with the given caps, calculate the size in bytes of a buffer on the other pad with the given other caps. The default implementation uses get_unit_size and keeps the number of units the same.

Methods

None

Details

class GstBase.BaseTransformClass

Subclasses can override any of the available virtual methods or not, as needed. At minimum either transform or transform_ip need to be overridden. If the element can overwrite the input data with the results (data is of the same type and quantity) it should provide transform_ip.