1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3mod channel;
7mod rtp;
8
9pub mod depacketizer;
10pub mod packetizer;
11pub mod rtcp;
12pub mod transceiver;
13pub mod utils;
14
15#[cfg(feature = "h264")]
16#[cfg_attr(docsrs, doc(cfg(feature = "h264")))]
17pub mod h264;
18
19#[cfg(feature = "opus")]
20#[cfg_attr(docsrs, doc(cfg(feature = "opus")))]
21pub mod opus;
22
23#[cfg(feature = "pcm")]
24#[cfg_attr(docsrs, doc(cfg(feature = "pcm")))]
25pub mod pcm;
26
27use std::fmt::{self, Display, Formatter};
28
29pub use self::{
30 channel::RtpChannel,
31 depacketizer::{Depacketizer, MediaStream},
32 packetizer::{MediaSink, Packetizer},
33 rtcp::{CompoundRtcpPacket, RtcpHeader, RtcpPacket, RtcpPacketType},
34 rtp::{IncomingRtpPacket, OrderedRtpPacket, RtpHeader, RtpHeaderExtension, RtpPacket},
35};
36
37#[derive(Debug)]
39pub struct Error {
40 msg: &'static str,
41}
42
43impl Error {
44 #[inline]
46 const fn from_static_msg(msg: &'static str) -> Self {
47 Self { msg }
48 }
49}
50
51impl Display for Error {
52 #[inline]
53 fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
54 f.write_str(self.msg)
55 }
56}
57
58impl std::error::Error for Error {}
59
60impl From<InvalidInput> for Error {
61 #[inline]
62 fn from(_: InvalidInput) -> Self {
63 Self::from_static_msg("invalid input")
64 }
65}
66
67#[derive(Debug)]
69pub struct InvalidInput(());
70
71impl InvalidInput {
72 #[inline]
74 const fn new() -> Self {
75 Self(())
76 }
77}
78
79impl Display for InvalidInput {
80 #[inline]
81 fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
82 f.write_str("invalid input")
83 }
84}
85
86impl std::error::Error for InvalidInput {}