Skip to main content

SpeakerLayout

Struct SpeakerLayout 

Source
pub struct SpeakerLayout { /* private fields */ }
Expand description

The speakers an AudioBlock’s planes feed, in plane order: 1 to MAX_AUDIO_CHANNELS of them.

A provider reports the layout its source declares (a WAVE channel mask, a QuickTime chan box, a codec’s channel configuration), in the order its planes arrive; neither binding rematrixes a source into another layout. A source that declares none, or only channels no speaker names, has SpeakerLayout::default_for its channel count.

Implementations§

Source§

impl SpeakerLayout

Source

pub const MONO: Self

One front-center plane: a mono source, and a mono project’s mix.

Source

pub const STEREO: Self

Front left and right: a stereo source, and a stereo project’s mix.

Source

pub fn new(speakers: &[Speaker]) -> Option<Self>

The layout of these speakers in this plane order, or None for none or more than MAX_AUDIO_CHANNELS.

Source

pub fn default_for(channels: usize) -> Option<Self>

The layout a source of channels planes that declares none has: FFmpeg’s default for the count (av_channel_layout_default), in the WAVE order. Mono, stereo, 2.1, 4.0, 5.0, 5.1, 6.1 and 7.1 up to 8; 5.1.4, 7.1.4, 9.1.4, 9.1.6 and 22.2 for 10, 12, 14, 16 and 24. A count FFmpeg names no layout for is a 7.1 with its further channels unnamed. None for no channels or more than MAX_AUDIO_CHANNELS.

Source

pub fn declared_or_default(speakers: &[Speaker]) -> Option<(Self, bool)>

The layout a source declares, or SpeakerLayout::default_for its channel count when it names no speaker at all. The flag says the default was assumed.

Source

pub fn speakers(&self) -> &[Speaker]

The speakers, in plane order.

Source

pub fn channels(&self) -> usize

How many planes the layout has.

Source

pub fn describe(&self) -> String

The speakers’ FFmpeg names, joined by + (FL+FR+FC), as av_channel_layout_from_string reads them.

Trait Implementations§

Source§

impl Clone for SpeakerLayout

Source§

fn clone(&self) -> Self

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 Copy for SpeakerLayout

Source§

impl Debug for SpeakerLayout

Source§

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

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

impl Eq for SpeakerLayout

Source§

impl Hash for SpeakerLayout

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SpeakerLayout

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SpeakerLayout

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.