playa_ffmpeg/software/resampling/
filter.rs

1use crate::ffi::{SwrFilterType::*, *};
2
3#[derive(Eq, PartialEq, Copy, Clone, Debug)]
4pub enum Filter {
5    Cubic,
6    BlackmanNuttall,
7    Kaiser,
8}
9
10impl From<SwrFilterType> for Filter {
11    fn from(value: SwrFilterType) -> Filter {
12        match value {
13            SWR_FILTER_TYPE_CUBIC => Filter::Cubic,
14            SWR_FILTER_TYPE_BLACKMAN_NUTTALL => Filter::BlackmanNuttall,
15            SWR_FILTER_TYPE_KAISER => Filter::Kaiser,
16        }
17    }
18}
19
20impl From<Filter> for SwrFilterType {
21    fn from(value: Filter) -> SwrFilterType {
22        match value {
23            Filter::Cubic => SWR_FILTER_TYPE_CUBIC,
24            Filter::BlackmanNuttall => SWR_FILTER_TYPE_BLACKMAN_NUTTALL,
25            Filter::Kaiser => SWR_FILTER_TYPE_KAISER,
26        }
27    }
28}