Skip to main content

ffmpeg_next/software/resampling/
filter.rs

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