From be0b6d883628d8ff9043107f1ddd780838facd3d Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 30 Sep 2006 21:28:09 +0200 Subject: [PATCH] para_server: New command line option: --autoplay_delay Useful together with para_audiod's new --clock_diff_count option. --- NEWS | 2 ++ afs.c | 12 ++++++++++++ server.c | 4 ---- server.ggo | 9 +++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 162a8a76..377065ad 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ until now for reasons beyond the scope of this changelog entry. and --with-mad-libs - some robustness fixes - dymamic audio format recognition for audiod + - para_server: new command line option: --autoplay_delay + - para_audiod: new command line option: --clock_diff_count --------------------------------------- 0.2.13 (2006-07-14) "sonic convolution" diff --git a/afs.c b/afs.c index b9d24331..2d4184d2 100644 --- a/afs.c +++ b/afs.c @@ -37,6 +37,7 @@ extern const char *status_item_list[]; static struct timeval announce_tv; static struct timeval data_send_barrier; static struct timeval eof_barrier; +static struct timeval autoplay_barrier; extern struct misc_meta_data *mmd; extern struct audio_file_selector selectors[]; @@ -166,6 +167,14 @@ void afs_init(void) } free(hn); free(home); + if (conf.autoplay_given) { + struct timeval now, tmp; + mmd->afs_status_flags |= AFS_PLAYING; + mmd->new_afs_status_flags |= AFS_PLAYING; + gettimeofday(&now, NULL); + ms2tv(conf.autoplay_delay_arg, &tmp); + tv_add(&now, &tmp, &autoplay_barrier); + } } static int get_file_info(int i) @@ -325,6 +334,9 @@ static struct timeval *afs_compute_timeout(void) return &the_timeout; } gettimeofday(&now, NULL); + if (chk_barrier("autoplay_delay", &now, &autoplay_barrier, + &the_timeout, 1) < 0) + return &the_timeout; if (chk_barrier("eof", &now, &eof_barrier, &the_timeout, 1) < 0) return &the_timeout; if (chk_barrier("data send", &now, &data_send_barrier, diff --git a/server.c b/server.c index ce56494f..c7e68126 100644 --- a/server.c +++ b/server.c @@ -359,10 +359,6 @@ static unsigned do_inits(int argc, char **argv) /* init network socket */ PARA_NOTICE_LOG("%s", "initializing tcp command socket\n"); sockfd = init_network(); - if (conf.autoplay_given) { - mmd->afs_status_flags |= AFS_PLAYING; - mmd->new_afs_status_flags |= AFS_PLAYING; - } PARA_NOTICE_LOG("%s", "init complete\n"); return sockfd; } diff --git a/server.ggo b/server.ggo index c524009f..a32673d5 100644 --- a/server.ggo +++ b/server.ggo @@ -105,6 +105,15 @@ option "autoplay" a flag off +option "autoplay_delay" - +#~~~~~~~~~~~~~~~~~~~~~~~~ +"Time to wait before autoplay starts. Ignored if +autoplay is off." + int typestr="milliseconds" + default="0" + optional + + option "announce_time" A #~~~~~~~~~~~~~~~~~~~~~~~ -- 2.39.5