Struct ChannelLayout

Source
pub struct ChannelLayout<'a>(/* private fields */);

Implementations§

Source§

impl<'a> ChannelLayout<'a>

Source

pub fn unspecified(channels: u32) -> Self

Get a new channel layout with an unspecified channel ordering.

Source

pub fn custom(channels: Vec<ChannelCustom>) -> Self

Source

pub fn default_for_channels(channels: u32) -> Self

Get the default channel layout for a given number of channels.

If no default layout exists for the given number of channels, an unspecified layout will be returned.

Source

pub fn standard_layouts() -> ChannelLayoutIter

Get an iterator over all standard channel layouts.

Source

pub fn from_mask(layout_mask: ChannelLayoutMask) -> Option<Self>

Initialize a native channel layout from a bitmask indicating which channels are present.

This will return None for invalid bitmask values.

Source

pub fn from_string<S: AsRef<str>>(description: S) -> Option<Self>

Initialize a channel layout from a given string description.

This can be

  • the formal channel layout name (as returned by description),
  • one or more channel names concatenated with “+”, each optionally containing a custom name after an “@”, e.g. “FL@Left+FR@Right+LFE”,
  • a decimal or hexadecimal value of a native channel layout (e.g. “4” or “0x4”),
  • the number of channels with the default layout (e.g. “4c”),
  • the number of unordered channels (e.g. “4C” or “4 channels”) or
  • the ambisonic order followed by optional non-diegetic channels (e.g. “ambisonic 2+stereo”)
Source

pub fn order(&self) -> ChannelOrder

The ChannelOrder used in this layout.

Source

pub fn channels(&self) -> u32

The number of channels in this layout.

Source

pub fn mask(&self) -> Option<ChannelLayoutMask>

If order is Native: A ChannelLayoutMask containing the channels of this layout.

If order is Ambisonic: A ChannelLayoutMask containing the non-diegetic channels of this layout.

Otherwise: None.

Source

pub fn map(&self) -> Option<&[ChannelCustom]>

Returns the custom channel map for this layout.

None if order is not Custom.

Source

pub fn into_owned(self) -> AVChannelLayout

Extracts the owned AVChannelLayout.

Clones it if not already owned.

Source

pub fn as_ptr(&self) -> *const AVChannelLayout

Exposes a pointer to the contained AVChannelLayout for FFI purposes.

This is guaranteed to be a non-null pointer.

Source

pub fn description(&self) -> String

Get a human-readable String describing the channel layout properties.

The returned string will be in the same format that is accepted by from_string, allowing to rebuild the same channel layout (excluding opaque pointers).

Source

pub fn channel_from_index(&self, idx: u32) -> Channel

Get the channel with the given index in a channel layout.

Returns Channel::None when the index is invalid or the channel order is unspecified.

Source

pub fn index_from_channel(&self, channel: Channel) -> Option<u32>

Get the index of a given channel in a channel layout.

Source

pub fn index_from_string<S: AsRef<str>>(&self, name: S) -> Option<u32>

Get the index in a channel layout of a channel described by the given string.

Returns the first match. Accepts channel names in the same format as from_string.

Source

pub fn channel_from_string<S: AsRef<str>>(&self, name: S) -> Channel

Get a channel described by the given string.

Accepts channel names in the same format as from_string.

Returns Channel::None when the string is invalid or the channel order is unspecified.

Source

pub fn subset(&self, mask: ChannelLayoutMask) -> ChannelLayoutMask

Find out what channels from a given set are present in this layout, without regard for their positions.

Source

pub fn is_valid(&self) -> bool

Check whether this layout is valid (i.e. can describe audio data).

Source§

impl<'a> ChannelLayout<'a>

Source

pub const MONO: ChannelLayout<'static>

Source

pub const STEREO: ChannelLayout<'static>

Source

pub const _2POINT1: ChannelLayout<'static>

Source

pub const _2_1: ChannelLayout<'static>

Source

pub const SURROUND: ChannelLayout<'static>

Source

pub const _3POINT1: ChannelLayout<'static>

Source

pub const _4POINT0: ChannelLayout<'static>

Source

pub const _4POINT1: ChannelLayout<'static>

Source

pub const _2_2: ChannelLayout<'static>

Source

pub const QUAD: ChannelLayout<'static>

Source

pub const _5POINT0: ChannelLayout<'static>

Source

pub const _5POINT1: ChannelLayout<'static>

Source

pub const _5POINT0_BACK: ChannelLayout<'static>

Source

pub const _5POINT1_BACK: ChannelLayout<'static>

Source

pub const _6POINT0: ChannelLayout<'static>

Source

pub const _6POINT0_FRONT: ChannelLayout<'static>

Source

pub const _3POINT1POINT2: ChannelLayout<'static>

Source

pub const HEXAGONAL: ChannelLayout<'static>

Source

pub const _6POINT1: ChannelLayout<'static>

Source

pub const _6POINT1_BACK: ChannelLayout<'static>

Source

pub const _6POINT1_FRONT: ChannelLayout<'static>

Source

pub const _7POINT0: ChannelLayout<'static>

Source

pub const _7POINT0_FRONT: ChannelLayout<'static>

Source

pub const _7POINT1: ChannelLayout<'static>

Source

pub const _7POINT1_WIDE: ChannelLayout<'static>

Source

pub const _7POINT1_WIDE_BACK: ChannelLayout<'static>

Source

pub const _5POINT1POINT2_BACK: ChannelLayout<'static>

Source

pub const OCTAGONAL: ChannelLayout<'static>

Source

pub const CUBE: ChannelLayout<'static>

Source

pub const _5POINT1POINT4_BACK: ChannelLayout<'static>

Source

pub const _7POINT1POINT2: ChannelLayout<'static>

Source

pub const _7POINT1POINT4_BACK: ChannelLayout<'static>

Source

pub const HEXADECAGONAL: ChannelLayout<'static>

Source

pub const STEREO_DOWNMIX: ChannelLayout<'static>

Source

pub const _22POINT2: ChannelLayout<'static>

Trait Implementations§

Source§

impl<'a> Borrow<AVChannelLayout> for ChannelLayout<'a>

Source§

fn borrow(&self) -> &AVChannelLayout

Immutably borrows from an owned value. Read more
Source§

impl<'a> Clone for ChannelLayout<'a>

Source§

fn clone(&self) -> ChannelLayout<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ChannelLayout<'a>

Source§

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

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

impl<'a> From<&'a AVChannelLayout> for ChannelLayout<'a>

Source§

fn from(value: &'a AVChannelLayout) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<AVChannelLayout> for ChannelLayout<'a>

Source§

fn from(value: AVChannelLayout) -> Self

Converts to this type from the input type.
Source§

impl<'a> PartialEq for ChannelLayout<'a>

Source§

fn eq(&self, other: &ChannelLayout<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<'a> StructuralPartialEq for ChannelLayout<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ChannelLayout<'a>

§

impl<'a> RefUnwindSafe for ChannelLayout<'a>

§

impl<'a> !Send for ChannelLayout<'a>

§

impl<'a> !Sync for ChannelLayout<'a>

§

impl<'a> Unpin for ChannelLayout<'a>

§

impl<'a> UnwindSafe for ChannelLayout<'a>

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.