- cddb_destroy:
- cddb_destroy(conn);
- }
- cddb_end: ;
-}
-#endif /*HAVE_LIBCDDB*/
-
-#define add_format_str_info(val) \
- { \
- const char *str = val; \
- unsigned int len; \
- if (val != NULL) { \
- len=strlen(str); \
- if (len != 0) { \
- strncat(tp, str, TEMP_STR_LEN-(tp-temp_str)); \
- tp += len; \
- } \
- saw_control_prefix = false; \
- } \
- }
-
-#define add_format_num_info(val, fmt) \
- { \
- char num_str[10]; \
- unsigned int len; \
- sprintf(num_str, fmt, val); \
- len=strlen(num_str); \
- if (len != 0) { \
- strncat(tp, num_str, TEMP_STR_LEN-(tp-temp_str)); \
- tp += len; \
- } \
- saw_control_prefix = false; \
- }
-
-/*!
- Take a format string and expand escape sequences, that is sequences that
- begin with %, with information from the current CD.
- The expanded string is returned. Here is a list of escape sequences:
-
- %a : The album artist **
- %A : The album information **
- %C : Category **
- %I : CDDB disk ID **
- %G : Genre **
- %M : The current MRL
- %m : The CD-DA Media Catalog Number (MCN)
- %n : The number of tracks on the CD
- %p : The artist/performer/composer in the track **
- %T : The track number **
- %s : Number of seconds in this track
- %t : The name **
- %Y : The year 19xx or 20xx **
- %% : a %
-*/
-static char *
-CDDAFormatStr(const input_thread_t *p_input, cdda_data_t *p_cdda,
- const char format_str[], const char *mrl, int i_track)
-{
-#define TEMP_STR_SIZE 256
-#define TEMP_STR_LEN (TEMP_STR_SIZE-1)
- static char temp_str[TEMP_STR_SIZE];
- size_t i;
- char * tp = temp_str;
- bool saw_control_prefix = false;
- size_t format_len = strlen(format_str);
-
- bzero(temp_str, TEMP_STR_SIZE);
-
- for (i=0; i<format_len; i++) {
-
- if (!saw_control_prefix && format_str[i] != '%') {
- *tp++ = format_str[i];
- saw_control_prefix = false;
- continue;