1 use lazy_static::lazy_static; 2 use std::collections::HashMap; 3 4 #[derive(Debug, Clone, Default, Hash, Eq, PartialEq)] 5 pub enum RtspCodecId { 6 #[default] 7 H264, 8 H265, 9 AAC, 10 G711A, 11 } 12 13 lazy_static! { 14 pub static ref RTSP_CODEC_ID_2_NAME: HashMap<RtspCodecId, &'static str> = { 15 let mut m = HashMap::new(); 16 m.insert(RtspCodecId::H264, "h264"); 17 m.insert(RtspCodecId::H265, "h265"); 18 m.insert(RtspCodecId::AAC, "mpeg4-generic"); 19 m.insert(RtspCodecId::G711A, "pcma"); 20 m 21 }; 22 pub static ref RTSP_CODEC_NAME_2_ID: HashMap<&'static str, RtspCodecId> = { 23 let mut m = HashMap::new(); 24 m.insert("h264", RtspCodecId::H264); 25 m.insert("h265", RtspCodecId::H265); 26 m.insert("mpeg4-generic", RtspCodecId::AAC); 27 m.insert("pcma", RtspCodecId::G711A); 28 m 29 }; 30 } 31 #[derive(Debug, Clone, Default)] 32 pub struct RtspCodecInfo { 33 pub codec_id: RtspCodecId, 34 pub payload_type: u8, 35 pub sample_rate: u32, 36 pub channel_count: u8, 37 } 38