aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-07-19 22:47:12 +0200
committerMax Kellermann <max@duempel.org>2011-07-20 12:54:22 +0200
commit4c4f8bf02a6315ce988fcacab9cfd890c67ca5d0 (patch)
tree6772fa2cf3c2b1e37753298cd152f153d633c63c /src
parente464be5f3922d87942a3afd0f7e9239b89901f2e (diff)
downloadmpd-4c4f8bf02a6315ce988fcacab9cfd890c67ca5d0.tar.gz
mpd-4c4f8bf02a6315ce988fcacab9cfd890c67ca5d0.tar.xz
mpd-4c4f8bf02a6315ce988fcacab9cfd890c67ca5d0.zip
decoder/wavpack: use the correct integer types
libwavpack provides int32_t samples, and wants uin32_t for sample counts.
Diffstat (limited to 'src')
-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;