diff options
author | Dave Bryant <bryant@rockbox.org> | 2006-04-22 22:21:36 +0000 |
---|---|---|
committer | Dave Bryant <bryant@rockbox.org> | 2006-04-22 22:21:36 +0000 |
commit | b76bb60219c08d8321ffe6260072b8291499e79a (patch) | |
tree | 2b36532e7b913a7544712da313864ca29de21d81 | |
parent | 2ec18b521c845be6ccb18217a877680904db3905 (diff) | |
download | rockbox-b76bb60219c08d8321ffe6260072b8291499e79a.tar.gz rockbox-b76bb60219c08d8321ffe6260072b8291499e79a.zip |
Update libwavpack to the latest stream specification, and cross fingers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9769 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/libwavpack/unpack.c | 33 | ||||
-rw-r--r-- | apps/codecs/libwavpack/wavpack.h | 13 | ||||
-rw-r--r-- | apps/codecs/libwavpack/words.c | 20 | ||||
-rw-r--r-- | apps/codecs/libwavpack/wputils.c | 14 |
4 files changed, 51 insertions, 29 deletions
diff --git a/apps/codecs/libwavpack/unpack.c b/apps/codecs/libwavpack/unpack.c index dcc9bf5bf9..5bb4467440 100644 --- a/apps/codecs/libwavpack/unpack.c +++ b/apps/codecs/libwavpack/unpack.c | |||
@@ -128,7 +128,7 @@ int read_decorr_weights (WavpackStream *wps, WavpackMetadata *wpmd) | |||
128 | signed char *byteptr = wpmd->data; | 128 | signed char *byteptr = wpmd->data; |
129 | struct decorr_pass *dpp; | 129 | struct decorr_pass *dpp; |
130 | 130 | ||
131 | if (!(wps->wphdr.flags & MONO_FLAG)) | 131 | if (!(wps->wphdr.flags & MONO_DATA)) |
132 | termcnt /= 2; | 132 | termcnt /= 2; |
133 | 133 | ||
134 | if (termcnt > wps->num_terms) | 134 | if (termcnt > wps->num_terms) |
@@ -140,7 +140,7 @@ int read_decorr_weights (WavpackStream *wps, WavpackMetadata *wpmd) | |||
140 | while (--dpp >= wps->decorr_passes && termcnt--) { | 140 | while (--dpp >= wps->decorr_passes && termcnt--) { |
141 | dpp->weight_A = restore_weight (*byteptr++); | 141 | dpp->weight_A = restore_weight (*byteptr++); |
142 | 142 | ||
143 | if (!(wps->wphdr.flags & MONO_FLAG)) | 143 | if (!(wps->wphdr.flags & MONO_DATA)) |
144 | dpp->weight_B = restore_weight (*byteptr++); | 144 | dpp->weight_B = restore_weight (*byteptr++); |
145 | } | 145 | } |
146 | 146 | ||
@@ -170,7 +170,7 @@ int read_decorr_samples (WavpackStream *wps, WavpackMetadata *wpmd) | |||
170 | if (wps->wphdr.version == 0x402 && (wps->wphdr.flags & HYBRID_FLAG)) { | 170 | if (wps->wphdr.version == 0x402 && (wps->wphdr.flags & HYBRID_FLAG)) { |
171 | byteptr += 2; | 171 | byteptr += 2; |
172 | 172 | ||
173 | if (!(wps->wphdr.flags & MONO_FLAG)) | 173 | if (!(wps->wphdr.flags & MONO_DATA)) |
174 | byteptr += 2; | 174 | byteptr += 2; |
175 | } | 175 | } |
176 | 176 | ||
@@ -180,7 +180,7 @@ int read_decorr_samples (WavpackStream *wps, WavpackMetadata *wpmd) | |||
180 | dpp->samples_A [1] = exp2s ((short)(byteptr [2] + (byteptr [3] << 8))); | 180 | dpp->samples_A [1] = exp2s ((short)(byteptr [2] + (byteptr [3] << 8))); |
181 | byteptr += 4; | 181 | byteptr += 4; |
182 | 182 | ||
183 | if (!(wps->wphdr.flags & MONO_FLAG)) { | 183 | if (!(wps->wphdr.flags & MONO_DATA)) { |
184 | dpp->samples_B [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); | 184 | dpp->samples_B [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); |
185 | dpp->samples_B [1] = exp2s ((short)(byteptr [2] + (byteptr [3] << 8))); | 185 | dpp->samples_B [1] = exp2s ((short)(byteptr [2] + (byteptr [3] << 8))); |
186 | byteptr += 4; | 186 | byteptr += 4; |
@@ -198,7 +198,7 @@ int read_decorr_samples (WavpackStream *wps, WavpackMetadata *wpmd) | |||
198 | dpp->samples_A [m] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); | 198 | dpp->samples_A [m] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); |
199 | byteptr += 2; | 199 | byteptr += 2; |
200 | 200 | ||
201 | if (!(wps->wphdr.flags & MONO_FLAG)) { | 201 | if (!(wps->wphdr.flags & MONO_DATA)) { |
202 | dpp->samples_B [m] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); | 202 | dpp->samples_B [m] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); |
203 | byteptr += 2; | 203 | byteptr += 2; |
204 | } | 204 | } |
@@ -322,7 +322,7 @@ int32_t unpack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_co | |||
322 | 322 | ||
323 | ///////////////////// handle version 4 mono data ///////////////////////// | 323 | ///////////////////// handle version 4 mono data ///////////////////////// |
324 | 324 | ||
325 | if (flags & MONO_FLAG) { | 325 | if (flags & MONO_DATA) { |
326 | eptr = buffer + sample_count; | 326 | eptr = buffer + sample_count; |
327 | i = get_words (buffer, sample_count, flags, &wps->w, &wps->wvbits); | 327 | i = get_words (buffer, sample_count, flags, &wps->w, &wps->wvbits); |
328 | 328 | ||
@@ -394,9 +394,20 @@ int32_t unpack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_co | |||
394 | fixup_samples (wps, buffer, i); | 394 | fixup_samples (wps, buffer, i); |
395 | 395 | ||
396 | if (flags & FLOAT_DATA) | 396 | if (flags & FLOAT_DATA) |
397 | float_normalize (buffer, (flags & MONO_FLAG) ? i : i * 2, | 397 | float_normalize (buffer, (flags & MONO_DATA) ? i : i * 2, |
398 | 127 - wps->float_norm_exp + wpc->norm_offset); | 398 | 127 - wps->float_norm_exp + wpc->norm_offset); |
399 | 399 | ||
400 | if (flags & FALSE_STEREO) { | ||
401 | int32_t *dptr = buffer + i * 2; | ||
402 | int32_t *sptr = buffer + i; | ||
403 | int32_t c = i; | ||
404 | |||
405 | while (c--) { | ||
406 | *--dptr = *--sptr; | ||
407 | *--dptr = *sptr; | ||
408 | } | ||
409 | } | ||
410 | |||
400 | wps->sample_index += i; | 411 | wps->sample_index += i; |
401 | wps->crc = crc; | 412 | wps->crc = crc; |
402 | 413 | ||
@@ -695,12 +706,12 @@ static void fixup_samples (WavpackStream *wps, int32_t *buffer, uint32_t sample_ | |||
695 | shift += 21 - (flags & BYTES_STORED) * 8; // this provides RockBox with 28-bit (+sign) | 706 | shift += 21 - (flags & BYTES_STORED) * 8; // this provides RockBox with 28-bit (+sign) |
696 | 707 | ||
697 | if (flags & FLOAT_DATA) { | 708 | if (flags & FLOAT_DATA) { |
698 | float_values (wps, buffer, (flags & MONO_FLAG) ? sample_count : sample_count * 2); | 709 | float_values (wps, buffer, (flags & MONO_DATA) ? sample_count : sample_count * 2); |
699 | return; | 710 | return; |
700 | } | 711 | } |
701 | 712 | ||
702 | if (flags & INT32_DATA) { | 713 | if (flags & INT32_DATA) { |
703 | uint32_t count = (flags & MONO_FLAG) ? sample_count : sample_count * 2; | 714 | uint32_t count = (flags & MONO_DATA) ? sample_count : sample_count * 2; |
704 | int sent_bits = wps->int32_sent_bits, zeros = wps->int32_zeros; | 715 | int sent_bits = wps->int32_sent_bits, zeros = wps->int32_zeros; |
705 | int ones = wps->int32_ones, dups = wps->int32_dups; | 716 | int ones = wps->int32_ones, dups = wps->int32_dups; |
706 | int32_t *dptr = buffer; | 717 | int32_t *dptr = buffer; |
@@ -721,7 +732,7 @@ static void fixup_samples (WavpackStream *wps, int32_t *buffer, uint32_t sample_ | |||
721 | } | 732 | } |
722 | 733 | ||
723 | if (shift > 0) { | 734 | if (shift > 0) { |
724 | if (!(flags & MONO_FLAG)) | 735 | if (!(flags & MONO_DATA)) |
725 | sample_count *= 2; | 736 | sample_count *= 2; |
726 | 737 | ||
727 | while (sample_count--) | 738 | while (sample_count--) |
@@ -730,7 +741,7 @@ static void fixup_samples (WavpackStream *wps, int32_t *buffer, uint32_t sample_ | |||
730 | else if (shift < 0) { | 741 | else if (shift < 0) { |
731 | shift = -shift; | 742 | shift = -shift; |
732 | 743 | ||
733 | if (!(flags & MONO_FLAG)) | 744 | if (!(flags & MONO_DATA)) |
734 | sample_count *= 2; | 745 | sample_count *= 2; |
735 | 746 | ||
736 | while (sample_count--) | 747 | while (sample_count--) |
diff --git a/apps/codecs/libwavpack/wavpack.h b/apps/codecs/libwavpack/wavpack.h index 593af7831d..3128328e49 100644 --- a/apps/codecs/libwavpack/wavpack.h +++ b/apps/codecs/libwavpack/wavpack.h | |||
@@ -76,11 +76,19 @@ typedef struct { | |||
76 | #define SRATE_LSB 23 | 76 | #define SRATE_LSB 23 |
77 | #define SRATE_MASK (0xfL << SRATE_LSB) | 77 | #define SRATE_MASK (0xfL << SRATE_LSB) |
78 | 78 | ||
79 | #define FALSE_STEREO 0x40000000 // block is stereo, but data is mono | ||
80 | |||
79 | #define IGNORED_FLAGS 0x18000000 // reserved, but ignore if encountered | 81 | #define IGNORED_FLAGS 0x18000000 // reserved, but ignore if encountered |
80 | #define NEW_SHAPING 0x20000000 // use IIR filter for negative shaping | 82 | #define NEW_SHAPING 0x20000000 // use IIR filter for negative shaping |
81 | #define UNKNOWN_FLAGS 0xC0000000 // also reserved, but refuse decode if | 83 | #define UNKNOWN_FLAGS 0x80000000 // also reserved, but refuse decode if |
82 | // encountered | 84 | // encountered |
83 | 85 | ||
86 | #define MONO_DATA (MONO_FLAG | FALSE_STEREO) | ||
87 | |||
88 | #define MIN_STREAM_VERS 0x402 // lowest stream version we'll decode | ||
89 | #define MAX_STREAM_VERS 0x410 // highest stream version we'll decode | ||
90 | #define CUR_STREAM_VERS 0x403 // stream version we are writing now | ||
91 | |||
84 | //////////////////////////// WavPack Metadata ///////////////////////////////// | 92 | //////////////////////////// WavPack Metadata ///////////////////////////////// |
85 | 93 | ||
86 | // This is an internal representation of metadata. | 94 | // This is an internal representation of metadata. |
@@ -426,5 +434,6 @@ void WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount); | |||
426 | int WavpackStartBlock (WavpackContext *wpc, uchar *begin, uchar *end); | 434 | int WavpackStartBlock (WavpackContext *wpc, uchar *begin, uchar *end); |
427 | int WavpackPackSamples (WavpackContext *wpc, int32_t *sample_buffer, uint32_t sample_count); | 435 | int WavpackPackSamples (WavpackContext *wpc, int32_t *sample_buffer, uint32_t sample_count); |
428 | uint32_t WavpackFinishBlock (WavpackContext *wpc); | 436 | uint32_t WavpackFinishBlock (WavpackContext *wpc); |
429 | 437 | void WavpackUpdateNumSamples (WavpackContext *wpc, void *first_block); | |
438 | void *WavpackGetWrapperLocation (void *first_block); | ||
430 | 439 | ||
diff --git a/apps/codecs/libwavpack/words.c b/apps/codecs/libwavpack/words.c index ccbd77f8f9..c7a8047d03 100644 --- a/apps/codecs/libwavpack/words.c +++ b/apps/codecs/libwavpack/words.c | |||
@@ -151,14 +151,14 @@ int read_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd) | |||
151 | { | 151 | { |
152 | uchar *byteptr = wpmd->data; | 152 | uchar *byteptr = wpmd->data; |
153 | 153 | ||
154 | if (wpmd->byte_length != ((wps->wphdr.flags & MONO_FLAG) ? 6 : 12)) | 154 | if (wpmd->byte_length != ((wps->wphdr.flags & MONO_DATA) ? 6 : 12)) |
155 | return FALSE; | 155 | return FALSE; |
156 | 156 | ||
157 | wps->w.c [0].median [0] = exp2s (byteptr [0] + (byteptr [1] << 8)); | 157 | wps->w.c [0].median [0] = exp2s (byteptr [0] + (byteptr [1] << 8)); |
158 | wps->w.c [0].median [1] = exp2s (byteptr [2] + (byteptr [3] << 8)); | 158 | wps->w.c [0].median [1] = exp2s (byteptr [2] + (byteptr [3] << 8)); |
159 | wps->w.c [0].median [2] = exp2s (byteptr [4] + (byteptr [5] << 8)); | 159 | wps->w.c [0].median [2] = exp2s (byteptr [4] + (byteptr [5] << 8)); |
160 | 160 | ||
161 | if (!(wps->wphdr.flags & MONO_FLAG)) { | 161 | if (!(wps->wphdr.flags & MONO_DATA)) { |
162 | wps->w.c [1].median [0] = exp2s (byteptr [6] + (byteptr [7] << 8)); | 162 | wps->w.c [1].median [0] = exp2s (byteptr [6] + (byteptr [7] << 8)); |
163 | wps->w.c [1].median [1] = exp2s (byteptr [8] + (byteptr [9] << 8)); | 163 | wps->w.c [1].median [1] = exp2s (byteptr [8] + (byteptr [9] << 8)); |
164 | wps->w.c [1].median [2] = exp2s (byteptr [10] + (byteptr [11] << 8)); | 164 | wps->w.c [1].median [2] = exp2s (byteptr [10] + (byteptr [11] << 8)); |
@@ -215,7 +215,7 @@ int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd) | |||
215 | wps->w.c [0].slow_level = exp2s (byteptr [0] + (byteptr [1] << 8)); | 215 | wps->w.c [0].slow_level = exp2s (byteptr [0] + (byteptr [1] << 8)); |
216 | byteptr += 2; | 216 | byteptr += 2; |
217 | 217 | ||
218 | if (!(wps->wphdr.flags & MONO_FLAG)) { | 218 | if (!(wps->wphdr.flags & MONO_DATA)) { |
219 | wps->w.c [1].slow_level = exp2s (byteptr [0] + (byteptr [1] << 8)); | 219 | wps->w.c [1].slow_level = exp2s (byteptr [0] + (byteptr [1] << 8)); |
220 | byteptr += 2; | 220 | byteptr += 2; |
221 | } | 221 | } |
@@ -224,7 +224,7 @@ int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd) | |||
224 | wps->w.bitrate_acc [0] = (int32_t)(byteptr [0] + (byteptr [1] << 8)) << 16; | 224 | wps->w.bitrate_acc [0] = (int32_t)(byteptr [0] + (byteptr [1] << 8)) << 16; |
225 | byteptr += 2; | 225 | byteptr += 2; |
226 | 226 | ||
227 | if (!(wps->wphdr.flags & MONO_FLAG)) { | 227 | if (!(wps->wphdr.flags & MONO_DATA)) { |
228 | wps->w.bitrate_acc [1] = (int32_t)(byteptr [0] + (byteptr [1] << 8)) << 16; | 228 | wps->w.bitrate_acc [1] = (int32_t)(byteptr [0] + (byteptr [1] << 8)) << 16; |
229 | byteptr += 2; | 229 | byteptr += 2; |
230 | } | 230 | } |
@@ -233,7 +233,7 @@ int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd) | |||
233 | wps->w.bitrate_delta [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); | 233 | wps->w.bitrate_delta [0] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); |
234 | byteptr += 2; | 234 | byteptr += 2; |
235 | 235 | ||
236 | if (!(wps->wphdr.flags & MONO_FLAG)) { | 236 | if (!(wps->wphdr.flags & MONO_DATA)) { |
237 | wps->w.bitrate_delta [1] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); | 237 | wps->w.bitrate_delta [1] = exp2s ((short)(byteptr [0] + (byteptr [1] << 8))); |
238 | byteptr += 2; | 238 | byteptr += 2; |
239 | } | 239 | } |
@@ -257,7 +257,7 @@ void update_error_limit (struct words_data *w, uint32_t flags) | |||
257 | { | 257 | { |
258 | int bitrate_0 = (w->bitrate_acc [0] += w->bitrate_delta [0]) >> 16; | 258 | int bitrate_0 = (w->bitrate_acc [0] += w->bitrate_delta [0]) >> 16; |
259 | 259 | ||
260 | if (flags & MONO_FLAG) { | 260 | if (flags & MONO_DATA) { |
261 | if (flags & HYBRID_BITRATE) { | 261 | if (flags & HYBRID_BITRATE) { |
262 | int slow_log_0 = (w->c [0].slow_level + SLO) >> SLS; | 262 | int slow_log_0 = (w->c [0].slow_level + SLO) >> SLS; |
263 | 263 | ||
@@ -326,13 +326,13 @@ int32_t get_words (int32_t *buffer, int nsamples, uint32_t flags, | |||
326 | register struct entropy_data *c = w->c; | 326 | register struct entropy_data *c = w->c; |
327 | int csamples; | 327 | int csamples; |
328 | 328 | ||
329 | if (!(flags & MONO_FLAG)) | 329 | if (!(flags & MONO_DATA)) |
330 | nsamples *= 2; | 330 | nsamples *= 2; |
331 | 331 | ||
332 | for (csamples = 0; csamples < nsamples; ++csamples) { | 332 | for (csamples = 0; csamples < nsamples; ++csamples) { |
333 | uint32_t ones_count, low, mid, high; | 333 | uint32_t ones_count, low, mid, high; |
334 | 334 | ||
335 | if (!(flags & MONO_FLAG)) | 335 | if (!(flags & MONO_DATA)) |
336 | c = w->c + (csamples & 1); | 336 | c = w->c + (csamples & 1); |
337 | 337 | ||
338 | if (!(w->c [0].median [0] & ~1) && !w->holding_zero && !w->holding_one && !(w->c [1].median [0] & ~1)) { | 338 | if (!(w->c [0].median [0] & ~1) && !w->holding_zero && !w->holding_one && !(w->c [1].median [0] & ~1)) { |
@@ -435,7 +435,7 @@ int32_t get_words (int32_t *buffer, int nsamples, uint32_t flags, | |||
435 | w->holding_zero = ~w->holding_one & 1; | 435 | w->holding_zero = ~w->holding_one & 1; |
436 | } | 436 | } |
437 | 437 | ||
438 | if ((flags & HYBRID_FLAG) && ((flags & MONO_FLAG) || !(csamples & 1))) | 438 | if ((flags & HYBRID_FLAG) && ((flags & MONO_DATA) || !(csamples & 1))) |
439 | update_error_limit (w, flags); | 439 | update_error_limit (w, flags); |
440 | 440 | ||
441 | if (ones_count == 0) { | 441 | if (ones_count == 0) { |
@@ -484,7 +484,7 @@ int32_t get_words (int32_t *buffer, int nsamples, uint32_t flags, | |||
484 | c->slow_level = c->slow_level - ((c->slow_level + SLO) >> SLS) + mylog2 (mid); | 484 | c->slow_level = c->slow_level - ((c->slow_level + SLO) >> SLS) + mylog2 (mid); |
485 | } | 485 | } |
486 | 486 | ||
487 | return (flags & MONO_FLAG) ? csamples : (csamples / 2); | 487 | return (flags & MONO_DATA) ? csamples : (csamples / 2); |
488 | } | 488 | } |
489 | 489 | ||
490 | // Read a single unsigned value from the specified bitstream with a value | 490 | // Read a single unsigned value from the specified bitstream with a value |
diff --git a/apps/codecs/libwavpack/wputils.c b/apps/codecs/libwavpack/wputils.c index 7a6cc44ad4..7fabc7ab34 100644 --- a/apps/codecs/libwavpack/wputils.c +++ b/apps/codecs/libwavpack/wputils.c | |||
@@ -69,9 +69,10 @@ WavpackContext *WavpackOpenFileInput (read_stream infile, char *error) | |||
69 | return NULL; | 69 | return NULL; |
70 | } | 70 | } |
71 | 71 | ||
72 | if ((wps->wphdr.flags & UNKNOWN_FLAGS) || wps->wphdr.version < 0x402 || wps->wphdr.version > 0x40f) { | 72 | if ((wps->wphdr.flags & UNKNOWN_FLAGS) || wps->wphdr.version < MIN_STREAM_VERS || |
73 | strcpy_loc (error, "invalid WavPack file!"); | 73 | wps->wphdr.version > MAX_STREAM_VERS) { |
74 | return NULL; | 74 | strcpy_loc (error, "invalid WavPack file!"); |
75 | return NULL; | ||
75 | } | 76 | } |
76 | 77 | ||
77 | if (wps->wphdr.block_samples && wps->wphdr.total_samples != (uint32_t) -1) | 78 | if (wps->wphdr.block_samples && wps->wphdr.total_samples != (uint32_t) -1) |
@@ -170,7 +171,7 @@ uint32_t WavpackUnpackSamples (WavpackContext *wpc, int32_t *buffer, uint32_t sa | |||
170 | if (bcount == (uint32_t) -1) | 171 | if (bcount == (uint32_t) -1) |
171 | break; | 172 | break; |
172 | 173 | ||
173 | if (wps->wphdr.version < 0x402 || wps->wphdr.version > 0x40f) { | 174 | if (wps->wphdr.version < MIN_STREAM_VERS || wps->wphdr.version > MAX_STREAM_VERS) { |
174 | strcpy_loc (wpc->error_message, "invalid WavPack file!"); | 175 | strcpy_loc (wpc->error_message, "invalid WavPack file!"); |
175 | break; | 176 | break; |
176 | } | 177 | } |
@@ -341,7 +342,8 @@ static uint32_t read_next_header (read_stream infile, WavpackHeader *wphdr) | |||
341 | sp = buffer; | 342 | sp = buffer; |
342 | 343 | ||
343 | if (*sp++ == 'w' && *sp == 'v' && *++sp == 'p' && *++sp == 'k' && | 344 | if (*sp++ == 'w' && *sp == 'v' && *++sp == 'p' && *++sp == 'k' && |
344 | !(*++sp & 1) && sp [2] < 16 && !sp [3] && sp [5] == 4 && sp [4] >= 2 && sp [4] <= 0xf) { | 345 | !(*++sp & 1) && sp [2] < 16 && !sp [3] && sp [5] == 4 && |
346 | sp [4] >= (MIN_STREAM_VERS & 0xff) && sp [4] <= (MAX_STREAM_VERS & 0xff)) { | ||
345 | memcpy (wphdr, buffer, sizeof (*wphdr)); | 347 | memcpy (wphdr, buffer, sizeof (*wphdr)); |
346 | little_endian_to_native (wphdr, WavpackHeaderFormat); | 348 | little_endian_to_native (wphdr, WavpackHeaderFormat); |
347 | return bytes_skipped; | 349 | return bytes_skipped; |
@@ -452,7 +454,7 @@ int WavpackSetConfiguration (WavpackContext *wpc, WavpackConfig *config, uint32_ | |||
452 | memcpy (wps->wphdr.ckID, "wvpk", 4); | 454 | memcpy (wps->wphdr.ckID, "wvpk", 4); |
453 | wps->wphdr.ckSize = sizeof (WavpackHeader) - 8; | 455 | wps->wphdr.ckSize = sizeof (WavpackHeader) - 8; |
454 | wps->wphdr.total_samples = wpc->total_samples; | 456 | wps->wphdr.total_samples = wpc->total_samples; |
455 | wps->wphdr.version = 0x403; | 457 | wps->wphdr.version = CUR_STREAM_VERS; |
456 | wps->wphdr.flags = flags; | 458 | wps->wphdr.flags = flags; |
457 | 459 | ||
458 | pack_init (wpc); | 460 | pack_init (wpc); |