]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
play: Remove pointless play_task arguments.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 29 Apr 2017 14:08:13 +0000 (16:08 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 25 May 2017 14:49:08 +0000 (16:49 +0200)
The play task is a global variable anyway, so it's pointless to pass
it to almost every function.

play.c

diff --git a/play.c b/play.c
index 10451039726037cf0d0628d8e5d5ddb1acb75b45..b54a46966355757a49c8a540d4b958b0696de688 100644 (file)
--- a/play.c
+++ b/play.c
@@ -109,8 +109,7 @@ struct play_task {
        char *afhi_txt;
 };
 
        char *afhi_txt;
 };
 
-typedef int (*play_cmd_handler_t)(struct play_task *pt,
-               struct lls_parse_result *lpr);
+typedef int (*play_cmd_handler_t)(struct lls_parse_result *lpr);
 struct play_command_info {
        play_cmd_handler_t handler;
 };
 struct play_command_info {
        play_cmd_handler_t handler;
 };
@@ -127,7 +126,7 @@ INIT_STDERR_LOGGING(loglevel);
 char *stat_item_values[NUM_STAT_ITEMS] = {NULL};
 
 static struct sched sched = {.max_fileno = 0};
 char *stat_item_values[NUM_STAT_ITEMS] = {NULL};
 
 static struct sched sched = {.max_fileno = 0};
-static struct play_task play_task;
+static struct play_task play_task, *pt = &play_task;
 
 #define AFH_RECV_CMD (lls_cmd(LSG_RECV_CMD_CMD_AFH, recv_cmd_suite))
 #define AFH_RECV ((struct receiver *)lls_user_data(AFH_RECV_CMD))
 
 #define AFH_RECV_CMD (lls_cmd(LSG_RECV_CMD_CMD_AFH, recv_cmd_suite))
 #define AFH_RECV ((struct receiver *)lls_user_data(AFH_RECV_CMD))
@@ -228,7 +227,7 @@ fail:
        exit(EXIT_FAILURE);
 }
 
        exit(EXIT_FAILURE);
 }
 
-static char get_playback_state(struct play_task *pt)
+static char get_playback_state(void)
 {
        switch (pt->rq) {
        case CRT_NONE: return pt->playing? 'P' : 'U';
 {
        switch (pt->rq) {
        case CRT_NONE: return pt->playing? 'P' : 'U';
@@ -239,9 +238,9 @@ static char get_playback_state(struct play_task *pt)
        assert(false);
 };
 
        assert(false);
 };
 
-static long unsigned get_play_time(struct play_task *pt)
+static long unsigned get_play_time(void)
 {
 {
-       char state = get_playback_state(pt);
+       char state = get_playback_state();
        long unsigned result;
 
        if (state != 'P' && state != 'U')
        long unsigned result;
 
        if (state != 'P' && state != 'U')
@@ -263,7 +262,7 @@ static long unsigned get_play_time(struct play_task *pt)
 }
 
 
 }
 
 
-static void wipe_receiver_node(struct play_task *pt)
+static void wipe_receiver_node(void)
 {
        PARA_NOTICE_LOG("cleaning up receiver node\n");
        btr_remove_node(&pt->rn.btrn);
 {
        PARA_NOTICE_LOG("cleaning up receiver node\n");
        btr_remove_node(&pt->rn.btrn);
@@ -273,7 +272,7 @@ static void wipe_receiver_node(struct play_task *pt)
 }
 
 /* returns: 0 not eof, 1: eof, < 0: fatal error.  */
 }
 
 /* returns: 0 not eof, 1: eof, < 0: fatal error.  */
-static int get_playback_error(struct play_task *pt)
+static int get_playback_error(void)
 {
        int err;
 
 {
        int err;
 
@@ -292,13 +291,13 @@ static int get_playback_error(struct play_task *pt)
        return err;
 }
 
        return err;
 }
 
-static int eof_cleanup(struct play_task *pt)
+static int eof_cleanup(void)
 {
        const struct filter *decoder;
        const struct writer *w = writer_get(-1); /* default writer */
        int ret;
 
 {
        const struct filter *decoder;
        const struct writer *w = writer_get(-1); /* default writer */
        int ret;
 
-       ret = get_playback_error(pt);
+       ret = get_playback_error();
        if (ret == 0)
                return ret;
        PARA_NOTICE_LOG("cleaning up wn/fn nodes\n");
        if (ret == 0)
                return ret;
        PARA_NOTICE_LOG("cleaning up wn/fn nodes\n");
@@ -324,7 +323,7 @@ static int eof_cleanup(struct play_task *pt)
         * paused.
         */
        if (ret < 0)
         * paused.
         */
        if (ret < 0)
-               wipe_receiver_node(pt);
+               wipe_receiver_node();
        return ret;
 }
 
        return ret;
 }
 
@@ -352,7 +351,7 @@ static struct btr_node *new_recv_btrn(struct receiver_node *rn)
                        .handler = AFH_RECV->execute));
 }
 
                        .handler = AFH_RECV->execute));
 }
 
-static int open_new_file(struct play_task *pt)
+static int open_new_file(void)
 {
        int ret;
        const char *path = get_playlist_file(pt->next_file);
 {
        int ret;
        const char *path = get_playlist_file(pt->next_file);
@@ -360,7 +359,7 @@ static int open_new_file(struct play_task *pt)
        char *argv[] = {"play", "-f", tmp, "-b", "0", NULL};
 
        PARA_NOTICE_LOG("next file: %s\n", path);
        char *argv[] = {"play", "-f", tmp, "-b", "0", NULL};
 
        PARA_NOTICE_LOG("next file: %s\n", path);
-       wipe_receiver_node(pt);
+       wipe_receiver_node();
        pt->start_chunk = 0;
        pt->rn.btrn = new_recv_btrn(&pt->rn);
        ret = lls(lls_parse(ARRAY_SIZE(argv) - 1, argv, AFH_RECV_CMD,
        pt->start_chunk = 0;
        pt->rn.btrn = new_recv_btrn(&pt->rn);
        ret = lls(lls_parse(ARRAY_SIZE(argv) - 1, argv, AFH_RECV_CMD,
@@ -400,11 +399,11 @@ static int open_new_file(struct play_task *pt)
        }
        return 1;
 fail:
        }
        return 1;
 fail:
-       wipe_receiver_node(pt);
+       wipe_receiver_node();
        return ret;
 }
 
        return ret;
 }
 
-static int load_file(struct play_task *pt)
+static int load_file(void)
 {
        const char *af;
        char *tmp, buf[20];
 {
        const char *af;
        char *tmp, buf[20];
@@ -414,7 +413,7 @@ static int load_file(struct play_task *pt)
 
        btr_remove_node(&pt->rn.btrn);
        if (!pt->rn.receiver || pt->next_file != pt->current_file) {
 
        btr_remove_node(&pt->rn.btrn);
        if (!pt->rn.receiver || pt->next_file != pt->current_file) {
-               ret = open_new_file(pt);
+               ret = open_new_file();
                if (ret < 0)
                        return ret;
        } else {
                if (ret < 0)
                        return ret;
        } else {
@@ -468,11 +467,11 @@ static int load_file(struct play_task *pt)
        register_writer_node(&pt->wn, pt->fn.btrn, &sched);
        return 1;
 fail:
        register_writer_node(&pt->wn, pt->fn.btrn, &sched);
        return 1;
 fail:
-       wipe_receiver_node(pt);
+       wipe_receiver_node();
        return ret;
 }
 
        return ret;
 }
 
-static int next_valid_file(struct play_task *pt)
+static int next_valid_file(void)
 {
        int i, j = pt->current_file;
        unsigned num_inputs = lls_num_inputs(play_lpr);
 {
        int i, j = pt->current_file;
        unsigned num_inputs = lls_num_inputs(play_lpr);
@@ -485,20 +484,20 @@ static int next_valid_file(struct play_task *pt)
        return -E_NO_VALID_FILES;
 }
 
        return -E_NO_VALID_FILES;
 }
 
-static int load_next_file(struct play_task *pt)
+static int load_next_file(void)
 {
        int ret;
 
 again:
        if (pt->rq == CRT_NONE) {
                pt->start_chunk = 0;
 {
        int ret;
 
 again:
        if (pt->rq == CRT_NONE) {
                pt->start_chunk = 0;
-               ret = next_valid_file(pt);
+               ret = next_valid_file();
                if (ret < 0)
                        return ret;
                pt->next_file = ret;
        } else if (pt->rq == CRT_REPOS)
                pt->next_file = pt->current_file;
                if (ret < 0)
                        return ret;
                pt->next_file = ret;
        } else if (pt->rq == CRT_REPOS)
                pt->next_file = pt->current_file;
-       ret = load_file(pt);
+       ret = load_file();
        if (ret < 0) {
                PARA_ERROR_LOG("%s: marking file as invalid\n",
                        para_strerror(-ret));
        if (ret < 0) {
                PARA_ERROR_LOG("%s: marking file as invalid\n",
                        para_strerror(-ret));
@@ -511,7 +510,7 @@ again:
        return ret;
 }
 
        return ret;
 }
 
-static void kill_stream(struct play_task *pt)
+static void kill_stream(void)
 {
        if (pt->wn.task)
                task_notify(pt->wn.task, E_EOF);
 {
        if (pt->wn.task)
                task_notify(pt->wn.task, E_EOF);
@@ -520,7 +519,7 @@ static void kill_stream(struct play_task *pt)
 #ifdef HAVE_READLINE
 
 /* only called from com_prev(), nec. only if we have readline */
 #ifdef HAVE_READLINE
 
 /* only called from com_prev(), nec. only if we have readline */
-static int previous_valid_file(struct play_task *pt)
+static int previous_valid_file(void)
 {
        int i, j = pt->current_file;
        unsigned num_inputs = lls_num_inputs(play_lpr);
 {
        int i, j = pt->current_file;
        unsigned num_inputs = lls_num_inputs(play_lpr);
@@ -730,7 +729,7 @@ static struct i9e_completer pp_completers[] = {
        {.name = NULL}
 };
 
        {.name = NULL}
 };
 
-static void attach_stdout(struct play_task *pt, const char *name)
+static void attach_stdout(const char *name)
 {
        if (pt->btrn)
                return;
 {
        if (pt->btrn)
                return;
@@ -739,20 +738,19 @@ static void attach_stdout(struct play_task *pt, const char *name)
        i9e_attach_to_stdout(pt->btrn);
 }
 
        i9e_attach_to_stdout(pt->btrn);
 }
 
-static void detach_stdout(struct play_task *pt)
+static void detach_stdout(void)
 {
        btr_remove_node(&pt->btrn);
 }
 
 {
        btr_remove_node(&pt->btrn);
 }
 
-static int com_quit(struct play_task *pt,
-               __a_unused struct lls_parse_result *lpr)
+static int com_quit(__a_unused struct lls_parse_result *lpr)
 {
        pt->rq = CRT_TERM_RQ;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(quit);
 
 {
        pt->rq = CRT_TERM_RQ;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(quit);
 
-static int com_help(struct play_task *pt, struct lls_parse_result *lpr)
+static int com_help(struct lls_parse_result *lpr)
 {
        int i, ret;
        char *buf, *errctx;
 {
        int i, ret;
        char *buf, *errctx;
@@ -805,8 +803,7 @@ static int com_help(struct play_task *pt, struct lls_parse_result *lpr)
 }
 EXPORT_PLAY_CMD_HANDLER(help);
 
 }
 EXPORT_PLAY_CMD_HANDLER(help);
 
-static int com_info(struct play_task *pt,
-               __a_unused struct lls_parse_result *lpr)
+static int com_info(__a_unused struct lls_parse_result *lpr)
 {
        char *buf;
        size_t sz;
 {
        char *buf;
        size_t sz;
@@ -821,7 +818,7 @@ static int com_info(struct play_task *pt,
 }
 EXPORT_PLAY_CMD_HANDLER(info);
 
 }
 EXPORT_PLAY_CMD_HANDLER(info);
 
-static void list_file(struct play_task *pt, int num)
+static void list_file(int num)
 {
        char *buf;
        size_t sz;
 {
        char *buf;
        size_t sz;
@@ -831,8 +828,7 @@ static void list_file(struct play_task *pt, int num)
        btr_add_output(buf, sz, pt->btrn);
 }
 
        btr_add_output(buf, sz, pt->btrn);
 }
 
-static int com_tasks(struct play_task *pt,
-               __a_unused struct lls_parse_result *lpr)
+static int com_tasks(__a_unused struct lls_parse_result *lpr)
 {
        static char state;
        char *buf;
 {
        static char state;
        char *buf;
@@ -840,26 +836,25 @@ static int com_tasks(struct play_task *pt,
 
        buf = get_task_list(&sched);
        btr_add_output(buf, strlen(buf), pt->btrn);
 
        buf = get_task_list(&sched);
        btr_add_output(buf, strlen(buf), pt->btrn);
-       state = get_playback_state(pt);
+       state = get_playback_state();
        sz = xasprintf(&buf, "state: %c\n", state);
        btr_add_output(buf, sz, pt->btrn);
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(tasks);
 
        sz = xasprintf(&buf, "state: %c\n", state);
        btr_add_output(buf, sz, pt->btrn);
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(tasks);
 
-static int com_ls(struct play_task *pt,
-       __a_unused struct lls_parse_result *lpr)
+static int com_ls(__a_unused struct lls_parse_result *lpr)
 {
        int i;
        unsigned num_inputs = lls_num_inputs(play_lpr);
 
        for (i = 0; i < num_inputs; i++)
 {
        int i;
        unsigned num_inputs = lls_num_inputs(play_lpr);
 
        for (i = 0; i < num_inputs; i++)
-               list_file(pt, i);
+               list_file(i);
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(ls);
 
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(ls);
 
-static int com_play(struct play_task *pt, struct lls_parse_result *lpr)
+static int com_play(struct lls_parse_result *lpr)
 {
        int32_t x;
        int ret;
 {
        int32_t x;
        int ret;
@@ -872,7 +867,7 @@ static int com_play(struct play_task *pt, struct lls_parse_result *lpr)
                free(errctx);
                return ret;
        }
                free(errctx);
                return ret;
        }
-       state = get_playback_state(pt);
+       state = get_playback_state();
        if (lls_num_inputs(lpr) == 0) {
                if (state == 'P')
                        return 0;
        if (lls_num_inputs(lpr) == 0) {
                if (state == 'P')
                        return 0;
@@ -886,24 +881,23 @@ static int com_play(struct play_task *pt, struct lls_parse_result *lpr)
                return ret;
        if (x < 0 || x >= lls_num_inputs(play_lpr))
                return -ERRNO_TO_PARA_ERROR(EINVAL);
                return ret;
        if (x < 0 || x >= lls_num_inputs(play_lpr))
                return -ERRNO_TO_PARA_ERROR(EINVAL);
-       kill_stream(pt);
+       kill_stream();
        pt->next_file = x;
        pt->rq = CRT_FILE_CHANGE;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(play);
 
        pt->next_file = x;
        pt->rq = CRT_FILE_CHANGE;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(play);
 
-static int com_pause(struct play_task *pt,
-               __a_unused struct lls_parse_result *lpr)
+static int com_pause(__a_unused struct lls_parse_result *lpr)
 {
        char state;
        long unsigned seconds, ss;
 
 {
        char state;
        long unsigned seconds, ss;
 
-       state = get_playback_state(pt);
+       state = get_playback_state();
        pt->playing = false;
        if (state != 'P')
                return 0;
        pt->playing = false;
        if (state != 'P')
                return 0;
-       seconds = get_play_time(pt);
+       seconds = get_play_time();
        pt->playing = false;
        ss = 0;
        if (pt->seconds > 0)
        pt->playing = false;
        ss = 0;
        if (pt->seconds > 0)
@@ -911,20 +905,19 @@ static int com_pause(struct play_task *pt,
        ss = PARA_MAX(ss, 0UL);
        ss = PARA_MIN(ss, pt->num_chunks);
        pt->start_chunk = ss;
        ss = PARA_MAX(ss, 0UL);
        ss = PARA_MIN(ss, pt->num_chunks);
        pt->start_chunk = ss;
-       kill_stream(pt);
+       kill_stream();
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(pause);
 
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(pause);
 
-static int com_prev(struct play_task *pt,
-       __a_unused struct lls_parse_result *lpr)
+static int com_prev(__a_unused struct lls_parse_result *lpr)
 {
        int ret;
 
 {
        int ret;
 
-       ret = previous_valid_file(pt);
+       ret = previous_valid_file();
        if (ret < 0)
                return ret;
        if (ret < 0)
                return ret;
-       kill_stream(pt);
+       kill_stream();
        pt->next_file = ret;
        pt->rq = CRT_FILE_CHANGE;
        pt->start_chunk = 0;
        pt->next_file = ret;
        pt->rq = CRT_FILE_CHANGE;
        pt->start_chunk = 0;
@@ -932,15 +925,14 @@ static int com_prev(struct play_task *pt,
 }
 EXPORT_PLAY_CMD_HANDLER(prev);
 
 }
 EXPORT_PLAY_CMD_HANDLER(prev);
 
-static int com_next(struct play_task *pt,
-               __a_unused struct lls_parse_result *lpr)
+static int com_next(__a_unused struct lls_parse_result *lpr)
 {
        int ret;
 
 {
        int ret;
 
-       ret = next_valid_file(pt);
+       ret = next_valid_file();
        if (ret < 0)
                return ret;
        if (ret < 0)
                return ret;
-       kill_stream(pt);
+       kill_stream();
        pt->next_file = ret;
        pt->rq = CRT_FILE_CHANGE;
        pt->start_chunk = 0;
        pt->next_file = ret;
        pt->rq = CRT_FILE_CHANGE;
        pt->start_chunk = 0;
@@ -948,23 +940,21 @@ static int com_next(struct play_task *pt,
 }
 EXPORT_PLAY_CMD_HANDLER(next);
 
 }
 EXPORT_PLAY_CMD_HANDLER(next);
 
-static int com_fg(struct play_task *pt,
-               __a_unused struct lls_parse_result *lpr)
+static int com_fg(__a_unused struct lls_parse_result *lpr)
 {
        pt->background = false;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(fg);
 
 {
        pt->background = false;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(fg);
 
-static int com_bg(struct play_task *pt,
-       __a_unused struct lls_parse_result *lpr)
+static int com_bg(__a_unused struct lls_parse_result *lpr)
 {
        pt->background = true;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(bg);
 
 {
        pt->background = true;
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(bg);
 
-static int com_jmp(struct play_task *pt, struct lls_parse_result *lpr)
+static int com_jmp(struct lls_parse_result *lpr)
 {
        int32_t percent;
        int ret;
 {
        int32_t percent;
        int ret;
@@ -983,19 +973,19 @@ static int com_jmp(struct play_task *pt, struct lls_parse_result *lpr)
        if (percent < 0 || percent > 100)
                return -ERRNO_TO_PARA_ERROR(EINVAL);
        if (percent == 100)
        if (percent < 0 || percent > 100)
                return -ERRNO_TO_PARA_ERROR(EINVAL);
        if (percent == 100)
-               return com_next(pt, NULL);
+               return com_next(NULL);
        if (pt->playing && !pt->fn.btrn)
                return 0;
        pt->start_chunk = percent * pt->num_chunks / 100;
        if (!pt->playing)
                return 0;
        pt->rq = CRT_REPOS;
        if (pt->playing && !pt->fn.btrn)
                return 0;
        pt->start_chunk = percent * pt->num_chunks / 100;
        if (!pt->playing)
                return 0;
        pt->rq = CRT_REPOS;
-       kill_stream(pt);
+       kill_stream();
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(jmp);
 
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(jmp);
 
-static int com_ff(struct play_task *pt, struct lls_parse_result *lpr)
+static int com_ff(struct lls_parse_result *lpr)
 {
        int32_t seconds;
        char *errctx;
 {
        int32_t seconds;
        char *errctx;
@@ -1013,7 +1003,7 @@ static int com_ff(struct play_task *pt, struct lls_parse_result *lpr)
                return ret;
        if (pt->playing && !pt->fn.btrn)
                return 0;
                return ret;
        if (pt->playing && !pt->fn.btrn)
                return 0;
-       seconds += get_play_time(pt);
+       seconds += get_play_time();
        seconds = PARA_MIN(seconds, (typeof(seconds))pt->seconds - 4);
        seconds = PARA_MAX(seconds, 0);
        pt->start_chunk = pt->num_chunks * seconds / pt->seconds;
        seconds = PARA_MIN(seconds, (typeof(seconds))pt->seconds - 4);
        seconds = PARA_MAX(seconds, 0);
        pt->start_chunk = pt->num_chunks * seconds / pt->seconds;
@@ -1022,12 +1012,12 @@ static int com_ff(struct play_task *pt, struct lls_parse_result *lpr)
        if (!pt->playing)
                return 0;
        pt->rq = CRT_REPOS;
        if (!pt->playing)
                return 0;
        pt->rq = CRT_REPOS;
-       kill_stream(pt);
+       kill_stream();
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(ff);
 
        return 0;
 }
 EXPORT_PLAY_CMD_HANDLER(ff);
 
-static int run_command(char *line, struct play_task *pt)
+static int run_command(char *line)
 {
        int ret, argc;
        char **argv = NULL;
 {
        int ret, argc;
        char **argv = NULL;
@@ -1036,7 +1026,7 @@ static int run_command(char *line, struct play_task *pt)
        struct lls_parse_result *lpr;
        const struct lls_command *cmd;
 
        struct lls_parse_result *lpr;
        const struct lls_command *cmd;
 
-       attach_stdout(pt, __FUNCTION__);
+       attach_stdout(__FUNCTION__);
        ret = create_argv(line, " ", &argv);
        if (ret < 0)
                goto out;
        ret = create_argv(line, " ", &argv);
        if (ret < 0)
                goto out;
@@ -1051,7 +1041,7 @@ static int run_command(char *line, struct play_task *pt)
        if (ret < 0)
                goto out;
        pci = lls_user_data(cmd);
        if (ret < 0)
                goto out;
        pci = lls_user_data(cmd);
-       ret = pci->handler(pt, lpr);
+       ret = pci->handler(lpr);
        lls_free_parse_result(lpr, cmd);
 out:
        if (errctx)
        lls_free_parse_result(lpr, cmd);
 out:
        if (errctx)
@@ -1063,12 +1053,11 @@ out:
 
 static int play_i9e_line_handler(char *line)
 {
 
 static int play_i9e_line_handler(char *line)
 {
-       return run_command(line, &play_task);
+       return run_command(line);
 }
 
 static int play_i9e_key_handler(int key)
 {
 }
 
 static int play_i9e_key_handler(int key)
 {
-       struct play_task *pt = &play_task;
        int idx = get_key_map_idx(key);
        char *seq = get_key_map_seq(key);
        char *cmd = get_key_map_cmd(key);
        int idx = get_key_map_idx(key);
        char *seq = get_key_map_seq(key);
        char *cmd = get_key_map_cmd(key);
@@ -1077,7 +1066,7 @@ static int play_i9e_key_handler(int key)
        PARA_NOTICE_LOG("pressed %d: %s key #%d (%s -> %s)\n",
                key, internal? "internal" : "user-defined",
                idx, seq, cmd);
        PARA_NOTICE_LOG("pressed %d: %s key #%d (%s -> %s)\n",
                key, internal? "internal" : "user-defined",
                idx, seq, cmd);
-       run_command(cmd, pt);
+       run_command(cmd);
        free(seq);
        free(cmd);
        pt->next_update = *now;
        free(seq);
        free(cmd);
        pt->next_update = *now;
@@ -1094,7 +1083,7 @@ static struct i9e_client_info ici = {
 
 static void sigint_handler(int sig)
 {
 
 static void sigint_handler(int sig)
 {
-       play_task.background = true;
+       pt->background = true;
        i9e_signal_dispatch(sig);
 }
 
        i9e_signal_dispatch(sig);
 }
 
@@ -1103,7 +1092,7 @@ static void sigint_handler(int sig)
  * stderr. Once the i9e subsystem has been initialized, we switch to the i9e
  * log facility.
  */
  * stderr. Once the i9e subsystem has been initialized, we switch to the i9e
  * log facility.
  */
-static void session_open(struct play_task *pt)
+static void session_open(void)
 {
        int ret;
        char *history_file;
 {
        int ret;
        char *history_file;
@@ -1147,7 +1136,7 @@ out:
        exit(EXIT_FAILURE);
 }
 
        exit(EXIT_FAILURE);
 }
 
-static void session_update_time_string(struct play_task *pt, char *str, unsigned len)
+static void session_update_time_string(char *str, unsigned len)
 {
        if (pt->background)
                return;
 {
        if (pt->background)
                return;
@@ -1172,30 +1161,30 @@ static void session_update_time_string(struct play_task *pt, char *str, unsigned
  * terminates. Subsequent calls to i9e_get_error() then return negative and we
  * are allowed to call i9e_close() and terminate as well.
  */
  * terminates. Subsequent calls to i9e_get_error() then return negative and we
  * are allowed to call i9e_close() and terminate as well.
  */
-static int session_post_select(__a_unused struct sched *s, struct play_task *pt)
+static int session_post_select(__a_unused struct sched *s)
 {
        int ret;
 
        if (pt->background)
 {
        int ret;
 
        if (pt->background)
-               detach_stdout(pt);
+               detach_stdout();
        else
        else
-               attach_stdout(pt, __FUNCTION__);
+               attach_stdout(__FUNCTION__);
        ret = i9e_get_error();
        if (ret < 0) {
        ret = i9e_get_error();
        if (ret < 0) {
-               kill_stream(pt);
+               kill_stream();
                i9e_close();
                para_log = stderr_log;
                free(ici.history_file);
                return ret;
        }
                i9e_close();
                para_log = stderr_log;
                free(ici.history_file);
                return ret;
        }
-       if (get_playback_state(pt) == 'X')
+       if (get_playback_state() == 'X')
                i9e_signal_dispatch(SIGTERM);
        return 0;
 }
 
 #else /* HAVE_READLINE */
 
                i9e_signal_dispatch(SIGTERM);
        return 0;
 }
 
 #else /* HAVE_READLINE */
 
-static int session_post_select(struct sched *s, struct play_task *pt)
+static int session_post_select(struct sched *s)
 {
        char c;
 
 {
        char c;
 
@@ -1203,38 +1192,36 @@ static int session_post_select(struct sched *s, struct play_task *pt)
                return 0;
        if (read(STDIN_FILENO, &c, 1))
                do_nothing;
                return 0;
        if (read(STDIN_FILENO, &c, 1))
                do_nothing;
-       kill_stream(pt);
+       kill_stream();
        return 1;
 }
 
        return 1;
 }
 
-static void session_open(__a_unused struct play_task *pt)
+static void session_open(void)
 {
 }
 
 {
 }
 
-static void session_update_time_string(__a_unused struct play_task *pt,
-               char *str, __a_unused unsigned len)
+static void session_update_time_string(char *str, __a_unused unsigned len)
 {
        printf("\r%s     ", str);
        fflush(stdout);
 }
 #endif /* HAVE_READLINE */
 
 {
        printf("\r%s     ", str);
        fflush(stdout);
 }
 #endif /* HAVE_READLINE */
 
-static void play_pre_select(struct sched *s, void *context)
+static void play_pre_select(struct sched *s, __a_unused void *context)
 {
 {
-       struct play_task *pt = context;
        char state;
 
        para_fd_set(STDIN_FILENO, &s->rfds, &s->max_fileno);
        char state;
 
        para_fd_set(STDIN_FILENO, &s->rfds, &s->max_fileno);
-       state = get_playback_state(pt);
+       state = get_playback_state();
        if (state == 'R' || state == 'F' || state == 'X')
                return sched_min_delay(s);
        sched_request_barrier_or_min_delay(&pt->next_update, s);
 }
 
        if (state == 'R' || state == 'F' || state == 'X')
                return sched_min_delay(s);
        sched_request_barrier_or_min_delay(&pt->next_update, s);
 }
 
-static unsigned get_time_string(struct play_task *pt, char **result)
+static unsigned get_time_string(char **result)
 {
        int seconds, length;
 {
        int seconds, length;
-       char state = get_playback_state(pt);
+       char state = get_playback_state();
 
        /* do not return anything if things are about to change */
        if (state != 'P' && state != 'U') {
 
        /* do not return anything if things are about to change */
        if (state != 'P' && state != 'U') {
@@ -1244,7 +1231,7 @@ static unsigned get_time_string(struct play_task *pt, char **result)
        length = pt->seconds;
        if (length == 0)
                return xasprintf(result, "0:00 [0:00] (0%%/0:00)");
        length = pt->seconds;
        if (length == 0)
                return xasprintf(result, "0:00 [0:00] (0%%/0:00)");
-       seconds = get_play_time(pt);
+       seconds = get_play_time();
        return xasprintf(result, "#%u: %d:%02d [%d:%02d] (%d%%/%d:%02d) %s",
                pt->current_file,
                seconds / 60,
        return xasprintf(result, "#%u: %d:%02d [%d:%02d] (%d%%/%d:%02d) %s",
                pt->current_file,
                seconds / 60,
@@ -1258,24 +1245,23 @@ static unsigned get_time_string(struct play_task *pt, char **result)
        );
 }
 
        );
 }
 
-static int play_post_select(struct sched *s, void *context)
+static int play_post_select(struct sched *s, __a_unused void *context)
 {
 {
-       struct play_task *pt = context;
        int ret;
 
        int ret;
 
-       ret = eof_cleanup(pt);
+       ret = eof_cleanup();
        if (ret < 0) {
                pt->rq = CRT_TERM_RQ;
                return 0;
        }
        if (ret < 0) {
                pt->rq = CRT_TERM_RQ;
                return 0;
        }
-       ret = session_post_select(s, pt);
+       ret = session_post_select(s);
        if (ret < 0)
                goto out;
        if (!pt->wn.btrn && !pt->fn.btrn) {
        if (ret < 0)
                goto out;
        if (!pt->wn.btrn && !pt->fn.btrn) {
-               char state = get_playback_state(pt);
+               char state = get_playback_state();
                if (state == 'P' || state == 'R' || state == 'F') {
                        PARA_NOTICE_LOG("state: %c\n", state);
                if (state == 'P' || state == 'R' || state == 'F') {
                        PARA_NOTICE_LOG("state: %c\n", state);
-                       ret = load_next_file(pt);
+                       ret = load_next_file();
                        if (ret < 0) {
                                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                                pt->rq = CRT_TERM_RQ;
                        if (ret < 0) {
                                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                                pt->rq = CRT_TERM_RQ;
@@ -1287,10 +1273,10 @@ static int play_post_select(struct sched *s, void *context)
        }
        if (tv_diff(now, &pt->next_update, NULL) >= 0) {
                char *str;
        }
        if (tv_diff(now, &pt->next_update, NULL) >= 0) {
                char *str;
-               unsigned len = get_time_string(pt, &str);
+               unsigned len = get_time_string(&str);
                struct timeval delay = {.tv_sec = 0, .tv_usec = 100 * 1000};
                if (str && len > 0)
                struct timeval delay = {.tv_sec = 0, .tv_usec = 100 * 1000};
                if (str && len > 0)
-                       session_update_time_string(pt, str, len);
+                       session_update_time_string(str, len);
                free(str);
                tv_add(now, &delay, &pt->next_update);
        }
                free(str);
                tv_add(now, &delay, &pt->next_update);
        }
@@ -1310,7 +1296,6 @@ out:
 int main(int argc, char *argv[])
 {
        int ret;
 int main(int argc, char *argv[])
 {
        int ret;
-       struct play_task *pt = &play_task;
        unsigned num_inputs;
 
        /* needed this early to make help work */
        unsigned num_inputs;
 
        /* needed this early to make help work */
@@ -1319,7 +1304,7 @@ int main(int argc, char *argv[])
        sched.default_timeout.tv_sec = 5;
        parse_config_or_die(argc, argv);
        AFH_RECV->init();
        sched.default_timeout.tv_sec = 5;
        parse_config_or_die(argc, argv);
        AFH_RECV->init();
-       session_open(pt);
+       session_open();
        num_inputs = lls_num_inputs(play_lpr);
        init_shuffle_map();
        pt->invalid = para_calloc(sizeof(*pt->invalid) * num_inputs);
        num_inputs = lls_num_inputs(play_lpr);
        init_shuffle_map();
        pt->invalid = para_calloc(sizeof(*pt->invalid) * num_inputs);