aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/aac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:11 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:11 +0200
commit5300f79ca98c55b367a612c93f0d7b2eef72ad23 (patch)
tree5bf98384542c47100647aa86582781c77202f464 /src/inputPlugins/aac_plugin.c
parent351dda01bd48061089883511d532926d425cd447 (diff)
downloadmpd-5300f79ca98c55b367a612c93f0d7b2eef72ad23.tar.gz
mpd-5300f79ca98c55b367a612c93f0d7b2eef72ad23.tar.xz
mpd-5300f79ca98c55b367a612c93f0d7b2eef72ad23.zip
aac: splitted aac_parse_header() from initAacBuffer()
initAacBuffer() should really only initialize the buffer; currently, it also reads data from the input stream and parses the header. All of the AAC buffer code should probably be moved to a separate library anyway.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/aac_plugin.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c
index 7a9137603..a01d4ccbf 100644
--- a/src/inputPlugins/aac_plugin.c
+++ b/src/inputPlugins/aac_plugin.c
@@ -176,22 +176,25 @@ static void adtsParse(AacBuffer * b, float *length)
*length = (float)frames / framesPerSec;
}
-static void initAacBuffer(InputStream * inStream, AacBuffer * b, float *length)
+static void initAacBuffer(InputStream * inStream, AacBuffer * b)
{
- size_t fileread;
- size_t tagsize;
-
- if (length)
- *length = -1;
-
memset(b, 0, sizeof(AacBuffer));
b->inStream = inStream;
- fileread = inStream->size;
-
b->buffer = xmalloc(FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS);
memset(b->buffer, 0, FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS);
+}
+
+static void aac_parse_header(AacBuffer * b, float *length)
+{
+ size_t fileread;
+ size_t tagsize;
+
+ if (length)
+ *length = -1;
+
+ fileread = b->inStream->size;
fillAacBuffer(b);
@@ -256,7 +259,8 @@ static float getAacFloatTotalTime(char *file)
if (openInputStream(&inStream, file) < 0)
return -1;
- initAacBuffer(&inStream, &b, &length);
+ initAacBuffer(&inStream, &b);
+ aac_parse_header(&b, &length);
if (length < 0) {
decoder = faacDecOpen();
@@ -324,7 +328,8 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
if (openInputStream(&inStream, path) < 0)
return -1;
- initAacBuffer(&inStream, &b, NULL);
+ initAacBuffer(&inStream, &b);
+ aac_parse_header(&b, NULL);
decoder = faacDecOpen();