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
commit9131f9ebfe9fe81c30b5bed62e4d86ec805ca740 (patch)
tree3790d6fe94ed9c4f4e6ed3563992c9d8e62bdec0 /src/inputPlugins/aac_plugin.c
parent00c47b3c85ef5d67e02bb1ea5f7e35b727803d01 (diff)
downloadmpd-9131f9ebfe9fe81c30b5bed62e4d86ec805ca740.tar.gz
mpd-9131f9ebfe9fe81c30b5bed62e4d86ec805ca740.tar.xz
mpd-9131f9ebfe9fe81c30b5bed62e4d86ec805ca740.zip
aac: use fillAacBuffer() instead of manual reading
Eliminate some duplicated code by using fillAacBuffer().
Diffstat (limited to 'src/inputPlugins/aac_plugin.c')
-rw-r--r--src/inputPlugins/aac_plugin.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c
index 8bdf22446..b48d985b4 100644
--- a/src/inputPlugins/aac_plugin.c
+++ b/src/inputPlugins/aac_plugin.c
@@ -179,7 +179,6 @@ static void adtsParse(AacBuffer * b, float *length)
static void initAacBuffer(InputStream * inStream, AacBuffer * b, float *length)
{
size_t fileread;
- size_t bread;
size_t tagsize;
if (length)
@@ -194,14 +193,7 @@ static void initAacBuffer(InputStream * inStream, AacBuffer * b, float *length)
b->buffer = xmalloc(FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS);
memset(b->buffer, 0, FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS);
- bread = readFromInputStream(inStream, b->buffer, 1,
- FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS);
- b->bytesIntoBuffer = bread;
- b->bytesConsumed = 0;
- b->fileOffset = 0;
-
- if (bread == 0 && inputStreamAtEOF(inStream))
- b->atEof = 1;
+ fillAacBuffer(b);
tagsize = 0;
if (!memcmp(b->buffer, "ID3", 3)) {
@@ -220,15 +212,11 @@ static void initAacBuffer(InputStream * inStream, AacBuffer * b, float *length)
adtsParse(b, length);
seekInputStream(b->inStream, tagsize, SEEK_SET);
- bread = readFromInputStream(b->inStream, b->buffer, 1,
- FAAD_MIN_STREAMSIZE *
- AAC_MAX_CHANNELS);
- if (bread == 0 && inputStreamAtEOF(inStream))
- b->atEof = 1;
-
- b->bytesIntoBuffer = bread;
+ b->bytesIntoBuffer = 0;
b->bytesConsumed = 0;
b->fileOffset = tagsize;
+
+ fillAacBuffer(b);
} else if (memcmp(b->buffer, "ADIF", 4) == 0) {
int bitRate;
int skipSize = (b->buffer[4] & 0x80) ? 9 : 0;