improved error handling pt 2

This commit is contained in:
apolunar 2024-06-06 16:29:36 -05:00
parent 5f1b057b14
commit eac5a32f3d

View file

@ -77,19 +77,15 @@ impl SymphoniaDecoder {
}; };
// Select the first supported track // Select the first supported track
let track_id = match probed let track_id = probed
.format .format
.tracks() .tracks()
.iter() .iter()
.find(|t| t.codec_params.codec != CODEC_TYPE_NULL) .find(|t| t.codec_params.codec != CODEC_TYPE_NULL)
{ .ok_or(symphonia::core::errors::Error::Unsupported(
Some(track) => track.id,
None => {
return Err(symphonia::core::errors::Error::Unsupported(
"No track with supported codec", "No track with supported codec",
)) ))?
} .id;
};
let track = probed let track = probed
.format .format