Sets our main struct and passes it to the parent class.
Lets #GstBaseTransform sub-classes know the memory @allocator used by the base class and its @params.
Get the main Gtk struct
the main Gtk struct as a void*
See if @trans is configured as a in_place transform.
See if @trans is configured as a passthrough transform.
Queries if the transform will handle QoS.
Negotiates src pad caps with downstream elements if the source pad is marked as needing reconfiguring. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if negotiation fails.
Instructs @trans to request renegotiation upstream. This function is typically called after properties on the transform were set that influence the input format.
Instructs @trans to renegotiate a new downstream transform on the next buffer. This function is typically called after properties on the transform were set that influence the output format.
If @gap_aware is %FALSE (the default), output buffers will have the %GST_BUFFER_FLAG_GAP flag unset.
Determines whether a non-writable buffer will be copied before passing to the transform_ip function.
Set passthrough mode for this filter by default. This is mostly useful for filters that do not care about negotiation.
If @prefer_passthrough is %TRUE (the default), @trans will check and prefer passthrough caps from the list of caps returned by the transform_caps vmethod.
Enable or disable QoS handling in the transform.
Set the QoS parameters in the transform. This function is called internally when a QOS event is received but subclasses can provide custom information when needed.
Updates the srcpad caps and sends the caps downstream. This function can be used by subclasses when they have already negotiated their caps but found a change in them (or computed new information). This way, they can notify downstream about that change without losing any buffer.
the main Gtk struct
the main Gtk struct
Get the main Gtk struct
the main Gtk struct as a void*
Queries an element for the stream position. This is a convenience function for gstreamerD.
Queries an element for the stream duration. This is a convenience function for gstreamerD.
This set's the filename for a filesrc element.
Set the caps property of an Element.
For your convenience in gstreamerD: you can seek to the position of the pipeline measured in time_nanoseconds.
Get's all the pads from an element in a Pad[].
Creates an element for handling the given URI.
Create a new elementfactory capable of instantiating objects of the @type and add the factory to @plugin.
Gets a string representing the given state change result.
Gets a string representing the given state.
Abort the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong.
Adds a pad (link point) to @element. @pad's parent will be set to @element; see gst_object_set_parent() for refcounting information.
Calls @func from another thread and passes @user_data to it. This is to be used for cases when a state change has to be performed from a streaming thread, directly via gst_element_set_state() or indirectly e.g. via SEEK events.
Perform @transition on @element.
Commit the state change of the element and proceed to the next pending state if any. This function is used by elements that do asynchronous state changes. The core will normally call this method automatically when an element returned %GST_STATE_CHANGE_SUCCESS from the state change function.
Creates a pad for each pad template that is always available. This function is only useful during object initialization of subclasses of #GstElement.
Call @func with @user_data for each of @element's pads. @func will be called exactly once for each pad that exists at the time of this call, unless one of the calls to @func returns %FALSE in which case we will stop iterating pads and return early. If new pads are added or pads are removed while pads are being iterated, this will not be taken into account until next time this function is used.
Call @func with @user_data for each of @element's sink pads. @func will be called exactly once for each sink pad that exists at the time of this call, unless one of the calls to @func returns %FALSE in which case we will stop iterating pads and return early. If new sink pads are added or sink pads are removed while the sink pads are being iterated, this will not be taken into account until next time this function is used.
Call @func with @user_data for each of @element's source pads. @func will be called exactly once for each source pad that exists at the time of this call, unless one of the calls to @func returns %FALSE in which case we will stop iterating pads and return early. If new source pads are added or source pads are removed while the source pads are being iterated, this will not be taken into account until next time this function is used.
Returns the base time of the element. The base time is the absolute time of the clock when this element was last put to PLAYING. Subtracting the base time from the clock time gives the running time of the element.
Returns the bus of the element. Note that only a #GstPipeline will provide a bus for the application.
Gets the currently configured clock of the element. This is the clock as was last set with gst_element_set_clock().
Looks for an unlinked pad to which the given pad can link. It is not guaranteed that linking the pads will work, though it should work in most cases.
Retrieves a pad template from @element that is compatible with @compattempl. Pads from compatible templates can be linked together.
Gets the context with @context_type set on the element or NULL.
Gets the context with @context_type set on the element or NULL.
Gets the contexts set on the element.
Returns the current clock time of the element, as in, the time of the element's clock, or GST_CLOCK_TIME_NONE if there is no clock.
Returns the running time of the element. The running time is the element's clock time minus its base time. Will return GST_CLOCK_TIME_NONE if the element has no clock, or if its base time has not been set.
Retrieves the factory that was used to create this element.
Get metadata with @key in @klass.
Retrieves a padtemplate from @element with the given name.
Retrieves a list of the pad templates associated with @element. The list must not be modified by the calling code.
Retrieves a pad from the element by name (e.g. "src_\%d"). This version only retrieves request pads. The pad should be released with gst_element_release_request_pad().
Returns the start time of the element. The start time is the running time of the clock when this element was last put to PAUSED.
Gets the state of the element.
Retrieves a pad from @element by name. This version only retrieves already-existing (i.e. 'static') pads.
Checks if the state of an element is locked. If the state of an element is locked, state changes of the parent don't affect the element. This way you can leave currently unused elements inside bins. Just lock their state before changing the state from #GST_STATE_NULL.
Retrieves an iterator of @element's pads. The iterator should be freed after usage. Also more specialized iterators exists such as gst_element_iterate_src_pads() or gst_element_iterate_sink_pads().
Retrieves an iterator of @element's sink pads.
Retrieves an iterator of @element's source pads.
Links @src to @dest. The link must be from source to destination; the other direction will not be tried. The function looks for existing pads that aren't linked yet. It will request new pads if necessary. Such pads need to be released manually when unlinking. If multiple links are possible, only one is established.
Links @src to @dest using the given caps as filtercaps. The link must be from source to destination; the other direction will not be tried. The function looks for existing pads that aren't linked yet. It will request new pads if necessary. If multiple links are possible, only one is established.
Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails.
Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails. If @caps is not %NULL, makes sure that the caps of the link is a subset of @caps.
Links the two named pads of the source and destination elements. Side effect is that if one of the pads has no parent, it becomes a child of the parent of the other element. If they have different parents, the link fails.
Brings the element to the lost state. The current state of the element is copied to the pending state so that any call to gst_element_get_state() will return %GST_STATE_CHANGE_ASYNC.
Post an error, warning or info message on the bus from inside an element.
Post an error, warning or info message on the bus from inside an element.
Use this function to signal that the element does not expect any more pads to show up in the current pipeline. This function should be called whenever pads have been added by the element itself. Elements with #GST_PAD_SOMETIMES pad templates use this in combination with autopluggers to figure out that the element is done initializing its pads.
Post a message on the element's #GstBus. This function takes ownership of the message; if you want to access the message after this call, you should add an additional reference before calling.
Get the clock provided by the given element. > An element is only required to provide a clock in the PAUSED > state. Some elements can provide a clock in other states.
Performs a query on the given element.
Queries an element to convert @src_val in @src_format to @dest_format.
Queries an element (usually top-level pipeline or playbin element) for the total stream duration in nanoseconds. This query will only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.
Queries an element (usually top-level pipeline or playbin element) for the stream position in nanoseconds. This will be a value between 0 and the stream duration (if the stream duration is known). This query will usually only work once the pipeline is prerolled (i.e. reached PAUSED or PLAYING state). The application will receive an ASYNC_DONE message on the pipeline bus when that is the case.
Makes the element free the previously requested pad as obtained with gst_element_request_pad().
Removes @pad from @element. @pad will be destroyed if it has not been referenced elsewhere using gst_object_unparent().
Retrieves a request pad from the element according to the provided template. Pad templates can be looked up using gst_element_factory_get_static_pad_templates().
Sends a seek event to an element. See gst_event_new_seek() for the details of the parameters. The seek event is sent to the element using gst_element_send_event().
Simple API to perform a seek on the given element, meaning it just seeks to the given position relative to the start of the stream. For more complex operations like segment seeks (e.g. for looping) or changing the playback rate or seeking relative to the last configured playback segment you should use gst_element_seek().
Sends an event to an element. If the element doesn't implement an event handler, the event will be pushed on a random linked sink pad for downstream events or a random linked source pad for upstream events.
Set the base time of an element. See gst_element_get_base_time().
Sets the bus of the element. Increases the refcount on the bus. For internal use only, unless you're testing elements.
Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.
Sets the context of the element. Increases the refcount of the context.
Locks the state of an element, so state changes of the parent don't affect this element anymore.
Set the start time of an element. The start time of the element is the running time of the element when it last went to the PAUSED state. In READY or after a flushing seek, it is set to 0.
Sets the state of the element. This function will try to set the requested state by going through all the intermediary states and calling the class's state change function for each.
Tries to change the state of the element to the same as its parent. If this function returns %FALSE, the state of element is undefined.
Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked.
Unlinks the two named pads of the source and destination elements.
This signals that the element will not generate more dynamic pads. Note that this signal will usually be emitted from the context of the streaming thread.
a new #GstPad has been added to the element. Note that this signal will usually be emitted from the context of the streaming thread. Also keep in mind that if you add new elements to the pipeline in the signal handler you will need to set them to the desired target state with gst_element_set_state() or gst_element_sync_state_with_parent().
a #GstPad has been removed from the element
This base class is for filter elements that process data. Elements that are suitable for implementation using #GstBaseTransform are ones where the size and caps of the output is known entirely from the input caps and buffer sizes. These include elements that directly transform one buffer into another, modify the contents of a buffer in-place, as well as elements that collate multiple input buffers into one output buffer, or that expand one input buffer into multiple output buffers. See below for more concrete use cases.
It provides for:
* one sinkpad and one srcpad * Possible formats on sink and source pad implemented with custom transform_caps function. By default uses same format on sink and source.
* Handles state changes * Does flushing * Push mode * Pull mode if the sub-class transform can operate on arbitrary data
Use Cases
Passthrough mode
* Element has no interest in modifying the buffer. It may want to inspect it, in which case the element should have a transform_ip function. If there is no transform_ip function in passthrough mode, the buffer is pushed intact.
* The #GstBaseTransformClass.passthrough_on_same_caps variable will automatically set/unset passthrough based on whether the element negotiates the same caps on both pads.
* #GstBaseTransformClass.passthrough_on_same_caps on an element that doesn't implement a transform_caps function is useful for elements that only inspect data (such as level)
* Example elements
* Level * Videoscale, audioconvert, videoconvert, audioresample in certain modes.
Modifications in-place - input buffer and output buffer are the same thing.
* The element must implement a transform_ip function. * Output buffer size must <= input buffer size * If the always_in_place flag is set, non-writable buffers will be copied and passed to the transform_ip function, otherwise a new buffer will be created and the transform function called.
* Incoming writable buffers will be passed to the transform_ip function immediately. * only implementing transform_ip and not transform implies always_in_place = %TRUE
* Example elements: * Volume * Audioconvert in certain modes (signed/unsigned conversion) * videoconvert in certain modes (endianness swapping)
Modifications only to the caps/metadata of a buffer
* The element does not require writable data, but non-writable buffers should be subbuffered so that the meta-information can be replaced.
* Elements wishing to operate in this mode should replace the prepare_output_buffer method to create subbuffers of the input buffer and set always_in_place to %TRUE
* Example elements * Capsfilter when setting caps on outgoing buffers that have none. * identity when it is going to re-timestamp buffers by datarate.
## Normal mode * always_in_place flag is not set, or there is no transform_ip function * Element will receive an input buffer and output buffer to operate on. * Output buffer is allocated by calling the prepare_output_buffer function. * Example elements: * Videoscale, videoconvert, audioconvert when doing scaling/conversions
## Special output buffer allocations * Elements which need to do special allocation of their output buffers beyond allocating output buffers via the negotiated allocator or buffer pool should implement the prepare_output_buffer method.
* Example elements: * efence
Sub-class settable flags on GstBaseTransform
* passthrough
* Implies that in the current configuration, the sub-class is not interested in modifying the buffers. * Elements which are always in passthrough mode whenever the same caps has been negotiated on both pads can set the class variable passthrough_on_same_caps to have this behaviour automatically.
* always_in_place * Determines whether a non-writable buffer will be copied before passing to the transform_ip function.
* Implied %TRUE if no transform function is implemented. * Implied %FALSE if ONLY transform function is implemented.