]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aacdec_filter.c
the paraslash-0.4.4 release tarball
[paraslash.git] / aacdec_filter.c
index 79c8bb660a9a94708b1d540d00d35b4795e0ba24..1127fc1132b90d56169c34d732c9343e47e8fa43 100644 (file)
@@ -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, "sample_rate")) {
-               if (padd->sample_rate == 0)
-                       return -E_BTR_NAVAIL;
-               *result = make_message("%u", padd->sample_rate);
-               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,7 +100,7 @@ next_buffer:
                return;
        btr_merge(btrn, fn->min_iqs);
        len = btr_next_buffer(btrn, (char **)&inbuf);
-       len = PARA_MAX(len, (size_t)8192);
+       len = PARA_MIN(len, (size_t)8192);
        consumed = 0;
        iqs = btr_get_input_queue_size(btrn);
        if (!padd->initialized) {
@@ -186,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;