From 3aa8cba15064d7b32c5e654e9aaf6bbb81b786d4 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 5 Oct 2023 15:35:41 +0500 Subject: [PATCH] allow errors, import new modules --- src/demux/mod.rs | 3 +++ src/util/mod.rs | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/demux/mod.rs b/src/demux/mod.rs index 5fbb4aa..f84670e 100644 --- a/src/demux/mod.rs +++ b/src/demux/mod.rs @@ -1,3 +1,6 @@ +mod input; +mod flv; + use std::sync::mpsc; use std::error::Error; diff --git a/src/util/mod.rs b/src/util/mod.rs index 9a8d351..c48f2ce 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -1,6 +1,8 @@ use std::error::Error; use std::fmt; +// Data structs/enums + pub struct VideoMetadata { pub width: u32, pub height: u32, @@ -51,3 +53,25 @@ pub struct RawMedia { pub media_type: RawMediaType, pub sample: Vec, } + +// 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) + } +}