aac: removed attribute "atEof"

Use input_stream_eof() instead.
This commit is contained in:
Max Kellermann 2008-11-12 07:41:54 +01:00
parent eff21067f0
commit f6765c4d8b

View File

@ -34,7 +34,6 @@ typedef struct {
size_t bytesConsumed; size_t bytesConsumed;
off_t fileOffset; off_t fileOffset;
unsigned char *buffer; unsigned char *buffer;
bool atEof;
} AacBuffer; } AacBuffer;
static void aac_buffer_shift(AacBuffer * b, size_t length) 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) static void fillAacBuffer(AacBuffer * b)
{ {
size_t bread; size_t rest, bread;
if (b->bytesIntoBuffer >= FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS) if (b->bytesIntoBuffer >= FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS)
/* buffer already full */ /* buffer already full */
@ -60,17 +59,11 @@ static void fillAacBuffer(AacBuffer * b)
aac_buffer_shift(b, b->bytesConsumed); aac_buffer_shift(b, b->bytesConsumed);
if (!b->atEof) { rest = FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS - b->bytesIntoBuffer;
size_t rest = FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS - bread = decoder_read(b->decoder, b->inStream,
b->bytesIntoBuffer; (void *)(b->buffer + b->bytesIntoBuffer),
rest);
bread = decoder_read(b->decoder, b->inStream, b->bytesIntoBuffer += bread;
(void *)(b->buffer + b->bytesIntoBuffer),
rest);
if (bread == 0 && input_stream_eof(b->inStream))
b->atEof = true;
b->bytesIntoBuffer += bread;
}
if ((b->bytesIntoBuffer > 3 && memcmp(b->buffer, "TAG", 3) == 0) || if ((b->bytesIntoBuffer > 3 && memcmp(b->buffer, "TAG", 3) == 0) ||
(b->bytesIntoBuffer > 11 && (b->bytesIntoBuffer > 11 &&
@ -335,7 +328,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
faacDecSetConfiguration(decoder, config); faacDecSetConfiguration(decoder, config);
while (b.bytesIntoBuffer < FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS && while (b.bytesIntoBuffer < FAAD_MIN_STREAMSIZE * AAC_MAX_CHANNELS &&
!b.atEof && !input_stream_eof(b.inStream) &&
decoder_get_command(mpd_decoder) == DECODE_COMMAND_NONE) { decoder_get_command(mpd_decoder) == DECODE_COMMAND_NONE) {
fillAacBuffer(&b); fillAacBuffer(&b);
adts_find_frame(&b); adts_find_frame(&b);