| 1 | use super::Context; |
| 2 | use util::format; |
| 3 | use {decoder, frame, ChannelLayout, Error}; |
| 4 | |
| 5 | impl frame::Audio { |
| 6 | #[inline ] |
| 7 | pub fn resampler( |
| 8 | &self, |
| 9 | format: format::Sample, |
| 10 | channel_layout: ChannelLayout, |
| 11 | rate: u32, |
| 12 | ) -> Result<Context, Error> { |
| 13 | Context::get( |
| 14 | self.format(), |
| 15 | self.channel_layout(), |
| 16 | src_rate:unsafe { (*self.as_ptr()).sample_rate as u32 }, |
| 17 | format, |
| 18 | channel_layout, |
| 19 | rate, |
| 20 | ) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | impl decoder::Audio { |
| 25 | #[inline ] |
| 26 | pub fn resampler( |
| 27 | &self, |
| 28 | format: format::Sample, |
| 29 | channel_layout: ChannelLayout, |
| 30 | rate: u32, |
| 31 | ) -> Result<Context, Error> { |
| 32 | Context::get( |
| 33 | self.format(), |
| 34 | self.channel_layout(), |
| 35 | self.rate(), |
| 36 | format, |
| 37 | channel_layout, |
| 38 | rate, |
| 39 | ) |
| 40 | } |
| 41 | } |
| 42 | |