metadata validation func
This commit is contained in:
parent
1f5133239c
commit
a654d17b7c
1 changed files with 17 additions and 0 deletions
|
@ -32,6 +32,21 @@ pub struct Metadata {
|
|||
pub audio: AudioMetadata,
|
||||
}
|
||||
|
||||
impl Metadata {
|
||||
pub fn is_valid(&self) -> bool {
|
||||
match self {
|
||||
x if x.video.width == u32::default() => false,
|
||||
x if x.video.height == u32::default() => false,
|
||||
x if x.video.framerate == f32::default() => false,
|
||||
x if x.video.codec.is_none() => false,
|
||||
x if x.audio.channels == u8::default() => false,
|
||||
x if x.audio.samplerate == u32::default() => false,
|
||||
x if x.audio.codec.is_none() => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum FileType {
|
||||
FLV,
|
||||
MPEGTS,
|
||||
|
@ -66,6 +81,7 @@ pub enum DemuxerError {
|
|||
FLVPacketNotMetadata,
|
||||
FLVMetadataSyncFail,
|
||||
FLVMetadataAMFMarkerError,
|
||||
MetadataValNotSet,
|
||||
CodecNotImplemented,
|
||||
}
|
||||
|
||||
|
@ -81,6 +97,7 @@ impl fmt::Debug for DemuxerError {
|
|||
DemuxerError::FLVMetadataSyncFail => write!(f, "ECMA array not where expected"),
|
||||
DemuxerError::FLVMetadataAMFMarkerError => write!(f, "Marker value not recognized/implemented"),
|
||||
DemuxerError::CodecNotImplemented => write!(f, "Input file has unrecognized codec"),
|
||||
DemuxerError::MetadataValNotSet => write!(f, "One or more metadata values failed to init"),
|
||||
_ => write!(f, "Error not described yet")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue