From 1f5133239ce490f3791fe8cafc86e38be69a592b Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Fri, 6 Oct 2023 12:18:23 +0500 Subject: [PATCH] typo fix, return Ok(false) if key is not relevant for value read and dump --- src/demux/flv.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/demux/flv.rs b/src/demux/flv.rs index bf777a4..80239e6 100644 --- a/src/demux/flv.rs +++ b/src/demux/flv.rs @@ -105,7 +105,7 @@ fn process_metadata(mut data: Vec) -> Result> } } } - return Ok(metadata); + return if metadata.is_valid() {Ok(metadata)} else {Err(Box::new(util::DemuxerError::MetadataValNotSet))}; } fn handle_relevant_keys(key: String, data: &mut Vec, marker: &u8, metadata: &mut util::Metadata) -> Result> { @@ -119,14 +119,15 @@ fn handle_relevant_keys(key: String, data: &mut Vec, marker: &u8, metadata: _ => {Err(Box::new(util::DemuxerError::CodecNotImplemented))} } }, - "stereo" => {metadata.audio.channels = if bool::fetch_amf_val(data) {2} else {1}; Ok(true)}, + "stereo" => {metadata.audio.channels = if bool::fetch_amf_val(data) {2u8} else {1u8}; Ok(true)}, "audiosamplerate" => {metadata.audio.samplerate = f64::fetch_amf_val(data) as u32; Ok(true)}, "audiocodecid" => { match f64::fetch_amf_val(data) as u8 { 10 => {metadata.audio.codec = Some(util::AudioCodec::AAC); Ok(true)}, _ => {Err(Box::new(util::DemuxerError::CodecNotImplemented))} } - } + }, + _ => Ok(false) } }