X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audioc.c;h=3cbd8a82f2d3a52248be600182daf76ecc768d03;hp=09b21ba95c73b976e753eac5da06ff5208ca16da;hb=1995ceed8d70a5b50dbf84ca4132a8c318afa51b;hpb=e83cbfdcc9f5671cab0b1dae5cb81b956d0ab5ce diff --git a/audioc.c b/audioc.c index 09b21ba9..3cbd8a82 100644 --- a/audioc.c +++ b/audioc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2012 Andre Noll + * Copyright (C) 2005-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -106,7 +106,7 @@ static void audioc_pre_select(struct sched *s, struct task *t) para_fd_set(at->fd, &s->rfds, &s->max_fileno); } -static void audioc_post_select(struct sched *s, struct task *t) +static int audioc_post_select(struct sched *s, struct task *t) { char *buf = NULL; struct audioc_task *at = container_of(t, struct audioc_task, task); @@ -115,7 +115,7 @@ static void audioc_post_select(struct sched *s, struct task *t) if (ret < 0) goto out; if (!FD_ISSET(at->fd, &s->rfds)) - return; + return 0; buf = para_malloc(conf.bufsize_arg); ret = recv_bin_buffer(at->fd, buf, conf.bufsize_arg); PARA_DEBUG_LOG("recv: %d\n", ret); @@ -124,22 +124,21 @@ static void audioc_post_select(struct sched *s, struct task *t) if (ret < 0) goto out; btr_add_output(buf, ret, at->btrn); - return; + return 0; out: if (ret < 0) { free(buf); - btr_remove_node(at->btrn); - btr_free_node(at->btrn); - at->btrn = NULL; + btr_remove_node(&at->btrn); close(at->fd); } - t->error = ret; + return ret; } static struct audioc_task audioc_task = { .task = { .pre_select = audioc_pre_select, - .post_select = audioc_post_select, + .new_post_select = audioc_post_select, + .post_select = NULL, .status = "audioc task" }, }, *at = &audioc_task; @@ -341,7 +340,7 @@ int main(int argc, char *argv[]) size_t n = ret = recv_bin_buffer(fd, buf, bufsize); if (ret <= 0) break; - ret = write_all(STDOUT_FILENO, buf, &n); + ret = write_all(STDOUT_FILENO, buf, n); } while (ret >= 0); out: free(buf);