Skip to main content

PacketSource

Trait PacketSource 

Source
pub trait PacketSource: Send {
    // Required methods
    fn streams(&self) -> &[StreamInfo];
    fn next_packet(&mut self) -> Result<Packet>;

    // Provided methods
    fn metadata(&self) -> &[(String, String)] { ... }
    fn duration_micros(&self) -> Option<i64> { ... }
}
Expand description

A producer of already-demuxed Packets.

Used by transport-layer protocols that perform demux themselves (RTMP, RTSP, …). The pipeline executor consumes packets directly, skipping the container-demux stage that bytes-shape sources go through.

Required Methods§

Source

fn streams(&self) -> &[StreamInfo]

Streams advertised by this source. Stable across the lifetime of the source.

Source

fn next_packet(&mut self) -> Result<Packet>

Read the next packet from any stream. Returns Error::Eof at end of stream.

Provided Methods§

Source

fn metadata(&self) -> &[(String, String)]

Source-level metadata as ordered (key, value) pairs. Default is empty.

Source

fn duration_micros(&self) -> Option<i64>

Source-level duration in microseconds, if known. Default is None. Live sources (RTMP push, etc.) typically return None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§