]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
para_server: New command line option: --autoplay_delay
authorAndre <maan@meins.(none)>
Sat, 30 Sep 2006 19:28:09 +0000 (21:28 +0200)
committerAndre <maan@meins.(none)>
Sat, 30 Sep 2006 19:28:09 +0000 (21:28 +0200)
Useful together with para_audiod's new --clock_diff_count option.

NEWS
afs.c
server.c
server.ggo

diff --git a/NEWS b/NEWS
index 162a8a769af99d07f6fc694a05ac3fc04de7ad40..377065ad53c3b320180782ebbceebdcb4d5cac35 100644 (file)
--- 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 b9d24331148263bfeca4ae075a989ca89eeeb3fb..2d4184d239e6d1f54ef6fb41bdbe1591e89c0195 100644 (file)
--- 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,
index ce56494f4fce68d0ce3f1499b8e00ee609d9b05e..c7e681264cddcd3fe7223b2492485be97869f4cc 100644 (file)
--- 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;
 }
index c524009f937d2ab09ec7369b3d8e5524a4577896..a32673d56a59cce296a05ce51d27623dd7d1f1a8 100644 (file)
@@ -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
 #~~~~~~~~~~~~~~~~~~~~~~~