codec/parameters: add medium and id methods

This commit is contained in:
Tae-il Lim 2016-11-30 11:28:46 +09:00 committed by meh
parent 606847cc50
commit f1ce26a137

View File

@ -1,6 +1,8 @@
use std::rc::Rc; use std::rc::Rc;
use ffi::*; use ffi::*;
use media;
use super::Id;
pub struct Parameters { pub struct Parameters {
ptr: *mut AVCodecParameters, ptr: *mut AVCodecParameters,
@ -29,6 +31,18 @@ impl Parameters {
Parameters { ptr: avcodec_parameters_alloc(), owner: None } Parameters { ptr: avcodec_parameters_alloc(), owner: None }
} }
} }
pub fn medium(&self) -> media::Type {
unsafe {
media::Type::from((*self.as_ptr()).codec_type)
}
}
pub fn id(&self) -> Id {
unsafe {
Id::from((*self.as_ptr()).codec_id)
}
}
} }
impl Drop for Parameters { impl Drop for Parameters {