xref: /xiu/protocol/rtmp/src/session/define.rs (revision 8e71d710)
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: &str = "FMS/3,0,1,123";
13 pub const CAPABILITIES: f64 = 31.0;
14 pub const LEVEL: &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: &str = "warning";
26 pub const RTMP_LEVEL_STATUS: &str = "status";
27 pub const RTMP_LEVEL_ERROR: &str = "error\n";
28 
29 pub enum SessionType {
30     Client,
31     Server,
32 }
33 
34 impl fmt::Display for SessionType {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result35     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
36         let client_type = match self {
37             SessionType::Client => String::from("client"),
38             SessionType::Server => String::from("server"),
39         };
40         write!(f, "{client_type}")
41     }
42 }
43