StreamProducer

Struct StreamProducer 

Source
pub struct StreamProducer(/* private fields */);
Expand description

The interface for transporting media data from one node to another.

A producer is essentially a GStreamer appsink whose output is sent to a set of consumers, who are essentially appsrc wrappers

Implementations§

Source§

impl StreamProducer

Source

pub fn configure_consumer(consumer: &AppSrc)

Configures a consumer appsrc for later use in a StreamProducer.

This function configures the appsrc in a suitable state to act as a consumer and also sets the internal queue properties as follows:

  • max-buffers <- 0 (unlimited)
  • max-bytes <- 0 (unlimited)
  • max-time <- 500ms

If you need different settings, call StreamProducer::configure_consumer_with instead.

This is automatically invoked when calling StreamProducer::add_consumer.

Source

pub fn configure_consumer_with(consumer: &AppSrc, settings: ConsumerSettings)

Configures a consumer appsrc for later use in a StreamProducer.

This function configures the appsrc in a suitable state to act as a consumer and applies the provided settings.

If unsure, call StreamProducer::configure_consumer instead.

Source

pub fn add_consumer( &self, consumer: &AppSrc, ) -> Result<ConsumptionLink, AddConsumerError>

Adds an appsrc to dispatch data to.

This function configures the appsrc in a suitable state to act as a consumer and also sets the internal queue properties as follows:

  • max-buffers <- 0 (unlimited)
  • max-bytes <- 0 (unlimited)
  • max-time <- 500ms

If you need different values, call StreamProducer::add_consumer_with instead.

Dropping the returned ConsumptionLink will automatically disconnect the consumer from the producer.

Source

pub fn add_consumer_with( &self, consumer: &AppSrc, settings: ConsumerSettings, ) -> Result<ConsumptionLink, AddConsumerError>

Adds a configured appsrc to dispatch data to.

This function configures the appsrc in a suitable state to act as a consumer and applies the provided settings.

If unsure, call StreamProducer::add_consumer instead.

Dropping the returned ConsumptionLink will automatically disconnect the consumer from the producer.

Source

pub fn remove_consumer(&self, consumer: &AppSrc)

Remove a consumer appsrc by id

Source

pub fn set_forward_events( &self, events_to_forward: impl IntoIterator<Item = EventType>, )

configure event types the appsink should forward to all its consumers (default: Eos).

Source

pub fn get_forwarded_events(&self) -> Vec<EventType>

get event types the appsink should forward to all its consumers

Source

pub fn set_forward_preroll(&self, forward_preroll: bool)

configure whether the preroll sample should be forwarded (default: true)

Source

pub fn appsink(&self) -> &AppSink

Get the GStreamer appsink wrapped by this producer

Source

pub fn error(&self, error: &Error, debug: Option<&str>)

Signals an error on all consumers

Source

pub fn last_sample(&self) -> Option<Sample>

The last sample produced by this producer.

Source§

impl StreamProducer

Source

pub fn from(appsink: &AppSink) -> Self

Adds an appsink to dispatch data from.

This function configures the appsink in a suitable state to act as a producer and also sets the properties as follows:

  • sync <- true (sync on the clock)

If you need a different value, use StreamProducer::with instead.

Source

pub fn with(appsink: &AppSink, settings: ProducerSettings) -> Self

Adds an appsink to dispatch data from.

This function configures the appsink in a suitable state to act as a producer and applies the provided settings.

If unsure, use StreamProducer::from instead.

Trait Implementations§

Source§

impl Clone for StreamProducer

Source§

fn clone(&self) -> StreamProducer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamProducer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for StreamProducer

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for StreamProducer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.