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 162a8a7..377065a 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
          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"
 
 ---------------------------------------
 0.2.13 (2006-07-14) "sonic convolution"
diff --git a/afs.c b/afs.c
index b9d2433..2d4184d 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 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[];
 
 extern struct misc_meta_data *mmd;
 extern struct audio_file_selector selectors[];
@@ -166,6 +167,14 @@ void afs_init(void)
        }
        free(hn);
        free(home);
        }
        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)
 }
 
 static int get_file_info(int i)
@@ -325,6 +334,9 @@ static struct timeval *afs_compute_timeout(void)
                return &the_timeout;
        }
        gettimeofday(&now, NULL);
                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,
        if (chk_barrier("eof", &now, &eof_barrier, &the_timeout, 1) < 0)
                return &the_timeout;
        if (chk_barrier("data send", &now, &data_send_barrier,
index ce56494..c7e6812 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();
        /* 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;
 }
        PARA_NOTICE_LOG("%s", "init complete\n");
        return sockfd;
 }
index c524009..a32673d 100644 (file)
@@ -105,6 +105,15 @@ option "autoplay" a
 
        flag off
 
 
        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
 #~~~~~~~~~~~~~~~~~~~~~~~
 
 option "announce_time" A
 #~~~~~~~~~~~~~~~~~~~~~~~