X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=flacdec_filter.c;h=4220b5d61db29b866063f1e6d1769589e1e67f23;hp=e8baa6b4b35031205f4fb28d858a6c1593e7ae7e;hb=8633a2877332e7949b8e2d55d5ebc5a47bda7794;hpb=128c594f32be41d928df432298a013a168891ab7 diff --git a/flacdec_filter.c b/flacdec_filter.c index e8baa6b4..4220b5d6 100644 --- a/flacdec_filter.c +++ b/flacdec_filter.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2012 Andre Noll + * Copyright (C) 2011-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -25,7 +25,7 @@ struct private_flacdec_data { * We can not consume directly what was copied by the read callback * because we might need to feed unconsumend bytes to the decoder again * after the read callback ran out of data and returned ABORT. So we - * track how many bytes are unconsumed so far. + * track how many bytes have been fed to libflac but are unconsumed so far. */ size_t unconsumed; }; @@ -216,15 +216,16 @@ static void flacdec_pre_select(struct sched *s, struct task *t) return sched_min_delay(s); } -static void flacdec_post_select(__a_unused struct sched *s, struct task *t) +static int flacdec_post_select(__a_unused struct sched *s, struct task *t) { struct filter_node *fn = container_of(t, struct filter_node, task); struct private_flacdec_data *pfd = fn->private_data; struct btr_node *btrn = fn->btrn; int ret; + FLAC__StreamDecoderState state; if (output_queue_full(btrn)) - return; + return 0; ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); if (ret < 0 && ret != -E_BTR_EOF) /* fatal error */ goto out; @@ -240,7 +241,6 @@ static void flacdec_post_select(__a_unused struct sched *s, struct task *t) goto out; } pfd->have_more = false; - FLAC__StreamDecoderState state; FLAC__stream_decoder_process_single(pfd->decoder); state = FLAC__stream_decoder_get_state(pfd->decoder); ret = -E_FLACDEC_EOF; @@ -255,9 +255,9 @@ static void flacdec_post_select(__a_unused struct sched *s, struct task *t) fn->min_iqs = 0; ret = 1; out: - t->error = ret; if (ret < 0) - btr_remove_node(btrn); + btr_remove_node(&fn->btrn); + return ret; } static void flacdec_close(struct filter_node *fn)