codec: fix signature of Packet::write_interleaved

av_interleaved_write_frame never returns 1, so bool makes no sense:
https://github.com/FFmpeg/FFmpeg/blob/n4.3.1/libavformat/avformat.h#L2592-L2635

Fixes #25.
This commit is contained in:
Zhiming Wang 2020-08-08 22:43:03 +08:00
parent f15408ccef
commit 5affb85148
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8

View File

@ -226,15 +226,14 @@ impl Packet {
}
#[inline]
pub fn write_interleaved(&self, format: &mut format::context::Output) -> Result<bool, Error> {
pub fn write_interleaved(&self, format: &mut format::context::Output) -> Result<(), Error> {
unsafe {
if self.is_empty() {
return Err(Error::InvalidData);
}
match av_interleaved_write_frame(format.as_mut_ptr(), self.as_ptr() as *mut _) {
1 => Ok(true),
0 => Ok(false),
0 => Ok(()),
e => Err(Error::from(e)),
}
}