aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/wavpack_decoder_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/wavpack_decoder_plugin.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/decoder/wavpack_decoder_plugin.c b/src/decoder/wavpack_decoder_plugin.c
index 601f05065..c8f0b7152 100644
--- a/src/decoder/wavpack_decoder_plugin.c
+++ b/src/decoder/wavpack_decoder_plugin.c
@@ -34,9 +34,6 @@
#undef G_LOG_DOMAIN
#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
static struct {
@@ -162,8 +159,6 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
enum sample_format sample_format;
struct audio_format audio_format;
format_samples_t format_samples;
- char chunk[CHUNK_SIZE];
- int samples_requested, samples_got;
float total_time;
int bytes_per_sample, output_sample_size;
@@ -193,7 +188,9 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
output_sample_size = audio_format_frame_size(&audio_format);
/* 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);
@@ -217,10 +214,8 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
break;
}
- samples_got = WavpackUnpackSamples(
- wpc, (int32_t *)chunk, samples_requested
- );
-
+ uint32_t samples_got = WavpackUnpackSamples(wpc, chunk,
+ samples_requested);
if (samples_got == 0)
break;