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
impl StreamProducer
Sourcepub fn configure_consumer(consumer: &AppSrc)
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
.
Sourcepub fn configure_consumer_with(consumer: &AppSrc, settings: ConsumerSettings)
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.
Sourcepub fn add_consumer(
&self,
consumer: &AppSrc,
) -> Result<ConsumptionLink, AddConsumerError>
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.
Sourcepub fn add_consumer_with(
&self,
consumer: &AppSrc,
settings: ConsumerSettings,
) -> Result<ConsumptionLink, AddConsumerError>
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.
Sourcepub fn remove_consumer(&self, consumer: &AppSrc)
pub fn remove_consumer(&self, consumer: &AppSrc)
Remove a consumer appsrc by id
Sourcepub fn set_forward_events(
&self,
events_to_forward: impl IntoIterator<Item = EventType>,
)
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
).
Sourcepub fn get_forwarded_events(&self) -> Vec<EventType>
pub fn get_forwarded_events(&self) -> Vec<EventType>
get event types the appsink should forward to all its consumers
Sourcepub fn set_forward_preroll(&self, forward_preroll: bool)
pub fn set_forward_preroll(&self, forward_preroll: bool)
configure whether the preroll sample should be forwarded (default: true
)
Sourcepub fn last_sample(&self) -> Option<Sample>
pub fn last_sample(&self) -> Option<Sample>
The last sample produced by this producer.
Source§impl StreamProducer
impl StreamProducer
Sourcepub fn from(appsink: &AppSink) -> Self
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.
Sourcepub fn with(appsink: &AppSink, settings: ProducerSettings) -> Self
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
impl Clone for StreamProducer
Source§fn clone(&self) -> StreamProducer
fn clone(&self) -> StreamProducer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StreamProducer
impl Debug for StreamProducer
Source§impl PartialEq for StreamProducer
impl PartialEq for StreamProducer
impl Eq for StreamProducer
Auto Trait Implementations§
impl Freeze for StreamProducer
impl RefUnwindSafe for StreamProducer
impl Send for StreamProducer
impl Sync for StreamProducer
impl Unpin for StreamProducer
impl UnwindSafe for StreamProducer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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