Convert writers to lopsub.
[paraslash.git] / play.c
diff --git a/play.c b/play.c
index ca584b9..1045103 100644 (file)
--- a/play.c
+++ b/play.c
 
 #include "recv_cmd.lsg.h"
 #include "play_cmd.lsg.h"
+#include "write_cmd.lsg.h"
 #include "play.lsg.h"
 #include "para.h"
 #include "list.h"
 #include "error.h"
-#include "ggo.h"
 #include "buffer_tree.h"
 #include "version.h"
 #include "string.h"
@@ -26,7 +26,6 @@
 #include "afh.h"
 #include "recv.h"
 #include "write.h"
-#include "write_common.h"
 #include "fd.h"
 
 /**
@@ -295,8 +294,8 @@ static int get_playback_error(struct play_task *pt)
 
 static int eof_cleanup(struct play_task *pt)
 {
-       struct writer *w = writers + DEFAULT_WRITER;
        const struct filter *decoder;
+       const struct writer *w = writer_get(-1); /* default writer */
        int ret;
 
        ret = get_playback_error(pt);
@@ -306,7 +305,7 @@ static int eof_cleanup(struct play_task *pt)
        task_reap(&pt->wn.task);
        w->close(&pt->wn);
        btr_remove_node(&pt->wn.btrn);
-       w->free_config(pt->wn.conf);
+       lls_free_parse_result(pt->wn.lpr, WRITE_CMD(pt->wn.wid));
        memset(&pt->wn, 0, sizeof(struct writer_node));
 
        decoder = filter_get(pt->fn.filter_num);
@@ -411,7 +410,7 @@ static int load_file(struct play_task *pt)
        char *tmp, buf[20];
        int ret;
        const struct filter *decoder;
-       static struct lls_parse_result *filter_lpr;
+       static struct lls_parse_result *filter_lpr, *writer_lpr;
 
        btr_remove_node(&pt->rn.btrn);
        if (!pt->rn.receiver || pt->next_file != pt->current_file) {
@@ -448,8 +447,8 @@ static int load_file(struct play_task *pt)
        btr_log_tree(pt->rn.btrn, LL_INFO);
 
        /* setup default writer */
-       pt->wn.conf = check_writer_arg_or_die(NULL, &pt->wn.writer_num);
-
+       pt->wn.wid = check_writer_arg_or_die(NULL, &writer_lpr);
+       pt->wn.lpr = writer_lpr;
        /* success, register tasks */
        pt->rn.task = task_register(
                &(struct task_info) {
@@ -1316,7 +1315,6 @@ int main(int argc, char *argv[])
 
        /* needed this early to make help work */
        recv_init();
-       writer_init();
 
        sched.default_timeout.tv_sec = 5;
        parse_config_or_die(argc, argv);