Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/util/frame/decode_error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use ffi::*;
use libc::c_int;

bitflags! {
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct DecodeError: c_int {
const INVALID_BITSTREAM = FF_DECODE_ERROR_INVALID_BITSTREAM;
const MISSING_REFERENCE = FF_DECODE_ERROR_MISSING_REFERENCE;
#[cfg(feature = "ffmpeg_5_1")]
const CONCEALMENT_ACTIVE = FF_DECODE_ERROR_CONCEALMENT_ACTIVE;
#[cfg(feature = "ffmpeg_5_1")]
const DECODE_SLICES = FF_DECODE_ERROR_DECODE_SLICES;
}
}
13 changes: 13 additions & 0 deletions src/util/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ pub use self::audio::Audio;
pub mod flag;
pub use self::flag::Flags;

pub mod decode_error;
pub use self::decode_error::DecodeError;

use ffi::*;
use {Dictionary, DictionaryRef};

Expand Down Expand Up @@ -84,6 +87,16 @@ impl Frame {
self.flags().contains(Flags::CORRUPT)
}

#[inline]
pub fn decode_error_flags(&self) -> DecodeError {
unsafe { DecodeError::from_bits_truncate((*self.as_ptr()).decode_error_flags) }
}

#[inline]
pub fn has_decode_errors(&self) -> bool {
!self.decode_error_flags().is_empty()
}

#[inline]
pub fn packet(&self) -> Packet {
unsafe {
Expand Down
Loading