aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/aac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-16 20:04:49 +0100
committerMax Kellermann <max@duempel.org>2008-11-16 20:04:49 +0100
commit9c4e97a61b59105c9b539faca272305bbb234c17 (patch)
treedb659e51b1fdf1893475d4fb4af4702bbb71a954 /src/decoder/aac_plugin.c
parentacfba02310a1b8159440dd71bdf7c7fefb7ef8fb (diff)
downloadmpd-9c4e97a61b59105c9b539faca272305bbb234c17.tar.gz
mpd-9c4e97a61b59105c9b539faca272305bbb234c17.tar.xz
mpd-9c4e97a61b59105c9b539faca272305bbb234c17.zip
aac: detect whether to pass "uint32_t*" to NeAACDecInit2()
neaacdec.h declares all arguments as "unsigned long", but internally expects uint32_t pointers. This triggers gcc warnings on 64 bit architectures. To avoid that, make configure.ac detect whether we're using Debian's corrected headers or the original libfaad headers. In any case, pass a pointer to an uint32_t, conditionally casted to "unsigned long*".
Diffstat (limited to 'src/decoder/aac_plugin.c')
-rw-r--r--src/decoder/aac_plugin.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index 76f5480e7..95b19735a 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -251,7 +251,15 @@ static float getAacFloatTotalTime(const char *file)
float length;
faacDecHandle decoder;
faacDecConfigurationPtr config;
- unsigned long sample_rate;
+ uint32_t sample_rate;
+#ifdef HAVE_FAAD_LONG
+ /* neaacdec.h declares all arguments as "unsigned long", but
+ internally expects uint32_t pointers. To avoid gcc
+ warnings, use this workaround. */
+ unsigned long *sample_rate_r = (unsigned long*)&sample_rate;
+#else
+ uint32_t *sample_rate_r = &sample_rate;
+#endif
unsigned char channels;
struct input_stream inStream;
long bread;
@@ -272,9 +280,9 @@ static float getAacFloatTotalTime(const char *file)
fillAacBuffer(&b);
#ifdef HAVE_FAAD_BUFLEN_FUNCS
bread = faacDecInit(decoder, b.buffer, b.bytesIntoBuffer,
- &sample_rate, &channels);
+ sample_rate_r, &channels);
#else
- bread = faacDecInit(decoder, b.buffer, &sample_rate, &channels);
+ bread = faacDecInit(decoder, b.buffer, sample_rate_r, &channels);
#endif
if (bread >= 0 && sample_rate > 0 && channels > 0)
length = 0;
@@ -307,7 +315,15 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
faacDecFrameInfo frameInfo;
faacDecConfigurationPtr config;
long bread;
- unsigned long sample_rate;
+ uint32_t sample_rate;
+#ifdef HAVE_FAAD_LONG
+ /* neaacdec.h declares all arguments as "unsigned long", but
+ internally expects uint32_t pointers. To avoid gcc
+ warnings, use this workaround. */
+ unsigned long *sample_rate_r = (unsigned long*)&sample_rate;
+#else
+ uint32_t *sample_rate_r = &sample_rate;
+#endif
unsigned char channels;
unsigned int sampleCount;
char *sampleBuffer;
@@ -343,9 +359,9 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
#ifdef HAVE_FAAD_BUFLEN_FUNCS
bread = faacDecInit(decoder, b.buffer, b.bytesIntoBuffer,
- &sample_rate, &channels);
+ sample_rate_r, &channels);
#else
- bread = faacDecInit(decoder, b.buffer, &sample_rate, &channels);
+ bread = faacDecInit(decoder, b.buffer, sample_rate_r, &channels);
#endif
if (bread < 0) {
ERROR("Error not a AAC stream.\n");