codec/decoder: add error checking

This commit is contained in:
meh 2015-05-16 17:34:31 +02:00
parent 757088f46c
commit 507a1b9e95
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,16 @@
use libc::c_int;
use ffi::*;
bitflags! {
flags Check: c_int {
const CHECK_CRC = AV_EF_CRCCHECK,
const CHECK_BISTREAM = AV_EF_BITSTREAM,
const CHECK_BUFFER = AV_EF_BUFFER,
const CHECK_EXPLODE = AV_EF_EXPLODE,
const CHECK_IGNORE_ERROR = AV_EF_IGNORE_ERR,
const CHECK_CAREFUL = AV_EF_CAREFUL,
const CHECK_COMPLIANT = AV_EF_COMPLIANT,
const CHECK_AGGRESSIVE = AV_EF_AGGRESSIVE,
}
}

View File

@ -12,6 +12,9 @@ pub mod slice;
pub mod conceal; pub mod conceal;
pub use self::conceal::*; pub use self::conceal::*;
pub mod check;
pub use self::check::*;
use std::ffi::CString; use std::ffi::CString;
use std::ptr; use std::ptr;
use std::ops::Deref; use std::ops::Deref;
@ -57,6 +60,12 @@ impl Decoder {
(*self.ptr).error_concealment = value.bits(); (*self.ptr).error_concealment = value.bits();
} }
} }
pub fn check(&mut self, value: Check) {
unsafe {
(*self.ptr).err_recognition = value.bits();
}
}
} }
impl Deref for Decoder { impl Deref for Decoder {