+ size_t used;
+
+ if (!s->next_frame)
+ used = max;
+ else { /* we still have some data */
+ used = s->next_frame - s->buffer;
+ assert(used <= max);
+ }
+ btr_consume(btrn, used);
+}
+
+static void mp3dec_close(struct filter_node *fn)
+{
+ struct private_mp3dec_data *pmd = fn->private_data;
+
+ mad_synth_finish(&pmd->synth);
+ mad_frame_finish(&pmd->frame);
+ mad_stream_finish(&pmd->stream);
+
+ free(pmd);
+ fn->private_data = NULL;
+}
+
+#define MP3DEC_MAX_FRAME 8192
+
+static int mp3dec_post_select(__a_unused struct sched *s, struct task *t)
+{
+ struct filter_node *fn = container_of(t, struct filter_node, task);