david-pace / wave-recovery-tool

Tool to display WAVE/AIFF file header information and to restore corrupted WAVE/AIFF file headers
GNU General Public License v3.0
14 stars 2 forks source link

Chunk Sizes are not Always Correct #11

Open david-pace opened 2 years ago

david-pace commented 2 years ago

Sometimes the chunk sizes are not computed correctly.

The background is that these are computed based on the size of the source files (i.e. the damaged files). The computed chunk sizes are only correct if the restored file is exactly as big as the damaged file. While this is correct in most cases, it does not hold true if:

This is a bit tricky because at this point it is not yet clear which chunks will be written, so the write operation has to be delayed.

A good approach would probably be to analyze the input file completely, detect the chunks that are still intact (if any), compute a plan which chunks should be written (including their sizes) and then finally write the complete file with correct chunk sizes.