Skip to content

The option -r should not add any file wrappers #190

@moubctez

Description

@moubctez

If I compress a RIFF-WAV file, I end up with the header stored in WavPack file. This is expected:

% wavpack -q audio.wav
% wvunpack -ss audio.wv
[...]
source format:     Microsoft RIFF with 'wav' extension
file wrapper:      44 byte RIFF header

When I add -r option, WavPack creates its own RIFF header, which is longer than the original one:

% wavpack -qr audio.wav
% wvunpack -ss audio.wv
[...]
source format:     Microsoft RIFF with 'wav' extension
file wrapper:      80 byte RIFF header

I would expect -r didn't add any file wrappers at all. To achieve that, I removed this section from the source code:

--- src/pack_utils.c.orig       2024-11-11 23:51:28.946320254 +0000
+++ src/pack_utils.c
@@ -680,13 +680,6 @@ int WavpackPackSamples (WavpackContext *
         unsigned int samples_to_copy;
         int stream_index;
 
-        if (!wpc->riff_header_added && !wpc->riff_header_created && !wpc->file_format) {
-            char riff_header [128];
-
-            if (!add_to_metadata (wpc, riff_header, create_riff_header (wpc, wpc->total_samples, riff_header), ID_RIFF_HEADER))
-                return FALSE;
-        }
-
         if (wpc->acc_samples + sample_count > wpc->max_samples)
             samples_to_copy = wpc->max_samples - wpc->acc_samples;
         else

Now, the file is what I expected:

source format:     Microsoft RIFF with 'wav' extension
file wrapper:      none stored

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions