typo fix, return Ok(false) if key is not relevant for value read and dump
This commit is contained in:
parent
5b57ffb3cb
commit
1f5133239c
1 changed files with 4 additions and 3 deletions
|
@ -105,7 +105,7 @@ fn process_metadata(mut data: Vec<u8>) -> Result<util::Metadata, Box<dyn Error>>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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<u8>, marker: &u8, metadata: &mut util::Metadata) -> Result<bool, Box<dyn Error>> {
|
fn handle_relevant_keys(key: String, data: &mut Vec<u8>, marker: &u8, metadata: &mut util::Metadata) -> Result<bool, Box<dyn Error>> {
|
||||||
|
@ -119,14 +119,15 @@ fn handle_relevant_keys(key: String, data: &mut Vec<u8>, marker: &u8, metadata:
|
||||||
_ => {Err(Box::new(util::DemuxerError::CodecNotImplemented))}
|
_ => {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)},
|
"audiosamplerate" => {metadata.audio.samplerate = f64::fetch_amf_val(data) as u32; Ok(true)},
|
||||||
"audiocodecid" => {
|
"audiocodecid" => {
|
||||||
match f64::fetch_amf_val(data) as u8 {
|
match f64::fetch_amf_val(data) as u8 {
|
||||||
10 => {metadata.audio.codec = Some(util::AudioCodec::AAC); Ok(true)},
|
10 => {metadata.audio.codec = Some(util::AudioCodec::AAC); Ok(true)},
|
||||||
_ => {Err(Box::new(util::DemuxerError::CodecNotImplemented))}
|
_ => {Err(Box::new(util::DemuxerError::CodecNotImplemented))}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
_ => Ok(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue