aacdec: kill some dead code
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index bbd68d2..0f4cd20 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -18,8 +18,8 @@
 
 /** \file afs.c audio file sending functions
  *
- * This contains the audio sending part of para_server which is independent
- * of the current audio format, database tool and of the activated senders.
+ * This contains the audio sending part of para_server which is independent of
+ * the current audio format, audio file selector and of the activated senders.
  */
 
 #include <sys/time.h> /* gettimeofday */
@@ -38,7 +38,7 @@ static struct timeval data_send_barrier;
 static struct timeval eof_barrier;
 
 extern struct misc_meta_data *mmd;
-extern struct audio_file_selector dblist[];
+extern struct audio_file_selector selectors[];
 extern struct sender senders[];
 extern struct gengetopt_args_info conf;
 
@@ -150,7 +150,7 @@ void afs_init(void)
                afl[i].init(&afl[i]);
        }
        ms2tv(conf.announce_time_arg, &announce_tv);
-       PARA_INFO_LOG("announce timeval: %lu:%lu\n", announce_tv.tv_sec, announce_tv.tv_usec);
+       PARA_INFO_LOG("announce timeval: %lums\n", tv2ms(&announce_tv));
        for (i = 0; senders[i].name; i++) {
                PARA_NOTICE_LOG("initializing %s sender\n", senders[i].name);
                senders[i].init(&senders[i]);
@@ -233,7 +233,7 @@ static int update_mmd(void)
 
 static void get_song(void)
 {
-       char **sl = dblist[mmd->dbt_num].get_audio_file_list(10);
+       char **sl = selectors[mmd->selector_num].get_audio_file_list(10);
        int i;
 
        if (!sl)
@@ -253,8 +253,8 @@ static void get_song(void)
                        continue;
                }
                mmd->num_played++;
-               if (dblist[mmd->dbt_num].update_audio_file)
-                       dblist[mmd->dbt_num].update_audio_file(sl[i]);
+               if (selectors[mmd->selector_num].update_audio_file)
+                       selectors[mmd->selector_num].update_audio_file(sl[i]);
                PARA_DEBUG_LOG("%s", "success\n");
                mmd->new_afs_status_flags &= (~AFS_NEXT);
                gettimeofday(&now, NULL);
@@ -313,7 +313,7 @@ static struct timeval *afs_compute_timeout(void)
        if (chk_barrier("eof", &now, &eof_barrier, &the_timeout, 1) < 0)
                return &the_timeout;
        if (chk_barrier("data send", &now, &data_send_barrier,
-                        &the_timeout, 1) < 0)
+                       &the_timeout, 1) < 0)
                return &the_timeout;
        if (mmd->audio_format < 0 || !afs_playing() || !audio_file)
                return NULL;
@@ -353,7 +353,7 @@ static void afs_eof(struct audio_format *af)
        free(tmp);
        tmp  = make_message("%s:\n%s:\n%s:\n", status_item_list[SI_DBINFO1],
                status_item_list[SI_DBINFO2], status_item_list[SI_DBINFO3]);
-       strcpy(mmd->dbinfo, tmp);
+       strcpy(mmd->selector_info, tmp);
        free(tmp);
        mmd->filename[0] = '\0';
        mmd->size = 0;
@@ -398,10 +398,9 @@ again:
                        senders[i].shutdown_clients();
                if (af) {
                        struct timeval now;
-                       if (!afs_paused() || mmd->chunks_sent) {
-                               gettimeofday(&now, NULL);
+                       gettimeofday(&now, NULL);
+                       if (!afs_paused() || mmd->chunks_sent)
                                tv_add(&af->eof_tv, &now, &eof_barrier);
-                       }
                        if (afs_repos())
                                tv_add(&now, &announce_tv, &data_send_barrier);
                        if (mmd->new_afs_status_flags & AFS_NOMORE)
@@ -415,7 +414,7 @@ again:
                mmd->new_afs_status_flags &= ~(AFS_REPOS);
                mmd->current_chunk = mmd->repos_request;
        }
-       ret = afs_compute_timeout(); 
+       ret = afs_compute_timeout();
        if (!ret && !audio_file && afs_playing() &&
                        !(mmd->new_afs_status_flags & AFS_NOMORE)) {
                PARA_DEBUG_LOG("%s", "ready and playing, but no audio file\n");
@@ -454,7 +453,7 @@ void afs_send_chunk(void)
        if (tv_diff(&due, &now, NULL) > 0)
                return;
        buf = af->read_chunk(mmd->current_chunk, &ret);
-       mmd->new_afs_status_flags &= ~(AFS_NEXT | AFS_REPOS);
+       mmd->new_afs_status_flags &= ~AFS_REPOS;
        if (!buf) {
                if (ret < 0)
                        mmd->new_afs_status_flags = AFS_NEXT;