Skip to main content

mux_media/types/
codec_id.rs

1use crate::ffmpeg::codec::id::Id;
2
3/// A wrapper around [`ffmpeg::codec::id::Id`](Id).
4#[derive(Copy, Clone, Debug)]
5pub struct CodecId(pub Id);
6
7deref_singleton_tuple_struct!(CodecId, Id);
8
9impl Default for CodecId {
10    fn default() -> Self {
11        CodecId(Id::None)
12    }
13}
14
15impl CodecId {
16    pub(crate) fn is_attach(self) -> bool {
17        match self.0 {
18            Id::PNG => true,
19            Id::LJPEG | Id::JPEGLS | Id::JPEG2000 => true,
20            _ => false,
21        }
22    }
23
24    pub(crate) fn is_font(self) -> bool {
25        match self.0 {
26            Id::TTF => true,
27            Id::OTF => true,
28            _ => false,
29        }
30    }
31}