Commit 4c4f8bf0 authored by Max Kellermann's avatar Max Kellermann

decoder/wavpack: use the correct integer types

libwavpack provides int32_t samples, and wants uin32_t for sample counts.
parent e464be5f
...@@ -34,9 +34,6 @@ ...@@ -34,9 +34,6 @@
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "wavpack" #define G_LOG_DOMAIN "wavpack"
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
#define CHUNK_SIZE 1020
#define ERRORLEN 80 #define ERRORLEN 80
static struct { static struct {
...@@ -162,8 +159,6 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek) ...@@ -162,8 +159,6 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
enum sample_format sample_format; enum sample_format sample_format;
struct audio_format audio_format; struct audio_format audio_format;
format_samples_t format_samples; format_samples_t format_samples;
char chunk[CHUNK_SIZE];
int samples_requested, samples_got;
float total_time; float total_time;
int bytes_per_sample, output_sample_size; int bytes_per_sample, output_sample_size;
...@@ -193,7 +188,9 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek) ...@@ -193,7 +188,9 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
output_sample_size = audio_format_frame_size(&audio_format); output_sample_size = audio_format_frame_size(&audio_format);
/* wavpack gives us all kind of samples in a 32-bit space */ /* wavpack gives us all kind of samples in a 32-bit space */
samples_requested = sizeof(chunk) / (4 * audio_format.channels); int32_t chunk[1024];
const uint32_t samples_requested = G_N_ELEMENTS(chunk) /
audio_format.channels;
decoder_initialized(decoder, &audio_format, can_seek, total_time); decoder_initialized(decoder, &audio_format, can_seek, total_time);
...@@ -217,10 +214,8 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek) ...@@ -217,10 +214,8 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
break; break;
} }
samples_got = WavpackUnpackSamples( uint32_t samples_got = WavpackUnpackSamples(wpc, chunk,
wpc, (int32_t *)chunk, samples_requested samples_requested);
);
if (samples_got == 0) if (samples_got == 0)
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment