polypaging/
rtpcodec.rs

1use crate::consts::*;
2use clap::ValueEnum;
3
4/// Paging supports two codecs, select the one you are using
5#[derive(Copy, Clone, Debug, ValueEnum)]
6pub enum CodecFlag {
7    /// G711µ
8    G711u,
9
10    /// G722
11    G722,
12}
13
14impl CodecFlag {
15    pub fn to_u8(&self) -> u8 {
16        match self {
17            CodecFlag::G711u => G711U,
18            CodecFlag::G722 => G722,
19        }
20    }
21}
22
23impl std::fmt::Display for CodecFlag {
24    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
25        match self {
26            CodecFlag::G711u => write!(f, "G711µ [0x00]"),
27            CodecFlag::G722 => write!(f, "G722  [0x09]"),
28        }
29    }
30}