Sets our main struct and passes it to the parent class.
If the sink spawns its own thread for pulling buffers from upstream it should call this method after it has pulled a buffer. If the element needed to preroll, this function will perform the preroll and will then block until the element state is changed.
Get the main Gtk struct
Get the number of bytes that the sink will pull when it is operating in pull mode.
Checks if sink is currently configured to drop buffers which are outside the current segment
Get the last sample that arrived in the sink and was used for preroll or for rendering. This property can be used to generate thumbnails.
Get the currently configured latency.
Get the maximum amount of bits per second that the sink will render.
Gets the max lateness value. See BaseSink.setMaxLateness for more details.
Get the processing deadline of sink. see BaseSink.setProcessingDeadline for more information about the processing deadline.
Get the render delay of sink. see BaseSink.setRenderDelay for more information about the render delay.
the main Gtk struct as a void*
Checks if sink is currently configured to synchronize against the clock.
Get the time that will be inserted between frames to control the maximum buffers per second.
Get the synchronisation offset of sink.
Checks if sink is currently configured to perform asynchronous state changes to PAUSED.
Checks if sink is currently configured to store the last received sample in the last-sample property.
Checks if sink is currently configured to send Quality-of-Service events upstream.
Query the sink for the latency parameters. The latency will be queried from the upstream elements. live will be TRUE if sink is configured to synchronize against the clock. upstream_live will be TRUE if an upstream element is live.
Configures sink to perform all state changes asynchronously. When async is disabled, the sink will immediately go to PAUSED instead of waiting for a preroll buffer. This feature is useful if the sink does not synchronize against the clock or when it is dealing with sparse streams.
Set the number of bytes that the sink will pull when it is operating in pull mode.
Configure sink to drop buffers which are outside the current segment
Configures sink to store the last received sample in the last-sample property.
Set the maximum amount of bits per second that the sink will render.
Sets the new max lateness value to max_lateness. This value is used to decide if a buffer should be dropped or not based on the buffer timestamp and the current clock time. A value of -1 means an unlimited time.
Maximum amount of time (in nanoseconds) that the pipeline can take for processing the buffer. This is added to the latency of live pipelines.
Configures sink to send Quality-of-Service events upstream.
Set the render delay in sink to delay. The render delay is the time between actual rendering of a buffer and its synchronisation time. Some devices might delay media rendering which can be compensated for with this function.
Configures sink to synchronize on the clock or not. When sync is FALSE, incoming samples will be played as fast as possible. If sync is TRUE, the timestamps of the incoming buffers will be used to schedule the exact render time of its contents.
Set the time that will be inserted between rendered buffers. This can be used to control the maximum buffers per second that the sink will render.
Adjust the synchronisation of sink with offset. A negative value will render buffers earlier than their timestamp. A positive value will delay rendering. This function can be used to fix playback of badly timestamped buffers.
This function will wait for preroll to complete and will then block until time is reached. It is usually called by subclasses that use their own internal synchronisation but want to let some synchronization (like EOS) be handled by the base class.
This function will block until time is reached. It is usually called by subclasses that use their own internal synchronisation.
If the GstBaseSinkClas.render|GstBaseSinkClas.renders method performs its own synchronisation against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to render the remaining data.
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 Element.setState 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 gstreamer.Element
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 gstreamer.Pipeline will provide a bus for the application.
Gets the currently configured clock of the element. This is the clock as was last set with Element.setClock.
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.
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 Element.releaseRequestPad.
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 Element.iterateSrcPads or Element.iterateSinkPads.
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 Element.getState 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 gstreamer.Bus 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 Element.requestPad.
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 Element.factoryGetStaticPadTemplates.
Sends a seek event to an element. See Event.newSeek for the details of the parameters. The seek event is sent to the element using Element.sendEvent.
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 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 Element.getBaseTime.
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 gstreamer.Pad 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 Element.setState or Element.syncStateWithParent.
a gstreamer.Pad has been removed from the element
gst.BaseSink.BaseSink is the base class for sink elements in GStreamer, such as xvimagesink or filesink. It is a layer on top of gstreamer.Element that provides a simplified interface to plugin writers. gst.BaseSink.BaseSink handles many details for you, for example: preroll, clock synchronization, state changes, activation in push or pull mode, and queries.
In most cases, when writing sink elements, there is no need to implement class methods from gstreamer.Element or to set functions on pads, because the gst.BaseSink.BaseSink infrastructure should be sufficient.
gst.BaseSink.BaseSink provides support for exactly one sink pad, which should be named "sink". A sink implementation (subclass of gst.BaseSink.BaseSink) should install a pad template in its class_init function, like so:
gst.BaseSink.BaseSink will handle the prerolling correctly. This means that it will return GST_STATE_CHANGE_ASYNC from a state change to PAUSED until the first buffer arrives in this element. The base class will call the GstBaseSinkClas.preroll|GstBaseSinkClas.prerolls vmethod with this preroll buffer and will then commit the state change to the next asynchronously pending state.
When the element is set to PLAYING, gst.BaseSink.BaseSink will synchronise on the clock using the times returned from GstBaseSinkClas.get_times|GstBaseSinkClas.get_timess. If this function returns GST_CLOCK_TIME_NONE for the start time, no synchronisation will be done. Synchronisation can be disabled entirely by setting the object sync property to FALSE.
After synchronisation the virtual method GstBaseSinkClas.render|GstBaseSinkClas.renders will be called. Subclasses should minimally implement this method.
Subclasses that synchronise on the clock in the GstBaseSinkClas.render|GstBaseSinkClas.renders method are supported as well. These classes typically receive a buffer in the render method and can then potentially block on the clock while rendering. A typical example is an audiosink. These subclasses can use BaseSink.waitPreroll to perform the blocking wait.
Upon receiving the EOS event in the PLAYING state, gst.BaseSink.BaseSink will wait for the clock to reach the time indicated by the stop time of the last GstBaseSinkClas.get_times|GstBaseSinkClas.get_timess call before posting an EOS message. When the element receives EOS in PAUSED, preroll completes, the event is queued and an EOS message is posted when going to PLAYING.
gst.BaseSink.BaseSink will internally use the GST_EVENT_SEGMENT events to schedule synchronisation and clipping of buffers. Buffers that fall completely outside of the current segment are dropped. Buffers that fall partially in the segment are rendered (and prerolled). Subclasses should do any subbuffer clipping themselves when needed.
gst.BaseSink.BaseSink will by default report the current playback position in GST_FORMAT_TIME based on the current clock time and segment information. If no clock has been set on the element, the query will be forwarded upstream.
The GstBaseSinkClas.set_caps|GstBaseSinkClas.set_capss function will be called when the subclass should configure itself to process a specific media type.
The GstBaseSinkClas.start|GstBaseSinkClas.starts and GstBaseSinkClas.stop|GstBaseSinkClas.stops virtual methods will be called when resources should be allocated. Any GstBaseSinkClas.preroll|GstBaseSinkClas.prerolls, GstBaseSinkClas.render|GstBaseSinkClas.renders and GstBaseSinkClas.set_caps|GstBaseSinkClas.set_capss function will be called between the GstBaseSinkClas.start|GstBaseSinkClas.starts and GstBaseSinkClas.stop|GstBaseSinkClas.stops calls.
The GstBaseSinkClas.event|GstBaseSinkClas.events virtual method will be called when an event is received by gst.BaseSink.BaseSink Normally this method should only be overridden by very specific elements (such as file sinks) which need to handle the newsegment event specially.
The GstBaseSinkClas.unlock|GstBaseSinkClas.unlocks method is called when the elements should unblock any blocking operations they perform in the GstBaseSinkClas.render|GstBaseSinkClas.renders method. This is mostly useful when the GstBaseSinkClas.render|GstBaseSinkClas.renders method performs a blocking write on a file descriptor, for example.
The max-lateness property affects how the sink deals with buffers that arrive too late in the sink. A buffer arrives too late in the sink when the presentation time (as a combination of the last segment, buffer timestamp and element base_time) plus the duration is before the current time of the clock. If the frame is later than max-lateness, the sink will drop the buffer without calling the render method. This feature is disabled if sync is disabled, the GstBaseSinkClas.get_times|GstBaseSinkClas.get_timess method does not return a valid start time or max-lateness is set to -1 (the default). Subclasses can use BaseSink.setMaxLateness to configure the max-lateness value.
The qos property will enable the quality-of-service features of the basesink which gather statistics about the real-time performance of the clock synchronisation. For each buffer received in the sink, statistics are gathered and a QOS event is sent upstream with these numbers. This information can then be used by upstream elements to reduce their processing rate, for example.
The async property can be used to instruct the sink to never perform an ASYNC state change. This feature is mostly usable when dealing with non-synchronized streams or sparse streams.