pub struct AVChannelLayout { /* private fields */ }Implementations§
Source§impl AVChannelLayout
impl AVChannelLayout
pub fn as_ptr(&self) -> *const AVChannelLayout
pub fn as_mut_ptr(&mut self) -> *mut AVChannelLayout
Sourcepub unsafe fn set_ptr(&mut self, ptr: NonNull<AVChannelLayout>)
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.
Sourcepub unsafe fn from_raw(raw: NonNull<AVChannelLayout>) -> Self
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.
pub fn into_raw(self) -> NonNull<AVChannelLayout>
Source§impl AVChannelLayout
impl AVChannelLayout
Sourcepub unsafe fn new(ch_layout: AVChannelLayout) -> Self
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.
Sourcepub fn into_inner(self) -> AVChannelLayout
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``.
Sourcepub fn from_mask(mask: u64) -> Option<Self>
pub fn from_mask(mask: u64) -> Option<Self>
Initialize a native channel layout from a bitmask indicating which channels are present.
Sourcepub fn from_string(str: &CStr) -> Option<Self>
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”)
Sourcepub fn from_nb_channels(nb_channels: i32) -> Self
pub fn from_nb_channels(nb_channels: i32) -> Self
Get the default channel layout for a given number of channels.
Sourcepub fn copy(&mut self, src: &Self)
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.
Sourcepub fn describe(&self) -> Result<CString>
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.
Sourcepub fn channel_from_index(&self, idx: u32) -> Option<AVChannel>
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
Sourcepub fn index_from_channel(&self, channel: AVChannel) -> Option<u32>
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
Sourcepub fn index_from_string(&self, name: &CStr) -> Option<u32>
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.
Sourcepub fn channel_from_string(&self, name: &CStr) -> Option<AVChannel>
pub fn channel_from_string(&self, name: &CStr) -> Option<AVChannel>
Get a channel described by the given string.
Sourcepub fn subset(&self, mask: u64) -> u64
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.
Sourcepub fn check(&self) -> bool
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.
Sourcepub fn equal(&self, other: &Self) -> Result<bool>
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.