[][src]Struct gst::Element

pub struct Element { /* fields omitted */ }

Methods

impl Element[src]

pub fn new(factory_name: &str, element_name: &str) -> Option<Element>[src]

Use a factory factory_name to create an element with name element_name.

pub fn factory_make(element: &str, name: &str) -> Option<Element>[src]

pub unsafe fn new_from_gst_element(element: *mut GstElement) -> Option<Element>[src]

Link several elements in succession.

Calling Element::link_many(&mut[&mut A, &mut B, &mut C, ...]) will attempt to link A->B, then B->C, ... . In case of error, this function returns immediately, without attempting to unlink.

See ElementT::link for more details about linking.

Make sure you have added your elements to a bin or pipeline with `Bin::add()`` before trying to link them.

returns true if all elements could be linked, false otherwise.

Links this element 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 Bin::add() before trying to link them.

returns true if the elements could be linked, false otherwise.

Unlinks all source pads of the this element with all sink pads of the sink element to which they are linked.

If the link has been made using Element::link(), it could have created a requestpad, which has to be released using gst_element_release_request_pad().

pub fn bus(&self) -> Option<Bus>[src]

Returns the bus of the element. Note that only a Pipeline will provide a bus for the application.

pub fn set_name(&mut self, name: &str)[src]

Sets the name of the element

pub fn set_state(&mut self, state: GstState) -> GstStateChangeReturn[src]

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.

This function can return GST_STATE_CHANGE_ASYNC, in which case the element will perform the remainder of the state change asynchronously in another thread. An application can use get_state() to wait for the completion of the state change or it can wait for a GST_MESSAGE_ASYNC_DONE or GST_MESSAGE_STATE_CHANGED on the bus.

State changes to GST_STATE_READY or GST_STATE_NULL never return GST_STATE_CHANGE_ASYNC.

pub fn get_state(
    &self,
    timeout: GstClockTime
) -> (GstState, GstState, GstStateChangeReturn)
[src]

Gets the state of the element.

For elements that performed an ASYNC state change, as reported by set_state(), this function will block up to the specified timeout value for the state change to complete. If the element completes the state change or goes into an error, this function returns immediately with a return value of GST_STATE_CHANGE_SUCCESS or GST_STATE_CHANGE_FAILURE respectively.

For elements that did not return GST_STATE_CHANGE_ASYNC, this function returns the current and pending state immediately.

This function returns GST_STATE_CHANGE_NO_PREROLL if the element successfully changed its state but is not able to provide data yet. This mostly happens for live sources that only produce data in GST_STATE_PLAYING. While the state change return is equivalent to GST_STATE_CHANGE_SUCCESS, it is returned to the application to signal that some sink elements might not be able to complete their state change because an element is not producing data to complete the preroll. When setting the element to playing, the preroll will complete and playback will start. Returns

GST_STATE_CHANGE_SUCCESS if the element has no more pending state and the last state change succeeded, GST_STATE_CHANGE_ASYNC if the element is still performing a state change or GST_STATE_CHANGE_FAILURE if the last state change failed.

pub unsafe fn send_event(&mut self, event: *mut GstEvent) -> bool[src]

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.

pub fn seek_simple(
    &mut self,
    format: GstFormat,
    flags: GstSeekFlags,
    pos: i64
) -> bool
[src]

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().

In a completely prerolled PAUSED or PLAYING pipeline, seeking is always guaranteed to return TRUE on a seekable media type or FALSE when the media type is certainly not seekable (such as a live stream).

Some elements allow for seeking in the READY state, in this case they will store the seek event and execute it when they are put to PAUSED. If the element supports seek in READY, it will always return true when it receives the event in the READY state.

pub fn seek(
    &mut self,
    rate: f64,
    format: GstFormat,
    flags: GstSeekFlags,
    start_type: GstSeekType,
    start: i64,
    stop_type: GstSeekType,
    stop: i64
) -> bool
[src]

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 send_event().

pub fn query_duration(&self, format: GstFormat) -> Option<i64>[src]

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.

If the duration changes for some reason, you will get a DURATION_CHANGED message on the pipeline bus, in which case you should re-query the duration using this function.

pub fn query_position(&self, format: GstFormat) -> Option<i64>[src]

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.

pub fn duration_ns(&self) -> Option<i64>[src]

Shortcut for query_duration with format == TIME

pub fn duration_s(&self) -> Option<f64>[src]

Shortcut for query_duration with format == TIME and conversion to seconds

pub fn position_ns(&self) -> Option<i64>[src]

Shortcut for query_position with format == TIME

pub fn position_pct(&self) -> Option<f64>[src]

Shortcut for query_position with format == TIME and conversion to pct as 0..1

pub fn position_s(&self) -> Option<f64>[src]

Shortcut for query_position with format == TIME and conversion to seconds

pub fn set_position_ns(&mut self, ns: i64) -> bool[src]

Shortcut for seek to a ceratin position in ns

pub fn set_position_s(&mut self, s: f64) -> bool[src]

Shortcut for seek to a ceratin position in secs

pub fn set_position_pct(&mut self, pct: f64) -> bool[src]

Shortcut for seek to a ceratin position in pcs as 0..1

pub fn set_speed(&mut self, speed: f64) -> bool[src]

Shortcut for seek to the current position but change in playback rate

pub fn set_null_state(&mut self) -> GstStateChangeReturn[src]

shortcut to set_state with state == NULL

pub fn set_ready_state(&mut self) -> GstStateChangeReturn[src]

shortcut to set_state with state == READY

pub fn pause(&mut self) -> GstStateChangeReturn[src]

shortcut to set_state with state == PAUSED

pub fn play(&mut self) -> GstStateChangeReturn[src]

shortcut to set_state with state == PLAYING

pub fn is_paused(&self) -> bool[src]

shortcut to query the state and returns state == PAUSED

pub fn is_playing(&self) -> bool[src]

shortcut to query the state and returns state == PLAYING

pub fn is_null_state(&self) -> bool[src]

shortcut to query the state and returns state == NULL

pub fn is_ready_state(&self) -> bool[src]

shortcut to query the state and returns state == READY

pub fn static_pad(&mut self, name: &str) -> Option<Pad>[src]

pub unsafe fn gst_element(&self) -> *const GstElement[src]

Returns a const raw pointer to the internal GstElement

pub unsafe fn gst_element_mut(&mut self) -> *mut GstElement[src]

Returns a mutable raw pointer to the internal GstElement

Methods from Deref<Target = Object>

pub fn set_name(&mut self, name: &str) -> bool[src]

pub fn name(&self) -> String[src]

Returns the name of the object

pub fn flags(&self) -> u32[src]

pub fn is_flag_set(&self, flag: u32) -> bool[src]

pub fn set_flag(&mut self, flag: u32)[src]

pub fn unset_flag(&mut self, flag: u32)[src]

pub fn refcount(&self) -> usize[src]

pub fn lock<F: FnMut(&mut Object)>(&mut self, f: F)[src]

pub fn set_unique_name(&mut self) -> bool[src]

pub fn set_parent(&mut self, parent: &Object) -> bool[src]

pub fn parent(&self) -> Option<Ref<Object>>[src]

pub fn unparent(&mut self)[src]

pub fn has_as_ancestor(&self, ancestor: &Object) -> bool[src]

pub fn path_string(&self) -> &str[src]

pub fn has_active_control_bindings(&self) -> bool[src]

pub fn disable_control_bindings(&mut self)[src]

pub fn enable_control_bindings(&mut self)[src]

pub fn disable_control_binding(&mut self, property_name: &str)[src]

pub fn enable_control_binding(&mut self, property_name: &str)[src]

pub fn set<T>(&mut self, name: &str, value: T) where
    T: Property, 
[src]

pub fn get<T>(&self, name: &str) -> T where
    T: FromProperty, 
[src]

pub unsafe fn signal_connect<T>(
    &mut self,
    signal: &str,
    callback: GCallback,
    data: &mut T
) where
    Self: Sized
[src]

pub unsafe fn gst_object(&self) -> *const GstObject[src]

pub unsafe fn gst_object_mut(&mut self) -> *mut GstObject[src]

Trait Implementations

impl Transfer<Struct__GstElement> for Element[src]

impl FromGValue for Element[src]

impl AsMut<Element> for AppSink[src]

impl AsMut<Element> for AppSrc[src]

impl AsMut<Object> for Element[src]

impl AsMut<Element> for Bin[src]

impl Sync for Element[src]

impl AsRef<Element> for AppSink[src]

impl AsRef<Element> for AppSrc[src]

impl AsRef<Object> for Element[src]

impl AsRef<Element> for Bin[src]

impl Send for Element[src]

impl From<AppSink> for Element[src]

impl From<AppSrc> for Element[src]

impl From<Element> for Object[src]

impl From<Bin> for Element[src]

impl Deref for Element[src]

type Target = Object

The resulting type after dereferencing.

impl DerefMut for Element[src]

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.