pub const SPEEX_NB_MIN_BITRATE: i32 = 2150;
pub const SPEEX_NB_MAX_BITRATE: i32 = 24600;
pub const SPEEX_WB_MIN_BITRATE: i32 = 3950;
pub const SPEEX_WB_MAX_BITRATE: i32 = 42200;
pub const SPEEX_UWB_MIN_BITRATE: i32 = 4150;
pub const SPEEX_UWB_MAX_BITRATE: i32 = 44000;
pub const OPUS_MIN_BITRATE: i32 = 6000;
pub const OPUS_MAX_BITRATE: i32 = 510000;
pub const OPUS_MIN_FRAMESIZE: i32 = 2;
pub const OPUS_MAX_FRAMESIZE: i32 = 60;
pub const WEBRTC_GAIN_MAX: f32 = 49.9;
pub const MOUSE_LEFT: u32 = 0x1000;
pub const MOUSE_RIGHT: u32 = 0x1001;
pub const MOUSE_MIDDLE: u32 = 0x1002;
pub const TT_STRLEN: usize = 512;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct Subscriptions(pub(crate) u32);
impl Subscriptions {
pub const NONE: u32 = 0x00000000;
pub const USER_MSG: u32 = 0x00000001;
pub const CHANNEL_MSG: u32 = 0x00000002;
pub const BROADCAST_MSG: u32 = 0x00000004;
pub const CUSTOM_MSG: u32 = 0x00000008;
pub const VOICE: u32 = 0x00000010;
pub const VIDEOCAPTURE: u32 = 0x00000020;
pub const DESKTOP: u32 = 0x00000040;
pub const DESKTOPINPUT: u32 = 0x00000080;
pub const MEDIAFILE: u32 = 0x00000100;
pub const INTERCEPT_USER_MSG: u32 = 0x00010000;
pub const INTERCEPT_CHANNEL_MSG: u32 = 0x00020000;
pub const INTERCEPT_CUSTOM_MSG: u32 = 0x00080000;
pub const INTERCEPT_VOICE: u32 = 0x00100000;
pub const INTERCEPT_VIDEOCAPTURE: u32 = 0x00200000;
pub const INTERCEPT_DESKTOP: u32 = 0x00400000;
pub const INTERCEPT_MEDIAFILE: u32 = 0x01000000;
pub const ALL: u32 = 0xFFFFFFFF;
pub fn new() -> Self {
Self(Self::NONE)
}
pub fn all() -> Self {
Self(Self::ALL)
}
pub fn all_audio() -> Self {
Self(Self::VOICE | Self::MEDIAFILE)
}
pub fn all_text() -> Self {
Self(Self::USER_MSG | Self::CHANNEL_MSG | Self::BROADCAST_MSG | Self::CUSTOM_MSG)
}
pub fn all_control() -> Self {
Self(Self::DESKTOP | Self::DESKTOPINPUT)
}
pub fn from_raw(raw: u32) -> Self {
Self(raw)
}
pub fn add(&mut self, flag: u32) {
self.0 |= flag;
}
pub fn remove(&mut self, flag: u32) {
self.0 &= !flag;
}
pub fn has(&self, flag: u32) -> bool {
(self.0 & flag) != 0
}
pub fn raw(&self) -> u32 {
self.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct UserState(pub(crate) u32);
impl UserState {
pub const NONE: u32 = 0x00000000;
pub const VOICE: u32 = 0x00000001;
pub const MUTE_VOICE: u32 = 0x00000002;
pub const MUTE_MEDIAFILE: u32 = 0x00000004;
pub const DESKTOP: u32 = 0x00000008;
pub const VIDEOCAPTURE: u32 = 0x00000010;
pub const MEDIAFILE_AUDIO: u32 = 0x00000020;
pub const MEDIAFILE_VIDEO: u32 = 0x00000040;
pub fn from_raw(raw: u32) -> Self {
Self(raw)
}
pub fn is_talking(&self) -> bool {
(self.0 & Self::VOICE) != 0
}
pub fn is_muted(&self) -> bool {
(self.0 & Self::MUTE_VOICE) != 0
}
pub fn has_video(&self) -> bool {
(self.0 & Self::VIDEOCAPTURE) != 0
}
pub fn raw(&self) -> u32 {
self.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct ChannelType(pub(crate) u32);
impl ChannelType {
pub const DEFAULT: u32 = 0x0000;
pub const PERMANENT: u32 = 0x0001;
pub const SOLO_TRANSMIT: u32 = 0x0002;
pub const CLASSROOM: u32 = 0x0004;
pub const OPERATOR_RECVONLY: u32 = 0x0008;
pub const NO_VOICEACTIVATION: u32 = 0x0010;
pub const NO_RECORDING: u32 = 0x0020;
pub const HIDDEN: u32 = 0x0040;
pub fn from_raw(raw: u32) -> Self {
Self(raw)
}
pub fn raw(&self) -> u32 {
self.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum UserPresence {
#[default]
Available,
Away,
Question,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum UserGender {
Male,
Female,
#[default]
Neutral,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct UserStatus {
pub presence: UserPresence,
pub gender: UserGender,
pub video: bool,
pub desktop: bool,
pub streaming: bool,
pub media_paused: bool,
}
impl UserStatus {
pub fn from_bits(bits: u32) -> Self {
let presence = match bits & 0xFF {
1 => UserPresence::Away,
2 => UserPresence::Question,
_ => UserPresence::Available,
};
let gender = if (bits & 0x1000) != 0 {
UserGender::Neutral
} else if (bits & 0x100) != 0 {
UserGender::Female
} else {
UserGender::Male
};
Self {
presence,
gender,
video: (bits & 0x200) != 0,
desktop: (bits & 0x400) != 0,
streaming: (bits & 0x800) != 0,
media_paused: (bits & 0x2000) != 0,
}
}
pub fn to_bits(&self) -> u32 {
let mut bits = match self.presence {
UserPresence::Available => 0,
UserPresence::Away => 1,
UserPresence::Question => 2,
};
match self.gender {
UserGender::Male => {}
UserGender::Female => bits |= 0x100,
UserGender::Neutral => bits |= 0x1000,
}
if self.video {
bits |= 0x200;
}
if self.desktop {
bits |= 0x400;
}
if self.streaming {
bits |= 0x800;
}
if self.media_paused {
bits |= 0x2000;
}
bits
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct UserRights(pub(crate) u32);
impl UserRights {
pub const NONE: Self = Self(0x00000000);
pub const MULTI_LOGIN: Self = Self(0x00000001);
pub const VIEW_ALL_USERS: Self = Self(0x00000002);
pub const CREATE_TEMPORARY_CHANNEL: Self = Self(0x00000004);
pub const MODIFY_CHANNELS: Self = Self(0x00000008);
pub const TEXTMESSAGE_BROADCAST: Self = Self(0x00000010);
pub const KICK_USERS: Self = Self(0x00000020);
pub const BAN_USERS: Self = Self(0x00000040);
pub const MOVE_USERS: Self = Self(0x00000080);
pub const OPERATOR_ENABLE: Self = Self(0x00000100);
pub const UPLOAD_FILES: Self = Self(0x00000200);
pub const DOWNLOAD_FILES: Self = Self(0x00000400);
pub const UPDATE_SERVERPROPERTIES: Self = Self(0x00000800);
pub const TRANSMIT_VOICE: Self = Self(0x00001000);
pub const TRANSMIT_VIDEOCAPTURE: Self = Self(0x00002000);
pub const TRANSMIT_DESKTOP: Self = Self(0x00004000);
pub const TRANSMIT_DESKTOPINPUT: Self = Self(0x00008000);
pub const TRANSMIT_MEDIAFILE_AUDIO: Self = Self(0x00010000);
pub const TRANSMIT_MEDIAFILE_VIDEO: Self = Self(0x00020000);
pub const TRANSMIT_MEDIAFILE: Self = Self(0x00010000 | 0x00020000);
pub const LOCKED_NICKNAME: Self = Self(0x00040000);
pub const LOCKED_STATUS: Self = Self(0x00080000);
pub const RECORD_VOICE: Self = Self(0x00100000);
pub const VIEW_HIDDEN_CHANNELS: Self = Self(0x00200000);
pub const TEXTMESSAGE_USER: Self = Self(0x00400000);
pub const TEXTMESSAGE_CHANNEL: Self = Self(0x00800000);
pub fn from_raw(raw: u32) -> Self {
Self(raw)
}
pub fn raw(self) -> u32 {
self.0
}
pub fn has_any(self, rights: Self) -> bool {
(self.0 & rights.0) != 0
}
pub fn has_all(self, rights: Self) -> bool {
(self.0 & rights.0) == rights.0
}
}
impl std::ops::BitOr for UserRights {
type Output = Self;
fn bitor(self, rhs: Self) -> Self::Output {
Self(self.0 | rhs.0)
}
}
impl std::ops::BitOrAssign for UserRights {
fn bitor_assign(&mut self, rhs: Self) {
self.0 |= rhs.0;
}
}