codec/decoder: add some accessors
This commit is contained in:
parent
4fdef8af50
commit
e2039ac550
@ -17,12 +17,13 @@ pub use self::check::*;
|
|||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
use std::slice::from_raw_parts;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
use super::Id;
|
use super::{Id, Profile};
|
||||||
use super::context::Opened;
|
use super::context::Opened;
|
||||||
use ::{Codec, Error};
|
use ::{Codec, Error, Discard};
|
||||||
use ::media;
|
use ::media;
|
||||||
|
|
||||||
pub struct Decoder(pub Opened);
|
pub struct Decoder(pub Opened);
|
||||||
@ -66,6 +67,36 @@ impl Decoder {
|
|||||||
(*self.ptr).err_recognition = value.bits();
|
(*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 {
|
impl Deref for Decoder {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user