more errors

This commit is contained in:
Muaz Ahmad 2023-10-05 16:29:03 +05:00
parent f9c59a90de
commit 44a4db496d

View file

@ -56,23 +56,27 @@ pub struct RawMedia {
// Errors // Errors
pub enum GenericError { pub enum DemuxerError {
UnknownSyncByte, UnknownSyncByte,
FLVUnknownTagType, FLVUnknownTagType,
FLVCheckFail,
FLVPacketNotMetadata,
} }
impl Error for GenericError {} impl Error for DemuxerError {}
impl fmt::Debug for GenericError { impl fmt::Debug for DemuxerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
GenericError::UnknownSyncByte => write!(f, "sync byte does not match any implemented input format"), DemuxerError::UnknownSyncByte => write!(f, "sync byte does not match any implemented input format"),
GenericError::FLVUnknownTagType => write!(f, "FLV tag does not match expected values") DemuxerError::FLVUnknownTagType => write!(f, "FLV tag does not match expected values"),
DemuxerError::FLVCheckFail => write!(f, "Input does not contain assumed FLV signature"),
DemuxerError::FLVPacketNotMetadata => write!(f, "Did not find expected metadata tag")
} }
} }
} }
impl fmt::Display for GenericError { impl fmt::Display for DemuxerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self, f) fmt::Debug::fmt(self, f)
} }