scuffle_ffmpeg/enums/av_media_type.rs
1use nutype_enum::nutype_enum;
2
3use crate::ffi::*;
4
5const _: () = {
6 assert!(std::mem::size_of::<AVMediaType>() == std::mem::size_of_val(&AVMEDIA_TYPE_UNKNOWN));
7};
8
9nutype_enum! {
10 /// Represents the different media types supported by FFmpeg.
11 ///
12 /// See FFmpeg's `AVMediaType` in the official documentation:
13 /// <https://ffmpeg.org/doxygen/trunk/group__lavu__misc.html#ga9a84bba4713dfced21a1a56163be1f48>
14 pub enum AVMediaType(i32) {
15 /// Unknown media type. Used when the type cannot be determined.
16 /// Corresponds to `AVMEDIA_TYPE_UNKNOWN`.
17 Unknown = AVMEDIA_TYPE_UNKNOWN as _,
18
19 /// Video media type. Used for visual content such as movies or streams.
20 /// Corresponds to `AVMEDIA_TYPE_VIDEO`.
21 Video = AVMEDIA_TYPE_VIDEO as _,
22
23 /// Audio media type. Represents sound or music data.
24 /// Corresponds to `AVMEDIA_TYPE_AUDIO`.
25 Audio = AVMEDIA_TYPE_AUDIO as _,
26
27 /// Data media type. Typically used for supplementary or non-media data.
28 /// Corresponds to `AVMEDIA_TYPE_DATA`.
29 Data = AVMEDIA_TYPE_DATA as _,
30
31 /// Subtitle media type. Represents textual or graphical subtitles.
32 /// Corresponds to `AVMEDIA_TYPE_SUBTITLE`.
33 Subtitle = AVMEDIA_TYPE_SUBTITLE as _,
34
35 /// Attachment media type. Used for files attached to a media container (e.g., fonts for subtitles).
36 /// Corresponds to `AVMEDIA_TYPE_ATTACHMENT`.
37 Attachment = AVMEDIA_TYPE_ATTACHMENT as _,
38
39 /// Special enumeration value representing the number of media types.
40 /// Not an actual media type.
41 /// Corresponds to `AVMEDIA_TYPE_NB`.
42 Nb = AVMEDIA_TYPE_NB as _,
43 }
44}
45
46impl PartialEq<i32> for AVMediaType {
47 fn eq(&self, other: &i32) -> bool {
48 self.0 == *other
49 }
50}
51
52impl From<u32> for AVMediaType {
53 fn from(value: u32) -> Self {
54 AVMediaType(value as i32)
55 }
56}
57
58impl From<AVMediaType> for u32 {
59 fn from(value: AVMediaType) -> Self {
60 value.0 as u32
61 }
62}