playa_ffmpeg/software/resampling/
extensions.rs

1use super::Context;
2use crate::{ChannelLayout, Error, decoder, frame, util::format};
3
4impl frame::Audio {
5    #[inline]
6    pub fn resampler(&self, format: format::Sample, channel_layout: ChannelLayout, rate: u32) -> Result<Context, Error> {
7        Context::get(self.format(), self.channel_layout(), unsafe { (*self.as_ptr()).sample_rate as u32 }, format, channel_layout, rate)
8    }
9}
10
11impl decoder::Audio {
12    #[inline]
13    pub fn resampler(&self, format: format::Sample, channel_layout: ChannelLayout, rate: u32) -> Result<Context, Error> {
14        Context::get(self.format(), self.channel_layout(), self.rate(), format, channel_layout, rate)
15    }
16}