*: make internal pointer handling safer

This commit is contained in:
meh
2015-06-04 03:03:19 +02:00
parent b2c9dc3747
commit ff1b880be6
28 changed files with 683 additions and 466 deletions

View File

@ -9,9 +9,9 @@ use ::Error;
pub struct Subtitle(pub Encoder);
impl Subtitle {
pub fn encode(&self, subtitle: &::Subtitle, out: &mut [u8]) -> Result<bool, Error> {
pub fn encode(&mut self, subtitle: &::Subtitle, out: &mut [u8]) -> Result<bool, Error> {
unsafe {
match avcodec_encode_subtitle(self.ptr, out.as_mut_ptr(), out.len() as c_int, &subtitle.val) {
match avcodec_encode_subtitle(self.as_mut_ptr(), out.as_mut_ptr(), out.len() as c_int, subtitle.as_ptr()) {
e if e < 0 => Err(Error::from(e)),
_ => Ok(true)
}