1use super::Context;
2use util::format;
3use {decoder, frame, ChannelLayout, Error};
4
5impl 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 dst_format:format,
18 dst_channel_layout:channel_layout,
19 dst_rate:rate,
20 )
21 }
22}
23
24impl 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 dst_format:format,
37 dst_channel_layout:channel_layout,
38 dst_rate:rate,
39 )
40 }
41}
42