]> git.tue.mpg.de Git - paraslash.git/commitdiff
Introduce filter_node->min_iqs.
authorAndre Noll <maan@systemlinux.org>
Sun, 3 Jan 2010 02:23:03 +0000 (03:23 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 3 Jan 2010 02:23:03 +0000 (03:23 +0100)
aacdec_filter.c
filter.h
mp3dec_filter.c
oggdec_filter.c
wmadec_filter.c

index f41fe8b1215800bbff616c3a2efdc87c0b8fa649..b9149ef24960cf9c536afd23dada91d6dbe62658 100644 (file)
@@ -209,6 +209,7 @@ static void aacdec_open(struct filter_node *fn)
        fn->private_data = padd;
        fn->bufsize = AAC_OUTBUF_SIZE;
        fn->buf = para_calloc(fn->bufsize);
+       fn->min_iqs = 2048;
        padd->handle = aac_open();
 }
 
@@ -235,7 +236,7 @@ static void aacdec_post_select(__a_unused struct sched *s, struct task *t)
 
 next_buffer:
        t->error = 0;
-       ret = prepare_filter_node(btrn, 2048);
+       ret = prepare_filter_node(btrn, fn->min_iqs);
        if (ret < 0)
                goto err;
        if (ret == 0)
index ec8631f8a866823c69a32b6d8b5aafe834d38b22..8ef0f27f4d83bcb1cf18035d113d753fb0c0d777 100644 (file)
--- a/filter.h
+++ b/filter.h
@@ -34,6 +34,7 @@ struct filter_node {
        void *conf;
        struct btr_node *btrn;
        struct task task;
+       size_t min_iqs;
 };
 
 /** Describes one running instance of a chain of filters */
index dfec0c4c133591c81c8be1cece951a0ea2a8b48f..c3f21f126ad7911a67e82903bb0ac12cdb49c13e 100644 (file)
@@ -101,10 +101,9 @@ static void mp3dec_pre_select(struct sched *s, struct task *t)
 {
        struct filter_node *fn = container_of(t, struct filter_node, task);
        size_t iqs = btr_get_input_queue_size(fn->btrn);
-       struct private_mp3dec_data *pmd = fn->private_data;
 
        t->error = 0;
-       if (iqs <= pmd->input_len_barrier)
+       if (iqs <= fn->min_iqs)
                return;
        if (btr_bytes_pending(fn->btrn) > MP3DEC_MAX_PENDING)
                return; /* FIXME, should use reasonable bound on timeout */
@@ -216,7 +215,7 @@ next_buffer:
        iqs = btr_get_input_queue_size(btrn);
        if (need_bad_data_delay(pmd, iqs))
                return;
-       ret = prepare_filter_node(btrn, pmd->input_len_barrier);
+       ret = prepare_filter_node(btrn, fn->min_iqs);
        if (ret < 0)
                goto err;
        if (ret == 0)
@@ -233,14 +232,14 @@ next_frame:
                                ret = -E_MP3DEC_EOF;
                                goto err;
                        }
-                       pmd->input_len_barrier += 100;
+                       fn->min_iqs += 100;
                        goto next_buffer;
                } else if (pmd->stream.error != MAD_ERROR_LOSTSYNC)
                        PARA_DEBUG_LOG("header decode: %s\n",
                                mad_stream_errorstr(&pmd->stream));
                goto next_buffer;
        }
-       pmd->input_len_barrier = 0;
+       fn->min_iqs = 0;
        pmd->samplerate = pmd->frame.header.samplerate;
        pmd->channels = MAD_NCHANNELS(&pmd->frame.header);
        ret = mad_frame_decode(&pmd->frame, &pmd->stream);
index f968bf142b2af5afc822c69a9c6ea36469f5a9d5..274d0c2a141222dbb2022d97c9d9fbb047173528 100644 (file)
@@ -43,7 +43,6 @@ struct private_oggdec_data {
        unsigned int channels;
        /** Current sample rate in Hz. */
        unsigned int samplerate;
-       size_t min_iqs;
 };
 
 static size_t cb_read_nobtr(void *buf, size_t size, size_t nmemb, void *datasource)
@@ -208,7 +207,7 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t)
        char *in;
 
        t->error = 0;
-       ret = prepare_filter_node(btrn, pod->min_iqs);
+       ret = prepare_filter_node(btrn, fn->min_iqs);
        if (ret < 0)
                goto err;
        if (ret == 0)
@@ -229,7 +228,7 @@ static void ogg_post_select(__a_unused struct sched *s, struct task *t)
                        if (!btr_no_parent(btrn)) {
                                free(pod->vf);
                                pod->vf = NULL;
-                               pod->min_iqs = iqs + 1;
+                               fn->min_iqs = iqs + 1;
                                return;
                        }
                        ret = (oret == OV_ENOTVORBIS)?
index 7681a762115317f0c6c01c7a7759734110c07ed4..87de6b44aef35bd78c42bd469b2a36c167750d06 100644 (file)
@@ -1249,29 +1249,29 @@ static void wmadec_post_select(__a_unused struct sched *s, struct task *t)
        int ret, converted = 0;
        struct private_wmadec_data *pwd = fn->private_data;
        struct btr_node *btrn = fn->btrn;
-       size_t len, min_len;
+       size_t len;
        char *in;
 
-       min_len = pwd? WMA_FRAME_SKIP + pwd->ahi.block_align : 8192;
 next_buffer:
        t->error = 0;
-       ret = prepare_filter_node(btrn, min_len);
+       ret = prepare_filter_node(btrn, fn->min_iqs);
        if (ret < 0)
                goto err;
        if (ret == 0)
                return;
        len = btr_next_buffer(btrn, (char **)&in);
        ret = -E_WMADEC_EOF;
-       if (len < min_len)
+       if (len < fn->min_iqs)
                goto err;
        if (!pwd) {
                ret = wma_decode_init(in, len, &pwd);
                if (ret < 0)
                        goto err;
                if (ret == 0) {
-                       min_len += 4096;
+                       fn->min_iqs += 4096;
                        goto next_buffer;
                }
+               fn->min_iqs = WMA_FRAME_SKIP + pwd->ahi.block_align;
                fn->private_data = pwd;
                converted = pwd->ahi.header_len;
                goto success;
@@ -1343,6 +1343,7 @@ static void wmadec_open(struct filter_node *fn)
        fn->buf = para_malloc(fn->bufsize);
        fn->private_data = NULL;
        fn->loaded = 0;
+       fn->min_iqs = 4096;
 }
 
 /**