Skip to content

WavPack handling: add support for version 5 files

David Bryant requested to merge dvbryant/mkvtoolnix:wavpack5-fixes into master

This is to update MKVToolNIX to correctly handle WavPack 5 files. Two specific additions for WavPack 5 are handled here: the block checksum and the DSD sample rate multiplier. Also, one feature from WavPack 4 (non-standard sampling rates) was added.

WavPack 5 blocks may now optionally contain a checksum. Because this checksum includes the 32-byte WavPack header, which is essentially discarded when muxing into Matroska, it doesn't make sense to include it and so they are discarded. On extraction they are also deleted to handle Matroska files that may still mistakenly contain them. It would also be possible to add back new, correct checksums during extraction, but I'll leave that for later.

WavPack 5 files may contain DSD audio data (i.e., 1-bit PCM). Unfortunately there was no room in the WavPack header to store all the possible sampling rates of DSD audio, and so partially parsing the WavPack block body is required to determine the rate, similar to how non-standard sampling rates are determined. Code to handle both these cases has been added to the parser.

I hope it's not too obvious that I am not a C++ programmer, but feel free to change anything to accommodate C++ best practices and/or any MKVToolNIX-specific coding or formatting standards that I missed.

More information about the WavPack 5 changes can be found here.

Thanks!

Merge request reports