[−][src]Trait gstreamer_video::prelude::ElementExt
Required methods
fn abort_state(&self)
Abort the state change of the element. This function is used by elements that do asynchronous state changes and find out something is wrong.
This function should be called with the STATE_LOCK held.
MT safe.
fn add_pad<P>(&self, pad: &P) -> Result<(), BoolError> where
P: IsA<Pad>,
P: IsA<Pad>,
Adds a pad (link point) to self
. pad
's parent will be set to self
;
see GstObjectExt::set_parent
for refcounting information.
Pads are automatically activated when added in the PAUSED or PLAYING state.
The pad and the element should be unlocked when calling this function.
This function will emit the Element::pad-added
signal on the element.
pad
the Pad
to add to the element.
Returns
true
if the pad could be added. This function can fail when
a pad with the same name already existed or the pad already had another
parent.
MT safe.
fn create_all_pads(&self)
Creates a pad for each pad template that is always available.
This function is only useful during object initialization of
subclasses of Element
.
fn foreach_pad<P>(&self, func: P) -> bool where
P: FnMut(&Element, &Pad) -> bool,
P: FnMut(&Element, &Pad) -> bool,
Call func
with user_data
for each of self
'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.
Feature: v1_14
func
function to call for each pad
user_data
user data passed to func
Returns
false
if self
had no pads or if one of the calls to func
returned false
.
fn foreach_sink_pad<P>(&self, func: P) -> bool where
P: FnMut(&Element, &Pad) -> bool,
P: FnMut(&Element, &Pad) -> bool,
Call func
with user_data
for each of self
'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.
Feature: v1_14
func
function to call for each sink pad
user_data
user data passed to func
Returns
false
if self
had no sink pads or if one of the calls to func
returned false
.
fn foreach_src_pad<P>(&self, func: P) -> bool where
P: FnMut(&Element, &Pad) -> bool,
P: FnMut(&Element, &Pad) -> bool,
Call func
with user_data
for each of self
'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.
Feature: v1_14
func
function to call for each source pad
user_data
user data passed to func
Returns
false
if self
had no source pads or if one of the calls
to func
returned false
.
fn get_base_time(&self) -> ClockTime
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 base time of the element.
MT safe.
fn get_bus(&self) -> Option<Bus>
Returns the bus of the element. Note that only a Pipeline
will provide a
bus for the application.
Returns
the element's Bus
. unref after
usage.
MT safe.
fn get_clock(&self) -> Option<Clock>
Gets the currently configured clock of the element. This is the clock as was
last set with ElementExt::set_clock
.
Elements in a pipeline will only have their clock set when the pipeline is in the PLAYING state.
Returns
the Clock
of the element. unref after usage.
MT safe.
fn get_compatible_pad<P>(&self, pad: &P, caps: Option<&Caps>) -> Option<Pad> where
P: IsA<Pad>,
P: IsA<Pad>,
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.
This function will first attempt to find a compatible unlinked ALWAYS pad,
and if none can be found, it will request a compatible REQUEST pad by looking
at the templates of self
.
pad
the Pad
to find a compatible one for.
caps
the Caps
to use as a filter.
Returns
the Pad
to which a link
can be made, or None
if one cannot be found. GstObjectExt::unref
after usage.
fn get_compatible_pad_template(
&self,
compattempl: &PadTemplate
) -> Option<PadTemplate>
&self,
compattempl: &PadTemplate
) -> Option<PadTemplate>
Retrieves a pad template from self
that is compatible with compattempl
.
Pads from compatible templates can be linked together.
compattempl
the PadTemplate
to find a compatible
template for
Returns
a compatible PadTemplate
,
or None
if none was found. No unreferencing is necessary.
fn get_context(&self, context_type: &str) -> Option<Context>
Gets the context with context_type
set on the element or NULL.
MT safe.
context_type
a name of a context to retrieve
Returns
A Context
or NULL
fn get_contexts(&self) -> Vec<Context>
fn get_factory(&self) -> Option<ElementFactory>
Retrieves the factory that was used to create this element.
Returns
the ElementFactory
used for creating this
element or None
if element has not been registered (static element). no refcounting is needed.
fn get_request_pad(&self, name: &str) -> Option<Pad>
Retrieves a pad from the element by name (e.g. "src_%d"). This version only
retrieves request pads. The pad should be released with
ElementExt::release_request_pad
.
This method is slower than manually getting the pad template and calling
ElementExt::request_pad
if the pads should have a specific name (e.g.
name
is "src_1" instead of "src_%u").
name
the name of the request Pad
to retrieve.
Returns
requested Pad
if found,
otherwise None
. Release after usage.
fn get_start_time(&self) -> ClockTime
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.
Usually the start_time is managed by a toplevel element such as
Pipeline
.
MT safe.
Returns
the start time of the element.
fn get_static_pad(&self, name: &str) -> Option<Pad>
Retrieves a pad from self
by name. This version only retrieves
already-existing (i.e. 'static') pads.
name
the name of the static Pad
to retrieve.
Returns
the requested Pad
if
found, otherwise None
. unref after usage.
MT safe.
fn is_locked_state(&self) -> bool
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 State::Null
.
MT safe.
Returns
true
, if the element's state is locked.
fn link<P>(&self, dest: &P) -> Result<(), BoolError> where
P: IsA<Element>,
P: IsA<Element>,
Links self
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.
Make sure you have added your elements to a bin or pipeline with
GstBinExt::add
before trying to link them.
dest
the Element
containing the destination pad.
Returns
true
if the elements could be linked, false
otherwise.
fn link_filtered<P>(
&self,
dest: &P,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
&self,
dest: &P,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
Links self
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.
Make sure you have added your elements to a bin or pipeline with
GstBinExt::add
before trying to link them.
dest
the Element
containing the destination pad.
filter
the Caps
to filter the link,
or None
for no filter.
Returns
true
if the pads could be linked, false
otherwise.
fn link_pads<P>(
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>
) -> Result<(), BoolError> where
P: IsA<Element>,
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>
) -> Result<(), BoolError> where
P: IsA<Element>,
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.
srcpadname
the name of the Pad
in source element
or None
for any pad.
dest
the Element
containing the destination pad.
destpadname
the name of the Pad
in destination element,
or None
for any pad.
Returns
true
if the pads could be linked, false
otherwise.
fn link_pads_filtered<P>(
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
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 None
, makes sure that the caps of the link is a subset of caps
.
srcpadname
the name of the Pad
in source element
or None
for any pad.
dest
the Element
containing the destination pad.
destpadname
the name of the Pad
in destination element
or None
for any pad.
filter
the Caps
to filter the link,
or None
for no filter.
Returns
true
if the pads could be linked, false
otherwise.
fn link_pads_full<P>(
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
flags: PadLinkCheck
) -> Result<(), BoolError> where
P: IsA<Element>,
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
flags: PadLinkCheck
) -> Result<(), BoolError> where
P: IsA<Element>,
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.
Calling ElementExt::link_pads_full
with flags
== PadLinkCheck::Default
is the same as calling ElementExt::link_pads
and the recommended way of
linking pads with safety checks applied.
This is a convenience function for Pad::link_full
.
srcpadname
the name of the Pad
in source element
or None
for any pad.
dest
the Element
containing the destination pad.
destpadname
the name of the Pad
in destination element,
or None
for any pad.
flags
the PadLinkCheck
to be performed when linking pads.
Returns
true
if the pads could be linked, false
otherwise.
fn lost_state(&self)
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::get_state
will return StateChangeReturn::Async
.
An ASYNC_START message is posted. If the element was PLAYING, it will go to PAUSED. The element will be restored to its PLAYING state by the parent pipeline when it prerolls again.
This is mostly used for elements that lost their preroll buffer
in the State::Paused
or State::Playing
state after a flush,
they will go to their pending state again when a new preroll buffer is
queued. This function can only be called when the element is currently
not in error or an async state change.
This function is used internally and should normally not be called from plugins or applications.
fn no_more_pads(&self)
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 PadPresence::Sometimes
pad templates use this in combination with autopluggers to figure out that
the element is done initializing its pads.
This function emits the Element::no-more-pads
signal.
MT safe.
fn post_message(&self, message: &Message) -> Result<(), BoolError>
Post a message on the element's 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.
message
a Message
to post
Returns
true
if the message was successfully posted. The function returns
false
if the element did not have a bus.
MT safe.
fn provide_clock(&self) -> Option<Clock>
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.
Returns
the GstClock provided by the
element or None
if no clock could be provided. Unref after usage.
MT safe.
fn release_request_pad<P>(&self, pad: &P) where
P: IsA<Pad>,
P: IsA<Pad>,
Makes the element free the previously requested pad as obtained
with ElementExt::request_pad
.
This does not unref the pad. If the pad was created by using
ElementExt::request_pad
, ElementExt::release_request_pad
needs to be
followed by GstObjectExt::unref
to free the pad
.
MT safe.
pad
the Pad
to release.
fn remove_pad<P>(&self, pad: &P) -> Result<(), BoolError> where
P: IsA<Pad>,
P: IsA<Pad>,
Removes pad
from self
. pad
will be destroyed if it has not been
referenced elsewhere using GstObjectExt::unparent
.
This function is used by plugin developers and should not be used
by applications. Pads that were dynamically requested from elements
with ElementExt::request_pad
should be released with the
ElementExt::release_request_pad
function instead.
Pads are not automatically deactivated so elements should perform the needed
steps to deactivate the pad in case this pad is removed in the PAUSED or
PLAYING state. See PadExt::set_active
for more information about
deactivating pads.
The pad and the element should be unlocked when calling this function.
This function will emit the Element::pad-removed
signal on the element.
pad
the Pad
to remove from the element.
Returns
true
if the pad could be removed. Can return false
if the
pad does not belong to the provided element.
MT safe.
fn request_pad(
&self,
templ: &PadTemplate,
name: Option<&str>,
caps: Option<&Caps>
) -> Option<Pad>
&self,
templ: &PadTemplate,
name: Option<&str>,
caps: Option<&Caps>
) -> Option<Pad>
Retrieves a request pad from the element according to the provided template.
Pad templates can be looked up using
ElementFactory::get_static_pad_templates
.
The pad should be released with ElementExt::release_request_pad
.
templ
a PadTemplate
of which we want a pad of.
name
the name of the request Pad
to retrieve. Can be None
.
caps
the caps of the pad we want to
request. Can be None
.
Returns
requested Pad
if found,
otherwise None
. Release after usage.
fn set_base_time(&self, time: ClockTime)
fn set_bus(&self, bus: Option<&Bus>)
Sets the bus of the element. Increases the refcount on the bus. For internal use only, unless you're testing elements.
MT safe.
bus
the Bus
to set.
fn set_clock<P>(&self, clock: Option<&P>) -> Result<(), BoolError> where
P: IsA<Clock>,
P: IsA<Clock>,
Sets the clock for the element. This function increases the refcount on the clock. Any previously set clock on the object is unreffed.
clock
the Clock
to set for the element.
Returns
true
if the element accepted the clock. An element can refuse a
clock when it, for example, is not able to slave its internal clock to the
clock
or when it requires a specific clock to operate.
MT safe.
fn set_context(&self, context: &Context)
Sets the context of the element. Increases the refcount of the context.
MT safe.
context
the Context
to set.
fn set_locked_state(&self, locked_state: bool) -> bool
Locks the state of an element, so state changes of the parent don't affect this element anymore.
Note that this is racy if the state lock of the parent bin is not taken. The parent bin might've just checked the flag in another thread and as the next step proceed to change the child element's state.
MT safe.
locked_state
true
to lock the element's state
Returns
true
if the state was changed, false
if bad parameters were given
or the elements state-locking needed no change.
fn set_start_time(&self, time: ClockTime)
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.
Toplevel elements like Pipeline
will manage the start_time and
base_time on its children. Setting the start_time to GST_CLOCK_TIME_NONE
on such a toplevel element will disable the distribution of the base_time to
the children and can be useful if the application manages the base_time
itself, for example if you want to synchronize capture from multiple
pipelines, and you can also ensure that the pipelines have the same clock.
MT safe.
time
the base time to set.
fn sync_state_with_parent(&self) -> Result<(), BoolError>
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.
Returns
true
, if the element's state could be synced to the parent's state.
MT safe.
fn unlink<P>(&self, dest: &P) where
P: IsA<Element>,
P: IsA<Element>,
Unlinks all source pads of the source element with all sink pads of the sink element to which they are linked.
If the link has been made using ElementExt::link
, it could have created an
requestpad, which has to be released using ElementExt::release_request_pad
.
dest
the sink Element
to unlink.
fn unlink_pads<P>(&self, srcpadname: &str, dest: &P, destpadname: &str) where
P: IsA<Element>,
P: IsA<Element>,
Unlinks the two named pads of the source and destination elements.
This is a convenience function for PadExt::unlink
.
srcpadname
the name of the Pad
in source element.
dest
a Element
containing the destination pad.
destpadname
the name of the Pad
in destination element.
fn connect_no_more_pads<F>(&self, f: F) -> SignalHandlerId where
F: 'static + Send + Sync + Fn(&Self),
F: 'static + Send + Sync + Fn(&Self),
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.
fn connect_pad_added<F>(&self, f: F) -> SignalHandlerId where
F: 'static + Send + Sync + Fn(&Self, &Pad),
F: 'static + Send + Sync + Fn(&Self, &Pad),
a new 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::set_state
or ElementExt::sync_state_with_parent
.
new_pad
the pad that has been added
fn connect_pad_removed<F>(&self, f: F) -> SignalHandlerId where
F: 'static + Send + Sync + Fn(&Self, &Pad),
F: 'static + Send + Sync + Fn(&Self, &Pad),
Implementors
impl<O> ElementExt for O where
O: IsA<Element>,
[src]
O: IsA<Element>,
fn abort_state(&self)
[src]
fn add_pad<P>(&self, pad: &P) -> Result<(), BoolError> where
P: IsA<Pad>,
[src]
P: IsA<Pad>,
fn create_all_pads(&self)
[src]
fn foreach_pad<P>(&self, func: P) -> bool where
P: FnMut(&Element, &Pad) -> bool,
[src]
P: FnMut(&Element, &Pad) -> bool,
fn foreach_sink_pad<P>(&self, func: P) -> bool where
P: FnMut(&Element, &Pad) -> bool,
[src]
P: FnMut(&Element, &Pad) -> bool,
fn foreach_src_pad<P>(&self, func: P) -> bool where
P: FnMut(&Element, &Pad) -> bool,
[src]
P: FnMut(&Element, &Pad) -> bool,
fn get_base_time(&self) -> ClockTime
[src]
fn get_bus(&self) -> Option<Bus>
[src]
fn get_clock(&self) -> Option<Clock>
[src]
fn get_compatible_pad<P>(&self, pad: &P, caps: Option<&Caps>) -> Option<Pad> where
P: IsA<Pad>,
[src]
P: IsA<Pad>,
fn get_compatible_pad_template(
&self,
compattempl: &PadTemplate
) -> Option<PadTemplate>
[src]
&self,
compattempl: &PadTemplate
) -> Option<PadTemplate>
fn get_context(&self, context_type: &str) -> Option<Context>
[src]
fn get_contexts(&self) -> Vec<Context>
[src]
fn get_factory(&self) -> Option<ElementFactory>
[src]
fn get_request_pad(&self, name: &str) -> Option<Pad>
[src]
fn get_start_time(&self) -> ClockTime
[src]
fn get_static_pad(&self, name: &str) -> Option<Pad>
[src]
fn is_locked_state(&self) -> bool
[src]
fn link<P>(&self, dest: &P) -> Result<(), BoolError> where
P: IsA<Element>,
[src]
P: IsA<Element>,
fn link_filtered<P>(
&self,
dest: &P,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
[src]
&self,
dest: &P,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
fn link_pads<P>(
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>
) -> Result<(), BoolError> where
P: IsA<Element>,
[src]
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>
) -> Result<(), BoolError> where
P: IsA<Element>,
fn link_pads_filtered<P>(
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
[src]
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
filter: Option<&Caps>
) -> Result<(), BoolError> where
P: IsA<Element>,
fn link_pads_full<P>(
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
flags: PadLinkCheck
) -> Result<(), BoolError> where
P: IsA<Element>,
[src]
&self,
srcpadname: Option<&str>,
dest: &P,
destpadname: Option<&str>,
flags: PadLinkCheck
) -> Result<(), BoolError> where
P: IsA<Element>,
fn lost_state(&self)
[src]
fn no_more_pads(&self)
[src]
fn post_message(&self, message: &Message) -> Result<(), BoolError>
[src]
fn provide_clock(&self) -> Option<Clock>
[src]
fn release_request_pad<P>(&self, pad: &P) where
P: IsA<Pad>,
[src]
P: IsA<Pad>,
fn remove_pad<P>(&self, pad: &P) -> Result<(), BoolError> where
P: IsA<Pad>,
[src]
P: IsA<Pad>,
fn request_pad(
&self,
templ: &PadTemplate,
name: Option<&str>,
caps: Option<&Caps>
) -> Option<Pad>
[src]
&self,
templ: &PadTemplate,
name: Option<&str>,
caps: Option<&Caps>
) -> Option<Pad>
fn set_base_time(&self, time: ClockTime)
[src]
fn set_bus(&self, bus: Option<&Bus>)
[src]
fn set_clock<P>(&self, clock: Option<&P>) -> Result<(), BoolError> where
P: IsA<Clock>,
[src]
P: IsA<Clock>,
fn set_context(&self, context: &Context)
[src]
fn set_locked_state(&self, locked_state: bool) -> bool
[src]
fn set_start_time(&self, time: ClockTime)
[src]
fn sync_state_with_parent(&self) -> Result<(), BoolError>
[src]
fn unlink<P>(&self, dest: &P) where
P: IsA<Element>,
[src]
P: IsA<Element>,
fn unlink_pads<P>(&self, srcpadname: &str, dest: &P, destpadname: &str) where
P: IsA<Element>,
[src]
P: IsA<Element>,
fn connect_no_more_pads<F>(&self, f: F) -> SignalHandlerId where
F: 'static + Send + Sync + Fn(&O),
[src]
F: 'static + Send + Sync + Fn(&O),
fn connect_pad_added<F>(&self, f: F) -> SignalHandlerId where
F: 'static + Send + Sync + Fn(&O, &Pad),
[src]
F: 'static + Send + Sync + Fn(&O, &Pad),
fn connect_pad_removed<F>(&self, f: F) -> SignalHandlerId where
F: 'static + Send + Sync + Fn(&O, &Pad),
[src]
F: 'static + Send + Sync + Fn(&O, &Pad),