scuffle_ffmpeg/enums/
av_media_type.rs

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