Merge branch 'refs/heads/t/si_conversion'
[paraslash.git] / audiod.c
index ead29e86b96dae01921ab4167f7231e308e7b76e..42f4c0a3be06b5aad9a00cf6a351f8b4287d0af7 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -109,9 +109,7 @@ struct slot_info {
  * para_audiod uses \p MAX_STREAM_SLOTS different slots, each of which may
  * be associated with a receiver/filter/writer triple. This array holds all
  * information on the status of these slots.
- *
- * \sa struct slot_info
- * */
+ */
 struct slot_info slot[MAX_STREAM_SLOTS];
 
 /** The vss status flags audiod is interested in. */
@@ -167,8 +165,8 @@ struct status_task {
 char *stat_item_values[NUM_STAT_ITEMS] = {NULL};
 
 /**
- * the current mode of operation of which can be changed by the on/off/cycle
- * commands. It is either, AUDIOD_OFF, AUDIOD_ON or AUDIOD_STANDBY.
+ * The current mode of operation (AUDIOD_OFF, AUDIOD_ON or AUDIOD_STANDBY).
+ * Set by the on/off/cycle commands.
  */
 int audiod_status = AUDIOD_ON;
 
@@ -179,20 +177,20 @@ static struct status_task status_task_struct;
 static uid_t *uid_whitelist;
 
 /**
- * the task that calls the status command of para_server
+ * The task that calls the status command of para_server.
  *
- * \sa struct status_task
+ * \sa \ref struct status_task.
  */
 static struct status_task *stat_task = &status_task_struct;
 
 struct command_task {
        /** The local listening socket. */
        int fd;
-       /** the associated task structure */
+       /** The associated task structure. */
        struct task *task;
 };
 
-/** iterate over all supported audio formats */
+/** Iterate over all supported audio formats. */
 #define FOR_EACH_AUDIO_FORMAT(af) for (af = 0; af < NUM_AUDIO_FORMATS; af++)
 
 /**
@@ -668,6 +666,7 @@ static int open_receiver(int format)
                EMBRACE(.name = name, .context = rn));
        ret = r->open(rn);
        if (ret < 0) {
+               PARA_ERROR_LOG("could not open %s receiver\n", name);
                btr_remove_node(&rn->btrn);
                free(rn);
                return ret;
@@ -803,38 +802,38 @@ static int update_item(int itemnum, char *buf)
 {
        long unsigned sec, usec;
 
-       if (stat_task->clock_diff_count && itemnum != SI_CURRENT_TIME)
+       if (stat_task->clock_diff_count && itemnum != SI_current_time)
                return 1;
        free(stat_item_values[itemnum]);
        stat_item_values[itemnum] = para_strdup(buf);
        stat_client_write_item(itemnum);
        switch (itemnum) {
-       case SI_STATUS_FLAGS:
+       case SI_status_flags:
                stat_task->vss_status = 0;
                if (strchr(buf, 'N'))
                        stat_task->vss_status |= VSS_STATUS_FLAG_NEXT;
                if (strchr(buf, 'P'))
                        stat_task->vss_status |= VSS_STATUS_FLAG_PLAYING;
                break;
-       case SI_OFFSET:
+       case SI_offset:
                stat_task->offset_seconds = atoi(buf);
                break;
-       case SI_SECONDS_TOTAL:
+       case SI_seconds_total:
                stat_task->length_seconds = atoi(buf);
                break;
-       case SI_STREAM_START:
+       case SI_stream_start:
                if (sscanf(buf, "%lu.%lu", &sec, &usec) == 2) {
                        stat_task->server_stream_start.tv_sec = sec;
                        stat_task->server_stream_start.tv_usec = usec;
                }
                break;
-       case SI_CURRENT_TIME:
+       case SI_current_time:
                if (sscanf(buf, "%lu.%lu", &sec, &usec) == 2) {
                        struct timeval tv = {sec, usec};
                        compute_time_diff(&tv);
                }
                break;
-       case SI_FORMAT:
+       case SI_format:
                stat_task->current_audio_format_num
                        = get_audio_format_num(buf);
        }
@@ -1001,7 +1000,7 @@ static int init_default_filters(void)
                }
                /* add "dec" to audio format name */
                tmp = make_message("%sdec", audio_formats[i]);
-               for (j = 0; filter_get(j); j++)
+               for (j = 1; filter_get(j); j++)
                        if (!strcmp(tmp, filter_name(j)))
                                break;
                free(tmp);
@@ -1386,10 +1385,10 @@ static int status_post_select(struct sched *s, void *context)
                client_open(argc, argv, &st->ct, NULL, NULL, st->btrn, s);
                set_stat_task_restart_barrier(5);
        }
-       free(stat_item_values[SI_BASENAME]);
-       stat_item_values[SI_BASENAME] = para_strdup(
+       free(stat_item_values[SI_basename]);
+       stat_item_values[SI_basename] = para_strdup(
                "no connection to para_server");
-       stat_client_write_item(SI_BASENAME);
+       stat_client_write_item(SI_basename);
        st->last_status_read = *now;
 out:
        start_stop_decoders();