Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust header parsing #14

Merged
merged 8 commits into from
Dec 11, 2023
Merged

Conversation

Sidelobe
Copy link
Collaborator

@Sidelobe Sidelobe commented Dec 11, 2023

Rewrote wav header parsing with the following advantages:

  • Header struct not longer read/written in one 'gulp' -- more portable, since compilers have different struct padding
  • No longer using htonl() -- no need for external dependency, since code is now endianess-agnostic by reading byte-by-byte

TinyWav now supports (and tests!) the following scenarios:

  • Additional subchunks between fmt and data
  • Additional subchunks between WAVE and fmt (rare, but it does happen...)

These kind of headers are now parsed correctly.

Furthermore, tinywav_read_f will not allow to read further than the data subchunk size declared in header. Some wave files have additional LIST chunks after the audio subchunk (e.g. generated by Reaper)

removed htonl dependency for open_write, quick n' dirty for tests and open_read
We now skip over unrecognized subchunks between fmt and data, but also between WAVE and fmt
@Sidelobe Sidelobe mentioned this pull request Dec 11, 2023
@Sidelobe Sidelobe merged commit db74d2f into master Dec 11, 2023
10 checks passed
@Sidelobe Sidelobe deleted the feature/MoreRobustHeaderParsing branch December 11, 2023 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant