Trait gstreamer::prelude::PadExt[][src]

pub trait PadExt: 'static {
Show methods fn activate_mode(
        &self,
        mode: PadMode,
        active: bool
    ) -> Result<(), BoolError>;
fn can_link<P: IsA<Pad>>(&self, sinkpad: &P) -> bool;
fn check_reconfigure(&self) -> bool;
fn create_stream_id<P: IsA<Element>>(
        &self,
        parent: &P,
        stream_id: Option<&str>
    ) -> GString;
fn forward<P: FnMut(&Pad) -> bool>(&self, forward: P) -> bool;
fn allowed_caps(&self) -> Option<Caps>;
fn current_caps(&self) -> Option<Caps>;
fn direction(&self) -> PadDirection;
fn last_flow_result(&self) -> Result<FlowSuccess, FlowError>;
fn offset(&self) -> i64;
fn pad_template(&self) -> Option<PadTemplate>;
fn pad_template_caps(&self) -> Caps;
fn parent_element(&self) -> Option<Element>;
fn peer(&self) -> Option<Pad>;
fn single_internal_link(&self) -> Option<Pad>;
fn sticky_event(&self, event_type: EventType, idx: u32) -> Option<Event>;
fn stream(&self) -> Option<Stream>;
fn stream_id(&self) -> Option<GString>;
fn task_state(&self) -> TaskState;
fn has_current_caps(&self) -> bool;
fn is_active(&self) -> bool;
fn is_blocked(&self) -> bool;
fn is_blocking(&self) -> bool;
fn is_linked(&self) -> bool;
fn link<P: IsA<Pad>>(
        &self,
        sinkpad: &P
    ) -> Result<PadLinkSuccess, PadLinkError>;
fn link_full<P: IsA<Pad>>(
        &self,
        sinkpad: &P,
        flags: PadLinkCheck
    ) -> Result<PadLinkSuccess, PadLinkError>;
fn link_maybe_ghosting<P: IsA<Pad>>(
        &self,
        sink: &P
    ) -> Result<(), BoolError>;
fn link_maybe_ghosting_full<P: IsA<Pad>>(
        &self,
        sink: &P,
        flags: PadLinkCheck
    ) -> Result<(), BoolError>;
fn mark_reconfigure(&self);
fn needs_reconfigure(&self) -> bool;
fn pause_task(&self) -> Result<(), BoolError>;
fn peer_query_accept_caps(&self, caps: &Caps) -> bool;
fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps;
fn query_accept_caps(&self, caps: &Caps) -> bool;
fn query_caps(&self, filter: Option<&Caps>) -> Caps;
fn set_active(&self, active: bool) -> Result<(), BoolError>;
fn set_offset(&self, offset: i64);
fn stop_task(&self) -> Result<(), BoolError>;
fn store_sticky_event(
        &self,
        event: &Event
    ) -> Result<FlowSuccess, FlowError>;
fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), BoolError>;
fn use_fixed_caps(&self);
fn caps(&self) -> Option<Caps>;
fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}

Trait containing all Pad methods.

Implementors

crate::Pad, crate::ProxyPad

Required methods

fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), BoolError>[src]

Activates or deactivates the given pad in mode via dispatching to the pad’s activatemodefunc. For use from within pad activation functions only.

If you don’t know what this is, you probably don’t want to call it.

mode

the requested activation mode

active

whether or not the pad should be active.

Returns

true if the operation was successful.

MT safe.

Checks if the source pad and the sink pad are compatible so they can be linked.

sinkpad

the sink crate::Pad.

Returns

true if the pads can be linked.

fn check_reconfigure(&self) -> bool[src]

Check and clear the [crate::PadFlags::NeedReconfigure] flag on self and return true if the flag was set.

Returns

true is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on self.

fn create_stream_id<P: IsA<Element>>(
    &self,
    parent: &P,
    stream_id: Option<&str>
) -> GString
[src]

Creates a stream-id for the source crate::Pad self by combining the upstream information with the optional stream_id of the stream of self. self must have a parent crate::Element and which must have zero or one sinkpad. stream_id can only be None if the parent element of self has only a single source pad.

This function generates an unique stream-id by getting the upstream stream-start event stream ID and appending stream_id to it. If the element has no sinkpad it will generate an upstream stream-id by doing an URI query on the element and in the worst case just uses a random number. Source elements that don’t implement the URI handler interface should ideally generate a unique, deterministic stream-id manually instead.

Since stream IDs are sorted alphabetically, any numbers in the stream ID should be printed with a fixed number of characters, preceded by 0’s, such as by using the format %03u instead of %u.

parent

Parent crate::Element of self

stream_id

The stream-id

Returns

A stream-id for self. g_free() after usage.

fn forward<P: FnMut(&Pad) -> bool>(&self, forward: P) -> bool[src]

Calls forward for all internally linked pads of self. This function deals with dynamically changing internal pads and will make sure that the forward function is only called once for each pad.

When forward returns true, no further pads will be processed.

forward

a GstPadForwardFunction

user_data

user data passed to forward

Returns

true if one of the dispatcher functions returned true.

fn allowed_caps(&self) -> Option<Caps>[src]

Gets the capabilities of the allowed media types that can flow through self and its peer.

The allowed capabilities is calculated as the intersection of the results of calling Self::query_caps() on self and its peer. The caller owns a reference on the resulting caps.

Returns

the allowed crate::Caps of the pad link. Unref the caps when you no longer need it. This function returns None when self has no peer.

MT safe.

fn current_caps(&self) -> Option<Caps>[src]

Gets the capabilities currently configured on self with the last crate::EventType::Caps event.

Returns

the current caps of the pad with incremented ref-count or None when pad has no caps. Unref after usage.

fn direction(&self) -> PadDirection[src]

Gets the direction of the pad. The direction of the pad is decided at construction time so this function does not take the LOCK.

Returns

the crate::PadDirection of the pad.

MT safe.

fn last_flow_result(&self) -> Result<FlowSuccess, FlowError>[src]

Gets the crate::FlowReturn return from the last data passed by this pad.

fn offset(&self) -> i64[src]

Get the offset applied to the running time of self. self has to be a source pad.

Returns

the offset.

fn pad_template(&self) -> Option<PadTemplate>[src]

Gets the template for self.

Returns

the crate::PadTemplate from which this pad was instantiated, or None if this pad has no template. Unref after usage.

fn pad_template_caps(&self) -> Caps[src]

Gets the capabilities for self’s template.

Returns

the crate::Caps of this pad template. Unref after usage.

fn parent_element(&self) -> Option<Element>[src]

Gets the parent of self, cast to a crate::Element. If a self has no parent or its parent is not an element, return None.

Returns

the parent of the pad. The caller has a reference on the parent, so unref when you’re finished with it.

MT safe.

fn peer(&self) -> Option<Pad>[src]

Gets the peer of self. This function refs the peer pad so you need to unref it after use.

Returns

the peer crate::Pad. Unref after usage.

MT safe.

This is supported on crate feature v1_18 only.

If there is a single internal link of the given pad, this function will return it. Otherwise, it will return NULL.

Returns

a crate::Pad, or None if self has none or more than one internal links. Unref returned pad with [crate::prelude::GstObjectExt::unref()].

fn sticky_event(&self, event_type: EventType, idx: u32) -> Option<Event>[src]

Returns a new reference of the sticky event of type event_type from the event.

event_type

the crate::EventType that should be retrieved.

idx

the index of the event

Returns

a crate::Event of type event_type or None when no event of event_type was on self. Unref after usage.

fn stream(&self) -> Option<Stream>[src]

This is supported on crate feature v1_10 only.

Returns the current crate::Stream for the self, or None if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around [Self::get_sticky_event()] and [crate::Event::parse_stream()].

Returns

the current crate::Stream for self, or None. unref the returned stream when no longer needed.

fn stream_id(&self) -> Option<GString>[src]

Returns the current stream-id for the self, or None if none has been set yet, i.e. the pad has not received a stream-start event yet.

This is a convenience wrapper around [Self::get_sticky_event()] and [crate::Event::parse_stream_start()].

The returned stream-id string should be treated as an opaque string, its contents should not be interpreted.

Returns

a newly-allocated copy of the stream-id for self, or None. g_free() the returned string when no longer needed.

fn task_state(&self) -> TaskState[src]

This is supported on crate feature v1_12 only.

Get self task state. If no task is currently set, crate::TaskState::Stopped is returned.

Returns

The current state of self’s task.

fn has_current_caps(&self) -> bool[src]

Check if self has caps set on it with a crate::EventType::Caps event.

Returns

true when self has caps associated with it.

fn is_active(&self) -> bool[src]

Query if a pad is active

Returns

true if the pad is active.

MT safe.

fn is_blocked(&self) -> bool[src]

Checks if the pad is blocked or not. This function returns the last requested state of the pad. It is not certain that the pad is actually blocking at this point (see Self::is_blocking()).

Returns

true if the pad is blocked.

MT safe.

fn is_blocking(&self) -> bool[src]

Checks if the pad is blocking or not. This is a guaranteed state of whether the pad is actually blocking on a crate::Buffer or a crate::Event.

Returns

true if the pad is blocking.

MT safe.

fn is_linked(&self) -> bool[src]

Checks if a self is linked to another pad or not.

Returns

true if the pad is linked, false otherwise.

MT safe.

Links the source pad and the sink pad.

sinkpad

the sink crate::Pad to link.

Returns

A result code indicating if the connection worked or what went wrong.

MT Safe.

Links the source pad and the sink pad.

This variant of Self::link provides a more granular control on the checks being done when linking. While providing some considerable speedups the caller of this method must be aware that wrong usage of those flags can cause severe issues. Refer to the documentation of crate::PadLinkCheck for more information.

MT Safe.

sinkpad

the sink crate::Pad to link.

flags

the checks to validate when linking

Returns

A result code indicating if the connection worked or what went wrong.

This is supported on crate feature v1_10 only.

Links self to sink, creating any crate::GhostPad’s in between as necessary.

This is a convenience function to save having to create and add intermediate crate::GhostPad’s as required for linking across crate::Bin boundaries.

If self or sink pads don’t have parent elements or do not share a common ancestor, the link will fail.

sink

a crate::Pad

Returns

whether the link succeeded.

This is supported on crate feature v1_10 only.

Links self to sink, creating any crate::GhostPad’s in between as necessary.

This is a convenience function to save having to create and add intermediate crate::GhostPad’s as required for linking across crate::Bin boundaries.

If self or sink pads don’t have parent elements or do not share a common ancestor, the link will fail.

Calling Self::link_maybe_ghosting_full() with flags == [crate::PadLinkCheck::Default] is the recommended way of linking pads with safety checks applied.

sink

a crate::Pad

flags

some crate::PadLinkCheck flags

Returns

whether the link succeeded.

fn mark_reconfigure(&self)[src]

Mark a pad for needing reconfiguration. The next call to Self::check_reconfigure() will return true after this call.

fn needs_reconfigure(&self) -> bool[src]

Check the [crate::PadFlags::NeedReconfigure] flag on self and return true if the flag was set.

Returns

true is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on self.

fn pause_task(&self) -> Result<(), BoolError>[src]

Pause the task of self. This function will also wait until the function executed by the task is finished if this function is not called from the task function.

Returns

a true if the task could be paused or false when the pad has no task.

fn peer_query_accept_caps(&self, caps: &Caps) -> bool[src]

Check if the peer of self accepts caps. If self has no peer, this function returns true.

caps

a crate::Caps to check on the pad

Returns

true if the peer of self can accept the caps or self has no peer.

fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps[src]

Gets the capabilities of the peer connected to this pad. Similar to Self::query_caps().

When called on srcpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on sinkpads filter contains the caps accepted by downstream in the preferred order. filter might be None but if it is not None the returned caps will be a subset of filter.

filter

a crate::Caps filter, or None.

Returns

the caps of the peer pad with incremented ref-count. When there is no peer pad, this function returns filter or, when filter is None, ANY caps.

fn query_accept_caps(&self, caps: &Caps) -> bool[src]

Check if the given pad accepts the caps.

caps

a crate::Caps to check on the pad

Returns

true if the pad can accept the caps.

fn query_caps(&self, filter: Option<&Caps>) -> Caps[src]

Gets the capabilities this pad can produce or consume. Note that this method doesn’t necessarily return the caps set by sending a [crate::Event::new_caps()] - use [Self::get_current_caps()] for that instead. gst_pad_query_caps returns all possible caps a pad can operate with, using the pad’s CAPS query function, If the query fails, this function will return filter, if not None, otherwise ANY.

When called on sinkpads filter contains the caps that upstream could produce in the order preferred by upstream. When called on srcpads filter contains the caps accepted by downstream in the preferred order. filter might be None but if it is not None the returned caps will be a subset of filter.

Note that this function does not return writable crate::Caps, use gst_caps_make_writable() before modifying the caps.

filter

suggested crate::Caps, or None

Returns

the caps of the pad with incremented ref-count.

fn set_active(&self, active: bool) -> Result<(), BoolError>[src]

Activates or deactivates the given pad. Normally called from within core state change functions.

If active, makes sure the pad is active. If it is already active, either in push or pull mode, just return. Otherwise dispatches to the pad’s activate function to perform the actual activation.

If not active, calls Self::activate_mode() with the pad’s current mode and a false argument.

active

whether or not the pad should be active.

Returns

true if the operation was successful.

MT safe.

fn set_offset(&self, offset: i64)[src]

Set the offset that will be applied to the running time of self.

offset

the offset

fn stop_task(&self) -> Result<(), BoolError>[src]

Stop the task of self. This function will also make sure that the function executed by the task will effectively stop if not called from the GstTaskFunction.

This function will deadlock if called from the GstTaskFunction of the task. Use [crate::Task::pause()] instead.

Regardless of whether the pad has a task, the stream lock is acquired and released so as to ensure that streaming through this pad has finished.

Returns

a true if the task could be stopped or false on error.

fn store_sticky_event(&self, event: &Event) -> Result<FlowSuccess, FlowError>[src]

Store the sticky event on self

event

a crate::Event

Returns

crate::FlowReturn::Ok on success, crate::FlowReturn::Flushing when the pad was flushing or crate::FlowReturn::Eos when the pad was EOS.

Unlinks the source pad from the sink pad. Will emit the [crate::Pad::unlinked] signal on both pads.

sinkpad

the sink crate::Pad to unlink.

Returns

true if the pads were unlinked. This function returns false if the pads were not linked together.

MT safe.

fn use_fixed_caps(&self)[src]

A helper function you can use that sets the FIXED_CAPS flag This way the default CAPS query will always return the negotiated caps or in case the pad is not negotiated, the padtemplate caps.

The negotiated caps are the caps of the last CAPS event that passed on the pad. Use this function on a pad that, once it negotiated to a CAPS, cannot be renegotiated to something else.

fn caps(&self) -> Option<Caps>[src]

fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Signals that a pad has been linked to the peer pad.

peer

the peer pad that has been connected

fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Signals that a pad has been unlinked from the peer pad.

peer

the peer pad that has been disconnected

fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Loading content...

Implementors

impl<O: IsA<Pad>> PadExt for O[src]

fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), BoolError>[src]

fn check_reconfigure(&self) -> bool[src]

fn create_stream_id<P: IsA<Element>>(
    &self,
    parent: &P,
    stream_id: Option<&str>
) -> GString
[src]

fn forward<P: FnMut(&Pad) -> bool>(&self, forward: P) -> bool[src]

fn allowed_caps(&self) -> Option<Caps>[src]

fn current_caps(&self) -> Option<Caps>[src]

fn direction(&self) -> PadDirection[src]

fn last_flow_result(&self) -> Result<FlowSuccess, FlowError>[src]

fn offset(&self) -> i64[src]

fn pad_template(&self) -> Option<PadTemplate>[src]

fn pad_template_caps(&self) -> Caps[src]

fn parent_element(&self) -> Option<Element>[src]

fn peer(&self) -> Option<Pad>[src]

This is supported on crate feature v1_18 only.

fn sticky_event(&self, event_type: EventType, idx: u32) -> Option<Event>[src]

fn stream(&self) -> Option<Stream>[src]

This is supported on crate feature v1_10 only.

fn stream_id(&self) -> Option<GString>[src]

fn task_state(&self) -> TaskState[src]

This is supported on crate feature v1_12 only.

fn has_current_caps(&self) -> bool[src]

fn is_active(&self) -> bool[src]

fn is_blocked(&self) -> bool[src]

fn is_blocking(&self) -> bool[src]

fn is_linked(&self) -> bool[src]

This is supported on crate feature v1_10 only.
This is supported on crate feature v1_10 only.

fn mark_reconfigure(&self)[src]

fn needs_reconfigure(&self) -> bool[src]

fn pause_task(&self) -> Result<(), BoolError>[src]

fn peer_query_accept_caps(&self, caps: &Caps) -> bool[src]

fn peer_query_caps(&self, filter: Option<&Caps>) -> Caps[src]

fn query_accept_caps(&self, caps: &Caps) -> bool[src]

fn query_caps(&self, filter: Option<&Caps>) -> Caps[src]

fn set_active(&self, active: bool) -> Result<(), BoolError>[src]

fn set_offset(&self, offset: i64)[src]

fn stop_task(&self) -> Result<(), BoolError>[src]

fn store_sticky_event(&self, event: &Event) -> Result<FlowSuccess, FlowError>[src]

fn use_fixed_caps(&self)[src]

fn caps(&self) -> Option<Caps>[src]

fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_caps_notify<F: Fn(&Self) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Loading content...