codec/decoder: implement DerefMut

This commit is contained in:
meh 2015-05-28 20:13:50 +02:00
parent 3b3f633c39
commit 5803c023ec

View File

@ -18,7 +18,7 @@ pub use self::check::Check;
use std::ffi::CString; use std::ffi::CString;
use std::ptr; use std::ptr;
use std::slice::from_raw_parts; use std::slice::from_raw_parts;
use std::ops::Deref; use std::ops::{Deref, DerefMut};
use ffi::*; use ffi::*;
use super::{Id, Profile}; use super::{Id, Profile};
@ -113,6 +113,12 @@ impl Deref for Decoder {
} }
} }
impl DerefMut for Decoder {
fn deref_mut(&mut self) -> &mut<Self as Deref>::Target {
&mut self.0
}
}
pub fn find(id: Id) -> Option<Codec<'static>> { pub fn find(id: Id) -> Option<Codec<'static>> {
unsafe { unsafe {
let ptr = avcodec_find_decoder(id.into()); let ptr = avcodec_find_decoder(id.into());