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;
"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" : "",
"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,
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 = "";
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)"
);
}
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);
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,
[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",
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);