From 9207a81bf1bb5b6bd4db7e2640994e0cfc5f9a3f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 2 Nov 2007 03:00:35 +0100 Subject: [PATCH] Rename audio_info status items and get rid of duplicate afh info. 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 | 10 ++++------ aft.c | 4 ++-- gui_theme.c | 53 ++++++++++++++++++++++++++--------------------------- mp3_afh.c | 29 +++++++++++++++-------------- ogg_afh.c | 13 ++++++------- para.h | 4 ++-- stat.c | 6 +++--- vss.c | 4 ++-- 8 files changed, 60 insertions(+), 63 deletions(-) diff --git a/aac_afh.c b/aac_afh.c index e495bf14..4941fb1f 100644 --- 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 2a35e8ac..e485997e 100644 --- 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, diff --git a/gui_theme.c b/gui_theme.c index e4f4ac86..bb0a813f 100644 --- a/gui_theme.c +++ b/gui_theme.c @@ -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 = ""; diff --git a/mp3_afh.c b/mp3_afh.c index ed55d7c0..710b6a50 100644 --- 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)" ); } diff --git a/ogg_afh.c b/ogg_afh.c index 5611579a..f223b57f 100644 --- 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 69383dbe..b7542bf5 100644 --- 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 514ca3f3..5b1c033e 100644 --- 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 7150c908..3c566227 100644 --- 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); -- 2.39.5