ffmpeg_next/util/
picture.rs

1use ffi::AVPictureType::*;
2use ffi::*;
3
4#[derive(Eq, PartialEq, Clone, Copy, Debug)]
5pub enum Type {
6    None,
7    I,
8    P,
9    B,
10    S,
11    SI,
12    SP,
13    BI,
14}
15
16impl From<AVPictureType> for Type {
17    #[inline(always)]
18    fn from(value: AVPictureType) -> Type {
19        match value {
20            AV_PICTURE_TYPE_NONE => Type::None,
21            AV_PICTURE_TYPE_I => Type::I,
22            AV_PICTURE_TYPE_P => Type::P,
23            AV_PICTURE_TYPE_B => Type::B,
24            AV_PICTURE_TYPE_S => Type::S,
25            AV_PICTURE_TYPE_SI => Type::SI,
26            AV_PICTURE_TYPE_SP => Type::SP,
27            AV_PICTURE_TYPE_BI => Type::BI,
28        }
29    }
30}
31
32impl From<Type> for AVPictureType {
33    #[inline(always)]
34    fn from(value: Type) -> AVPictureType {
35        match value {
36            Type::None => AV_PICTURE_TYPE_NONE,
37            Type::I => AV_PICTURE_TYPE_I,
38            Type::P => AV_PICTURE_TYPE_P,
39            Type::B => AV_PICTURE_TYPE_B,
40            Type::S => AV_PICTURE_TYPE_S,
41            Type::SI => AV_PICTURE_TYPE_SI,
42            Type::SP => AV_PICTURE_TYPE_SP,
43            Type::BI => AV_PICTURE_TYPE_BI,
44        }
45    }
46}