Files
ffmpeg-the-third/src/util/media.rs
Tadas Barzdžius 0bcd4550b8 *: format code with rustfmt and fix clippy suggestions
* Add avformat_close_input call to clean up AVFormantContext
* Format code with rustfmt
* Fix clippy lint double_parens
* Fix clippy lint deref_addrof
* Fix clippy lint identity_conversion
* Fix clippy lint match_ref_pats
* Fix clippy lint cast_lossless
* Fix clippy lint cmp_null
* Fix clippy lint clone_on_ref_ptr
* Fix clippy lint map_clone
* Fix clippy lint needless_borrow
* Fix clippy lint needless_pass_by_value
* Fix clippy lints for examples
* Fix clippy lint unused_io_amount
* Fix clippy lint new_without_default
* Ignore inline_always clippy lint
* Add vim temp files to .gitignore
2018-04-10 16:06:42 +02:00

42 lines
1.1 KiB
Rust

use ffi::AVMediaType::*;
use ffi::*;
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
pub enum Type {
Unknown,
Video,
Audio,
Data,
Subtitle,
Attachment,
}
impl From<AVMediaType> for Type {
#[inline(always)]
fn from(value: AVMediaType) -> Self {
match value {
AVMEDIA_TYPE_UNKNOWN => Type::Unknown,
AVMEDIA_TYPE_VIDEO => Type::Video,
AVMEDIA_TYPE_AUDIO => Type::Audio,
AVMEDIA_TYPE_DATA => Type::Data,
AVMEDIA_TYPE_SUBTITLE => Type::Subtitle,
AVMEDIA_TYPE_ATTACHMENT => Type::Attachment,
AVMEDIA_TYPE_NB => Type::Unknown,
}
}
}
impl Into<AVMediaType> for Type {
#[inline(always)]
fn into(self) -> AVMediaType {
match self {
Type::Unknown => AVMEDIA_TYPE_UNKNOWN,
Type::Video => AVMEDIA_TYPE_VIDEO,
Type::Audio => AVMEDIA_TYPE_AUDIO,
Type::Data => AVMEDIA_TYPE_DATA,
Type::Subtitle => AVMEDIA_TYPE_SUBTITLE,
Type::Attachment => AVMEDIA_TYPE_ATTACHMENT,
}
}
}