saecki / mp4ameta

A library for reading and writing iTunes style MPEG-4 audio metadata
Apache License 2.0
35 stars 5 forks source link

Allow filetype signature that starts with `mp4` #7

Closed TianyiShi2001 closed 4 years ago

TianyiShi2001 commented 4 years ago

Thank you for the development of this crate which is very helpful to me!

Music downloaded from mora (one of the major music stores in Japan) usually have .m4a extensions, but its filetype signature within the file data is not recognised by rust-mp4ameta.

When calling mp4ameta::Tag::read_from_path("foo.m4a").unwrap();:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidFiletype("mp42\u{0}\u{0}\u{0}\u{1}isommp423gp5"): Invalid filetype.'

However, they really contain valid m4a tags, and I was able to parse them by changing core::atom::VALID_FILETYPES to [&str; 6] = ["M4A ", "M4B ", "M4P ", "M4V ", "isom", "mp4"] (appeded "mp4"). I am not sure whether this is a standard fieltype signature. If it is, could it be added to VALID_FILETYPES? If not, is there any possibility for having a function for "force-parsing" the tags regardless of the file type?

saecki commented 4 years ago

I've added mp41 mp42 and iso2 to the list of valid filetypes and published version 0.5.1.

TianyiShi2001 commented 4 years ago

Thank you!