1#[cfg(feature = "audio")]
2use crate::audio::AudioFrameDescriptor;
3use crate::data::DataFrameDescriptor;
4#[cfg(feature = "video")]
5use crate::video::VideoFrameDescriptor;
6
7#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8pub enum MediaType {
9 Audio = 0,
10 Video,
11 Data,
12}
13
14#[derive(Clone, Debug)]
15pub enum FrameDescriptor {
16 #[cfg(feature = "audio")]
17 Audio(AudioFrameDescriptor),
18 #[cfg(feature = "video")]
19 Video(VideoFrameDescriptor),
20 Data(DataFrameDescriptor),
21}
22
23impl FrameDescriptor {
24 pub fn media_type(&self) -> MediaType {
25 match self {
26 #[cfg(feature = "audio")]
27 FrameDescriptor::Audio(_) => MediaType::Audio,
28 #[cfg(feature = "video")]
29 FrameDescriptor::Video(_) => MediaType::Video,
30 FrameDescriptor::Data(_) => MediaType::Data,
31 }
32 }
33
34 #[cfg(feature = "audio")]
35 pub fn is_audio(&self) -> bool {
36 matches!(self, FrameDescriptor::Audio(_))
37 }
38
39 #[cfg(feature = "video")]
40 pub fn is_video(&self) -> bool {
41 matches!(self, FrameDescriptor::Video(_))
42 }
43
44 pub fn is_data(&self) -> bool {
45 matches!(self, FrameDescriptor::Data(_))
46 }
47}
48
49#[deprecated = "Use 'FrameDescriptor' directly"]
50pub type MediaFrameDescriptor = FrameDescriptor;