Skip to content

Commit

Permalink
Added error handeling to make_writeable function
Browse files Browse the repository at this point in the history
  • Loading branch information
0000mz committed Dec 23, 2021
1 parent 8366275 commit 007f392
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/util/frame/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ impl Video {
}

#[inline]
pub unsafe fn make_writeable(&mut self) {
av_frame_make_writable(self.as_mut_ptr());
pub unsafe fn make_writeable(&mut self) -> std::io::Result<()> {
match av_frame_make_writable(self.as_mut_ptr()) {
0 => Ok(()),
err_code => Err(std::io::Error::new(
std::io::ErrorKind::Interrupted,
format!("Failed to make writeable. AVERROR = {}", err_code),
)),
}
}
}

Expand Down

0 comments on commit 007f392

Please sign in to comment.