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§
Sourcefn streams(&self) -> &[StreamInfo]
fn streams(&self) -> &[StreamInfo]
Streams advertised by this source. Stable across the lifetime of the source.
Sourcefn next_packet(&mut self) -> Result<Packet>
fn next_packet(&mut self) -> Result<Packet>
Read the next packet from any stream. Returns Error::Eof at
end of stream.
Provided Methods§
Sourcefn metadata(&self) -> &[(String, String)]
fn metadata(&self) -> &[(String, String)]
Source-level metadata as ordered (key, value) pairs. Default is empty.
Sourcefn duration_micros(&self) -> Option<i64>
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".