Rename audio_info status items and get rid of duplicate afh info.
authorAndre Noll <maan@systemlinux.org>
Fri, 2 Nov 2007 02:00:35 +0000 (03:00 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 2 Nov 2007 02:00:35 +0000 (03:00 +0100)
SI_AUDIO_INFO1 -> SI_AUDIO_FILE_INFO
SI_AUDIO_INFO2 -> SI_TAG_INFO1
SI_AUDIO_INFO3 -> SI_TAG_INFO2

The mp3 and the ogg afh stored bits of information in the info
string. Only store there what is not already contained in afh_info.

aac_afh.c
aft.c
gui_theme.c
mp3_afh.c
ogg_afh.c
para.h
stat.c
vss.c

index e495bf1..4941fb1 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -137,12 +137,10 @@ static int aac_get_file_info(char *map, size_t numbytes,
        ret = (afhi->chunk_table[afhi->chunks_total] - afhi->chunk_table[0]) * 8; /* bits */
        ret += (channels * afhi->seconds_total * 500); /* avoid rounding error */
        afhi->bitrate = ret / (channels * afhi->seconds_total * 1000);
-       sprintf(afhi->info_string, "audio_file_info1:%lu x %lums, "
-               "%uHz, %d channel%s, %ukb/s\n"
-               "audio_file_info2:\n"
-               "audio_file_info3:\n",
-               afhi->chunks_total, tv2ms(&afhi->chunk_tv),
-               afhi->frequency, channels, channels == 1? "" : "s", afhi->bitrate
+       sprintf(afhi->info_string, "%s:\n%s:\n%s:\n",
+               status_item_list[SI_AUDIO_FILE_INFO],
+               status_item_list[SI_TAG_INFO1],
+               status_item_list[SI_TAG_INFO2]
        );
        tv_scale(20, &afhi->chunk_tv, &afhi->eof_tv);
        ret = 1;
diff --git a/aft.c b/aft.c
index 2a35e8a..e485997 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -932,7 +932,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        "seconds_total: %lu\n"
                        "num_played: %d\n"
                        "last_played: %s\n"
-                       "tag info: %s\n",
+                       "%s\n", /* tag info */
                        filename_lines,
                        have_score? "score: " : "", score_buf,
                                have_score? "\n" : "",
@@ -968,7 +968,7 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                        "channels: %d\n"
                        "duration: %s\n"
                        "num_played: %d\n"
-                       "tag info: %s\n"
+                       "%s\n" /* tag info */
                        "%s%s\n",
                        last_played_time,
                        d->path,
index e4f4ac8..bb0a813 100644 (file)
@@ -228,33 +228,32 @@ static void init_theme_colorful_blackness(struct gui_theme *t)
        d[SI_AUDIOD_UPTIME].y = 27;
        d[SI_AUDIOD_UPTIME].len = 22;
 
-
-       d[SI_AUDIO_INFO1].prefix = "";
-       d[SI_AUDIO_INFO1].postfix = "";
-       d[SI_AUDIO_INFO1].fg = COLOR_GREEN;
-       d[SI_AUDIO_INFO1].bg = COLOR_BLACK;
-       d[SI_AUDIO_INFO1].align = CENTER;
-       d[SI_AUDIO_INFO1].x = 0;
-       d[SI_AUDIO_INFO1].y = 43;
-       d[SI_AUDIO_INFO1].len = 100;
-
-       d[SI_AUDIO_INFO2].prefix = "";
-       d[SI_AUDIO_INFO2].postfix = "";
-       d[SI_AUDIO_INFO2].fg = COLOR_GREEN;
-       d[SI_AUDIO_INFO2].bg = COLOR_BLACK;
-       d[SI_AUDIO_INFO2].align = CENTER;
-       d[SI_AUDIO_INFO2].x = 0;
-       d[SI_AUDIO_INFO2].y = 53;
-       d[SI_AUDIO_INFO2].len = 100;
-
-       d[SI_AUDIO_INFO3].prefix = "";
-       d[SI_AUDIO_INFO3].postfix = "";
-       d[SI_AUDIO_INFO3].fg = COLOR_GREEN;
-       d[SI_AUDIO_INFO3].bg = COLOR_BLACK;
-       d[SI_AUDIO_INFO3].align = CENTER;
-       d[SI_AUDIO_INFO3].x = 0;
-       d[SI_AUDIO_INFO3].y = 63;
-       d[SI_AUDIO_INFO3].len = 100;
+       d[SI_AUDIO_FILE_INFO].prefix = "";
+       d[SI_AUDIO_FILE_INFO].postfix = "";
+       d[SI_AUDIO_FILE_INFO].fg = COLOR_GREEN;
+       d[SI_AUDIO_FILE_INFO].bg = COLOR_BLACK;
+       d[SI_AUDIO_FILE_INFO].align = CENTER;
+       d[SI_AUDIO_FILE_INFO].x = 0;
+       d[SI_AUDIO_FILE_INFO].y = 43;
+       d[SI_AUDIO_FILE_INFO].len = 100;
+
+       d[SI_TAG_INFO1].prefix = "";
+       d[SI_TAG_INFO1].postfix = "";
+       d[SI_TAG_INFO1].fg = COLOR_GREEN;
+       d[SI_TAG_INFO1].bg = COLOR_BLACK;
+       d[SI_TAG_INFO1].align = CENTER;
+       d[SI_TAG_INFO1].x = 0;
+       d[SI_TAG_INFO1].y = 53;
+       d[SI_TAG_INFO1].len = 100;
+
+       d[SI_TAG_INFO2].prefix = "";
+       d[SI_TAG_INFO2].postfix = "";
+       d[SI_TAG_INFO2].fg = COLOR_GREEN;
+       d[SI_TAG_INFO2].bg = COLOR_BLACK;
+       d[SI_TAG_INFO2].align = CENTER;
+       d[SI_TAG_INFO2].x = 0;
+       d[SI_TAG_INFO2].y = 63;
+       d[SI_TAG_INFO2].len = 100;
 
        d[SI_AFS_MODE].prefix = "";
        d[SI_AFS_MODE].postfix = "";
index ed55d7c..710b6a5 100644 (file)
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -139,20 +139,21 @@ static void write_info_str(struct afh_info *afhi)
        int v = mp3.id3_isvalid;
 
        snprintf(afhi->info_string, MMD_INFO_SIZE,
-               "audio_file_info1:%lu x %lums, %u kbit/s (%cbr) %i KHz %s\n"
-               "audio_file_info2:%s, by %s\n"
-               "audio_file_info3:A: %s, Y: %s, C: %s\n",
-               afhi->chunks_total,
-               tv2ms(&afhi->chunk_tv),
-               afhi->bitrate,
-               mp3.vbr? 'v' : 'c',
-               afhi->frequency / 1000,
-               header_mode(&mp3.header),
-               v && *mp3.id3.title? mp3.id3.title : "(title tag not set)",
-               v && *mp3.id3.artist? mp3.id3.artist : "(artist tag not set)",
-               v && *mp3.id3.album? mp3.id3.album : "(album tag not set)",
-               v && *mp3.id3.year? mp3.id3.year : "????",
-               v && *mp3.id3.comment? mp3.id3.comment : "(comment tag not set)"
+               "%s: %cbr, %s\n" /* audio file info*/
+               "%s: %s, by %s\n" /* taginfo1 */
+               "%s: A: %s, Y: %s, C: %s\n", /* taginfo 2*/
+               status_item_list[SI_AUDIO_FILE_INFO], mp3.vbr? 'v' : 'c',
+                       header_mode(&mp3.header),
+               status_item_list[SI_TAG_INFO1], v && *mp3.id3.title?
+                       mp3.id3.title : "(title tag not set)",
+                       v && *mp3.id3.artist?
+                       mp3.id3.artist : "(artist tag not set)",
+               status_item_list[SI_TAG_INFO2],
+                       v && *mp3.id3.album?
+                               mp3.id3.album : "(album tag not set)",
+                       v && *mp3.id3.year? mp3.id3.year : "????",
+                       v && *mp3.id3.comment?
+                               mp3.id3.comment : "(comment tag not set)"
        );
 }
 
index 5611579..f223b57 100644 (file)
--- a/ogg_afh.c
+++ b/ogg_afh.c
@@ -267,13 +267,12 @@ static int ogg_get_file_info(char *map, size_t numbytes,
        afhi->bitrate = ov_bitrate(&of, 0) / 1000;
        afhi->channels = vi->channels;
        afhi->chunks_total = ogg_compute_chunk_table(&of, afhi, afhi->seconds_total);
-       sprintf(afhi->info_string, "audio_file_info1:%lu x %lu, %ukHz, "
-               "%d channels, %ukbps\n"
-               "audio_file_info2: \n"
-               "audio_file_info3: \n",
-               afhi->chunks_total, (long unsigned) (chunk_time * 1000 * 1000),
-               afhi->frequency / 1000, vi->channels, afhi->bitrate
-               );
+       afhi->info_string[0] = '\0';
+       sprintf(afhi->info_string, "%s:\n%s:\n%s:\n",
+               status_item_list[SI_AUDIO_FILE_INFO],
+               status_item_list[SI_TAG_INFO1],
+               status_item_list[SI_TAG_INFO2]
+       );
        afhi->chunk_tv.tv_sec = 0;
        afhi->chunk_tv.tv_usec = 250 * 1000;
        tv_scale(3, &afhi->chunk_tv, &afhi->eof_tv);
diff --git a/para.h b/para.h
index 69383db..b7542bf 100644 (file)
--- a/para.h
+++ b/para.h
@@ -163,8 +163,8 @@ enum {
        SI_BASENAME,            SI_STATUS,              SI_NUM_PLAYED,
        SI_MTIME,               SI_LENGTH_MIN,          SI_LENGTH_SEC,
        SI_FILE_SIZE,           SI_STATUS_FLAGS,        SI_FORMAT,
-       SI_SCORE,               SI_AUDIO_INFO1,         SI_AUDIO_INFO2,
-       SI_AUDIO_INFO3,         SI_AFS_MODE,            SI_ATTRIBUTES,
+       SI_SCORE,               SI_AUDIO_FILE_INFO,     SI_TAG_INFO1,
+       SI_TAG_INFO2,           SI_AFS_MODE,            SI_ATTRIBUTES,
        SI_DIRECTORY,           SI_DECODER_FLAGS,       SI_AUDIOD_STATUS,
        SI_PLAY_TIME,           SI_UPTIME,              SI_OFFSET,
        SI_SECONDS_TOTAL,       SI_STREAM_START,        SI_CURRENT_TIME,
diff --git a/stat.c b/stat.c
index 514ca3f..5b1c033 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -59,10 +59,10 @@ const char *status_item_list[NUM_STAT_ITEMS] = {
        [SI_FORMAT] = "format",
 
        [SI_SCORE] = "score",
-       [SI_AUDIO_INFO1] = "audio_file_info1",
-       [SI_AUDIO_INFO2] = "audio_file_info2",
+       [SI_AUDIO_FILE_INFO] = "audio_file_info",
 
-       [SI_AUDIO_INFO3] = "audio_file_info3",
+       [SI_TAG_INFO1] = "taginfo1",
+       [SI_TAG_INFO2] =  "taginfo2",
        [SI_AFS_MODE] = "afs_mode",
        [SI_ATTRIBUTES] = "attributes",
 
diff --git a/vss.c b/vss.c
index 7150c90..3c56622 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -193,8 +193,8 @@ static void vss_eof(void)
        mmd->afd.afhi.seconds_total = 0;
        free(mmd->afd.afhi.chunk_table);
        mmd->afd.afhi.chunk_table = NULL;
-       tmp  = make_message("%s:\n%s:\n%s:\n", status_item_list[SI_AUDIO_INFO1],
-               status_item_list[SI_AUDIO_INFO2], status_item_list[SI_AUDIO_INFO3]);
+       tmp  = make_message("%s:\n%s:\n%s:\n", status_item_list[SI_AUDIO_FILE_INFO],
+               status_item_list[SI_TAG_INFO1], status_item_list[SI_TAG_INFO2]);
        strncpy(mmd->afd.afhi.info_string, tmp, sizeof(mmd->afd.afhi.info_string));
        mmd->afd.afhi.info_string[sizeof(mmd->afd.afhi.info_string) - 1] = '\0';
        free(tmp);