X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=play.c;h=2dcc37ea2bf0954ccea2776c8dd410b85c9804b2;hb=e58586b7395a84e5883b077d89b92c8ac649a1f2;hp=01125ab647f73482bb248ecdbaac2b8b2ad13021;hpb=20c8622c90f488ab398146a9e5b51d61149e96d3;p=paraslash.git diff --git a/play.c b/play.c index 01125ab6..2dcc37ea 100644 --- a/play.c +++ b/play.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2013 Andre Noll + * Copyright (C) 2012-2014 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -249,7 +249,7 @@ static int get_playback_error(struct play_task *pt) return 0; if (pt->fn.task.error >= 0) return 0; - if (pt->rn.task.error >= 0) + if (pt->rn.task->error >= 0) return 0; if (err == -E_BTR_EOF || err == -E_RECV_EOF || err == -E_EOF || err == -E_WRITE_COMMON_EOF) @@ -277,6 +277,7 @@ static int eof_cleanup(struct play_task *pt) free(pt->fn.conf); memset(&pt->fn, 0, sizeof(struct filter_node)); + task_reap(&pt->rn.task); btr_remove_node(&pt->rn.btrn); /* * On eof (ret > 0), we do not wipe the receiver node struct until a @@ -351,9 +352,6 @@ static int open_new_file(struct play_task *pt) free(tmp); tmp = NULL; } - pt->rn.task.pre_select = afh_recv->pre_select; - pt->rn.task.post_select = afh_recv->post_select; - sprintf(pt->rn.task.status, "%s receiver node", afh_recv->name); return 1; fail: wipe_receiver_node(pt); @@ -405,7 +403,13 @@ static int load_file(struct play_task *pt) pt->wn.task.error = 0; /* success, register tasks */ - register_task(&sched, &pt->rn.task); + pt->rn.task = task_register( + &(struct task_info) { + .name = afh_recv->name, + .pre_select = afh_recv->pre_select, + .post_select = afh_recv->post_select, + .context = &pt->rn + }, &sched); register_task(&sched, &pt->fn.task); register_writer_node(&pt->wn, pt->fn.btrn, &sched); return 1; @@ -1250,6 +1254,7 @@ int main(int argc, char *argv[]) sprintf(pt->task.status, "play task"); register_task(&sched, &pt->task); ret = schedule(&sched); + sched_shutdown(&sched); if (ret < 0) PARA_ERROR_LOG("%s\n", para_strerror(-ret)); return ret < 0? EXIT_FAILURE : EXIT_SUCCESS;