codec/decoder: add some accessors

This commit is contained in:
meh 2015-05-16 18:40:32 +02:00
parent 4fdef8af50
commit e2039ac550

View File

@ -17,12 +17,13 @@ pub use self::check::*;
use std::ffi::CString;
use std::ptr;
use std::slice::from_raw_parts;
use std::ops::Deref;
use ffi::*;
use super::Id;
use super::{Id, Profile};
use super::context::Opened;
use ::{Codec, Error};
use ::{Codec, Error, Discard};
use ::media;
pub struct Decoder(pub Opened);
@ -66,6 +67,36 @@ impl Decoder {
(*self.ptr).err_recognition = value.bits();
}
}
pub fn profile(&self) -> Profile {
unsafe {
Profile::from((self.id(), (*self.ptr).profile))
}
}
pub fn skip_loop_filter(&mut self, value: Discard) {
unsafe {
(*self.ptr).skip_loop_filter = value.into();
}
}
pub fn skip_idct(&mut self, value: Discard) {
unsafe {
(*self.ptr).skip_idct = value.into();
}
}
pub fn skip_frame(&mut self, value: Discard) {
unsafe {
(*self.ptr).skip_frame = value.into();
}
}
pub fn subtitle_header(&self) -> &[u8] {
unsafe {
from_raw_parts((*self.ptr).subtitle_header, (*self.ptr).subtitle_header_size as usize)
}
}
}
impl Deref for Decoder {