Trait gstreamer::subclass::prelude::ElementImpl
source · pub trait ElementImpl: ElementImplExt + GstObjectImpl + Send + Sync {
// Provided methods
fn metadata() -> Option<&'static ElementMetadata> { ... }
fn pad_templates() -> &'static [PadTemplate] { ... }
fn change_state(
&self,
transition: StateChange,
) -> Result<StateChangeSuccess, StateChangeError> { ... }
fn request_new_pad(
&self,
templ: &PadTemplate,
name: Option<&str>,
caps: Option<&Caps>,
) -> Option<Pad> { ... }
fn release_pad(&self, pad: &Pad) { ... }
fn send_event(&self, event: Event) -> bool { ... }
fn query(&self, query: &mut QueryRef) -> bool { ... }
fn set_context(&self, context: &Context) { ... }
fn set_clock(&self, clock: Option<&Clock>) -> bool { ... }
fn provide_clock(&self) -> Option<Clock> { ... }
fn post_message(&self, msg: Message) -> bool { ... }
}
Provided Methods§
fn metadata() -> Option<&'static ElementMetadata>
fn pad_templates() -> &'static [PadTemplate]
sourcefn change_state(
&self,
transition: StateChange,
) -> Result<StateChangeSuccess, StateChangeError>
fn change_state( &self, transition: StateChange, ) -> Result<StateChangeSuccess, StateChangeError>
Perform transition
on self
.
This function must be called with STATE_LOCK held and is mainly used internally.
§transition
the requested transition
§Returns
the StateChangeReturn
of the state transition.
sourcefn request_new_pad(
&self,
templ: &PadTemplate,
name: Option<&str>,
caps: Option<&Caps>,
) -> Option<Pad>
fn request_new_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::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.
sourcefn release_pad(&self, pad: &Pad)
fn release_pad(&self, pad: &Pad)
called when a request pad is to be released
sourcefn send_event(&self, event: Event) -> bool
fn send_event(&self, event: Event) -> bool
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.
This function takes ownership of the provided event so you should
gst_event_ref()
it if you want to reuse the event after this call.
MT safe.
§event
the Event
to send to the element.
§Returns
true
if the event was handled. Events that trigger a preroll (such
as flushing seeks and steps) will emit GST_MESSAGE_ASYNC_DONE
.
sourcefn query(&self, query: &mut QueryRef) -> bool
fn query(&self, query: &mut QueryRef) -> bool
Performs a query on the given element.
For elements that don’t implement a query handler, this function forwards the query to a random srcpad or to the peer of a random linked sinkpad of this element.
Please note that some queries might need a running pipeline to work.
§query
the Query
.
§Returns
true
if the query could be performed.
MT safe.
sourcefn set_context(&self, context: &Context)
fn set_context(&self, context: &Context)
sourcefn set_clock(&self, clock: Option<&Clock>) -> bool
fn set_clock(&self, clock: Option<&Clock>) -> bool
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.
sourcefn provide_clock(&self) -> Option<Clock>
fn provide_clock(&self) -> Option<Clock>
sourcefn post_message(&self, msg: Message) -> bool
fn post_message(&self, msg: Message) -> bool
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.