pub struct Multitrack {
pub multitrack_type: u8,
pub tracks: Vec<MultitrackTrack>,
}Expand description
Decoded Multitrack body of an Enhanced RTMP v2 video or audio message
(enhanced-rtmp-v2.pdf §“ExVideoTagBody” / §“ExAudioTagBody”). The decoded
view sits in VideoTag::multitrack / AudioTag::multitrack; when
present, the tag’s VideoTag::ex_packet_type /
AudioTag::ex_packet_type holds the real (inner) PacketType the
tracks carry (e.g. CodedFrames, SequenceStart), and the tag’s
VideoTag::fourcc / AudioTag::audio_fourcc holds the shared FourCC
when multitrack_type is OneTrack or
ManyTracks. For ManyTracksManyCodecs the outer FourCC is None
(each track carries its own).
The VideoTag::body / AudioTag::body field is unused for
multitrack tags — track payloads live inside
MultitrackTrack::body.
Fields§
§multitrack_type: u8AvMultitrackType discriminator (one of AV_MULTITRACK_TYPE_*).
Reserved values (3..=15) round-trip verbatim — the parser does not
reject them, so a forwarding ingest preserves unknown future modes.
tracks: Vec<MultitrackTrack>Decoded per-track entries in stream order. Always at least 1 entry after a successful parse.
Implementations§
Source§impl Multitrack
impl Multitrack
Sourcepub fn parse(body: &[u8], multitrack_type: u8) -> Result<Multitrack>
pub fn parse(body: &[u8], multitrack_type: u8) -> Result<Multitrack>
Parse the multitrack track-list bytes (everything in
VideoTag::body / AudioTag::body after parse_video /
parse_audio stripped the per-tag header) given the outer
multitrack_type. Returns Err(Error::Other) on truncation or on
a track whose sizeOfTrack UI24 overruns the buffer.
OneTrack mode produces exactly one track whose body runs to the
end of the buffer. ManyTracks and ManyTracksManyCodecs modes
loop while bytes remain, consuming a UI24 sizeOfTrack per track.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Serialise to the byte layout parse consumes. Output goes into the
tag’s VideoTag::body / AudioTag::body slot when building an
outgoing multitrack message.
For OneTrack mode only the first track’s track_id + body are
emitted (the second-and-beyond tracks are silently ignored — the
caller is responsible for using ManyTracks if it has more than
one). For ManyTracksManyCodecs each track’s fourcc MUST be
Some(..); a None is encoded as four zero bytes to keep the
output decodable but the caller should treat that as a bug.
Trait Implementations§
Source§impl Clone for Multitrack
impl Clone for Multitrack
Source§fn clone(&self) -> Multitrack
fn clone(&self) -> Multitrack
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Multitrack
impl Debug for Multitrack
impl Eq for Multitrack
Source§impl PartialEq for Multitrack
impl PartialEq for Multitrack
Source§fn eq(&self, other: &Multitrack) -> bool
fn eq(&self, other: &Multitrack) -> bool
self and other values to be equal, and is used by ==.