Skip to main content

wedeo_codec/
descriptor.rs

1use bitflags::bitflags;
2
3use wedeo_core::{CodecId, MediaType};
4
5bitflags! {
6    /// Codec capabilities, matching FFmpeg's AV_CODEC_CAP_*.
7    #[derive(Debug, Clone, Copy, PartialEq, Eq)]
8    pub struct CodecCapabilities: u32 {
9        const DRAW_HORIZ_BAND     = 1 << 0;
10        const DR1                 = 1 << 1;
11        const DELAY               = 1 << 5;
12        const SMALL_LAST_FRAME    = 1 << 6;
13        const SUBFRAMES           = 1 << 8;
14        const EXPERIMENTAL        = 1 << 9;
15        const CHANNEL_CONF        = 1 << 10;
16        const FRAME_THREADS       = 1 << 12;
17        const SLICE_THREADS       = 1 << 13;
18        const PARAM_CHANGE        = 1 << 14;
19        const OTHER_THREADS       = 1 << 15;
20        const VARIABLE_FRAME_SIZE = 1 << 16;
21        const AVOID_PROBING       = 1 << 17;
22        const HARDWARE            = 1 << 18;
23        const HYBRID              = 1 << 19;
24        const ENCODER_REORDERED_OPAQUE = 1 << 20;
25        const ENCODER_FLUSH       = 1 << 21;
26        const ENCODER_RECON_FRAME = 1 << 22;
27    }
28}
29
30bitflags! {
31    /// Codec properties, matching FFmpeg's AV_CODEC_PROP_*.
32    #[derive(Debug, Clone, Copy, PartialEq, Eq)]
33    pub struct CodecProperties: u32 {
34        const INTRA_ONLY  = 1 << 0;
35        const LOSSY       = 1 << 1;
36        const LOSSLESS    = 1 << 2;
37        const REORDER     = 1 << 3;
38        const FIELDS      = 1 << 4;
39        const BITMAP_SUB  = 1 << 16;
40        const TEXT_SUB    = 1 << 17;
41    }
42}
43
44/// Profile descriptor.
45#[derive(Debug, Clone)]
46pub struct Profile {
47    pub id: i32,
48    pub name: &'static str,
49}
50
51/// Codec descriptor, matching FFmpeg's AVCodecDescriptor.
52#[derive(Debug, Clone)]
53pub struct CodecDescriptor {
54    pub id: CodecId,
55    pub media_type: MediaType,
56    pub name: &'static str,
57    pub long_name: &'static str,
58    pub properties: CodecProperties,
59    pub profiles: &'static [Profile],
60}