X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aacdec_filter.c;h=1ac6a99a225ea4b6c4f4faa72ce825dfd285ae72;hp=d48b18e03d729c5617455aa39eb5de91f0ea27ef;hb=92f089b820b45a5dbdc5b4f69d596105d5acba68;hpb=eecc102ad0abeb0335fe994bb72031a15b9090d7 diff --git a/aacdec_filter.c b/aacdec_filter.c index d48b18e0..1ac6a99a 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2009 Andre Noll + * Copyright (C) 2006-2011 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -52,7 +52,7 @@ struct private_aacdec_data { /** The number of channels of the current stream. */ unsigned int channels; /** Current sample rate in Hz. */ - unsigned int samplerate; + unsigned int sample_rate; }; static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result) @@ -60,19 +60,7 @@ static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result) struct filter_node *fn = btr_context(btrn); struct private_aacdec_data *padd = fn->private_data; - if (!strcmp(cmd, "samplerate")) { - if (padd->samplerate == 0) - return -E_BTR_NAVAIL; - *result = make_message("%u", padd->samplerate); - return 1; - } - if (!strcmp(cmd, "channels")) { - if (padd->channels == 0) - return -E_BTR_NAVAIL; - *result = make_message("%u", padd->channels); - return 1; - } - return -ERRNO_TO_PARA_ERROR(ENOTSUP); + return decoder_execute(cmd, padd->sample_rate, padd->channels, result); } static void aacdec_open(struct filter_node *fn) @@ -112,6 +100,7 @@ next_buffer: return; btr_merge(btrn, fn->min_iqs); len = btr_next_buffer(btrn, (char **)&inbuf); + len = PARA_MIN(len, (size_t)8192); consumed = 0; iqs = btr_get_input_queue_size(btrn); if (!padd->initialized) { @@ -139,10 +128,10 @@ next_buffer: &channels) < 0) goto out; } - padd->samplerate = rate; + padd->sample_rate = rate; padd->channels = channels; PARA_INFO_LOG("rate: %u, channels: %d\n", - padd->samplerate, padd->channels); + padd->sample_rate, padd->channels); padd->initialized = 1; } if (padd->decoder_length > 0) { @@ -185,7 +174,8 @@ next_buffer: padd->frame_info.bytesconsumed); PARA_ERROR_LOG("%s\n", NeAACDecGetErrorMessage( padd->frame_info.error)); - consumed++; /* catch 21 */ + if (consumed < len) + consumed++; /* catch 21 */ goto success; } padd->error_count = 0;