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) } }