Skip to main content

MultichannelConfig

Struct MultichannelConfig 

Source
pub struct MultichannelConfig {
    pub order: MultichannelConfigOrder,
    pub channel_count: u8,
    pub extra: Vec<u8>,
}
Expand description

Decoded body of an Enhanced RTMP v2 AudioPacketType.MultichannelConfig message (enhanced-rtmp-v2.pdf §“ExAudioTagBody”). The body sits in AudioTag::body verbatim on parse; callers can lift it into this strongly-typed view via MultichannelConfig::parse and round-trip back through MultichannelConfig::encode / [AudioTag::with_multichannel_config].

Per spec the body length depends on audio_channel_order:

  • Unspecified (0): 2 bytes (order, channel_count).
  • Native (1): 6 bytes (order, channel_count, UI32 flags).
  • Custom (2): 2 + channel_count bytes (mapping is a UI8 per channel).

Any UI8 audio_channel_order value that is not one of those three surfaces as MultichannelConfigOrder::Reserved — the parser does not invent a layout, and the build path will encode just the (order, channel_count) prefix, leaving any trailing bytes to the caller via MultichannelConfig::extra.

Fields§

§order: MultichannelConfigOrder

The full discriminator union from the spec table. See MultichannelConfigOrder for the shape per variant.

§channel_count: u8

Number of channels in the multichannel stream. UI8 on the wire, so values 0..=255 are representable.

§extra: Vec<u8>

Trailing bytes preserved verbatim when [order] is MultichannelConfigOrder::Reserved (forward-compat with future spec additions). Empty for the three recognised orders.

Implementations§

Source§

impl MultichannelConfig

Source

pub fn parse(body: &[u8]) -> Result<MultichannelConfig>

Parse the body bytes of an AudioPacketType.MultichannelConfig audio message (the bytes that sit in AudioTag::body after a successful parse_audio call). Returns Err(Error::Other) on truncation; an unrecognised audioChannelOrder does NOT trigger an error — it is preserved as MultichannelConfigOrder::Reserved and any trailing bytes flow through MultichannelConfig::extra.

Source

pub fn encode(&self) -> Vec<u8>

Serialise to the byte layout parse consumes. The output is what AudioTag::body needs to hold when constructing an outgoing MultichannelConfig message.

Trait Implementations§

Source§

impl Clone for MultichannelConfig

Source§

fn clone(&self) -> MultichannelConfig

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 MultichannelConfig

Source§

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

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

impl Eq for MultichannelConfig

Source§

impl PartialEq for MultichannelConfig

Source§

fn eq(&self, other: &MultichannelConfig) -> 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 MultichannelConfig

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.