Skip to main content

AVChannelLayout

Struct AVChannelLayout 

Source
pub struct AVChannelLayout { /* private fields */ }

Implementations§

Source§

impl AVChannelLayout

Source

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

Source

pub fn as_mut_ptr(&mut self) -> *mut AVChannelLayout

Source

pub unsafe fn set_ptr(&mut self, ptr: NonNull<AVChannelLayout>)

§Safety

This function should only be called when the pointer is valid and the data it’s pointing to can be dropped.

Source

pub unsafe fn from_raw(raw: NonNull<AVChannelLayout>) -> Self

§Safety

This function should only be called when the pointer is valid and the data it’s pointing to can be dropped.

Source

pub fn into_raw(self) -> NonNull<AVChannelLayout>

Source§

impl AVChannelLayout

Source

pub unsafe fn new(ch_layout: AVChannelLayout) -> Self

Create a new channel layout from raw

§Safety

The raw channel layout need to be correctly constructed.

Source

pub fn into_inner(self) -> AVChannelLayout

Convert self into ffi::AVChannelLayout`.

Be careful when using it. Since this fucntion leaks the raw type, you have to manually do `ffi::av_channel_layout_uninit``.

Source

pub fn from_mask(mask: u64) -> Option<Self>

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

Source

pub fn from_string(str: &CStr) -> Option<Self>

Initialize a channel layout from a given string description. The input string can be represented by:

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

pub fn from_nb_channels(nb_channels: i32) -> Self

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

Source

pub fn copy(&mut self, src: &Self)

Make a copy of a channel layout. This differs from just assigning src to dst in that it allocates and copies the map for AV_CHANNEL_ORDER_CUSTOM.

Source

pub fn describe(&self) -> Result<CString>

Get a human-readable string describing the channel layout properties. The string will be in the same format that is accepted by AVChannelLayout::from_string, allowing to rebuild the same channel layout, except for opaque pointers.

Source

pub fn channel_from_index(&self, idx: u32) -> Option<AVChannel>

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

Return None if idx is not valid or the channel order is unspecified

Source

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

Get the index of a given channel in a channel layout. In case multiple channels are found, only the first match will be returned.

Return None when channel is not present in channel_layout

Source

pub fn index_from_string(&self, name: &CStr) -> Option<u32>

Get the index in a channel layout of a channel described by the given string. In case multiple channels are found, only the first match will be returned.

Source

pub fn channel_from_string(&self, name: &CStr) -> Option<AVChannel>

Get a channel described by the given string.

Source

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

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

Source

pub fn check(&self) -> bool

Check whether a channel layout is valid, i.e. can possibly describe audio data.

Return true if channel_layout is valid, false otherwise.

Source

pub fn equal(&self, other: &Self) -> Result<bool>

Check whether two channel layouts are semantically the same, i.e. the same channels are present on the same positions in both.

If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the other is not, they are considered to be unequal. If both are AV_CHANNEL_ORDER_UNSPEC, they are considered equal iff the channel counts are the same in both.

Trait Implementations§

Source§

impl Clone for AVChannelLayout

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 Debug for AVChannelLayout

Source§

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

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

impl Deref for AVChannelLayout

Source§

type Target = AVChannelLayout

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Drop for AVChannelLayout

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for AVChannelLayout

Source§

impl UnsafeDerefMut for AVChannelLayout

Source§

unsafe fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value, unsafely. Read more

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.