1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
mod rtp;
pub mod depacketizer;
pub mod packetizer;
pub mod rtcp;
pub mod utils;
#[cfg(feature = "h264")]
pub mod h264;
#[cfg(feature = "pcm")]
pub mod pcm;
use std::fmt::{self, Display, Formatter};
pub use self::{
depacketizer::{Depacketizer, MediaStream},
packetizer::{MediaSink, Packetizer},
rtcp::{CompoundRtcpPacket, RtcpHeader, RtcpPacket, RtcpPacketType},
rtp::{RtpHeader, RtpHeaderExtension, RtpPacket},
};
#[derive(Debug, Copy, Clone)]
pub struct InvalidInput;
impl Display for InvalidInput {
#[inline]
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
f.write_str("invalid input")
}
}
impl std::error::Error for InvalidInput {}
#[derive(Clone)]
pub enum PacketMux {
Rtp(RtpPacket),
Rtcp(CompoundRtcpPacket),
}
impl From<RtpPacket> for PacketMux {
#[inline]
fn from(packet: RtpPacket) -> Self {
Self::Rtp(packet)
}
}
impl From<RtcpPacket> for PacketMux {
#[inline]
fn from(packet: RtcpPacket) -> Self {
Self::Rtcp(packet.into())
}
}
impl From<CompoundRtcpPacket> for PacketMux {
#[inline]
fn from(packet: CompoundRtcpPacket) -> Self {
Self::Rtcp(packet)
}
}