Skip to main content

Multitrack

Struct Multitrack 

Source
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: u8

AvMultitrackType 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

Source

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.

Source

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

Source§

fn clone(&self) -> Multitrack

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Multitrack

Source§

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

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

impl Eq for Multitrack

Source§

impl PartialEq for Multitrack

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for Multitrack

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> 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.