playa_ffmpeg/util/
picture.rs

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