diff --git a/bingus/Cargo.toml b/bingus/Cargo.toml index 5030a22..41573b5 100644 --- a/bingus/Cargo.toml +++ b/bingus/Cargo.toml @@ -18,7 +18,7 @@ thiserror = "2.0" derive-new = "0.7" strum = { version = "0.26", features = ["derive"] } derive_wrapper = "0.1" -symphonia = { version = "0.5.4", features = ["all"] } +symphonia = { version = "0.5", features = ["all"] } [dev_dependencies] project-root = "0.2.2" diff --git a/bingus/src/snd/simphonia.rs b/bingus/src/snd/simphonia.rs index d4b13b9..7c4430a 100644 --- a/bingus/src/snd/simphonia.rs +++ b/bingus/src/snd/simphonia.rs @@ -58,7 +58,13 @@ impl Audio { let mss = MediaSourceStream::new(Box::new(mediasource), Default::default()); let reader = probe .format( - &Default::default(), + &Hint::new().with_extension( + path.as_ref() + .extension() + .map(|os_str| os_str.to_str()) + .flatten() + .unwrap_or("mp3"), + ), mss, &Default::default(), &Default::default(), @@ -179,6 +185,16 @@ mod tests { #[test] fn open_sample_file() { - assert_eq!(Ok(include_bytes!("../../../testing material/sound/1938-04-30_BBC_Winston_Churchill_To_The_Royal_Academy_Of_Arts.mp3").to_vec()), Audio::open(get_project_root().expect("can't find project root!").join("testing material").join("sound").join("1938-04-30_BBC_Winston_Churchill_To_The_Royal_Academy_Of_Arts.mp3")).map(|audio| audio.into_data_bytes())); + assert_eq!( + Ok(include_bytes!("../../../testing material/sound/sample-3s.mp3").to_vec()), + Audio::open( + get_project_root() + .expect("can't find project root!") + .join("testing material") + .join("sound") + .join("sample-3s.mp3") + ) + .map(|audio| audio.into_data_bytes()) + ); } }