aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-12 07:41:54 +0100
committerMax Kellermann <max@duempel.org>2008-11-12 07:41:54 +0100
commitf6765c4d8bcf6e34831e714fd70a3de1791c073f (patch)
tree7b4b3a750e2887117dc64adb2d9aafa36b6c733e /src/decoder
parenteff21067f0a3135242ecb9bfdc66e4b6f760089e (diff)
downloadmpd-f6765c4d8bcf6e34831e714fd70a3de1791c073f.tar.gz
mpd-f6765c4d8bcf6e34831e714fd70a3de1791c073f.tar.xz
mpd-f6765c4d8bcf6e34831e714fd70a3de1791c073f.zip
aac: removed attribute "atEof"
Use input_stream_eof() instead.
Diffstat (limited to '')
-rw-r--r--src/decoder/aac_plugin.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index 7847a0f98..d7e6fe7f6 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -34,7 +34,6 @@ typedef struct {
size_t bytesConsumed;
off_t fileOffset;
unsigned char *buffer;
- bool atEof;
} AacBuffer;
static void aac_buffer_shift(AacBuffer * b, size_t length)
@@ -52,7 +51,7 @@ static void aac_buffer_shift(AacBuffer * b, size_t length)
static void fillAacBuffer(AacBuffer * b)
{
- size_t bread;
+ size_t rest, bread;
if (b->bytesIntoBuffer >= FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS)
/* buffer already full */
@@ -60,17 +59,11 @@ static void fillAacBuffer(AacBuffer * b)
aac_buffer_shift(b, b->bytesConsumed);
- if (!b->atEof) {
- size_t rest = FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS -
- b->bytesIntoBuffer;
-
- bread = decoder_read(b->decoder, b->inStream,
- (void *)(b->buffer + b->bytesIntoBuffer),
- rest);
- if (bread == 0 && input_stream_eof(b->inStream))
- b->atEof = true;
- b->bytesIntoBuffer += bread;
- }
+ rest = FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS - b->bytesIntoBuffer;
+ bread = decoder_read(b->decoder, b->inStream,
+ (void *)(b->buffer + b->bytesIntoBuffer),
+ rest);
+ b->bytesIntoBuffer += bread;
if ((b->bytesIntoBuffer > 3 && memcmp(b->buffer, "TAG", 3) == 0) ||
(b->bytesIntoBuffer > 11 &&
@@ -335,7 +328,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
faacDecSetConfiguration(decoder, config);
while (b.bytesIntoBuffer < FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS &&
- !b.atEof &&
+ !input_stream_eof(b.inStream) &&
decoder_get_command(mpd_decoder) == DECODE_COMMAND_NONE) {
fillAacBuffer(&b);
adts_find_frame(&b);