use ffmpeg_next as ffmpeg;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct AudioFormat {
pub sample_format: ffmpeg::format::Sample,
pub sample_rate: u32,
pub channels: u16,
}
impl AudioFormat {
pub fn new(sample_format: ffmpeg::format::Sample, sample_rate: u32, channels: u16) -> Self {
Self {
sample_format,
sample_rate,
channels,
}
}
pub fn channels(self) -> u16 {
self.channels
}
pub fn channel_layout(self) -> ffmpeg::ChannelLayout {
ffmpeg::ChannelLayout::default(i32::from(self.channels))
}
}