allow errors, import new modules

This commit is contained in:
Muaz Ahmad 2023-10-05 15:35:41 +05:00
parent 101afc4406
commit 3aa8cba150
2 changed files with 27 additions and 0 deletions

View file

@ -1,3 +1,6 @@
mod input;
mod flv;
use std::sync::mpsc; use std::sync::mpsc;
use std::error::Error; use std::error::Error;

View file

@ -1,6 +1,8 @@
use std::error::Error; use std::error::Error;
use std::fmt; use std::fmt;
// Data structs/enums
pub struct VideoMetadata { pub struct VideoMetadata {
pub width: u32, pub width: u32,
pub height: u32, pub height: u32,
@ -51,3 +53,25 @@ pub struct RawMedia {
pub media_type: RawMediaType, pub media_type: RawMediaType,
pub sample: Vec<u8>, pub sample: Vec<u8>,
} }
// Errors
pub enum GenericError {
UnknownSyncByte
}
impl Error for GenericError {}
impl fmt::Debug for GenericError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
GenericError::UnknownSyncByte => write!(f, "sync byte does not match any implemented input format"),
}
}
}
impl fmt::Display for GenericError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self, f)
}
}