X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=play.c;h=10451039726037cf0d0628d8e5d5ddb1acb75b45;hp=330c8b212049123ee1a53de285e2d3b2c6ebd3d6;hb=1be3886508d2fe35df06e97336598d11bf2dd965;hpb=44779382f0699be6b8daeeb25e7e1a2c40116d4b diff --git a/play.c b/play.c index 330c8b21..10451039 100644 --- a/play.c +++ b/play.c @@ -13,11 +13,11 @@ #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 = filter_get(pt->fn.filter_num); + const struct filter *decoder; + const struct writer *w = writer_get(-1); /* default writer */ int ret; ret = get_playback_error(pt); @@ -306,9 +305,10 @@ 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); task_reap(&pt->fn.task); if (decoder->close) decoder->close(&pt->fn); @@ -410,6 +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, *writer_lpr; btr_remove_node(&pt->rn.btrn); if (!pt->rn.receiver || pt->next_file != pt->current_file) { @@ -429,24 +430,25 @@ static int load_file(struct play_task *pt) /* set up decoding filter */ af = audio_format_name(pt->audio_format_num); tmp = make_message("%sdec", af); - PARA_INFO_LOG("decoder: %s\n", tmp); - ret = check_filter_arg(tmp, &pt->fn.conf); + ret = filter_setup(tmp, &pt->fn.conf, &filter_lpr); freep(&tmp); if (ret < 0) goto fail; pt->fn.filter_num = ret; + pt->fn.lpr = filter_lpr; decoder = filter_get(ret); pt->fn.btrn = btr_new_node(&(struct btr_node_description) - EMBRACE(.name = decoder->name, .parent = pt->rn.btrn, - .handler = decoder->execute, .context = &pt->fn)); + EMBRACE(.name = filter_name(pt->fn.filter_num), + .parent = pt->rn.btrn, .handler = decoder->execute, + .context = &pt->fn)); if (decoder->open) decoder->open(&pt->fn); PARA_INFO_LOG("buffer tree:\n"); 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) { @@ -1313,8 +1315,6 @@ int main(int argc, char *argv[]) /* needed this early to make help work */ recv_init(); - filter_init(); - writer_init(); sched.default_timeout.tv_sec = 5; parse_config_or_die(argc, argv);