1 use std::fmt; 2 3 pub const WINDOW_ACKNOWLEDGEMENT_SIZE: u32 = 4096; 4 pub const PEER_BANDWIDTH: u32 = 4096; 5 6 pub mod peer_bandwidth_limit_type { 7 pub const HARD: u8 = 0; 8 pub const SOFT: u8 = 1; 9 pub const DYNAMIC: u8 = 2; 10 } 11 12 pub const FMSVER: &'static str = "FMS/3,0,1,123"; 13 pub const CAPABILITIES: f64 = 31.0; 14 pub const LEVEL: &'static str = "status"; 15 16 pub const OBJENCODING_AMF0: f64 = 0.0; 17 pub const OBJENCODING_AMF3: f64 = 3.0; 18 19 pub const STREAM_ID: f64 = 1.0; 20 21 pub const TRANSACTION_ID_CONNECT: u8 = 1; 22 pub const TRANSACTION_ID_CREATE_STREAM: u8 = 2; 23 24 //pub mod 25 pub const RTMP_LEVEL_WARNING: &'static str = "warning"; 26 pub const RTMP_LEVEL_STATUS: &'static str = "status"; 27 pub const RTMP_LEVEL_ERROR: &'static str = "error\n"; 28 //session subscribe type 29 #[derive(Debug)] 30 pub enum SessionSubType { 31 Player, 32 Publisher, 33 } 34 35 pub enum SessionType { 36 Client, 37 Server, 38 } 39 40 impl fmt::Display for SessionType { 41 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 42 let client_type: String; 43 44 match self { 45 SessionType::Client => { 46 client_type = String::from("client"); 47 } 48 SessionType::Server => { 49 client_type = String::from("server"); 50 } 51 } 52 write!(f, "{}", client_type) 53 } 54 } 55