mp3dec: Switch to the alternative post select method.
authorAndre Noll <maan@systemlinux.org>
Sun, 31 Mar 2013 13:25:02 +0000 (13:25 +0000)
committerAndre Noll <maan@systemlinux.org>
Tue, 30 Apr 2013 12:12:45 +0000 (14:12 +0200)
mp3dec_filter.c

index bd1f0d3..0e8c568 100644 (file)
@@ -77,7 +77,7 @@ static void mp3dec_close(struct filter_node *fn)
 
 #define MP3DEC_MAX_FRAME 8192
 
-static void mp3dec_post_select(__a_unused struct sched *s, struct task *t)
+static int mp3dec_post_select(__a_unused struct sched *s, struct task *t)
 {
        struct filter_node *fn = container_of(t, struct filter_node, task);
        int i, ret;
@@ -88,13 +88,12 @@ static void mp3dec_post_select(__a_unused struct sched *s, struct task *t)
 
 next_buffer:
        pmd->stream.error = 0;
-       t->error = 0;
        iqs = btr_get_input_queue_size(btrn);
        ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL);
        if (ret < 0)
                goto err;
        if (ret == 0)
-               return;
+               return 0;
        btr_merge(btrn, fn->min_iqs);
        len = btr_next_buffer(btrn, &inbuffer);
        /*
@@ -120,7 +119,7 @@ next_frame:
                }
                if (loaded == 0)
                        goto next_buffer;
-               return;
+               return 0;
        }
        pmd->sample_rate = pmd->frame.header.samplerate;
        pmd->channels = MAD_NCHANNELS(&pmd->frame.header);
@@ -140,12 +139,12 @@ decode:
                        if (fn->min_iqs > MP3DEC_MAX_FRAME)
                                goto err;
                        mp3dec_consume(btrn, &pmd->stream, len);
-                       return;
+                       return 0;
                }
                if (pmd->stream.error != MAD_ERROR_BADDATAPTR)
                        goto decode;
                mp3dec_consume(btrn, &pmd->stream, len);
-               return;
+               return 0;
        }
        fn->min_iqs = 0;
        mad_synth_frame(&pmd->synth, &pmd->frame);
@@ -165,8 +164,8 @@ decode:
        goto next_frame;
 err:
        assert(ret < 0);
-       t->error = ret;
        btr_remove_node(&fn->btrn);
+       return ret;
 }
 
 static void mp3dec_open(struct filter_node *fn)
@@ -220,7 +219,8 @@ void mp3dec_filter_init(struct filter *f)
        f->parse_config = mp3dec_parse_config;
        f->free_config = mp3dec_free_config;
        f->pre_select = generic_filter_pre_select;
-       f->post_select = mp3dec_post_select;
+       f->new_post_select = mp3dec_post_select;
+       f->post_select = NULL;
        f->execute = mp3dec_execute;
        f->help = (struct ggo_help) {
                .short_help = mp3dec_filter_args_info_help,