pub struct SampleFormat(/* private fields */);Expand description
Audio sample format identifier.
Implementations§
Source§impl SampleFormat
impl SampleFormat
Sourcepub const fn from_raw(raw: i32) -> Self
pub const fn from_raw(raw: i32) -> Self
Constructs a SampleFormat from the raw integer FFmpeg uses for
AVCodecContext::sample_fmt / AVFrame::format (audio).
Sourcepub const fn is_planar(self) -> bool
pub const fn is_planar(self) -> bool
Returns true if this is a planar (one buffer per channel) format.
Sourcepub const fn bytes_per_sample(self) -> Option<u32>
pub const fn bytes_per_sample(self) -> Option<u32>
Bytes per sample for known formats. None for Self::NONE or
values outside the closed set this newtype enumerates.
Sourcepub const fn to_ffmpeg(self) -> Option<Sample>
pub const fn to_ffmpeg(self) -> Option<Sample>
The ffmpeg_next::format::Sample this identifier names, or
None for Self::NONE and for any integer outside the closed
set above.
The inverse of Self::from_raw, and the direction that has to
exist for this newtype to be usable as input to FFmpeg’s safe
API — swr_alloc_set_opts2 and AVFrame allocation both take the
format, and a raw integer read out of a container cannot be cast
back into the bindgen enum to get there. Matching against
compile-time constants is the way across, exactly as
crate::boundary::from_av_pixel_format comes the other way.
Sourcepub fn from_ffmpeg(value: Sample) -> Self
pub fn from_ffmpeg(value: Sample) -> Self
The identifier for an ffmpeg_next::format::Sample — the safe
direction, since Sample is ffmpeg-next’s own Rust enum and
converting it to AVSampleFormat constructs the bindgen enum from
a known constant rather than from foreign memory.
Trait Implementations§
Source§impl Clone for SampleFormat
impl Clone for SampleFormat
Source§fn clone(&self) -> SampleFormat
fn clone(&self) -> SampleFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more