# HG changeset patch # User William Pitcock # Date 1197050956 21600 # Node ID 6a4d667a9183f9910a3ff88ab8a8fe5c44ae6857 # Parent 3673c7ec4ea2d1066de4afabbf92a4525efca524# Parent 9ddfa78b43a055f9374b00fda09f8251c745974e Automated merge with ssh://hg.atheme.org//hg/audacious-plugins diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/demac/ape.c --- a/src/demac/ape.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/demac/ape.c Fri Dec 07 12:09:16 2007 -0600 @@ -74,6 +74,18 @@ return tmp[0] | (tmp[1] << 8) | (tmp[2] << 16) | (tmp[3] << 24); } +int put_le32(uint32_t val, VFSFile *vfd) +{ + unsigned char tmp[4]; + + tmp[0] = (val & 0x000000ff); + tmp[1] = (val & 0x0000ff00) >> 8; + tmp[2] = (val & 0x00ff0000) >> 16; + tmp[3] = (val & 0xff000000) >> 24; + + return aud_vfs_fwrite(tmp, 1, 4, vfd); +} + uint64_t get_le64(VFSFile *vfd) { unsigned char tmp[8]; diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/demac/ape.h --- a/src/demac/ape.h Fri Dec 07 12:08:47 2007 -0600 +++ b/src/demac/ape.h Fri Dec 07 12:09:16 2007 -0600 @@ -290,6 +290,7 @@ uint16_t get_le16(VFSFile *vfd); uint32_t get_le32(VFSFile *vfd); +int put_le32(uint32_t val, VFSFile *vfd); uint64_t get_le64(VFSFile *vfd); int ape_read_header(APEContext *ape, VFSFile *pb, int probe_only); diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/demac/apev2.c --- a/src/demac/apev2.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/demac/apev2.c Fri Dec 07 12:09:16 2007 -0600 @@ -37,6 +37,16 @@ #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif +#define FLAGS_HEADER_EXISTS (1 << 31) +#define FLAGS_HEADER (1 << 29) +#define APE_SIGNATURE MKTAG64('A', 'P', 'E', 'T', 'A', 'G', 'E', 'X') + +/*typedef struct { + int tag_items; + int tag_size; + VFSFile *vfd; +} iterator_pvt_t;*/ + mowgli_dictionary_t* parse_apev2_tag(VFSFile *vfd) { unsigned char tmp[TMP_BUFSIZE+1]; unsigned char tmp2[TMP_BUFSIZE+1]; @@ -45,12 +55,12 @@ long tag_size, item_size; int item_flags; int tag_items; - int tag_flags; + unsigned int tag_flags; mowgli_dictionary_t *dict; aud_vfs_fseek(vfd, -32, SEEK_END); signature = get_le64(vfd); - if (signature != MKTAG64('A', 'P', 'E', 'T', 'A', 'G', 'E', 'X')) { + if (signature != APE_SIGNATURE) { #ifdef DEBUG fprintf(stderr, "** demac: apev2.c: APE tag not found\n"); #endif @@ -85,23 +95,114 @@ #endif /* read key */ - for(p = tmp; p <= tmp+TMP_BUFSIZE; p++) { - aud_vfs_fread(p, 1, 1, vfd); - if(*p == '\0') break; - } - *(p+1) = '\0'; + if (item_size > 0 && item_size < tag_size) { /* be bulletproof */ + for(p = tmp; p <= tmp+TMP_BUFSIZE; p++) { + aud_vfs_fread(p, 1, 1, vfd); + if(*p == '\0') break; + } + *(p+1) = '\0'; - /* read item */ - aud_vfs_fread(tmp2, 1, MIN(item_size, TMP_BUFSIZE), vfd); - tmp2[item_size] = '\0'; + /* read item */ + aud_vfs_fread(tmp2, 1, MIN(item_size, TMP_BUFSIZE), vfd); + tmp2[item_size] = '\0'; #ifdef DEBUG - fprintf(stderr, "%s: \"%s\", f:%08x\n", tmp, tmp2, item_flags); + fprintf(stderr, "%s: \"%s\", f:%08x\n", tmp, tmp2, item_flags); #endif - /* APEv2 stores all items in utf-8 */ - gchar *item = ((tag_version == 1000 ) ? aud_str_to_utf8((gchar*)tmp2) : g_strdup((gchar*)tmp2)); + /* APEv2 stores all items in utf-8 */ + gchar *item = ((tag_version == 1000 ) ? aud_str_to_utf8((gchar*)tmp2) : g_strdup((gchar*)tmp2)); - mowgli_dictionary_add(dict, (char*)tmp, item); + mowgli_dictionary_add(dict, (char*)tmp, item); + } } - + return dict; } + +static void write_header_or_footer(guint32 version, guint32 size, guint32 items, guint32 flags, VFSFile *vfd) { + guint64 filling = 0; + + aud_vfs_fwrite("APETAGEX", 1, 8, vfd); + put_le32(version, vfd); + put_le32(size, vfd); + put_le32(items, vfd); + put_le32(flags, vfd); + aud_vfs_fwrite(&filling, 1, 8, vfd); +} + +gboolean write_apev2_tag(VFSFile *vfd, mowgli_dictionary_t *tag) { + guint64 signature; + guint32 tag_version; + guint32 tag_size, tag_items = 0, tag_flags; + guint32 item_size, item_flags=0; + long file_size; + void *current_field; + + if (vfd == NULL || tag == NULL) return FALSE; + + aud_vfs_fseek(vfd, -32, SEEK_END); + signature = get_le64(vfd); + + /* strip existing tag */ + if (signature == APE_SIGNATURE) { + tag_version = get_le32(vfd); + tag_size = get_le32(vfd); + tag_items = get_le32(vfd); + tag_flags = get_le32(vfd); + aud_vfs_fseek(vfd, 0, SEEK_END); + file_size = aud_vfs_ftell(vfd); + file_size -= (long)tag_size; + + /* also strip header */ + if((tag_version >= 2000) && (tag_flags | FLAGS_HEADER_EXISTS)) { + aud_vfs_fseek(vfd, -((long)tag_size)-32, SEEK_END); + signature = get_le64(vfd); /* be bulletproof: check header also */ + if (signature == APE_SIGNATURE) { +#ifdef DEBUG + fprintf(stderr, "stripping also header\n"); +#endif + file_size -= 32; + } + } +#ifdef DEBUG + fprintf(stderr, "stripping existing tag\n"); +#endif + if(aud_vfs_truncate(vfd, file_size) < 0) return FALSE; + } + aud_vfs_fseek(vfd, 0, SEEK_END); + + mowgli_dictionary_iteration_state_t state; + + tag_size = 32; /* footer size */ + /* let's count tag size */ + tag_items = 0; + MOWGLI_DICTIONARY_FOREACH(current_field, &state, tag) { + if(strlen((char*)current_field) != 0) { + tag_items++; + tag_size += strlen((char*)state.cur->key) + strlen((char*)current_field) + 9; /* length in bytes not symbols */ + } + } + + if(tag_items == 0) { +#ifdef DEBUG + fprintf(stderr, "tag stripped, all done\n"); +#endif + return TRUE; /* old tag is stripped, new one is empty */ + } + + write_header_or_footer(2000, tag_size, tag_items, FLAGS_HEADER | FLAGS_HEADER_EXISTS, vfd); /* header */ + MOWGLI_DICTIONARY_FOREACH(current_field, &state, tag) { + if( (item_size = strlen((char*)current_field)) != 0 ) { +#ifdef DEBUG + fprintf(stderr, "Writing field %s = %s\n", (char*)state.cur->key, (char*)current_field); +#endif + put_le32(item_size, vfd); + put_le32(item_flags, vfd); /* all set to zero */ + aud_vfs_fwrite(state.cur->key, 1, strlen((char*)state.cur->key) + 1, vfd); /* null-terminated */ + aud_vfs_fwrite(current_field, 1, item_size, vfd); + } + } + write_header_or_footer(2000, tag_size, tag_items, FLAGS_HEADER_EXISTS, vfd); /* footer */ + + return TRUE; +} + diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/demac/apev2.h --- a/src/demac/apev2.h Fri Dec 07 12:08:47 2007 -0600 +++ b/src/demac/apev2.h Fri Dec 07 12:09:16 2007 -0600 @@ -5,5 +5,6 @@ #include mowgli_dictionary_t* parse_apev2_tag(VFSFile *vfd); +gboolean write_apev2_tag(VFSFile *vfd, mowgli_dictionary_t *tag); #endif diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/demac/plugin.c --- a/src/demac/plugin.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/demac/plugin.c Fri Dec 07 12:09:16 2007 -0600 @@ -389,17 +389,43 @@ } } +static void insert_str_tuple_field_to_dictionary(Tuple *tuple, int fieldn, mowgli_dictionary_t *dict, char *key) { + + if(mowgli_dictionary_find(dict, key) != NULL) g_free(mowgli_dictionary_delete(dict, key)); + + gchar *tmp = (gchar*)aud_tuple_get_string(tuple, fieldn, NULL); + if(tmp != NULL && strlen(tmp) != 0) mowgli_dictionary_add(dict, key, g_strdup(tmp)); +} + +static void insert_int_tuple_field_to_dictionary(Tuple *tuple, int fieldn, mowgli_dictionary_t *dict, char *key) { + int val; + + if(mowgli_dictionary_find(dict, key) != NULL) g_free(mowgli_dictionary_delete(dict, key)); + + if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_INT && (val = aud_tuple_get_int(tuple, fieldn, NULL)) >= 0) { + gchar *tmp = g_strdup_printf("%d", val); + mowgli_dictionary_add(dict, key, tmp); + } +} + static gboolean demac_update_song_tuple(Tuple *tuple, VFSFile *vfd) { - fprintf(stderr, "demac_update_song_tuple(): stub\n"); - fprintf(stderr, "Title: %s\n", aud_tuple_get_string(tuple, FIELD_TITLE, NULL)); - fprintf(stderr, "Artist: %s\n", aud_tuple_get_string(tuple, FIELD_ARTIST, NULL)); - fprintf(stderr, "Album: %s\n", aud_tuple_get_string(tuple, FIELD_ALBUM, NULL)); - fprintf(stderr, "Comment: %s\n", aud_tuple_get_string(tuple, FIELD_COMMENT, NULL)); - fprintf(stderr, "Genre: %s\n", aud_tuple_get_string(tuple, FIELD_GENRE, NULL)); - fprintf(stderr, "Year: %d\n", aud_tuple_get_int(tuple, FIELD_YEAR, NULL)); - fprintf(stderr, "Track: %d\n", aud_tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL)); + + mowgli_dictionary_t *tag = parse_apev2_tag(vfd); + if (tag == NULL) tag = mowgli_dictionary_create(g_ascii_strcasecmp); - return TRUE; + insert_str_tuple_field_to_dictionary(tuple, FIELD_TITLE, tag, "Title"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_ARTIST, tag, "Artist"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_ALBUM, tag, "Album"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_COMMENT, tag, "Comment"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_GENRE, tag, "Genre"); + + insert_int_tuple_field_to_dictionary(tuple, FIELD_YEAR, tag, "Year"); + insert_int_tuple_field_to_dictionary(tuple, FIELD_TRACK_NUMBER, tag, "Track"); + + gboolean ret = write_apev2_tag(vfd, tag); + mowgli_dictionary_destroy(tag, destroy_cb, NULL); + + return ret; } static gchar *fmts[] = { "ape", NULL }; diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/flacng/plugin.c --- a/src/flacng/plugin.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/flacng/plugin.c Fri Dec 07 12:09:16 2007 -0600 @@ -27,7 +27,7 @@ #include "version.h" #include "debug.h" -static gchar *flac_fmts[] = { "flac", NULL }; +static gchar *flac_fmts[] = { "flac", "fla", NULL }; InputPlugin flac_ip = { .description = "FLACng Audio Plugin", diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/m3u/m3u.c --- a/src/m3u/m3u.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/m3u/m3u.c Fri Dec 07 12:09:16 2007 -0600 @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* #define AUD_DEBUG 1 */ + #include #include #include @@ -84,14 +86,14 @@ gint ext_len = -1; gboolean is_extm3u = FALSE; Playlist *playlist = aud_playlist_get_active(); - gchar *uri; + gchar *uri = NULL; uri = g_filename_to_uri(filename, NULL, NULL); if ((file = aud_vfs_fopen(uri ? uri : filename, "rb")) == NULL) return; - g_free(uri); + g_free(uri); uri = NULL; line = g_malloc(line_len); while (aud_vfs_fgets(line, line_len, file)) { @@ -130,15 +132,21 @@ ext_info = NULL; } - uri = g_filename_to_uri(line, NULL, NULL); - aud_playlist_load_ins_file(playlist, uri ? uri : line, filename, pos, ext_title, ext_len); + uri = aud_construct_uri(line, filename); + AUDDBG("uri=%s\n", uri); + + /* add file only if valid uri has been constructed */ + if (uri) { + aud_playlist_load_ins_file(playlist, uri, filename, pos, ext_title, ext_len); + + if (pos >= 0) + pos++; + } + g_free(uri); aud_str_replace_in(&ext_title, NULL); ext_len = -1; - - if (pos >= 0) - pos++; } aud_vfs_fclose(file); diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/Makefile --- a/src/madplug/Makefile Fri Dec 07 12:08:47 2007 -0600 +++ b/src/madplug/Makefile Fri Dec 07 12:09:16 2007 -0600 @@ -5,7 +5,7 @@ input.c \ replaygain.c \ decoder.c \ - fileinfo.c \ + tuple.c \ plugin.c \ xing.c diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/configure.c --- a/src/madplug/configure.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/madplug/configure.c Fri Dec 07 12:09:16 2007 -0600 @@ -37,9 +37,8 @@ { ConfigDb *db; const gchar *text = NULL; -#ifdef DEBUG - g_message("saving"); -#endif + + AUDDBG("saving"); audmad_config.fast_play_time_calc = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fast_playback)); diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/decoder.c --- a/src/madplug/decoder.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/madplug/decoder.c Fri Dec 07 12:09:16 2007 -0600 @@ -196,10 +196,8 @@ info->fileinfo_request = FALSE; } -#ifdef DEBUG - g_message("f: scan_file"); - g_message("scan_file frames = %d", info->frames); -#endif /* DEBUG */ + AUDDBG("f: scan_file"); + AUDDBG("scan_file frames = %d", info->frames); while (1) { remainder = stream.bufend - stream.next_frame; @@ -216,9 +214,7 @@ BUFFER_SIZE - remainder); if (len <= 0) { -#ifdef DEBUG - g_message("scan_file: len <= 0 len = %d", len); -#endif + AUDDBG("scan_file: len <= 0 len = %d", len); break; } @@ -230,12 +226,10 @@ break; } if (!MAD_RECOVERABLE(stream.error)) { -#ifdef DEBUG - g_message("(fatal) error decoding header %d: %s", + AUDDBG("(fatal) error decoding header %d: %s", info->frames, mad_stream_errorstr(&stream)); - g_message("remainder = %d", remainder); - g_message("len = %d", len); -#endif /* DEBUG */ + AUDDBG("remainder = %d", remainder); + AUDDBG("len = %d", len); break; } if (stream.error == MAD_ERROR_LOSTSYNC) { @@ -244,31 +238,27 @@ stream.bufend - stream.this_frame); if (tagsize > 0) { -#ifdef DEBUG - g_message("skipping id3_tag: %d", tagsize); -#endif /* DEBUG */ + AUDDBG("skipping id3_tag: %d", tagsize); mad_stream_skip(&stream, tagsize); continue; } } -#ifdef DEBUG - g_message("(recovered) error decoding header %d: %s", + + AUDDBG("(recovered) error decoding header %d: %s", info->frames, mad_stream_errorstr(&stream)); - g_message("remainder = %d", remainder); - g_message("len = %d", len); -#endif /* DEBUG */ + AUDDBG("remainder = %d", remainder); + AUDDBG("len = %d", len); + continue; } info->frames++; -#ifdef DEBUG #ifdef DEBUG_INTENSIVELY - g_message("header bitrate = %ld", header.bitrate); - g_message("duration = %ul", + AUDDBG("header bitrate = %ld", header.bitrate); + AUDDBG("duration = %ul", mad_timer_count(header.duration, MAD_UNITS_MILLISECONDS)); - g_message("size = %d", stream.next_frame - stream.this_frame); -#endif + AUDDBG("size = %d", stream.next_frame - stream.this_frame); #endif if(aud_tuple_get_int(info->tuple, FIELD_LENGTH, NULL) == -1) mad_timer_add(&info->duration, header.duration); @@ -290,40 +280,34 @@ if (audmad_config.use_xing) { frame.header = header; if (mad_frame_decode(&frame, &stream) == -1) { -#ifdef DEBUG - g_message("xing frame decode failed"); -#endif + AUDDBG("xing frame decode failed"); goto no_xing; } if (xing_parse(&info->xing, stream.anc_ptr, stream.anc_bitlen) == 0) { -#ifdef DEBUG - g_message("xing header found "); -#endif /* DEBUG */ + AUDDBG("xing header found "); has_xing = TRUE; info->vbr = TRUE; /* otherwise xing header would have been 'Info' */ -#ifdef DEBUG - g_message("xing: bytes = %ld frames = %ld", info->xing.bytes, info->xing.frames); -#endif + AUDDBG("xing: bytes = %ld frames = %ld", info->xing.bytes, info->xing.frames); + /* we have enough info to calculate bitrate and duration */ if(info->xing.bytes && info->xing.frames) { xing_bitrate = 8 * (double)info->xing.bytes * 38 / (double)info->xing.frames; //38fps in MPEG1. -#ifdef DEBUG +#ifdef AUD_DEBUG { gint tmp = (gint)(info->xing.bytes * 8 / xing_bitrate); - g_message("xing: bitrate = %4.1f kbps", xing_bitrate / 1000); - g_message("xing: duration = %d:%02d", tmp / 60, tmp % 60); + AUDDBG("xing: bitrate = %4.1f kbps", xing_bitrate / 1000); + AUDDBG("xing: duration = %d:%02d", tmp / 60, tmp % 60); } #endif } continue; } -#ifdef DEBUG +#ifdef AUD_DEBUG else { - g_message("no usable xing header"); + AUDDBG("no usable xing header"); continue; } - #endif } /* xing */ @@ -347,16 +331,16 @@ no_xing: if (fast && info->frames >= N_AVERAGE_FRAMES) { float frame_size = ((double) data_used) / N_AVERAGE_FRAMES; -#ifdef DEBUG - g_message("bitrate = %ld samplerate = %d", header.bitrate, header.samplerate); - g_message("data_used = %d info->frames = %d info->size = %d tagsize = %d frame_size = %lf", + + AUDDBG("bitrate = %ld samplerate = %d", header.bitrate, header.samplerate); + AUDDBG("data_used = %d info->frames = %d info->size = %d tagsize = %d frame_size = %lf", data_used, info->frames, info->size, tagsize, frame_size); -#endif + if(info->size != 0) info->frames = (info->size - tagsize) / frame_size; -#ifdef DEBUG - g_message("info->frames = %d", info->frames); -#endif + + AUDDBG("info->frames = %d", info->frames); + if(aud_tuple_get_int(info->tuple, FIELD_LENGTH, NULL) == -1) { if(xing_bitrate > 0.0) { /* calc duration with xing info */ @@ -376,15 +360,15 @@ info->duration.seconds = length / 1000; info->duration.fraction = length % 1000; } -#ifdef DEBUG - g_message("using fast playtime calculation"); - g_message("data used = %d [tagsize=%d framesize=%f]", +#ifdef AUD_DEBUG + AUDDBG("using fast playtime calculation"); + AUDDBG("data used = %d [tagsize=%d framesize=%f]", data_used, tagsize, frame_size); - g_message("frames = %d, frequency = %d, channels = %d", + AUDDBG("frames = %d, frequency = %d, channels = %d", info->frames, info->freq, info->channels); long millis = mad_timer_count(info->duration, MAD_UNITS_MILLISECONDS); - g_message("duration = %ld:%02ld", millis / 1000 / 60, (millis / 1000) % 60); + AUDDBG("duration = %ld:%02ld", millis / 1000 / 60, (millis / 1000) % 60); #endif /* DEBUG */ break; } @@ -408,10 +392,9 @@ mad_stream_finish(&stream); xing_finish(&info->xing); -#ifdef DEBUG - g_message("scan_file: info->frames = %d", info->frames); - g_message("e: scan_file"); -#endif /* DEBUG */ + AUDDBG("scan_file: info->frames = %d", info->frames); + AUDDBG("e: scan_file"); + return (info->frames != 0 || info->remote == TRUE); } @@ -445,9 +428,7 @@ /* track info is passed in as thread argument */ struct mad_info_t *info = (struct mad_info_t *) arg; -#ifdef DEBUG - g_message("f: decode"); -#endif /* DEBUG */ + AUDDBG("f: decode"); /* init mad stuff */ mad_frame_init(&frame); @@ -456,15 +437,11 @@ mad_synth_init(&synth); if(!info->playback){ -#ifdef DEBUG - g_message("decode: playback == NULL"); -#endif + AUDDBG("decode: playback == NULL"); return NULL; } -#ifdef DEBUG - g_message("decode: fmt = %d freq = %d channels = %d", info->fmt, info->freq, info->channels); -#endif + AUDDBG("decode: fmt = %d freq = %d channels = %d", info->fmt, info->freq, info->channels); if(check_audio_param(info) == FALSE) return NULL; @@ -489,16 +466,13 @@ info->playback->set_params(info->playback, info->title, (tlen == 0 || info->size <= 0) ? -1 : tlen, info->bitrate, info->freq, info->channels); -#ifdef DEBUG - g_message("decode: tlen = %d", tlen); -#endif + + AUDDBG("decode: tlen = %d", tlen); /* main loop */ do { if (!info->playback->playing) { -#ifdef DEBUG - g_message("decode: stop signaled"); -#endif /* DEBUG */ + AUDDBG("decode: stop signaled"); break; } if (seek_skip) @@ -513,9 +487,7 @@ input_process_remote_metadata(info); if (len <= 0) { -#ifdef DEBUG - g_message("finished decoding"); -#endif /* DEBUG */ + AUDDBG("finished decoding"); break; } len += remainder; @@ -529,9 +501,9 @@ mad_stream_buffer(&stream, buffer, len); if (seek_skip) { -#ifdef DEBUG - g_message("skipping: %d", seek_skip); -#endif + + AUDDBG("skipping: %d", seek_skip); + int skip = 2; do { if (mad_frame_decode(&frame, &stream) == 0) { @@ -553,9 +525,9 @@ while (info->playback->playing) { if (info->seek != -1 && info->size > 0) { -#ifdef DEBUG - g_message("seeking: %ld", info->seek); -#endif + + AUDDBG("seeking: %ld", info->seek); + int new_position; gulong milliseconds = mad_timer_count(info->duration, MAD_UNITS_MILLISECONDS); @@ -568,9 +540,9 @@ if(new_position < 0) new_position = 0; -#ifdef DEBUG - g_message("seeking to: %d bytes", new_position); -#endif + + AUDDBG("seeking to: %d bytes", new_position); + if (aud_vfs_fseek(info->infile, new_position, SEEK_SET) == -1) audmad_error("failed to seek to: %d", new_position); mad_frame_mute(&frame); @@ -597,21 +569,20 @@ continue; } } -#ifdef DEBUG - g_message("(recovered) error decoding header %d: %s", + + AUDDBG("(recovered) error decoding header %d: %s", info->current_frame, mad_stream_errorstr(&stream)); -#endif /* DEBUG */ + continue; } info->bitrate = frame.header.bitrate; if (!audmad_config.show_avg_vbr_bitrate && info->vbr && (iteration % 40 == 0)) { -#ifdef DEBUG + #ifdef DEBUG_INTENSIVELY - g_message("decode vbr tlen = %d", tlen); -#endif + AUDDBG("decode vbr tlen = %d", tlen); #endif info->playback->set_params(info->playback, info->title, (tlen == 0 || info->size <= 0) ? -1 : tlen, @@ -622,11 +593,11 @@ if (mad_frame_decode(&frame, &stream) == -1) { if (!MAD_RECOVERABLE(stream.error)) break; -#ifdef DEBUG - g_message("(recovered) error decoding frame %d: %s", + + AUDDBG("(recovered) error decoding frame %d: %s", info->current_frame, mad_stream_errorstr(&stream)); -#endif /* DEBUG */ + } info->current_frame++; @@ -634,22 +605,22 @@ if (info->freq != frame.header.samplerate || info->channels != (guint) MAD_NCHANNELS(&frame.header)) { -#ifdef DEBUG - g_message("change in audio type detected"); - g_message("old: frequency = %d, channels = %d", info->freq, + + AUDDBG("change in audio type detected"); + AUDDBG("old: frequency = %d, channels = %d", info->freq, info->channels); - g_message("new: frequency = %d, channels = %d", + AUDDBG("new: frequency = %d, channels = %d", frame.header.samplerate, (guint) MAD_NCHANNELS(&frame.header)); -#endif /* DEBUG */ + info->freq = frame.header.samplerate; info->channels = MAD_NCHANNELS(&frame.header); if(audmad_config.force_reopen_audio && check_audio_param(info)) { gint current_time = info->playback->output->output_time(); -#ifdef DEBUG - g_message("re-opening audio due to change in audio type"); -#endif + + AUDDBG("re-opening audio due to change in audio type"); + info->playback->output->close_audio(); if (!info->playback->output->open_audio(info->fmt, info->freq, info->channels)) { @@ -688,10 +659,9 @@ info->playback->output->buffer_free(); info->playback->output->buffer_free(); while (info->playback->output->buffer_playing()) { -#ifdef DEBUG - g_message("f: buffer_playing=%d", - info->playback->output->buffer_playing()); -#endif + + AUDDBG("f: buffer_playing=%d", info->playback->output->buffer_playing()); + g_get_current_time(&sleeptime); g_time_val_add(&sleeptime, 500000); @@ -704,9 +674,8 @@ } } -#ifdef DEBUG - g_message("e: decode"); -#endif /* DEBUG */ + + AUDDBG("e: decode"); aud_tuple_free(info->tuple); info->tuple = NULL; diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/fileinfo.c --- a/src/madplug/fileinfo.c Fri Dec 07 12:08:47 2007 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,760 +0,0 @@ -/* - * mad plugin for audacious - * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa - * - * Portions derived from xmms-mad: - * Copyright (C) 2001-2002 Sam Clegg - See COPYING - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; under version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include "plugin.h" -#include "input.h" - -#include "mp3.xpm" - -#include -#include -#include -#include - -/* yaz */ -#include - -#ifndef NOGUI -static GtkWidget *window = 0; -static GtkWidget *filename_entry, *id3_frame; -static GtkWidget *title_entry, *artist_entry, *album_entry; -static GtkWidget *year_entry, *tracknum_entry, *comment_entry; -static GtkWidget *genre_combo; -static GtkWidget *mpeg_level, *mpeg_bitrate, *mpeg_samplerate, - *mpeg_frames, *mpeg_duration, *mpeg_flags; -static GtkWidget *mpeg_fileinfo, *mpeg_replaygain, *mpeg_replaygain2, - *mpeg_replaygain3, *mpeg_replaygain4, *mp3gain1, *mp3gain2; -#endif /* !NOGUI */ - -static GList *genre_list = 0; -static struct mad_info_t info; -struct id3_frame *id3_frame_new(const char *str); -id3_ucs4_t *mad_parse_genre(const id3_ucs4_t *string); - -#ifndef NOGUI -static void -update_id3_frame(struct id3_tag *tag, const char *frame_name, - const char *data) -{ - int res; - struct id3_frame *frame; - union id3_field *field; - id3_ucs4_t *ucs4; - - if (data == NULL) - return; - - /* printf ("updating id3: %s: %s\n", frame_name, data); */ - - /* - * An empty string removes the frame altogether. - */ - if (strlen(data) == 0) { - while ((frame = id3_tag_findframe(tag, frame_name, 0))) { -#ifdef DEBUG - printf("detachframe\n"); -#endif - id3_tag_detachframe(tag, frame); - } - return; - } - - frame = id3_tag_findframe(tag, frame_name, 0); - if (!frame) { -#ifdef DEBUG - printf("frame_new\n"); -#endif - frame = id3_frame_new(frame_name); - id3_tag_attachframe(tag, frame); - } - - // setup ucs4 string - if(audmad_config.sjis) { - ucs4 = id3_latin1_ucs4duplicate((id3_latin1_t *) data); - } - else { - ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) data); - } - - // set encoding - field = id3_frame_field(frame, 0); - id3_field_settextencoding(field, audmad_config.sjis ? ID3_FIELD_TEXTENCODING_ISO_8859_1 : - ID3_FIELD_TEXTENCODING_UTF_8); - - // setup genre code - if (!strcmp(frame_name, ID3_FRAME_GENRE)) { - char *tmp; - int index = id3_genre_number(ucs4); - g_free(ucs4); - - if(index == -1) { // unknown genre. remove TCON frame. -#ifdef DEBUG - printf("remove genre frame\n"); -#endif - id3_tag_detachframe(tag, frame); - } - else { // meaningful genre - tmp = g_strdup_printf("%d", index); - ucs4 = id3_latin1_ucs4duplicate((unsigned char *) tmp); - } - - } - - // write string - if (!strcmp(frame_name, ID3_FRAME_COMMENT)) { - field = id3_frame_field(frame, 3); - field->type = ID3_FIELD_TYPE_STRINGFULL; - res = id3_field_setfullstring(field, ucs4); - } - else { - field = id3_frame_field(frame, 1); - field->type = ID3_FIELD_TYPE_STRINGLIST; - res = id3_field_setstrings(field, 1, &ucs4); - } - - if (res != 0) - g_print("error setting id3 field: %s\n", frame_name); -} - -static void close_window(GtkWidget * w, gpointer data) -{ - input_term(&info); - gtk_widget_destroy(window); -} - -static void save_cb(GtkWidget * w, gpointer data) -{ - gchar *text, *text2; - struct id3_file *id3file; - struct id3_tag *id3tag; - char *encoding; - - if (info.remote) - return; - - /* read tag from file */ - id3file = id3_file_open(info.filename, ID3_FILE_MODE_READWRITE); - if (!id3file) { - audacious_info_dialog(_("File Info"), _("Couldn't open file!"), _("Ok"), - FALSE, NULL, NULL); - return; - } - - id3tag = id3_file_tag(id3file); - if (!id3tag) { -#ifdef DEBUG - printf("no id3tag\n. append new tag.\n"); -#endif - id3tag = id3_tag_new(); - id3_tag_clearframes(id3tag); - id3tag->options |= ID3_TAG_OPTION_APPENDEDTAG | ID3_TAG_OPTION_ID3V1; - } - - id3_tag_options(id3tag, ID3_TAG_OPTION_ID3V1, ~0); /* enables id3v1 */ -// id3_tag_options(id3tag, ID3_TAG_OPTION_ID3V1, 0); /* diable id3v1 */ - - encoding = audmad_config.sjis ? "SJIS" : "UTF-8"; - - text = gtk_editable_get_chars(GTK_EDITABLE(title_entry), 0, -1); - text2 = g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); - - update_id3_frame(id3tag, ID3_FRAME_TITLE, text2); - free(text); - free(text2); - - text = gtk_editable_get_chars(GTK_EDITABLE(artist_entry), 0, -1); - text2 = g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); - update_id3_frame(id3tag, ID3_FRAME_ARTIST, text2); - free(text); - free(text2); - - text = gtk_editable_get_chars(GTK_EDITABLE(album_entry), 0, -1); - text2 = - g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); - update_id3_frame(id3tag, ID3_FRAME_ALBUM, text2); - free(text); - free(text2); - - text = gtk_editable_get_chars(GTK_EDITABLE(year_entry), 0, -1); - text2 = - g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); - update_id3_frame(id3tag, ID3_FRAME_YEAR, text2); - free(text); - free(text2); - - // update TLEN frame - text = g_strdup_printf("%ld", mad_timer_count(info.duration, MAD_UNITS_MILLISECONDS)); - update_id3_frame(id3tag, "TLEN", text); - free(text); - - text = gtk_editable_get_chars(GTK_EDITABLE(comment_entry), 0, -1); - text2 = - g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); - update_id3_frame(id3tag, ID3_FRAME_COMMENT, text2); - free(text); - free(text2); - - text = gtk_editable_get_chars(GTK_EDITABLE(tracknum_entry), 0, -1); - text2 = - g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); - update_id3_frame(id3tag, ID3_FRAME_TRACK, text2); - free(text); - free(text2); - - text = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(genre_combo)->entry), - 0, -1); -#ifdef DEBUG - g_print("genre entry = %s\n", text); -#endif - update_id3_frame(id3tag, ID3_FRAME_GENRE, text); - free(text); - -#ifdef DEBUG - printf("about to write id3tag\n"); -#endif - if (id3_file_update(id3file) != 0) { - audacious_info_dialog(_("File Info"), _("Couldn't write tag!"), _("Ok"), FALSE, - NULL, NULL); - } - id3_file_close(id3file); -} - -static void remove_id3_cb(GtkWidget * w, gpointer data) -{ - struct id3_file *id3file; - struct id3_tag *id3tag; - - id3file = id3_file_open(info.filename, ID3_FILE_MODE_READWRITE); - - if (id3file == NULL) - return; - - id3tag = id3_file_tag(id3file); - - if (id3tag == NULL) - { - id3_file_close(id3file); - return; - } - - id3_tag_clearframes(id3tag); - id3_file_update(id3file); - id3_file_close(id3file); - - gtk_entry_set_text(GTK_ENTRY(title_entry), ""); - gtk_entry_set_text(GTK_ENTRY(artist_entry), ""); - gtk_entry_set_text(GTK_ENTRY(album_entry), ""); - gtk_entry_set_text(GTK_ENTRY(comment_entry), ""); - gtk_entry_set_text(GTK_ENTRY(year_entry), ""); - gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ""); - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), ""); - gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); -} - -static void -change_buttons(GtkWidget * object) -{ - gtk_widget_set_sensitive(GTK_WIDGET(object), TRUE); -} - -#ifndef NOGUI -static gboolean -on_fileinfo_window_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data) -{ - g_return_val_if_fail(GTK_IS_WIDGET (widget), FALSE); - - if (event->keyval == GDK_Escape) - { - gtk_widget_hide(widget); - } - - return FALSE; -} -#endif - -void create_window() -{ - GtkWidget *vbox, *hbox, *left_vbox, *table; - GtkWidget *mpeg_frame, *mpeg_box; - GtkWidget *label, *filename_hbox; - GtkWidget *bbox, *save, *remove_id3, *cancel; - GtkWidget *pixmapwid; - GdkPixbuf *pixbuf; - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_type_hint(GTK_WINDOW(window), - GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); - g_signal_connect(G_OBJECT(window), "destroy", - G_CALLBACK(close_window), &window); - g_signal_connect(G_OBJECT(window), "key-press-event", - G_CALLBACK(on_fileinfo_window_key_press), &window); - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(window), vbox); - - filename_hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); - - pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) - gnome_mime_audio_xpm); - pixmapwid = gtk_image_new_from_pixbuf(pixbuf); - g_object_unref(pixbuf); - gtk_misc_set_alignment(GTK_MISC(pixmapwid), 0, 0); - gtk_box_pack_start(GTK_BOX(filename_hbox), pixmapwid, FALSE, FALSE, - 0); - - label = gtk_label_new(_("Name:")); - gtk_label_set_use_markup(GTK_LABEL(label), TRUE); - gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); - filename_entry = gtk_entry_new(); - gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); - gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, - 0); - - hbox = gtk_hbox_new(FALSE, 10); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); - - left_vbox = gtk_table_new(2, 4, FALSE); - gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); - - mpeg_frame = gtk_frame_new(_(" MPEG Info ")); - gtk_table_attach(GTK_TABLE(left_vbox), mpeg_frame, 0, 2, 0, 1, - GTK_FILL, GTK_FILL, 5, 5); - - mpeg_box = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_box); - gtk_container_set_border_width(GTK_CONTAINER(mpeg_box), 10); - gtk_box_set_spacing(GTK_BOX(mpeg_box), 0); - - mpeg_level = gtk_label_new(""); - gtk_widget_set_usize(mpeg_level, 120, -2); - gtk_misc_set_alignment(GTK_MISC(mpeg_level), 0, 0); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_level, FALSE, FALSE, 0); - - mpeg_bitrate = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_bitrate), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_bitrate, FALSE, FALSE, 0); - - mpeg_samplerate = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 0, 0); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_samplerate, FALSE, FALSE, - 0); - - mpeg_flags = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_flags), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_flags), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_flags, FALSE, FALSE, 0); - - mpeg_frames = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_frames), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_frames), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_frames, FALSE, FALSE, 0); - - mpeg_duration = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_duration), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_duration), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_duration, FALSE, FALSE, 0); - - mpeg_replaygain = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_replaygain), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_replaygain), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_replaygain, FALSE, FALSE, - 0); - mpeg_replaygain2 = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_replaygain2), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_replaygain2), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_replaygain2, FALSE, FALSE, - 0); - mpeg_replaygain3 = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_replaygain3), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_replaygain3), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_replaygain3, FALSE, FALSE, - 0); - mpeg_replaygain4 = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_replaygain4), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_replaygain4), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_replaygain4, FALSE, FALSE, - 0); - mp3gain1 = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mp3gain1), 0, 0); - gtk_label_set_justify(GTK_LABEL(mp3gain1), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mp3gain1, FALSE, FALSE, 0); - mp3gain2 = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mp3gain2), 0, 0); - gtk_label_set_justify(GTK_LABEL(mp3gain2), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mp3gain2, FALSE, FALSE, 0); - - mpeg_fileinfo = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(mpeg_fileinfo), 0, 0); - gtk_label_set_justify(GTK_LABEL(mpeg_fileinfo), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_fileinfo, FALSE, FALSE, 0); - - id3_frame = gtk_frame_new(_(" ID3 Tag ")); - gtk_table_attach(GTK_TABLE(left_vbox), id3_frame, 2, 4, 0, 1, - GTK_FILL, GTK_FILL, 0, 5); - - table = gtk_table_new(5, 5, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_container_add(GTK_CONTAINER(id3_frame), table); - - label = gtk_label_new(_("Title:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, - GTK_FILL, 5, 5); - - title_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Artist:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, - GTK_FILL, 5, 5); - - artist_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 4, 1, 2, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Album:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, - GTK_FILL, 5, 5); - - album_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Comment:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, - GTK_FILL, 5, 5); - - comment_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 4, 3, 4, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Year:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, - GTK_FILL, 5, 5); - - year_entry = gtk_entry_new(); - gtk_widget_set_usize(year_entry, 40, -1); - gtk_table_attach(GTK_TABLE(table), year_entry, 1, 2, 4, 5, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Track number:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, GTK_FILL, - GTK_FILL, 5, 5); - - tracknum_entry = gtk_entry_new(); - gtk_widget_set_usize(tracknum_entry, 40, -1); - gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Genre:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, - GTK_FILL, 5, 5); - - genre_combo = gtk_combo_new(); - gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), - FALSE); - if (!genre_list) { - int i = 0; - const id3_ucs4_t *ucs4 = id3_genre_index(i); - - //add "Unknown" to the first. we must shift index. - genre_list = g_list_append(genre_list, _("Unknown")); - - while (ucs4) { - genre_list = - g_list_append(genre_list, id3_ucs4_utf8duplicate(ucs4)); - i++; - ucs4 = id3_genre_index(i); - } - } - gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list); - - gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 4, 5, 6, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - bbox = gtk_hbutton_box_new(); - gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_SPREAD); - - save = gtk_button_new_from_stock(GTK_STOCK_SAVE); - g_signal_connect(G_OBJECT(save), "clicked", - G_CALLBACK(save_cb), NULL); - gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 0); - - remove_id3 = gtk_button_new_from_stock(GTK_STOCK_DELETE); - g_signal_connect(G_OBJECT(remove_id3), "clicked", - G_CALLBACK(remove_id3_cb), save); - gtk_box_pack_start(GTK_BOX(bbox), remove_id3, TRUE, TRUE, 0); - - g_signal_connect_swapped(G_OBJECT(title_entry), "changed", - G_CALLBACK(change_buttons), save); - g_signal_connect_swapped(G_OBJECT(artist_entry), "changed", - G_CALLBACK(change_buttons), save); - g_signal_connect_swapped(G_OBJECT(album_entry), "changed", - G_CALLBACK(change_buttons), save); - g_signal_connect_swapped(G_OBJECT(year_entry), "changed", - G_CALLBACK(change_buttons), save); - g_signal_connect_swapped(G_OBJECT(comment_entry), "changed", - G_CALLBACK(change_buttons), save); - g_signal_connect_swapped(G_OBJECT(tracknum_entry), "changed", - G_CALLBACK(change_buttons), save); - - g_signal_connect_swapped(G_OBJECT(GTK_COMBO(genre_combo)->entry), "changed", - G_CALLBACK(change_buttons), save); - - - gtk_table_attach(GTK_TABLE(table), bbox, 0, 5, 6, 7, GTK_FILL, 0, - 0, 8); - - bbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); - gtk_table_attach(GTK_TABLE(left_vbox), bbox, 0, 4, 1, 2, GTK_FILL, - 0, 0, 8); - - cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); - g_signal_connect_swapped(G_OBJECT(cancel), "clicked", - G_CALLBACK(gtk_widget_destroy), - G_OBJECT(window)); - GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); - gtk_window_set_focus(GTK_WINDOW(window), cancel); - - gtk_widget_show_all(window); -} - -static void id3_frame_to_entry(char *framename, GtkEntry * entry) -{ - gtk_entry_set_text(entry, ""); - - if (info.tag) { - gchar *text = input_id3_get_string(info.tag, framename); - if (text) { - gtk_entry_set_text(entry, text); - g_free(text); - } - } -} -#endif /* !NOGUI */ - -void audmad_get_file_info(char *fileurl) -{ -#ifndef NOGUI - gchar *title; - gchar message[128]; - static char const *const layer_str[3] = { "I", "II", "III" }; - static char const *const mode_str[4] = { - ("single channel"), ("dual channel"), "joint stereo", "stereo" - }; - gchar *tmp, *utf_filename; - gchar *realfn = NULL; -#ifdef DEBUG - { - tmp = aud_str_to_utf8(fileurl); - g_message("f: audmad_get_file_info: %s", tmp); - g_free(tmp); - tmp = NULL; - } -#endif - - if(!aud_vfs_is_remote(fileurl) && !aud_vfs_file_test(fileurl, G_FILE_TEST_EXISTS)) { - return; - } - - input_init(&info, fileurl, NULL); - - if(audmad_is_remote(fileurl)) { - info.remote = TRUE; - if(aud_vfs_is_streaming(info.infile)) - return; //file info dialog for remote streaming doesn't make sense. - } - - realfn = g_filename_from_uri(fileurl, NULL, NULL); - utf_filename = aud_str_to_utf8(realfn ? realfn : fileurl); - g_free(realfn); realfn = NULL; - create_window(); - - info.fileinfo_request = TRUE; - input_get_info(&info, info.remote ? TRUE : FALSE); - - tmp = g_path_get_basename(utf_filename); - title = g_strdup_printf(_("File Info - %s"), tmp); - g_free(tmp); tmp = NULL; - gtk_window_set_title(GTK_WINDOW(window), title); - g_free(title); - - gtk_entry_set_text(GTK_ENTRY(filename_entry), utf_filename); - gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1); - - free(utf_filename); - - id3_frame_to_entry(ID3_FRAME_ARTIST, GTK_ENTRY(artist_entry)); - id3_frame_to_entry(ID3_FRAME_TITLE, GTK_ENTRY(title_entry)); - id3_frame_to_entry(ID3_FRAME_ALBUM, GTK_ENTRY(album_entry)); - -// year -// id3_frame_to_entry (ID3_FRAME_YEAR, GTK_ENTRY (year_entry)); -// to set year entry, we have to do manually because TYER is still used equally to TDRC. - gtk_entry_set_text(GTK_ENTRY(year_entry), ""); - if (info.tag) { - gchar *text = NULL; - text = input_id3_get_string(info.tag, "TDRC"); - if (!text) - text = input_id3_get_string(info.tag, "TYER"); - if (text) { - gtk_entry_set_text(GTK_ENTRY(year_entry), text); - g_free(text); - } - } - - id3_frame_to_entry(ID3_FRAME_TRACK, GTK_ENTRY(tracknum_entry)); - id3_frame_to_entry(ID3_FRAME_COMMENT, GTK_ENTRY(comment_entry)); - snprintf(message, 127, _("Layer %s"), layer_str[info.mpeg_layer - 1]); - gtk_label_set_text(GTK_LABEL(mpeg_level), message); - if (info.vbr) { - snprintf(message, 127, _("VBR (avg. %d kbps)"), info.bitrate / 1000); - } - else { - snprintf(message, 127, "%d kbps", info.bitrate / 1000); - } - gtk_label_set_text(GTK_LABEL(mpeg_bitrate), message); - snprintf(message, 127, _("%d Hz"), info.freq); - gtk_label_set_text(GTK_LABEL(mpeg_samplerate), message); - if (info.frames != -1) { - snprintf(message, 127, _("%d frames"), info.frames); - gtk_label_set_text(GTK_LABEL(mpeg_frames), message); - } - else { - gtk_label_set_text(GTK_LABEL(mpeg_frames), ""); - } - gtk_label_set_text(GTK_LABEL(mpeg_flags), mode_str[info.mode]); - { - guint sec = mad_timer_count(info.duration, MAD_UNITS_SECONDS); - snprintf(message, 127, _("%d:%02d (%d seconds)"), sec /60 ,sec % 60, sec); - } - gtk_label_set_text(GTK_LABEL(mpeg_duration), message); - - if (info.replaygain_album_str != NULL) { - snprintf(message, 127, _("RG_album=%4s (x%4.2f)"), - info.replaygain_album_str, info.replaygain_album_scale); - gtk_label_set_text(GTK_LABEL(mpeg_replaygain), message); - } - else - gtk_label_set_text(GTK_LABEL(mpeg_replaygain), ""); - - if (info.replaygain_track_str != NULL) { - snprintf(message, 127, _("RG_track=%4s (x%4.2f)"), - info.replaygain_track_str, info.replaygain_track_scale); - gtk_label_set_text(GTK_LABEL(mpeg_replaygain2), message); - } - else - gtk_label_set_text(GTK_LABEL(mpeg_replaygain2), ""); - - if (info.replaygain_album_peak_str != NULL) { - snprintf(message, 127, _("Peak album=%4s (%+5.3fdBFS)"), - info.replaygain_album_peak_str, - 20 * log10(info.replaygain_album_peak)); - gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), message); - } - else - gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), ""); - - if (info.replaygain_track_peak_str != NULL) { - snprintf(message, 127, _("Peak track=%4s (%+5.3fdBFS)"), - info.replaygain_track_peak_str, - 20 * log10(info.replaygain_track_peak)); - gtk_label_set_text(GTK_LABEL(mpeg_replaygain4), message); - } - else - gtk_label_set_text(GTK_LABEL(mpeg_replaygain3), ""); - - if (info.mp3gain_undo_str != NULL) { - snprintf(message, 127, _("mp3gain undo=%4s (%+5.3fdB)"), - info.mp3gain_undo_str, info.mp3gain_undo); - gtk_label_set_text(GTK_LABEL(mp3gain1), message); - } - else - gtk_label_set_text(GTK_LABEL(mp3gain1), ""); - - if (info.mp3gain_minmax_str != NULL) { - snprintf(message, 127, _("mp3gain minmax=%4s (max-min=%+6.3fdB)"), - info.mp3gain_minmax_str, info.mp3gain_minmax); - gtk_label_set_text(GTK_LABEL(mp3gain2), message); - } - else - gtk_label_set_text(GTK_LABEL(mp3gain2), ""); - - gtk_label_set_text(GTK_LABEL(mpeg_fileinfo), ""); - - - /* work out the index of the genre in the list */ - { - const id3_ucs4_t *string; - id3_ucs4_t *genre; - struct id3_frame *frame; - union id3_field *field; - frame = id3_tag_findframe(info.tag, ID3_FRAME_GENRE, 0); - if (frame) { - field = id3_frame_field(frame, 1); - string = id3_field_getstrings(field, 0); - genre = mad_parse_genre(string); -#ifdef DEBUG - if (genre) { - gchar *utf = (gchar *)id3_ucs4_utf8duplicate(genre); - g_print("genre = %s\n", utf); - g_print("genre num = %d\n", id3_genre_number(genre)); - g_free(utf); - } -#endif - if (genre) { - gtk_list_select_item(GTK_LIST - (GTK_COMBO(genre_combo)->list), - id3_genre_number(genre)+1); //shift one for "Unknown". - g_free((void *)genre); - } - } - } - - gtk_widget_set_sensitive(id3_frame, TRUE); - -#endif /* !NOGUI */ -} diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/input.c --- a/src/madplug/input.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/madplug/input.c Fri Dec 07 12:09:16 2007 -0600 @@ -71,9 +71,8 @@ */ gboolean input_init(struct mad_info_t * info, const char *url, VFSFile *fd) { -#ifdef DEBUG - g_message("f: input_init"); -#endif + AUDDBG("f: input_init"); + memset(info, 0, sizeof(struct mad_info_t)); // all fields are cleared to 0 --yaz info->fmt = FMT_S16_LE; @@ -100,9 +99,8 @@ } } else{ -#ifdef DEBUG - printf("input_init: aud_vfs_dup\n"); -#endif + AUDDBG("input_init: aud_vfs_dup\n"); + info->infile = aud_vfs_dup(fd); } @@ -114,10 +112,9 @@ info->fileinfo_request = FALSE; -#ifdef DEBUG - g_message("i: info->size = %lu", (long unsigned int)info->size); - g_message("e: input_init"); -#endif + AUDDBG("i: info->size = %lu", (long unsigned int)info->size); + AUDDBG("e: input_init"); + return TRUE; } @@ -223,18 +220,16 @@ tp++; } if(is_num) { -#ifdef DEBUG - printf("is_num!\n"); -#endif + AUDDBG("is_num!\n"); + tmp = g_malloc0(BYTES(end - ptr + 1)); memcpy(tmp, ptr, BYTES(end - ptr)); *(tmp + (end - ptr)) = 0; //terminate ptr += end - ptr; genre = (id3_ucs4_t *)id3_genre_name((const id3_ucs4_t *)tmp); -#ifdef DEBUG - printf("genre length = %d\n", mad_ucs4len(genre)); -#endif + AUDDBG("genre length = %d\n", mad_ucs4len(genre)); + g_free(tmp); tmp = NULL; @@ -246,11 +241,10 @@ *(ret + ret_len) = 0; //terminate } else { // plain text -#ifdef DEBUG - printf("plain!\n"); - printf("ret_len = %d\n", ret_len); - printf("end - ptr = %d\n", BYTES(end - ptr)); -#endif + AUDDBG("plain!\n"); + AUDDBG("ret_len = %d\n", ret_len); + AUDDBG("end - ptr = %d\n", BYTES(end - ptr)); + memcpy(ret + BYTES(ret_len), ptr, BYTES(end - ptr)); ret_len = ret_len + (end - ptr); *(ret + ret_len) = 0; //terminate @@ -316,9 +310,8 @@ } g_free((void *)string); -#ifdef DEBUG - g_print("i: string = %s\n", rtn); -#endif + AUDDBG("i: string = %s\n", rtn); + return rtn; } @@ -352,9 +345,8 @@ Tuple *tuple; glong curpos = 0; -#ifdef DEBUG - g_message("f: input_read_tag"); -#endif + AUDDBG("f: input_read_tag"); + if (info->tuple != NULL) aud_tuple_free(info->tuple); @@ -370,17 +362,13 @@ } if (!info->id3file) { -#ifdef DEBUG - g_message("read_tag: no id3file"); -#endif + AUDDBG("read_tag: no id3file"); return; } info->tag = id3_file_tag(info->id3file); if (!info->tag) { -#ifdef DEBUG - g_message("read_tag: no tag"); -#endif + AUDDBG("read_tag: no tag"); return; } @@ -413,9 +401,7 @@ string = input_id3_get_string(info->tag, "TLEN"); if (string) { aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, atoi(string)); -#ifdef DEBUG - g_message("input_read_tag: TLEN = %d", atoi(string)); -#endif + AUDDBG("input_read_tag: TLEN = %d", atoi(string)); g_free(string); string = NULL; } else @@ -433,9 +419,7 @@ aud_vfs_fseek(info->infile, curpos, SEEK_SET); } -#ifdef DEBUG - g_message("e: input_read_tag"); -#endif + AUDDBG("e: input_read_tag"); } void input_process_remote_metadata(struct mad_info_t *info) @@ -444,12 +428,10 @@ if(info->remote && mad_timer_count(info->duration, MAD_UNITS_SECONDS) <= 0){ gchar *tmp = NULL; -#ifdef DEBUG + #ifdef DEBUG_INTENSIVELY - g_message("process_remote_meta"); + AUDDBG("process_remote_meta"); #endif -#endif - g_free(info->title); info->title = NULL; aud_tuple_disassociate(info->tuple, FIELD_TITLE, NULL); @@ -516,9 +498,9 @@ */ gboolean input_get_info(struct mad_info_t *info, gboolean fast_scan) { -#ifdef DEBUG +#ifdef AUD_DEBUG gchar *tmp = g_filename_to_utf8(info->filename, -1, NULL, NULL, NULL); - g_message("f: input_get_info: %s, fast_scan = %s", tmp, fast_scan ? "TRUE" : "FALSE"); + AUDDBG("f: input_get_info: %s, fast_scan = %s", tmp, fast_scan ? "TRUE" : "FALSE"); g_free(tmp); #endif /* DEBUG */ @@ -531,9 +513,7 @@ /* scan mp3 file, decoding headers */ if (scan_file(info, fast_scan) == FALSE) { -#ifdef DEBUG - g_message("input_get_info: scan_file failed"); -#endif + AUDDBG("input_get_info: scan_file failed"); return FALSE; } @@ -550,9 +530,7 @@ info->title = g_strdup(info->filename); //XXX info->filename is uri. --yaz } -#ifdef DEBUG - g_message("e: input_get_info"); -#endif /* DEBUG */ + AUDDBG("e: input_get_info"); return TRUE; } @@ -570,10 +548,8 @@ int buffer_size) { int len = 0; -#ifdef DEBUG #ifdef DEBUG_INTENSIVELY - g_message ("f: input_get_data: %d", buffer_size); -#endif + AUDDBG ("f: input_get_data: %d", buffer_size); #endif /* simply read to data from the file */ len = aud_vfs_fread(buffer, 1, buffer_size, info->infile); //aud_vfs_fread returns num of elements. @@ -582,11 +558,10 @@ info->playback->eof = TRUE; } -#ifdef DEBUG #ifdef DEBUG_INTENSIVELY - g_message ("e: input_get_data: size=%d offset=%d", len, info->offset); + AUDDBG ("e: input_get_data: size=%d offset=%d", len, info->offset); #endif -#endif + info->offset += len; return len; } @@ -596,9 +571,7 @@ */ gboolean input_term(struct mad_info_t * info) { -#ifdef DEBUG - g_message("f: input_term"); -#endif + AUDDBG("f: input_term"); if (info->title) g_free(info->title); @@ -634,8 +607,8 @@ /* set everything to zero in case it gets used again. */ memset(info, 0, sizeof(struct mad_info_t)); -#ifdef DEBUG - g_message("e: input_term"); -#endif + + AUDDBG("e: input_term"); + return TRUE; } diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/mp3.xpm --- a/src/madplug/mp3.xpm Fri Dec 07 12:08:47 2007 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,963 +0,0 @@ -/* XPM */ -static char * gnome_mime_audio_xpm[] = { -"48 52 908 2", -" c None", -". c #000000", -"+ c #010100", -"@ c #020201", -"# c #030201", -"$ c #232323", -"% c #1F1F1F", -"& c #DADADA", -"* c #FFFFFF", -"= c #F6F6F6", -"- c #CFCFCF", -"; c #707070", -"> c #FFFFFE", -", c #FEFEFE", -"' c #FBFBFB", -") c #EDEDED", -"! c #C0C0C0", -"~ c #FFFEFE", -"{ c #F8F5F2", -"] c #EBE7E1", -"^ c #ECEDE8", -"/ c #ECEFEA", -"( c #E6E9E4", -"_ c #CED0CE", -": c #BCBFBC", -"< c #F0F0EF", -"[ c #FEFEFD", -"} c #F7F7F7", -"| c #D7D7D7", -"1 c #F1F1F1", -"2 c #B7B7B7", -"3 c #EAEDEA", -"4 c #8EA299", -"5 c #697D70", -"6 c #546459", -"7 c #404D44", -"8 c #2C352F", -"9 c #4E5649", -"0 c #D6D8D3", -"a c #D2D2D2", -"b c #AEAEAE", -"c c #070707", -"d c #FCFCFB", -"e c #6D7C75", -"f c #5A5D4C", -"g c #6B735F", -"h c #6E7B63", -"i c #5B6052", -"j c #4A5042", -"k c #CED0CB", -"l c #FEFDFD", -"m c #FDFDFD", -"n c #B8B8B8", -"o c #DCDCDC", -"p c #A4A4A3", -"q c #0E0E0E", -"r c #8A928F", -"s c #6A7F68", -"t c #4D564E", -"u c #4E5950", -"v c #585E57", -"w c #333530", -"x c #9D9C9B", -"y c #FCFDFE", -"z c #FDFEFE", -"A c #FDFDFE", -"B c #F5F5F4", -"C c #B5B5B5", -"D c #F9F9F9", -"E c #FCFCFC", -"F c #CBCBCB", -"G c #A5A5A5", -"H c #CECDCB", -"I c #788976", -"J c #C6BDBB", -"K c #E2E2E2", -"L c #E2E0DF", -"M c #656A65", -"N c #4A4B49", -"O c #EAEDF1", -"P c #CED5DD", -"Q c #DBE0E9", -"R c #DDE1E9", -"S c #D3D7DD", -"T c #D9DCE1", -"U c #F4F4F4", -"V c #ACACAC", -"W c #ECECEC", -"X c #C3C3C3", -"Y c #C2C2C2", -"Z c #C9C9C8", -"` c #A8A8A8", -" . c #F6F8F6", -".. c #A7ADA5", -"+. c #6D7F71", -"@. c #ECECE9", -"#. c #FDFDFC", -"$. c #939C9A", -"%. c #1B2321", -"&. c #FCFBFA", -"*. c #F2F6F9", -"=. c #B4BFCC", -"-. c #7E8A9B", -";. c #515B6F", -">. c #50596A", -",. c #737D8D", -"'. c #BEC6CE", -"). c #C4CBD5", -"!. c #BFC5D1", -"~. c #F1F2F4", -"{. c #F4F4F3", -"]. c #ABABAB", -"^. c #515151", -"/. c #474747", -"(. c #464645", -"_. c #464646", -":. c #5D5D5C", -"<. c #A9A9A9", -"[. c #FAFAF9", -"}. c #EDEFF0", -"|. c #F1F5F5", -"1. c #636E62", -"2. c #636E5F", -"3. c #D4D5D3", -"4. c #FBF7F4", -"5. c #9BA595", -"6. c #657366", -"7. c #001514", -"8. c #FCFAF8", -"9. c #FDFCFC", -"0. c #FBF9F7", -"a. c #E3E6EA", -"b. c #9DACBF", -"c. c #515A6D", -"d. c #111828", -"e. c #131B29", -"f. c #0F1A2B", -"g. c #081125", -"h. c #0D1328", -"i. c #C2C9D1", -"j. c #C5CBD4", -"k. c #A6AEBB", -"l. c #F6F6F7", -"m. c #FAFAFA", -"n. c #F2F2F2", -"o. c #F3F3F3", -"p. c #AAAAAA", -"q. c #A0A09F", -"r. c #8A8A8A", -"s. c #7A7A7A", -"t. c #6C6C6C", -"u. c #454545", -"v. c #ABB3AF", -"w. c #A8B6A3", -"x. c #D0DBD0", -"y. c #F2F3F0", -"z. c #DEE1E0", -"A. c #66736A", -"B. c #354336", -"C. c #556254", -"D. c #C5C7C6", -"E. c #F2EDEA", -"F. c #CADAD9", -"G. c #9BA893", -"H. c #1B3128", -"I. c #FCF4EF", -"J. c #FDFBF9", -"K. c #DDDFE4", -"L. c #97A3B4", -"M. c #374152", -"N. c #0D131C", -"O. c #1C2026", -"P. c #262C3A", -"Q. c #242E43", -"R. c #202D41", -"S. c #172538", -"T. c #121523", -"U. c #BABCC3", -"V. c #9DA6B5", -"W. c #BABEC4", -"X. c #F8F8F7", -"Y. c #E7E7E7", -"Z. c #C6C6C5", -"`. c #BABAB9", -" + c #E7E9E9", -".+ c #63736C", -"++ c #464945", -"@+ c #5F7361", -"#+ c #CED4C3", -"$+ c #DBDEDA", -"%+ c #979999", -"&+ c #404342", -"*+ c #606E6B", -"=+ c #E5E5E3", -"-+ c #4B5F52", -";+ c #455845", -">+ c #2D362F", -",+ c #FCFAF9", -"'+ c #E4E4E7", -")+ c #97A8B9", -"!+ c #343C4A", -"~+ c #13181E", -"{+ c #1B2027", -"]+ c #1D232B", -"^+ c #1F2632", -"/+ c #212A3C", -"(+ c #242F45", -"_+ c #2A374D", -":+ c #121C2F", -"<+ c #525A67", -"[+ c #D9DDE5", -"}+ c #737C8C", -"|+ c #EAEBEB", -"1+ c #F7F7F6", -"2+ c #F6F6F5", -"3+ c #F5F5F5", -"4+ c #EDEDEB", -"5+ c #FBFBFA", -"6+ c #6C8175", -"7+ c #778673", -"8+ c #121613", -"9+ c #4C504A", -"0+ c #8FA695", -"a+ c #E2DCD8", -"b+ c #E5E6E7", -"c+ c #FBFAF9", -"d+ c #CAC6C1", -"e+ c #847F79", -"f+ c #FCFAFA", -"g+ c #ECE9E9", -"h+ c #A6B1C4", -"i+ c #232B37", -"j+ c #12171E", -"k+ c #191F27", -"l+ c #1D222B", -"m+ c #1E242B", -"n+ c #1E252F", -"o+ c #202937", -"p+ c #232F44", -"q+ c #283853", -"r+ c #253046", -"s+ c #0A1526", -"t+ c #D5D7DB", -"u+ c #727D90", -"v+ c #CFD0D2", -"w+ c #B1B1B1", -"x+ c #99A597", -"y+ c #7B9173", -"z+ c #65705D", -"A+ c #1F201B", -"B+ c #58655E", -"C+ c #F3F2F1", -"D+ c #AAB3C1", -"E+ c #525C6D", -"F+ c #0A0F17", -"G+ c #1C2129", -"H+ c #1E242A", -"I+ c #1E242C", -"J+ c #1F232D", -"K+ c #232E41", -"L+ c #2B3855", -"M+ c #2C3B57", -"N+ c #070D1F", -"O+ c #A3ABB6", -"P+ c #828EA0", -"Q+ c #B9BCC2", -"R+ c #F3F3F2", -"S+ c #F1EFEC", -"T+ c #72886D", -"U+ c #4E5849", -"V+ c #748268", -"W+ c #808080", -"X+ c #D6D9DE", -"Y+ c #5E6A7A", -"Z+ c #121621", -"`+ c #161D26", -" @ c #1D242C", -".@ c #1F242B", -"+@ c #1E2427", -"@@ c #212C3F", -"#@ c #283552", -"$@ c #2F405D", -"%@ c #0E162B", -"&@ c #59657B", -"*@ c #8A98AA", -"=@ c #AFB4BC", -"-@ c #F2F2F1", -";@ c #7D9074", -">@ c #494949", -",@ c #676D65", -"'@ c #C8CBC7", -")@ c #818B9B", -"!@ c #1B232F", -"~@ c #0F151F", -"{@ c #1B212B", -"]@ c #1E232D", -"^@ c #20252C", -"/@ c #24272C", -"(@ c #1F2429", -"_@ c #1C2228", -":@ c #1F2A3C", -"<@ c #1F2A40", -"[@ c #25344E", -"}@ c #314464", -"|@ c #15223A", -"1@ c #34445E", -"2@ c #939FB3", -"3@ c #ACB2BC", -"4@ c #F1F1F0", -"5@ c #ECEEEB", -"6@ c #B8BCB7", -"7@ c #647C65", -"8@ c #797E78", -"9@ c #C4C3C2", -"0@ c #919191", -"a@ c #DCE3EA", -"b@ c #242C3D", -"c@ c #0B101C", -"d@ c #1A212A", -"e@ c #1F242C", -"f@ c #21252C", -"g@ c #222629", -"h@ c #1C232A", -"i@ c #212B3D", -"j@ c #33415B", -"k@ c #27344B", -"l@ c #212F47", -"m@ c #374A68", -"n@ c #1A2840", -"o@ c #34445F", -"p@ c #96A3B5", -"q@ c #B3B7C0", -"r@ c #F2F2F0", -"s@ c #F0F0F0", -"t@ c #E2E7E2", -"u@ c #939E92", -"v@ c #50644E", -"w@ c #3D443E", -"x@ c #D4D2CF", -"y@ c #7F8898", -"z@ c #020A14", -"A@ c #171E28", -"B@ c #1C222A", -"C@ c #1E232B", -"D@ c #1F242D", -"E@ c #1F2228", -"F@ c #1D2328", -"G@ c #283449", -"H@ c #4A5C7B", -"I@ c #697D98", -"J@ c #4D5D79", -"K@ c #1F2D45", -"L@ c #394A6B", -"M@ c #1B2943", -"N@ c #425371", -"O@ c #95A3B5", -"P@ c #B8BDC2", -"Q@ c #EFEFEE", -"R@ c #EFEFED", -"S@ c #EDEEED", -"T@ c #EFF0F0", -"U@ c #F7FCF3", -"V@ c #313F30", -"W@ c #1C2120", -"X@ c #C9CBC9", -"Y@ c #F9F9F8", -"Z@ c #E9EEF2", -"`@ c #3C4352", -" # c #0C111D", -".# c #1E232E", -"+# c #1D212A", -"@# c #20242C", -"## c #1B1D20", -"$# c #263043", -"%# c #576886", -"&# c #8396B1", -"*# c #7A8FAD", -"=# c #677B99", -"-# c #28374F", -";# c #384A69", -"># c #182642", -",# c #5D708F", -"'# c #828FA3", -")# c #C5C7CB", -"!# c #F1F1EF", -"~# c #EEEEED", -"{# c #EEEEEC", -"]# c #9DA7A4", -"^# c #2A3B34", -"/# c #222725", -"(# c #80807E", -"_# c #EFEEEC", -":# c #F1F0EF", -"<# c #F4F3F2", -"[# c #F8F8F8", -"}# c #A8AFBB", -"|# c #0D1522", -"1# c #1A212E", -"2# c #1D232C", -"3# c #21252D", -"4# c #1E2327", -"5# c #171B20", -"6# c #637593", -"7# c #95A6BE", -"8# c #6D7F9C", -"9# c #617395", -"0# c #5A6E8B", -"a# c #2A354A", -"b# c #3D4E6D", -"c# c #1C2A46", -"d# c #748DAB", -"e# c #6D798A", -"f# c #DEDFE0", -"g# c #EEEEEE", -"h# c #EDEDEC", -"i# c #ECEAE7", -"j# c #ADB1B0", -"k# c #B5B9BA", -"l# c #F1F0F0", -"m# c #F9F8F8", -"n# c #F7F5F4", -"o# c #A7AAA4", -"p# c #B7BAB4", -"q# c #F7F6F6", -"r# c #ECEFF1", -"s# c #747F8E", -"t# c #0A121E", -"u# c #232C3A", -"v# c #1D232E", -"w# c #222932", -"x# c #1B1D21", -"y# c #1C273E", -"z# c #C1CFE1", -"A# c #8FA1B7", -"B# c #6D81A0", -"C# c #596D93", -"D# c #455674", -"E# c #293343", -"F# c #4A5C7D", -"G# c #304060", -"H# c #7690B8", -"I# c #5D6878", -"J# c #BBC0CC", -"K# c #ECECEB", -"L# c #F6F4F3", -"M# c #F4F1EF", -"N# c #F7F5F3", -"O# c #F9F8F7", -"P# c #BBBDB9", -"Q# c #4D5852", -"R# c #71746D", -"S# c #F0EAE7", -"T# c #DBDEE3", -"U# c #3E495B", -"V# c #1C2435", -"W# c #273041", -"X# c #283040", -"Y# c #293141", -"Z# c #262B38", -"`# c #1D212D", -" $ c #4A5B77", -".$ c #CFDBEB", -"+$ c #7A8FAC", -"@$ c #6C83A5", -"#$ c #4D6389", -"$$ c #35445E", -"%$ c #404D60", -"&$ c #506586", -"*$ c #4F6687", -"=$ c #6983AB", -"-$ c #343E50", -";$ c #4D5F7A", -">$ c #B8C0CC", -",$ c #F7F6F5", -"'$ c #D2D6D3", -")$ c #6C866F", -"!$ c #5A715E", -"~$ c #566758", -"{$ c #B5C1B4", -"]$ c #B2BAC8", -"^$ c #273245", -"/$ c #29354A", -"($ c #323D53", -"_$ c #364258", -":$ c #333F52", -"<$ c #343F52", -"[$ c #28354A", -"}$ c #6D7B92", -"|$ c #ACBDD2", -"1$ c #5B7297", -"2$ c #495F87", -"3$ c #3A4D6B", -"4$ c #252F44", -"5$ c #8292AC", -"6$ c #586E94", -"7$ c #6782A9", -"8$ c #37404D", -"9$ c #394860", -"0$ c #475977", -"a$ c #6E7E99", -"b$ c #EBEBEA", -"c$ c #BEC3BE", -"d$ c #CFD1CE", -"e$ c #F4F2F0", -"f$ c #7D8F84", -"g$ c #6A8667", -"h$ c #D5D8D4", -"i$ c #6B6B6B", -"j$ c #9E9E9F", -"k$ c #7A8EA8", -"l$ c #2B374D", -"m$ c #313E56", -"n$ c #34425B", -"o$ c #36425A", -"p$ c #354257", -"q$ c #39465D", -"r$ c #3B4963", -"s$ c #64738B", -"t$ c #768CAD", -"u$ c #354C72", -"v$ c #2E3D5B", -"w$ c #1D273A", -"x$ c #3D4655", -"y$ c #A7BACE", -"z$ c #607799", -"A$ c #617494", -"B$ c #191B1B", -"C$ c #445675", -"D$ c #3A4A65", -"E$ c #6C7A91", -"F$ c #ECECEA", -"G$ c #EAEAE9", -"H$ c #EAEAE8", -"I$ c #F7F6F4", -"J$ c #B5B9B6", -"K$ c #D7DCD9", -"L$ c #7B8982", -"M$ c #A9AEAD", -"N$ c #517257", -"O$ c #839284", -"P$ c #DEDEDD", -"Q$ c #D8D9D9", -"R$ c #F3F2EE", -"S$ c #51698C", -"T$ c #313F55", -"U$ c #35435B", -"V$ c #36445A", -"W$ c #35425C", -"X$ c #37465D", -"Y$ c #3D4A62", -"Z$ c #516079", -"`$ c #47536A", -" % c #354561", -".% c #212F46", -"+% c #0F1624", -"@% c #1A2231", -"#% c #99A5B7", -"$% c #97A8C3", -"%% c #6A7DA0", -"&% c #394559", -"*% c #1C1D26", -"=% c #35435C", -"-% c #344159", -";% c #8E96A2", -">% c #E9E9E8", -",% c #E9E9E7", -"'% c #F6F5F5", -")% c #70827F", -"!% c #C6D0C3", -"~% c #445344", -"{% c #637161", -"]% c #4B6C4C", -"^% c #CAC8C8", -"/% c #3D5271", -"(% c #3A4863", -"_% c #384862", -":% c #3E4C65", -"<% c #424D67", -"[% c #45536C", -"}% c #4D5A74", -"|% c #66768F", -"1% c #76869D", -"2% c #2A3243", -"3% c #151A27", -"4% c #252C3A", -"5% c #B2BBCE", -"6% c #C3D0E3", -"7% c #7B8CA9", -"8% c #51627E", -"9% c #171C22", -"0% c #141920", -"a% c #242C3A", -"b% c #3F4B60", -"c% c #BDC0C6", -"d% c #EBEBE9", -"e% c #D1D7D3", -"f% c #4F5753", -"g% c #27322D", -"h% c #57655B", -"i% c #7E8B86", -"j% c #F0EFED", -"k% c #3E516C", -"l% c #3F4E68", -"m% c #3C4A64", -"n% c #4C5A74", -"o% c #55637C", -"p% c #5A6881", -"q% c #707D95", -"r% c #8493A6", -"s% c #BFC8D8", -"t% c #D8E4F0", -"u% c #CCD5E4", -"v% c #E2E8F1", -"w% c #D2DAE9", -"x% c #8D9DB7", -"y% c #526380", -"z% c #323E53", -"A% c #080B11", -"B% c #0E1217", -"C% c #272E3A", -"D% c #747D8A", -"E% c #D6D7D8", -"F% c #E8E8E7", -"G% c #E8E8E6", -"H% c #D2D2D0", -"I% c #B3B7B4", -"J% c #BFC1BF", -"K% c #EBE8E7", -"L% c #5A718E", -"M% c #3F4C65", -"N% c #38475F", -"O% c #68768E", -"P% c #6E7C92", -"Q% c #78879B", -"R% c #959FB1", -"S% c #AAB4C1", -"T% c #C4CBD8", -"U% c #D7DCE6", -"V% c #D3D9E1", -"W% c #CCD3DC", -"X% c #8C9CB4", -"Y% c #52627B", -"Z% c #38475E", -"`% c #080E1A", -" & c #060910", -".& c #0E0F14", -"+& c #4F5869", -"@& c #B6B8BC", -"#& c #DDDDDC", -"$& c #E2E2E1", -"%& c #E5E5E4", -"&& c #E6E6E5", -"*& c #F2F1F1", -"=& c #F2F1F0", -"-& c #93A8C2", -";& c #2F3E56", -">& c #6C7A93", -",& c #939EAE", -"'& c #A9B3C0", -")& c #BDC3CB", -"!& c #C8CCD2", -"~& c #CDCFD5", -"{& c #CBD2DB", -"]& c #C7CFDC", -"^& c #A4B2C7", -"/& c #4C576D", -"(& c #262C3C", -"_& c #252D3B", -":& c #232C3D", -"<& c #323B4B", -"[& c #464B5A", -"}& c #959697", -"|& c #BDBDBC", -"1& c #C9C9C9", -"2& c #D6D6D5", -"3& c #E2E2E0", -"4& c #E7E7E6", -"5& c #E6E6E4", -"6& c #C8D6E7", -"7& c #515D76", -"8& c #33415A", -"9& c #66728A", -"0& c #C0C7D2", -"a& c #CACED7", -"b& c #CCCDD2", -"c& c #CBCED1", -"d& c #C8CED3", -"e& c #C2CDDB", -"f& c #A2B1C5", -"g& c #586377", -"h& c #181F27", -"i& c #363B40", -"j& c #575857", -"k& c #626261", -"l& c #656463", -"m& c #787877", -"n& c #929291", -"o& c #9F9F9D", -"p& c #B0B0AE", -"q& c #C3C3C2", -"r& c #D1D1D0", -"s& c #DCDCDB", -"t& c #DFE4EB", -"u& c #5F708B", -"v& c #717E92", -"w& c #4F5E78", -"x& c #8391A4", -"y& c #A9B4C2", -"z& c #B1BBC5", -"A& c #BAC3CE", -"B& c #D5DDE8", -"C& c #9EA7B9", -"D& c #444D63", -"E& c #1F242F", -"F& c #2D2F33", -"G& c #424242", -"H& c #4D4D4D", -"I& c #515150", -"J& c #575756", -"K& c #60605F", -"L& c #747473", -"M& c #838381", -"N& c #989897", -"O& c #B3B3B2", -"P& c #C6C6C4", -"Q& c #D3D3D2", -"R& c #F0EFEE", -"S& c #D0D1D3", -"T& c #959FB4", -"U& c #5B697E", -"V& c #9DA7B7", -"W& c #D8DEE4", -"X& c #D4DAE1", -"Y& c #DBE1E5", -"Z& c #DBDDE3", -"`& c #818894", -" * c #1E293A", -".* c #1B222B", -"+* c #222425", -"@* c #313131", -"#* c #343434", -"$* c #363635", -"%* c #3A3A3A", -"&* c #40403F", -"** c #484847", -"=* c #585858", -"-* c #6B6B6A", -";* c #838382", -">* c #A5A5A3", -",* c #BCBCBA", -"'* c #CFCFCE", -")* c #EFEFEF", -"!* c #E3E3E2", -"~* c #D9D9D8", -"{* c #BCBCBB", -"]* c #9DA0A4", -"^* c #616678", -"/* c #2F3A4F", -"(* c #2C3649", -"_* c #394250", -":* c #111923", -"<* c #010613", -"[* c #0A0F16", -"}* c #1F2225", -"|* c #262628", -"1* c #282828", -"2* c #292828", -"3* c #292929", -"4* c #2D2D2C", -"5* c #2F2F2F", -"6* c #343433", -"7* c #3D3D3C", -"8* c #5C5C5C", -"9* c #A1A1A0", -"0* c #B9B9B8", -"a* c #CECECC", -"b* c #E4E4E2", -"c* c #D7D7D5", -"d* c #989896", -"e* c #717174", -"f* c #464B51", -"g* c #2F353C", -"h* c #23272C", -"i* c #222529", -"j* c #25272A", -"k* c #2E2F31", -"l* c #313030", -"m* c #313130", -"n* c #333332", -"o* c #363636", -"p* c #3C3C3C", -"q* c #545454", -"r* c #686867", -"s* c #848483", -"t* c #A8A8A7", -"u* c #C0C0BE", -"v* c #D3D3D1", -"w* c #D9D9D7", -"x* c #C0C0BF", -"y* c #A3A3A2", -"z* c #888886", -"A* c #6E6D6C", -"B* c #5F6061", -"C* c #585859", -"D* c #525252", -"E* c #A3A3A1", -"F* c #A2A2A0", -"G* c #A2A1A0", -"H* c #A2A2A1", -"I* c #A3A2A1", -"J* c #A4A3A2", -"K* c #A4A4A2", -"L* c #A6A6A4", -"M* c #A9A8A6", -"N* c #ABAAA8", -"O* c #AFAEAB", -"P* c #B3B1AE", -"Q* c #B5B4B1", -"R* c #B8B6B2", -"S* c #BAB8B4", -"T* c #6E6B62", -"U* c #DEDEDC", -"V* c #D1D1CF", -"W* c #BFBFBE", -"X* c #AFAFAF", -"Y* c #9F9F9F", -"Z* c #919190", -"`* c #888888", -" = c #302E28", -".= c #2E2C27", -"+= c #2D2B26", -"@= c #312F29", -"#= c #33312B", -"$= c #36332D", -"%= c #38362F", -"&= c #3D3A33", -"*= c #413E36", -"== c #47433B", -"-= c #4D4940", -";= c #514D44", -">= c #535046", -",= c #565248", -"'= c #23211D", -")= c #EBEAE9", -"!= c #DADAD9", -"~= c #C9C9C7", -"{= c #B6B6B6", -"]= c #B2B0AD", -"^= c #423F37", -"/= c #E3E2E1", -"(= c #4E4B44", -"_= c #403D36", -":= c #413E37", -"<= c #908E8A", -"[= c #46433B", -"}= c #D8D7D5", -"|= c #75726A", -"1= c #ACAAA5", -"2= c #D7D6D3", -"3= c #DBDAD8", -"4= c #86837C", -"5= c #D5D5D4", -"6= c #B6B5B1", -"7= c #4E4A41", -"8= c #D5D4D2", -"9= c #514E46", -"0= c #5E5B52", -"a= c #504D43", -"b= c #545147", -"c= c #8A8780", -"d= c #E3E3E1", -"e= c #D2D1CE", -"f= c #7B7770", -"g= c #58544A", -"h= c #7C7971", -"i= c #E7E7E5", -"j= c #CCCBC8", -"k= c #C4C2BF", -"l= c #C4C3BF", -"m= c #FBFAFA", -"n= c #817E76", -"o= c #D1D0CD", -"p= c #67635A", -"q= c #F5F4F4", -"r= c #67645B", -"s= c #908E87", -"t= c #E5E4E3", -"u= c #6F6C63", -"v= c #8B8881", -"w= c #C0BEBA", -"x= c #8C8982", -"y= c #C8C7C4", -"z= c #656259", -"A= c #77736B", -"B= c #E4E4E3", -"C= c #D3D2CF", -"D= c #76736B", -"E= c #59554B", -"F= c #E7E6E5", -"G= c #AFADA8", -"H= c #DFDFDD", -"I= c #D0CFCC", -"J= c #736F67", -"K= c #A9A9A7", -"L= c #8D8D8D", -"M= c #E1E1DF", -"N= c #9A9A9A", -"O= c #8C8C8C", -" . . . . . . . . . . . . . + @ # + . . . . . . . . . . . . . . . . . $ % ", -". & * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * = - ; . ", -". * * * * * * * * * * * * * * * * * * * > * * , , , , , , , , , , , , ' = ) ! . ", -". * * * * * * ~ * * { ] ^ / ( _ : < * * * , [ [ , , , , , , , , , , , } | * 1 2 . ", -". * * * * * * ~ * * 3 4 5 6 7 8 9 0 * , , , , , , , , , , , , , , , , } a * * ) b c ", -". * * * * * * * * * d e f g h i j k , , , , , l , , , , , , , , , m m = n * m * o p q ", -". * * * * * * * * * * r s t u v w x , , , , , l , , y z A m m m m m m B C * D E * F G . ", -". * * * * * * * * * * H I J K L M N , , , , l m z O P Q R S T ' E E E U V W X F n Y Z ` . ", -". * * * * * * * * m ...+.@., #.$.%., , , , &.*.=.-.;.>.,.'.).!.~.E d {.].^./.(._._.:.<.. ", -". * * * * [. .m * }.|.1.2.3.4.5.6.7.8.m 9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.! p.q.r.s.t.u.. ", -". * * , n.v.w.x.y.z.A.B.C.D.E.F.G.H.I.m J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.D ' } } Y.Z.Z `.s.. ", -". * * , +.+++@+#+$+%+&+*+=+E -+;+>+,+,+'+)+!+~+{+]+^+/+(+_+:+<+[+}+|+} X.1+2+3+3+3+4+<.. ", -". * * , 5+6+7+8+9+0+1 a+b+c+E d+e+` f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+= } 3+3+B B o.o.w+. ", -". * , , 9.x+y+z+A+B+c+E E E E E E d C+D+E+F+G+l+m+H+I+J+K+L+M+N+O+P+Q+B B B U {.o.R+R+C . ", -". * m m m S+T+U+V+W+X.E E d ' ' ' ' X+Y+Z+`+ @I+.@.@+@^+@@#@$@%@&@*@=@o.U {.R+R+R+-@-@C . ", -". * m #.E ' ;@>@,@'@5+' ' ' ' 5+5+m.)@!@~@{@]@^@/@(@_@:@<@[@}@|@1@2@3@{.R+R+n.n.-@4@4@C . ", -". * E ' 5@6@7@8@9@0@} ' 5+5+m.m.m.a@b@c@d@l+e@f@g@h@i@j@k@l@m@n@o@p@q@n.n.-@r@4@4@s@s@C . ", -". * d [.t@u@v@w@x@{.m.m.m.m.m.[.m.y@z@A@B@C@D@E@F@G@H@I@J@K@L@M@N@O@P@-@-@r@s@s@< Q@R@C . ", -". * ' S@T@U@V@W@X@m.m.[.[.[.D Y@Z@`@ #.#+#@#D@##$#%#&#*#=#-#;#>#,#'#)#4@!#< < Q@~#~#{#C . ", -". * 5+3+]#^#/#(#_#[.D :#<#D X.[#}#|#1#2#3#f@4#5#6#7#8#9#0#a#b#c#d#e#f#< < g#g#~#{#h#h#C . ", -". * m.X.i#j#k#l#m#D n#o#p#q#} r#s#t#u#v#w#^@x#y#z#A#B#C#D#E#F#G#H#I#J#|+~#~#{#h#h#W K#C . ", -". * [.L#M#N#[#O#O#1+P#Q#R#S#1+T#U#V#W#X#Y#Z#`# $.$+$@$#$$$%$&$*$=$-$;$>${#h#4+4+K#K#K#C . ", -". * D ,$X.Y@[#[#} '$)$!$~${$3+]$^$/$($_$:$<$[$}$|$1$2$3$4$5$6$7$8$9$0$a$4+4+K#K#b$b$b$C . ", -". * [#[#[#n#c$d$e$f$g$h$i$j${.k$l$m$n$o$p$q$r$s$t$u$v$w$x$y$z$A$B$C$D$E$K#F$b$b$b$G$H$C . ", -". * X.1+I$J$K$L$M$N$O$< P$Q$R$S$T$U$V$W$X$Y$Z$`$ %.%+%@%#%$%%%&%*%=%-%;%b$b$b$G$>%>%,%C . ", -". * = = '%)%!%~%{%]%^%o.R+R+{./%(%_%:%<%[%}%|%1%2%3%4%5%6%7%8%9%0%a%b%c%d%>%>%>%,%,%,%C . ", -". * 2+2+2+e%f%g%h%i%j%R+-@1 -@k%l%m%n%o%p%q%r%s%t%u%v%w%x%y%z%A%B%C%D%E%F%F%>%,%F%F%G%C . ", -". * 3+U {.{.H%I%J%K%-@4@4@4@4@L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%`% &.&+&@&#&$&%&&&F%G%G%G%C . ", -". * {.{.R+n.*&=&=&4@4@4@s@< Q@-&M%;&>&,&'&)&!&~&{&]&^&/&(&_&:&<&[&}&|&1&2&#&3&4&4&4&5&C . ", -". * n.-@-@-@-@4@4@s@< < < ~#b$6&7&8&9&0&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&4&5&5&%&C . ", -". * -@-@-@4@< < < < < Q@R@G$%&t&u&v&w&x&y&z&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&%&%&%&%&C . ", -". * 1 4@< < j%R&Q@Q@R@~#h#&&P$S&T&U&V&W&X&Y&Z&`& *.*+*@*#*$*%*&***=*-*;*>*,*'*%&=+=+=+C . ", -". * < < )*Q@Q@Q@R@~#~#K#G$!*~*{*]*^*/*(*_*:*<*[*}*|*1*2*3*4*5*6*7*>@8*m&9*0*a*=+=+=+b*C . ", -". * Q@Q@Q@Q@R@~#{#K#K#K#>%!*c*,*d*e*f*g*h*i*j*k*l*m*5*@*@*n*o*p*u.q*r*s*t*u*v*=+=+b*b*C . ", -". * Q@Q@~#~#{#K#K#K#K#b$>%!*w*x*y*z*A*B*C*D*E*F*F*F*G*F*H*I*J*K*L*M*N*O*P*Q*R*S*S*S*S*S*S*S*S*T*", -". * ~#~#4+K#K#F$b$b$b$b$H$5&U*V*W*X*Y*N&Z*`*N* =.=+=+=.= =@=#=$=%=&=*===-=;=>=,=,=,=,=,=,=,=,='=", -". * 4+K#F$)=)=)=b$d%d%G$H$G%b*!=H%~=x*{*0*{=]=^=* /=(=_=:=<=* * [=* * * m.}=|=,=1=2=D X.3=4=,='=", -". * F$b$b$b$d%G$G$G$G$H$H$G%5&3&#&~*5=Q&Q&H%6=7=* * 8=9=0={.* * a=* * b=c=* d=,=e=f=g=h=* R+,='=", -". * d%d%G$G$G$G$G$H$H$G%G%G%G%i=i=i=i=i=&&5&S*,=* j=* k=l=j=* * ,=* * ,=g=* m=,=,=,=,=n=* o=,='=", -". * G$G$G$H$H$>%>%F%G%G%G%i=i=i=i=i=5&5&=+=+S*,=* p={.* q=r=* * ,=* * ,=s=* o=,=,=,=* * t=u=,='=", -". * H$>%>%>%>%F%G%G%4&4&i=i=i=i=5&5&=+=+=+=+S*,=* ,=v=w=x=,=* * ,=* * * m#y=z=,=,=,=,=A=* )=,='=", -". * >%>%>%G%4&4&4&4&i=i=i=&&&&5&=+=+=+=+B=B=S*,=* ,=,=,=,=,=* * ,=* * ,=,=,=,=,=C=D=E=4=* F=,='=", -". * ,%4&4&4&4&i=i=i=&&&&&&5&=+=+=+B=B=b*b*b*S*,=* ,=,=,=,=,=* * ,=* * ,=,=,=,=,=G=H=m=q#I=J=,='=", -". * 4&i=i=i=&&&&&&&&5&5&=+B=B=B=b*b*b*b*b*b*S*,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,=,='=", -". * i=&&&&&&5&5&5&5&B=B=b*b*b*b*b*b*b*b*b*d=T*'='='='='='='='='='='='='='='='='='='='='='='='='=", -". * &&5&5&5&5&%&B=b*b*b*b*b*b*b*b*b*b*d=d=d=d=K=p p p y*y*y*y*E*E*E*E*E*E*E*E*E*E*E*E*L=. ", -". & 5&5&5&=+b*b*b*b*b*b*b*b*b*b*!*d=d=d=d=d=d=d=d=3&3&3&3&M=M=M=M=M=M=M=M=M=M=M=M=M=M=N=. ", -". Y C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C N=O=. ", -" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", -" ", -" ", -" "}; diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/plugin.c --- a/src/madplug/plugin.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/madplug/plugin.c Fri Dec 07 12:09:16 2007 -0600 @@ -1,6 +1,6 @@ /* * mad plugin for audacious - * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa + * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa, Eugene Zagidullin * * Portions derived from xmms-mad: * Copyright (C) 2001-2002 Sam Clegg - See COPYING @@ -19,6 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* #define AUD_DEBUG 1 */ + #include "config.h" #include "plugin.h" #include "input.h" @@ -33,6 +35,7 @@ #include #include #include "SFMT.h" +#include "tuple.h" /* * Global variables @@ -101,19 +104,15 @@ else x = 0; config->pregain_scale = (x != 0) ? pow(10.0, x / 20) : 1; -#ifdef DEBUG - g_message("pregain=[%s] -> %g -> %g", text, x, config->pregain_scale); -#endif + AUDDBG("pregain=[%s] -> %g -> %g", text, x, config->pregain_scale); text = config->replaygain.default_db; if ( text != NULL ) x = g_strtod(text, NULL); else x = 0; config->replaygain.default_scale = (x != 0) ? pow(10.0, x / 20) : 1; -#ifdef DEBUG - g_message("RG.default=[%s] -> %g -> %g", text, x, + AUDDBG("RG.default=[%s] -> %g -> %g", text, x, config->replaygain.default_scale); -#endif } static void audmad_init() @@ -404,9 +403,7 @@ static void audmad_stop(InputPlayback *playback) { -#ifdef DEBUG - g_message("f: audmad_stop"); -#endif + AUDDBG("f: audmad_stop"); g_mutex_lock(mad_mutex); info.playback = playback; g_mutex_unlock(mad_mutex); @@ -418,20 +415,15 @@ g_mutex_unlock(mad_mutex); g_cond_signal(mad_cond); -#ifdef DEBUG - g_message("waiting for thread"); -#endif + AUDDBG("waiting for thread"); g_thread_join(decode_thread); -#ifdef DEBUG - g_message("thread done"); -#endif + AUDDBG("thread done"); + input_term(&info); decode_thread = NULL; } -#ifdef DEBUG - g_message("e: audmad_stop"); -#endif + AUDDBG("e: audmad_stop"); } static void audmad_play_file(InputPlayback *playback) @@ -439,10 +431,10 @@ gboolean rtn; gchar *url = playback->filename; -#ifdef DEBUG +#ifdef AUD_DEBUG { gchar *tmp = g_filename_to_utf8(url, -1, NULL, NULL, NULL); - g_message("playing %s", tmp); + AUDDBG("playing %s", tmp); g_free(tmp); } #endif /* DEBUG */ @@ -502,16 +494,14 @@ audmad_get_song_info(char *url, char **title, int *length) { struct mad_info_t myinfo; -#ifdef DEBUG +#ifdef AUD_DEBUG gchar *tmp = g_filename_to_utf8(url, -1, NULL, NULL, NULL); - g_message("f: audmad_get_song_info: %s", tmp); + AUDDBG("f: audmad_get_song_info: %s", tmp); g_free(tmp); #endif /* DEBUG */ if (input_init(&myinfo, url, NULL) == FALSE) { -#ifdef DEBUG - g_message("error initialising input"); -#endif + AUDDBG("error initialising input"); return; } @@ -530,40 +520,22 @@ *length = -1; } input_term(&myinfo); -#ifdef DEBUG - g_message("e: audmad_get_song_info"); -#endif /* DEBUG */ + AUDDBG("e: audmad_get_song_info"); } -static void -audmad_get_song_length(char *url, int *length, VFSFile *fd) +static gboolean +audmad_fill_info(struct mad_info_t *info, VFSFile *fd) { - struct mad_info_t myinfo; -#ifdef DEBUG - gchar *tmp = g_filename_to_utf8(url, -1, NULL, NULL, NULL); - g_message("f: audmad_get_song_length: %s", tmp); - g_free(tmp); -#endif /* DEBUG */ + if (fd == NULL || info == NULL) return FALSE; + AUDDBG("f: audmad_fill_info(): %s", fd->uri); - if (input_init(&myinfo, url, fd ? fd : NULL) == FALSE) { -#ifdef DEBUG - g_message("error initialising input"); -#endif - return; + if (input_init(info, fd->uri, fd) == FALSE) { + AUDDBG("audmad_fill_info(): error initialising input"); + return FALSE; } - - if (input_get_info(&myinfo, info.remote ? TRUE : audmad_config.fast_play_time_calc) == TRUE) { - *length = aud_tuple_get_int(myinfo.tuple, FIELD_LENGTH, NULL); - if(*length == -1) - *length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS); - } - else { - *length = -1; - } - input_term(&myinfo); -#ifdef DEBUG - g_message("e: audmad_get_song_info"); -#endif /* DEBUG */ + + info->fileinfo_request = FALSE; /* we don't need to read tuple again */ + return input_get_info(info, aud_vfs_is_remote(fd->uri) ? TRUE : audmad_config.fast_play_time_calc); } static void audmad_about() @@ -625,7 +597,6 @@ #endif /* !NOGUI */ } -extern void audmad_get_file_info(char *filename); extern void audmad_configure(); static void __set_and_free(Tuple *tuple, gint nfield, gchar *name, gchar *value) @@ -644,23 +615,28 @@ struct id3_file *id3file = NULL; struct id3_tag *tag = NULL; - gboolean local_fd = FALSE; + struct mad_info_t myinfo; -#ifdef DEBUG + gboolean local_fd = FALSE; + int length; + +#ifdef AUD_DEBUG string = aud_str_to_utf8(filename); - g_message("f: mad: audmad_get_song_tuple: %s", string); + AUDDBG("f: mad: audmad_get_song_tuple: %s", string); g_free(string); string = NULL; #endif + /* isn't is obfuscated? --eugene */ + if(info.remote && mad_timer_count(info.duration, MAD_UNITS_SECONDS) <= 0){ if((fd && aud_vfs_is_streaming(fd)) || (info.playback && info.playback->playing)) { gchar *tmp = NULL; tuple = aud_tuple_new_from_filename(filename); -#ifdef DEBUG +#ifdef AUD_DEBUG if(info.playback) - g_message("info.playback->playing = %d",info.playback->playing); + AUDDBG("info.playback->playing = %d",info.playback->playing); #endif tmp = aud_vfs_get_metadata(info.infile ? info.infile : fd, "track-name"); if(tmp){ @@ -685,21 +661,14 @@ tmp = NULL; } -#ifdef DEBUG - g_message("audmad_get_song_tuple: track_name = %s", aud_tuple_get_string(tuple, -1, "track-name")); - g_message("audmad_get_song_tuple: stream_name = %s", aud_tuple_get_string(tuple, -1, "stream-name")); -#endif + AUDDBG("audmad_get_song_tuple: track_name = %s", aud_tuple_get_string(tuple, -1, "track-name")); + AUDDBG("audmad_get_song_tuple: stream_name = %s", aud_tuple_get_string(tuple, -1, "stream-name")); aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, -1); aud_tuple_associate_int(tuple, FIELD_MTIME, NULL, 0); // this indicates streaming -#ifdef DEBUG - g_message("get_song_tuple: remote: tuple"); -#endif + AUDDBG("get_song_tuple: remote: tuple"); return tuple; } -#ifdef DEBUG - g_message("get_song_tuple: remote: NULL"); -#endif -// return NULL; + AUDDBG("get_song_tuple: remote: NULL"); } /* info.remote */ // if !fd, pre-open the file with aud_vfs_fopen() and reuse fd. @@ -710,6 +679,12 @@ local_fd = TRUE; } + if (!audmad_fill_info(&myinfo, fd)) { + AUDDBG("get_song_tuple: error obtaining info\n"); + if (local_fd) aud_vfs_fclose(fd); + return NULL; + } + tuple = aud_tuple_new(); aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, -1); @@ -741,22 +716,8 @@ g_free(realfn); realfn = NULL; // length - string = input_id3_get_string(tag, "TLEN"); - if (string) { - aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, atoi(string)); -#ifdef DEBUG - g_message("get_song_tuple: TLEN = %d", aud_tuple_get_int(tuple, FIELD_LENGTH, NULL)); -#endif - g_free(string); - string = NULL; - } - else { - char *dummy = NULL; - int length = 0; - audmad_get_song_length(filename, &length, fd); - aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); - g_free(dummy); - } + length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS); + aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); // track number string = input_id3_get_string(tag, ID3_FRAME_TRACK); @@ -768,9 +729,7 @@ // genre __set_and_free(tuple, FIELD_GENRE, NULL, input_id3_get_string(tag, ID3_FRAME_GENRE)); __set_and_free(tuple, FIELD_COMMENT, NULL, input_id3_get_string(tag, ID3_FRAME_COMMENT)); -#ifdef DEBUG - g_message("genre = %s", aud_tuple_get_string(tuple, FIELD_GENRE, NULL)); -#endif + AUDDBG("genre = %s", aud_tuple_get_string(tuple, FIELD_GENRE, NULL)); } id3_file_close(id3file); } // id3file @@ -781,26 +740,26 @@ aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(realfn ? realfn : filename)); g_free(realfn); realfn = NULL; // length - { - char *dummy = NULL; - int length = 0; - if(aud_tuple_get_int(tuple, FIELD_LENGTH, NULL) == -1) { - audmad_get_song_length(filename, &length, fd); - aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); - } - g_free(dummy); - } + length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS); + aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); } aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); - aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "MPEG Audio (MP3)"); + aud_tuple_associate_int(tuple, FIELD_BITRATE, NULL, myinfo.bitrate / 1000); + g_free(string); + + string = g_strdup_printf("MPEG-1 Audio Layer %d", myinfo.mpeg_layer); + aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, string); + g_free(string); + + aud_tuple_associate_string(tuple, FIELD_MIMETYPE, NULL, "audio/mpeg"); + + input_term(&myinfo); if(local_fd) aud_vfs_fclose(fd); -#ifdef DEBUG - g_message("e: mad: audmad_get_song_tuple"); -#endif + AUDDBG("e: mad: audmad_get_song_tuple"); return tuple; } @@ -833,12 +792,12 @@ .seek = audmad_seek, .cleanup = audmad_cleanup, .get_song_info = audmad_get_song_info, - .file_info_box = audmad_get_file_info, .get_song_tuple = audmad_get_song_tuple, .is_our_file_from_vfs = audmad_is_our_fd, .vfs_extensions = fmts, .mseek = audmad_mseek, - .probe_for_tuple = audmad_probe_for_tuple + .probe_for_tuple = audmad_probe_for_tuple, + .update_song_tuple = audmad_update_song_tuple, }; InputPlugin *madplug_iplist[] = { &mad_ip, NULL }; diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/plugin.h --- a/src/madplug/plugin.h Fri Dec 07 12:08:47 2007 -0600 +++ b/src/madplug/plugin.h Fri Dec 07 12:09:16 2007 -0600 @@ -22,7 +22,7 @@ #ifndef AUD_MAD_H #define AUD_MAD_H -/* #define DEBUG 1 */ +/* #define AUD_DEBUG 1 */ /* #define DEBUG_INTENSIVELY 1 */ /* #define DEBUG_DITHER 1 */ diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/replaygain.c --- a/src/madplug/replaygain.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/madplug/replaygain.c Fri Dec 07 12:09:16 2007 -0600 @@ -92,10 +92,9 @@ free(buff); return 8; } -#ifdef DEBUG - printf("ver = %ld\n", Read_LE_Uint32(tp->Version)); - printf("taglen = %ld\n", TagLen); -#endif + + AUDDBG("ver = %ld\n", Read_LE_Uint32(tp->Version)); + AUDDBG("taglen = %ld\n", TagLen); TagCount = Read_LE_Uint32(tp->TagCount); end = buff + TagLen - sizeof(T); @@ -204,14 +203,11 @@ char *value; struct id3_frame *frame; -#ifdef DEBUG - g_message("f: ReadId3v2TXXX"); -#endif + AUDDBG("f: ReadId3v2TXXX"); + /* tag must be read before! */ if (! file_info->tag ) { -#ifdef DEBUG - g_message("id3v2 not found"); -#endif + AUDDBG("id3v2 not found"); return 0; } @@ -259,9 +255,7 @@ VFSFile *fp; glong curpos = 0; -#ifdef DEBUG - g_message("f: read_replaygain"); -#endif + AUDDBG("f: read_replaygain"); file_info->has_replaygain = FALSE; file_info->replaygain_album_scale = -1; @@ -270,11 +264,11 @@ file_info->mp3gain_minmax = -77; if (ReadId3v2TXXX(file_info)) { -#ifdef DEBUG - g_message("found ReplayGain info in id3v2 tag"); +#ifdef AUD_DEBUG + AUDDBG("found ReplayGain info in id3v2 tag"); gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL); - g_message("RG album scale= %g, RG track scale = %g, in %s", + AUDDBG("RG album scale= %g, RG track scale = %g, in %s", file_info->replaygain_album_scale, file_info->replaygain_track_scale, tmp); g_free(tmp); @@ -322,15 +316,15 @@ offs, res); } } -#ifdef DEBUG +#ifdef AUD_DEBUG else - g_message("replaygain: not found"); + AUDDBG("replaygain: not found"); #endif } -#ifdef DEBUG +#ifdef AUD_DEBUG if (res == 0) { // got APE tags, show the result gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL); - g_message("RG album scale= %g, RG track scale = %g, in %s", + AUDDBG("RG album scale= %g, RG track scale = %g, in %s", file_info->replaygain_album_scale, file_info->replaygain_track_scale, tmp); g_free(tmp); @@ -346,7 +340,5 @@ aud_vfs_fclose(fp); -#ifdef DEBUG - g_message("e: read_replaygain"); -#endif + AUDDBG("e: read_replaygain"); } diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/tuple.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/madplug/tuple.c Fri Dec 07 12:09:16 2007 -0600 @@ -0,0 +1,188 @@ +/* + * mad plugin for audacious + * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa, Eugene Zagidullin + * + * Portions derived from xmms-mad: + * Copyright (C) 2001-2002 Sam Clegg - See COPYING + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include "plugin.h" +#include "tuple.h" +#include "input.h" + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +static void +update_id3_frame(struct id3_tag *tag, const char *frame_name, const char *data, int sjis) +{ + int res; + struct id3_frame *frame; + union id3_field *field; + id3_ucs4_t *ucs4; + + if (data == NULL) + return; + + /* printf ("updating id3: %s: %s\n", frame_name, data); + + + An empty string removes the frame altogether. + */ + if (strlen(data) == 0) { + while ((frame = id3_tag_findframe(tag, frame_name, 0))) { + AUDDBG("madplug: detachframe\n"); + id3_tag_detachframe(tag, frame); + } + return; + } + + frame = id3_tag_findframe(tag, frame_name, 0); + if (!frame) { + AUDDBG("frame_new\n"); + frame = id3_frame_new(frame_name); + id3_tag_attachframe(tag, frame); + } + + /* setup ucs4 string */ + if(sjis) { + ucs4 = id3_latin1_ucs4duplicate((id3_latin1_t *) data); + } + else { + ucs4 = id3_utf8_ucs4duplicate((id3_utf8_t *) data); + } + + /* set encoding */ + field = id3_frame_field(frame, 0); + id3_field_settextencoding(field, sjis ? ID3_FIELD_TEXTENCODING_ISO_8859_1 : + ID3_FIELD_TEXTENCODING_UTF_8); + + /* setup genre code */ + if (!strcmp(frame_name, ID3_FRAME_GENRE)) { + char *tmp; + int index = id3_genre_number(ucs4); + g_free(ucs4); + + if(index == -1) { /* unknown genre. remove TCON frame. */ + AUDDBG("madplug: remove genre frame\n"); + id3_tag_detachframe(tag, frame); + } + else { /* meaningful genre */ + tmp = g_strdup_printf("%d", index); + ucs4 = id3_latin1_ucs4duplicate((unsigned char *) tmp); + } + + } + + /* write string */ + if (!strcmp(frame_name, ID3_FRAME_COMMENT)) { + field = id3_frame_field(frame, 3); + field->type = ID3_FIELD_TYPE_STRINGFULL; + res = id3_field_setfullstring(field, ucs4); + } + else { + field = id3_frame_field(frame, 1); + field->type = ID3_FIELD_TYPE_STRINGLIST; + res = id3_field_setstrings(field, 1, &ucs4); + } + + if (res != 0) + g_print("error setting id3 field: %s\n", frame_name); +} + +static void +update_id3_frame_from_tuple(struct id3_tag *id3tag, const char *field, Tuple *tuple, int fieldn, int sjis) +{ + int val; + char *text, *text2; + const char *encoding = sjis ? "SJIS" : "UTF-8"; + + if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_INT) { + val = aud_tuple_get_int(tuple, fieldn, NULL); + if(val > 0) { + text2 = g_strdup_printf("%d", val); + AUDDBG("madplug: updating field:\"%s\"=\"%s\", enc %s\n", field, text2, encoding); + update_id3_frame(id3tag, field, text2, 0); + g_free(text2); + } else { + update_id3_frame(id3tag, field, "", 0); /* will be detached */ + } + + } else if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_STRING) { + text = (char*)aud_tuple_get_string(tuple, fieldn, NULL); + text2 = g_convert(text, strlen(text), encoding, "UTF-8", NULL, NULL, NULL); + AUDDBG("madplug: updating field:\"%s\"=\"%s\", enc %s\n", field, text2, encoding); + update_id3_frame(id3tag, field, text2, sjis); + g_free(text2); + } +} + +gboolean +audmad_update_song_tuple(Tuple *tuple, VFSFile *fd) +{ + struct id3_file *id3file; + struct id3_tag *id3tag; + gchar *text; + struct mad_info_t songinfo; + + if ((id3file = id3_file_vfsopen(fd, ID3_FILE_MODE_READWRITE)) == NULL) return FALSE; + + id3tag = id3_file_tag(id3file); + if (!id3tag) { + AUDDBG("no id3tag\n. append new tag.\n"); + id3tag = id3_tag_new(); + id3_tag_clearframes(id3tag); + id3tag->options |= ID3_TAG_OPTION_APPENDEDTAG | ID3_TAG_OPTION_ID3V1; + } + + id3_tag_options(id3tag, ID3_TAG_OPTION_ID3V1, ~0); /* enables id3v1. TODO: make id3v1 optional */ + + update_id3_frame_from_tuple(id3tag, ID3_FRAME_TITLE, tuple, FIELD_TITLE, audmad_config.sjis); + update_id3_frame_from_tuple(id3tag, ID3_FRAME_ARTIST, tuple, FIELD_ARTIST, audmad_config.sjis); + update_id3_frame_from_tuple(id3tag, ID3_FRAME_ALBUM, tuple, FIELD_ALBUM, audmad_config.sjis); + update_id3_frame_from_tuple(id3tag, ID3_FRAME_YEAR, tuple, FIELD_YEAR, audmad_config.sjis); + update_id3_frame_from_tuple(id3tag, ID3_FRAME_COMMENT, tuple, FIELD_COMMENT, audmad_config.sjis); + update_id3_frame_from_tuple(id3tag, ID3_FRAME_TRACK, tuple, FIELD_TRACK_NUMBER, audmad_config.sjis); + update_id3_frame_from_tuple(id3tag, ID3_FRAME_GENRE, tuple, FIELD_GENRE, audmad_config.sjis); + + if(!id3_tag_findframe(id3tag, "TLEN", 0) && input_init(&songinfo, fd->uri, fd) && !songinfo.remote) { + AUDDBG("update TLEN frame\n"); + songinfo.fileinfo_request = FALSE; /* we don't need to read tuple again */ + input_get_info(&songinfo, FALSE); + text = g_strdup_printf("%ld", mad_timer_count(songinfo.duration, MAD_UNITS_MILLISECONDS)); + AUDDBG("TLEN: \"%s\"\n", text); + update_id3_frame(id3tag, "TLEN", text, 0); + g_free(text); + input_term(&songinfo); + } + + if (id3_file_update(id3file) != 0) return FALSE; + + id3_file_close(id3file); + return TRUE; +} + diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/madplug/tuple.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/madplug/tuple.h Fri Dec 07 12:09:16 2007 -0600 @@ -0,0 +1,30 @@ +/* + * mad plugin for audacious + * Copyright (C) 2005-2007 William Pitcock, Yoshiki Yazawa, Eugene Zagidullin + * + * Portions derived from xmms-mad: + * Copyright (C) 2001-2002 Sam Clegg - See COPYING + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TUPLE_H +#define TUPLE_H + +#include +#include + +gboolean audmad_update_song_tuple(Tuple *tuple, VFSFile *fd); + +#endif diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/pls/pls.c --- a/src/pls/pls.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/pls/pls.c Fri Dec 07 12:09:16 2007 -0600 @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* #define AUD_DEBUG 1 */ + #include #include #include @@ -65,30 +67,28 @@ g_snprintf(line_key, sizeof(line_key), "File%d", i); if ((line = aud_read_ini_string(inifile, "playlist", line_key))) { - gchar *uri = g_filename_to_uri(line, NULL, NULL); - - if (uri) - g_free(line); - else - uri = line; + gchar *uri = aud_construct_uri(line, filename); + g_free(line); - if (aud_cfg->use_pl_metadata) - { - g_snprintf(title_key, sizeof(title_key), "Title%d", i); + /* add file only if valid uri has been constructed */ + if (uri) { + if (aud_cfg->use_pl_metadata) + { + g_snprintf(title_key, sizeof(title_key), "Title%d", i); - if ((title = aud_read_ini_string(inifile, "playlist", title_key))) - aud_playlist_load_ins_file(playlist, uri, filename, pos, title, -1); + if ((title = aud_read_ini_string(inifile, "playlist", title_key))) + aud_playlist_load_ins_file(playlist, uri, filename, pos, title, -1); + else + aud_playlist_load_ins_file(playlist, uri, filename, pos, NULL, -1); + } else aud_playlist_load_ins_file(playlist, uri, filename, pos, NULL, -1); - } - else - aud_playlist_load_ins_file(playlist, uri, filename, pos, NULL, -1); + + added_count++; - added_count++; - - if (pos >= 0) - pos++; - + if (pos >= 0) + pos++; + } g_free(uri); } } @@ -99,10 +99,14 @@ static void playlist_save_pls(const gchar *filename, gint pos) { + gchar *uri = g_filename_to_uri(filename, NULL, NULL); GList *node; - VFSFile *file = aud_vfs_fopen(filename, "wb"); + VFSFile *file = aud_vfs_fopen(uri, "wb"); Playlist *playlist = aud_playlist_get_active(); + AUDDBG("filename=%s\n", filename); + AUDDBG("uri=%s\n", uri); + g_return_if_fail(file != NULL); g_return_if_fail(playlist != NULL); diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/tta/libtta.c --- a/src/tta/libtta.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/tta/libtta.c Fri Dec 07 12:09:16 2007 -0600 @@ -28,6 +28,8 @@ * information. */ +/* #define AUD_DEBUG 1 */ + #include "config.h" #include @@ -695,18 +697,14 @@ tp++; } if(is_num) { -#ifdef DEBUG - printf("is_num!\n"); -#endif + AUDDBG("is_num!\n"); tmp = g_malloc0(BYTES(end - ptr + 1)); memcpy(tmp, ptr, BYTES(end - ptr)); *(tmp + (end - ptr)) = 0; //terminate ptr += end - ptr; genre = (id3_ucs4_t *)id3_genre_name((const id3_ucs4_t *)tmp); -#ifdef DEBUG - printf("genre length = %d\n", tta_ucs4len(genre)); -#endif + AUDDBG("genre length = %d\n", tta_ucs4len(genre)); g_free(tmp); tmp = NULL; @@ -718,10 +716,8 @@ *(ret + ret_len) = 0; //terminate } else { // plain text -#ifdef DEBUG - printf("plain!\n"); - printf("ret_len = %d\n", ret_len); -#endif + AUDDBG("plain!\n"); + AUDDBG("ret_len = %d\n", ret_len); memcpy(ret + BYTES(ret_len), ptr, BYTES(end - ptr)); ret_len = ret_len + (end - ptr); *(ret + ret_len) = 0; //terminate @@ -796,9 +792,7 @@ } g_free(string); string = NULL; -#ifdef DEBUG - g_print("string = %s\n", rtn); -#endif + AUDDBG("string = %s\n", rtn); return rtn; } diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/vorbis/Makefile --- a/src/vorbis/Makefile Fri Dec 07 12:08:47 2007 -0600 +++ b/src/vorbis/Makefile Fri Dec 07 12:09:16 2007 -0600 @@ -1,7 +1,7 @@ PLUGIN = vorbis${PLUGIN_SUFFIX} SRCS = configure.c \ - fileinfo.c \ + vcupdate.c \ vcedit.c \ vorbis.c diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/vorbis/fileinfo.c --- a/src/vorbis/fileinfo.c Fri Dec 07 12:08:47 2007 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1084 +0,0 @@ -/* BMP - Cross-platform multimedia player - * Copyright (C) 2003-2004 BMP development team. - * - * Based on XMMS: - * Copyright (C) 1998-2003 XMMS development team. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include "vorbis.h" -#include "vcedit.h" - -#include "ogg.xpm" - -static struct vte_struct { - VFSFile *in; - gchar *filename; -} vte; - -static void fail(const gchar * error); -static void save_cb(GtkWidget * w, gpointer data); -static void remove_cb(GtkWidget * w, gpointer data); -static gint init_files(vcedit_state * state); -static gint close_files(vcedit_state * state); - -extern GMutex *vf_mutex; -static GtkWidget *window = NULL; -static GList *genre_list = NULL; - -static GtkWidget *title_entry, *album_entry, *performer_entry; -static GtkWidget *tracknumber_entry, *date_entry; -static GtkWidget *genre_combo, *user_comment_entry; -#ifdef ALL_VORBIS_TAGS -static GtkWidget *description_entry, *version_entry, *isrc_entry; -static GtkWidget *copyright_entry, *organization_entry, *location_entry; -#endif -static GtkWidget *rg_track_entry, *rg_album_entry, *rg_track_peak_entry, - *rg_album_peak_entry; -static GtkWidget *rg_track_label, *rg_album_label, *rg_track_peak_label, - *rg_album_peak_label; -static GtkWidget *rg_show_button; - -GtkWidget *save_button, *remove_button; -GtkWidget *rg_frame, *rg_table; - -/* From mpg123.c, as no standardized Ogg Vorbis genres exists. */ -static const gchar *vorbis_genres[] = { - N_("Blues"), N_("Classic Rock"), N_("Country"), N_("Dance"), - N_("Disco"), N_("Funk"), N_("Grunge"), N_("Hip-Hop"), - N_("Jazz"), N_("Metal"), N_("New Age"), N_("Oldies"), - N_("Other"), N_("Pop"), N_("R&B"), N_("Rap"), N_("Reggae"), - N_("Rock"), N_("Techno"), N_("Industrial"), N_("Alternative"), - N_("Ska"), N_("Death Metal"), N_("Pranks"), N_("Soundtrack"), - N_("Euro-Techno"), N_("Ambient"), N_("Trip-Hop"), N_("Vocal"), - N_("Jazz+Funk"), N_("Fusion"), N_("Trance"), N_("Classical"), - N_("Instrumental"), N_("Acid"), N_("House"), N_("Game"), - N_("Sound Clip"), N_("Gospel"), N_("Noise"), N_("AlternRock"), - N_("Bass"), N_("Soul"), N_("Punk"), N_("Space"), - N_("Meditative"), N_("Instrumental Pop"), - N_("Instrumental Rock"), N_("Ethnic"), N_("Gothic"), - N_("Darkwave"), N_("Techno-Industrial"), N_("Electronic"), - N_("Pop-Folk"), N_("Eurodance"), N_("Dream"), - N_("Southern Rock"), N_("Comedy"), N_("Cult"), - N_("Gangsta Rap"), N_("Top 40"), N_("Christian Rap"), - N_("Pop/Funk"), N_("Jungle"), N_("Native American"), - N_("Cabaret"), N_("New Wave"), N_("Psychedelic"), N_("Rave"), - N_("Showtunes"), N_("Trailer"), N_("Lo-Fi"), N_("Tribal"), - N_("Acid Punk"), N_("Acid Jazz"), N_("Polka"), N_("Retro"), - N_("Musical"), N_("Rock & Roll"), N_("Hard Rock"), N_("Folk"), - N_("Folk/Rock"), N_("National Folk"), N_("Swing"), - N_("Fast-Fusion"), N_("Bebob"), N_("Latin"), N_("Revival"), - N_("Celtic"), N_("Bluegrass"), N_("Avantgarde"), - N_("Gothic Rock"), N_("Progressive Rock"), - N_("Psychedelic Rock"), N_("Symphonic Rock"), N_("Slow Rock"), - N_("Big Band"), N_("Chorus"), N_("Easy Listening"), - N_("Acoustic"), N_("Humour"), N_("Speech"), N_("Chanson"), - N_("Opera"), N_("Chamber Music"), N_("Sonata"), N_("Symphony"), - N_("Booty Bass"), N_("Primus"), N_("Porn Groove"), - N_("Satire"), N_("Slow Jam"), N_("Club"), N_("Tango"), - N_("Samba"), N_("Folklore"), N_("Ballad"), N_("Power Ballad"), - N_("Rhythmic Soul"), N_("Freestyle"), N_("Duet"), - N_("Punk Rock"), N_("Drum Solo"), N_("A Cappella"), - N_("Euro-House"), N_("Dance Hall"), N_("Goa"), - N_("Drum & Bass"), N_("Club-House"), N_("Hardcore"), - N_("Terror"), N_("Indie"), N_("BritPop"), N_("Negerpunk"), - N_("Polsk Punk"), N_("Beat"), N_("Christian Gangsta Rap"), - N_("Heavy Metal"), N_("Black Metal"), N_("Crossover"), - N_("Contemporary Christian"), N_("Christian Rock"), - N_("Merengue"), N_("Salsa"), N_("Thrash Metal"), - N_("Anime"), N_("JPop"), N_("Synthpop") -}; - -static const gchar * -get_comment(vorbis_comment * vc, const gchar * tag) -{ - const gchar *value; - - g_return_val_if_fail(tag != NULL, ""); - - if (!vc) - return ""; - - if ((value = vorbis_comment_query(vc, (gchar *) tag, 0))) - return value; - else - return ""; -} - -static gboolean -str_equal_nocase(gconstpointer a, - gconstpointer b) -{ - return strcasecmp((const gchar *) a, (const gchar *) b) == 0; -} - -static GHashTable * -hash_table_from_vorbis_comment(vorbis_comment * vc) -{ - GHashTable *table; - gint i; - - table = g_hash_table_new_full(g_str_hash, str_equal_nocase, - g_free, g_free); - - for (i = 0; i < vc->comments; i++) { - gchar **frags; -#ifdef DEBUG - g_message(vc->user_comments[i]); -#endif - frags = g_strsplit(vc->user_comments[i], "=", 2); - - /* FIXME: need more rigorous checks to guard against - borqued comments */ - - /* No RHS? */ - if (!frags[1]) frags[1] = g_strdup(""); - - g_hash_table_replace(table, frags[0], frags[1]); - g_free(frags); - } - - return table; -} - -static void -comment_hash_add_tag(GHashTable * table, - const gchar * tag, - const gchar * value) -{ - g_hash_table_replace(table, g_strdup(tag), g_strdup(value)); -} - - -static void -vorbis_comment_add_swapped(gchar * key, - gchar * value, - vorbis_comment * vc) -{ - vorbis_comment_add_tag(vc, key, value); -} - -static void -hash_table_to_vorbis_comment(vorbis_comment * vc, GHashTable * table) -{ - vorbis_comment_clear(vc); - g_hash_table_foreach(table, (GHFunc) vorbis_comment_add_swapped, - vc); -} - - -static void -fail(const gchar * error) -{ - gchar *errorstring; - errorstring = g_strdup_printf(_("An error occured:\n%s"), error); - - audacious_info_dialog(_("Error!"), errorstring, _("Ok"), FALSE, NULL, NULL); - - g_free(errorstring); - return; -} - - -static void -save_cb(GtkWidget * w, gpointer data) -{ - const gchar *track_name, *performer, *album_name, *date, *track_number; - const gchar *genre, *user_comment; -#ifdef ALL_VORBIS_TAGS - const gchar *description, *version, *isrc, *copyright, *organization; - const gchar *location; -#endif - const gchar *rg_track_gain, *rg_album_gain, *rg_track_peak, *rg_album_peak; - - GHashTable *comment_hash; - - vcedit_state *state; - vorbis_comment *comment; - - if (!g_strncasecmp(vte.filename, "http://", 7)) - return; - if (!g_strncasecmp(vte.filename, "https://", 8)) - return; - - state = vcedit_new_state(); - - g_mutex_lock(vf_mutex); - if (init_files(state) < 0) { - fail(_("Failed to modify tag (open)")); - goto close; - } - - comment = vcedit_comments(state); - comment_hash = hash_table_from_vorbis_comment(comment); - - track_name = gtk_entry_get_text(GTK_ENTRY(title_entry)); - performer = gtk_entry_get_text(GTK_ENTRY(performer_entry)); - album_name = gtk_entry_get_text(GTK_ENTRY(album_entry)); - track_number = gtk_entry_get_text(GTK_ENTRY(tracknumber_entry)); - genre = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry)); - date = gtk_entry_get_text(GTK_ENTRY(date_entry)); - user_comment = gtk_entry_get_text(GTK_ENTRY(user_comment_entry)); -#ifdef ALL_VORBIS_TAGS - location = gtk_entry_get_text(GTK_ENTRY(location_entry)); - description = gtk_entry_get_text(GTK_ENTRY(description_entry)); - version = gtk_entry_get_text(GTK_ENTRY(version_entry)); - isrc = gtk_entry_get_text(GTK_ENTRY(isrc_entry)); - organization = gtk_entry_get_text(GTK_ENTRY(organization_entry)); - copyright = gtk_entry_get_text(GTK_ENTRY(copyright_entry)); -#endif - rg_track_gain = gtk_entry_get_text(GTK_ENTRY(rg_track_entry)); - rg_album_gain = gtk_entry_get_text(GTK_ENTRY(rg_album_entry)); - rg_track_peak = gtk_entry_get_text(GTK_ENTRY(rg_track_peak_entry)); - rg_album_peak = gtk_entry_get_text(GTK_ENTRY(rg_album_peak_entry)); - - comment_hash_add_tag(comment_hash, "title", track_name); - comment_hash_add_tag(comment_hash, "artist", performer); - comment_hash_add_tag(comment_hash, "album", album_name); - comment_hash_add_tag(comment_hash, "tracknumber", track_number); - comment_hash_add_tag(comment_hash, "genre", genre); - comment_hash_add_tag(comment_hash, "date", date); - comment_hash_add_tag(comment_hash, "comment", user_comment); - -#ifdef ALL_VORBIS_TAGS - comment_hash_add_tag(comment_hash, "location", location); - comment_hash_add_tag(comment_hash, "description", description); - comment_hash_add_tag(comment_hash, "version", version); - comment_hash_add_tag(comment_hash, "isrc", isrc); - comment_hash_add_tag(comment_hash, "organization", organization); - comment_hash_add_tag(comment_hash, "copyright", copyright); -#endif - - comment_hash_add_tag(comment_hash, "replaygain_track_gain", rg_track_gain); - comment_hash_add_tag(comment_hash, "replaygain_album_gain", rg_album_gain); - comment_hash_add_tag(comment_hash, "replaygain_track_peak", rg_track_peak); - comment_hash_add_tag(comment_hash, "replaygain_album_peak", rg_album_peak); - - hash_table_to_vorbis_comment(comment, comment_hash); - g_hash_table_destroy(comment_hash); - - if (close_files(state) < 0) - fail(_("Failed to modify tag (close)")); - else { - gtk_widget_set_sensitive(save_button, FALSE); - gtk_widget_set_sensitive(remove_button, TRUE); - } - - - close: - vcedit_clear(state); - g_mutex_unlock(vf_mutex); -} - -static void -remove_cb(GtkWidget * w, gpointer data) -{ - vcedit_state *state; - vorbis_comment *comment; - - if (!g_strncasecmp(vte.filename, "http://", 7)) - return; - if (!g_strncasecmp(vte.filename, "https://", 8)) - return; - - state = vcedit_new_state(); - - g_mutex_lock(vf_mutex); - if (init_files(state) < 0) { - fail(_("Failed to modify tag")); - goto close; - } - - comment = vcedit_comments(state); - - vorbis_comment_clear(comment); - - if (close_files(state) < 0) { - fail(_("Failed to modify tag")); - } - else { - gtk_entry_set_text(GTK_ENTRY(title_entry), ""); - gtk_entry_set_text(GTK_ENTRY(album_entry), ""); - gtk_entry_set_text(GTK_ENTRY(performer_entry), ""); - gtk_entry_set_text(GTK_ENTRY(tracknumber_entry), ""); - gtk_entry_set_text(GTK_ENTRY(date_entry), ""); - gtk_entry_set_text(GTK_ENTRY(genre_combo), ""); - gtk_entry_set_text(GTK_ENTRY(user_comment_entry), ""); - } - - close: - vcedit_clear(state); - g_mutex_unlock(vf_mutex); -/* gtk_widget_destroy(window); */ -} - -static void -rg_show_cb(GtkWidget * w, gpointer data) -{ - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rg_show_button))) { - gtk_widget_show(rg_frame); - } - else { - gtk_widget_hide(rg_frame); - } -} - -static gint -init_files(vcedit_state * state) -{ - if ((vte.in = aud_vfs_fopen(vte.filename, "rb")) == NULL) { -#ifdef DEBUG - g_message("fileinfo.c: couldn't open file %s", vte.filename); -#endif - return -1; - } - - if (vcedit_open(state, vte.in) < 0) { -#ifdef DEBUG - g_message("fileinfo.c: couldn't open file for editing %s", - vte.filename); -#endif - aud_vfs_fclose(vte.in); - return -1; - } - -#ifdef DEBUG - g_message("fileinfo.c: file successfully opened for editing %s", - vte.filename); -#endif - - return 0; -} - -static gint -close_files(vcedit_state * state) -{ - gint retval = 0, ofh; - gchar *tmpfn; - VFSFile *out; - - tmpfn = g_strdup_printf("%s.XXXXXX", vte.filename); - - if ((ofh = mkstemp(tmpfn)) < 0) { - g_free(tmpfn); - aud_vfs_fclose(vte.in); -#ifdef DEBUG - g_critical("fileinfo.c: couldn't create temp file"); -#endif - return -1; - } - else { -#ifdef DEBUG - g_message("fileinfo.c: created temp file %s", tmpfn); -#endif - } - - if ((out = aud_vfs_fopen(tmpfn, "wb")) == NULL) { - close(ofh); - remove(tmpfn); - g_free(tmpfn); - aud_vfs_fclose(vte.in); -#ifdef DEBUG - g_critical("fileinfo.c: couldn't open temp file"); -#endif - return -1; - } - else { -#ifdef DEBUG - g_message("fileinfo.c: opened temp file %s", tmpfn); -#endif - } - - if (vcedit_write(state, out) < 0) { -#ifdef DEBUG - g_warning("vcedit_write: %s", state->lasterror); -#endif - retval = -1; - } - - aud_vfs_fclose(vte.in); - - if (aud_vfs_fclose(out) != 0) { -#ifdef DEBUG - g_critical("fileinfo.c: couldn't close out file"); -#endif - retval = -1; - } - else { -#ifdef DEBUG - g_message("fileinfo.c: outfile closed"); -#endif - } - - if (retval < 0 || rename(tmpfn, vte.filename) < 0) { - remove(tmpfn); - retval = -1; -#ifdef DEBUG - g_critical("fileinfo.c: couldn't rename file"); -#endif - } - else { -#ifdef DEBUG - g_message("fileinfo.c: file %s renamed successfully to %s", tmpfn, - vte.filename); -#endif - } - - g_free(tmpfn); - return retval; -} - - -static void -label_set_text(GtkLabel * label, const gchar * format, ...) -{ - va_list args; - gchar *text; - - va_start(args, format); - text = g_strdup_vprintf(format, args); - va_end(args); - - gtk_label_set_text(label, text); - g_free(text); -} - -void -change_buttons(void) -{ - gtk_widget_set_sensitive(GTK_WIDGET(save_button), TRUE); -} - - -/***********************************************************************/ - -void -vorbis_file_info_box(gchar * filename) -{ - gchar *filename_utf8, *title; - const gchar *rg_track_gain, *rg_track_peak; - const gchar *rg_album_gain, *rg_album_peak; - - gint time, minutes, seconds, bitrate, rate, channels, filesize; - gsize i; - - OggVorbis_File vf; - vorbis_info *vi; - vorbis_comment *comment = NULL; - - VFSVorbisFile *fh = g_new0(VFSVorbisFile, 1); - - gboolean clear_vf = FALSE; - - GtkWidget *pixmapwid; - GdkPixbuf *pixbuf; - PangoAttrList *attrs; - PangoAttribute *attr; - - GtkWidget *boxx; - GtkWidget *img; - GtkWidget *test_table; - - static GtkWidget *info_frame, *info_box, *bitrate_label, *rate_label; - static GtkWidget *bitrate_label_val, *rate_label_val; - - static GtkWidget *channel_label, *length_label, *filesize_label; - static GtkWidget *channel_label_val, *length_label_val, - *filesize_label_val; - - static GtkWidget *filename_entry, *tag_frame; - - g_free(vte.filename); - vte.filename = g_strdup(filename); - - if (!window) { - GtkWidget *hbox, *label, *filename_hbox, *vbox, *left_vbox; - GtkWidget *table, *bbox, *cancel_button; - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_type_hint(GTK_WINDOW(window), - GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - g_signal_connect(G_OBJECT(window), "destroy", - G_CALLBACK(gtk_widget_destroyed), &window); - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(window), vbox); - - filename_hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); - - pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) - gnome_mime_audio_ogg_xpm); - pixmapwid = gtk_image_new_from_pixbuf(pixbuf); - gtk_misc_set_alignment(GTK_MISC(pixmapwid), 0, 0); - gtk_box_pack_start(GTK_BOX(filename_hbox), pixmapwid, FALSE, FALSE, - 0); - - attrs = pango_attr_list_new(); - - attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD); - attr->start_index = 0; - attr->end_index = -1; - pango_attr_list_insert(attrs, attr); - - label = gtk_label_new(_("Name:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, FALSE, 0); - - filename_entry = gtk_entry_new(); - gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); - gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, - TRUE, 0); - - hbox = gtk_hbox_new(FALSE, 10); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); - - left_vbox = gtk_table_new(4, 7, FALSE); - gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); - - tag_frame = gtk_frame_new(_(" Ogg Vorbis Tag ")); - gtk_table_attach(GTK_TABLE(left_vbox), tag_frame, 2, 4, 0, 1, - GTK_FILL, GTK_FILL, 0, 4); - - table = gtk_table_new(16, 6, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_container_add(GTK_CONTAINER(tag_frame), table); - - label = gtk_label_new(_("Title:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 5, 5); - - title_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Artist:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, - GTK_FILL, GTK_FILL, 5, 5); - - performer_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), performer_entry, 1, 4, 1, 2, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Album:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, - GTK_FILL, GTK_FILL, 5, 5); - - album_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Comment:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, - GTK_FILL, GTK_FILL, 5, 5); - - user_comment_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), user_comment_entry, 1, 4, 3, - 4, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Date:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, - GTK_FILL, GTK_FILL, 5, 5); - - date_entry = gtk_entry_new(); - gtk_widget_set_size_request(date_entry, 60, -1); - gtk_table_attach(GTK_TABLE(table), date_entry, 1, 2, 4, 5, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Track number:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, - GTK_FILL, GTK_FILL, 5, 5); - - tracknumber_entry = gtk_entry_new_with_max_length(4); - gtk_widget_set_size_request(tracknumber_entry, 20, -1); - gtk_table_attach(GTK_TABLE(table), tracknumber_entry, 3, 4, 4, - 5, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Genre:")); - gtk_label_set_attributes(GTK_LABEL(label), attrs); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, - GTK_FILL, GTK_FILL, 5, 5); - - genre_combo = gtk_combo_new(); - if (!genre_list) { - for (i = 0; i < G_N_ELEMENTS(vorbis_genres); i++) - genre_list = g_list_prepend(genre_list, _(vorbis_genres[i])); - genre_list = g_list_sort(genre_list, (GCompareFunc) g_strcasecmp); - } - gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list); - gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 4, 5, 6, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - -#ifdef ALL_VORBIS_TAGS - label = gtk_label_new(_("Description:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7, - GTK_FILL, GTK_FILL, 5, 5); - - description_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), description_entry, 1, 4, 6, - 7, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Location:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 7, 8, - GTK_FILL, GTK_FILL, 5, 5); - - location_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), location_entry, 1, 4, 7, 8, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Version:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 8, 9, - GTK_FILL, GTK_FILL, 5, 5); - - version_entry = gtk_entry_new(); - gtk_widget_set_size_request(version_entry, 60, -1); - gtk_table_attach(GTK_TABLE(table), version_entry, 1, 2, 8, 9, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("ISRC number:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 8, 9, - GTK_FILL, GTK_FILL, 5, 5); - - isrc_entry = gtk_entry_new(); - gtk_widget_set_size_request(isrc_entry, 20, -1); - gtk_table_attach(GTK_TABLE(table), isrc_entry, 3, 4, 8, 9, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Organization:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 9, 10, - GTK_FILL, GTK_FILL, 5, 5); - - organization_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), organization_entry, 1, 4, 9, - 10, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Copyright:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 10, 11, - GTK_FILL, GTK_FILL, 5, 5); - - copyright_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), copyright_entry, 1, 4, 10, - 11, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); -#endif - boxx = gtk_hbutton_box_new(); - gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_SPREAD); - - remove_button = gtk_button_new_from_stock(GTK_STOCK_DELETE); - g_signal_connect_swapped(G_OBJECT(remove_button), - "clicked", G_CALLBACK(remove_cb), NULL); - gtk_container_add(GTK_CONTAINER(boxx), remove_button); - - save_button = gtk_button_new_from_stock(GTK_STOCK_SAVE); - g_signal_connect(G_OBJECT(save_button), "clicked", - G_CALLBACK(save_cb), NULL); - gtk_container_add(GTK_CONTAINER(boxx), save_button); - - gtk_table_attach(GTK_TABLE(table), boxx, 0, 5, 6, 7, GTK_FILL, 0, - 0, 8); - - rg_show_button = gtk_toggle_button_new(); - img = gtk_image_new_from_stock(GTK_STOCK_GO_FORWARD, - GTK_ICON_SIZE_MENU); - gtk_container_add(GTK_CONTAINER(rg_show_button), img); - g_signal_connect(G_OBJECT(rg_show_button), "toggled", - G_CALLBACK(rg_show_cb), NULL); - - gtk_table_attach(GTK_TABLE(left_vbox), rg_show_button, 4, 5, 0, 2, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 5, 5); - - rg_frame = gtk_frame_new(_(" Ogg Vorbis ReplayGain ")); - gtk_table_attach(GTK_TABLE(left_vbox), rg_frame, 5, 6, 0, 4, - GTK_FILL, GTK_FILL, 0, 4); - rg_table = gtk_table_new(16, 4, FALSE); - gtk_container_add(GTK_CONTAINER(rg_frame), GTK_WIDGET(rg_table)); - - rg_track_label = gtk_label_new(_("Track gain:")); - gtk_misc_set_alignment(GTK_MISC(rg_track_label), 1, 0.5); - gtk_table_attach(GTK_TABLE(rg_table), rg_track_label, 5, 6, 0, 1, - GTK_FILL, GTK_FILL, 5, 5); - - rg_track_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(rg_table), rg_track_entry, 6, 7, 0, - 1, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - rg_track_peak_label = gtk_label_new(_("Track peak:")); - gtk_misc_set_alignment(GTK_MISC(rg_track_peak_label), 1, 0.5); - gtk_table_attach(GTK_TABLE(rg_table), rg_track_peak_label, 5, 6, 1, - 2, GTK_FILL, GTK_FILL, 5, 5); - - rg_track_peak_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(rg_table), rg_track_peak_entry, 6, 7, 1, - 2, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - - rg_album_label = gtk_label_new(_("Album gain:")); - gtk_misc_set_alignment(GTK_MISC(rg_album_label), 1, 0.5); - gtk_table_attach(GTK_TABLE(rg_table), rg_album_label, 5, 6, 2, 3, - GTK_FILL, GTK_FILL, 5, 5); - - rg_album_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(rg_table), rg_album_entry, 6, 7, 2, - 3, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - rg_album_peak_label = gtk_label_new(_("Album peak:")); - gtk_misc_set_alignment(GTK_MISC(rg_album_peak_label), 1, 0.5); - gtk_table_attach(GTK_TABLE(rg_table), rg_album_peak_label, 5, 6, 3, - 4, GTK_FILL, GTK_FILL, 5, 5); - - rg_album_peak_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(rg_table), rg_album_peak_entry, 6, 7, 3, - 4, GTK_FILL | GTK_EXPAND | GTK_SHRINK, - GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - bbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); - gtk_table_attach(GTK_TABLE(left_vbox), bbox, 0, 4, 1, 2, GTK_FILL, - 0, 0, 8); - - cancel_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); - g_signal_connect_swapped(G_OBJECT(cancel_button), - "clicked", - G_CALLBACK(gtk_widget_destroy), - G_OBJECT(window)); - GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0); - gtk_widget_grab_default(cancel_button); - - - gtk_table_set_col_spacing(GTK_TABLE(left_vbox), 1, 10); - - - info_frame = gtk_frame_new(_(" Ogg Vorbis Info ")); - gtk_table_attach(GTK_TABLE(left_vbox), info_frame, 0, 2, 0, 1, - GTK_FILL, GTK_FILL, 0, 4); - - info_box = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(info_frame), info_box); - gtk_container_set_border_width(GTK_CONTAINER(info_box), 10); - gtk_box_set_spacing(GTK_BOX(info_box), 0); - - /* FIXME: Obvious... */ - test_table = gtk_table_new(2, 10, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(test_table), 0); - gtk_container_add(GTK_CONTAINER(info_box), test_table); - - - bitrate_label = gtk_label_new(_("Bit rate:")); - gtk_label_set_attributes(GTK_LABEL(bitrate_label), attrs); - gtk_misc_set_alignment(GTK_MISC(bitrate_label), 1, 0.5); - gtk_label_set_justify(GTK_LABEL(bitrate_label), GTK_JUSTIFY_RIGHT); - gtk_table_attach(GTK_TABLE(test_table), bitrate_label, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 5, 2); - - bitrate_label_val = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(bitrate_label_val), 0, 0); - gtk_label_set_justify(GTK_LABEL(bitrate_label_val), GTK_JUSTIFY_LEFT); - gtk_table_attach(GTK_TABLE(test_table), bitrate_label_val, 1, 2, 0, - 1, GTK_FILL, GTK_FILL, 10, 2); - - rate_label = gtk_label_new(_("Sample rate:")); - gtk_label_set_attributes(GTK_LABEL(rate_label), attrs); - gtk_misc_set_alignment(GTK_MISC(rate_label), 1, 0.5); - gtk_label_set_justify(GTK_LABEL(rate_label), GTK_JUSTIFY_RIGHT); - gtk_table_attach(GTK_TABLE(test_table), rate_label, 0, 1, 1, 2, - GTK_FILL, GTK_FILL, 5, 2); - - rate_label_val = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(rate_label_val), 0, 0); - gtk_label_set_justify(GTK_LABEL(rate_label_val), GTK_JUSTIFY_LEFT); - gtk_table_attach(GTK_TABLE(test_table), rate_label_val, 1, 2, 1, 2, - GTK_FILL, GTK_FILL, 10, 2); - - channel_label = gtk_label_new(_("Channels:")); - gtk_label_set_attributes(GTK_LABEL(channel_label), attrs); - gtk_misc_set_alignment(GTK_MISC(channel_label), 1, 0.5); - gtk_label_set_justify(GTK_LABEL(channel_label), GTK_JUSTIFY_RIGHT); - gtk_table_attach(GTK_TABLE(test_table), channel_label, 0, 1, 2, 3, - GTK_FILL, GTK_FILL, 5, 2); - - channel_label_val = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(channel_label_val), 0, 0); - gtk_label_set_justify(GTK_LABEL(channel_label_val), GTK_JUSTIFY_LEFT); - gtk_table_attach(GTK_TABLE(test_table), channel_label_val, 1, 2, 2, - 3, GTK_FILL, GTK_FILL, 10, 2); - - length_label = gtk_label_new(_("Length:")); - gtk_label_set_attributes(GTK_LABEL(length_label), attrs); - gtk_misc_set_alignment(GTK_MISC(length_label), 1, 0.5); - gtk_label_set_justify(GTK_LABEL(length_label), GTK_JUSTIFY_RIGHT); - gtk_table_attach(GTK_TABLE(test_table), length_label, 0, 1, 3, 4, - GTK_FILL, GTK_FILL, 5, 2); - - length_label_val = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(length_label_val), 0, 0); - gtk_label_set_justify(GTK_LABEL(length_label_val), GTK_JUSTIFY_LEFT); - gtk_table_attach(GTK_TABLE(test_table), length_label_val, 1, 2, 3, - 4, GTK_FILL, GTK_FILL, 10, 2); - - filesize_label = gtk_label_new(_("File size:")); - gtk_label_set_attributes(GTK_LABEL(filesize_label), attrs); - gtk_misc_set_alignment(GTK_MISC(filesize_label), 1, 0.5); - gtk_label_set_justify(GTK_LABEL(filesize_label), GTK_JUSTIFY_RIGHT); - gtk_table_attach(GTK_TABLE(test_table), filesize_label, 0, 1, 4, 5, - GTK_FILL, GTK_FILL, 5, 2); - - filesize_label_val = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(filesize_label_val), 0, 0); - gtk_label_set_justify(GTK_LABEL(filesize_label_val), - GTK_JUSTIFY_LEFT); - gtk_table_attach(GTK_TABLE(test_table), filesize_label_val, 1, 2, - 4, 5, GTK_FILL, GTK_FILL, 10, 2); - - pango_attr_list_unref(attrs); - } - else - gtk_window_present(GTK_WINDOW(window)); - - if (!g_strncasecmp(vte.filename, "http://", 7) - || !g_strncasecmp(vte.filename, "https://", 8)) - gtk_widget_set_sensitive(tag_frame, FALSE); - else - gtk_widget_set_sensitive(tag_frame, TRUE); - - gtk_label_set_text(GTK_LABEL(bitrate_label), _("Bit rate:")); - gtk_label_set_text(GTK_LABEL(bitrate_label_val), _("N/A")); - - gtk_label_set_text(GTK_LABEL(rate_label), _("Sample rate:")); - gtk_label_set_text(GTK_LABEL(rate_label_val), _("N/A")); - - gtk_label_set_text(GTK_LABEL(channel_label), _("Channels:")); - gtk_label_set_text(GTK_LABEL(channel_label_val), _("N/A")); - - gtk_label_set_text(GTK_LABEL(length_label), _("Length:")); - gtk_label_set_text(GTK_LABEL(length_label_val), _("N/A")); - - gtk_label_set_text(GTK_LABEL(filesize_label), _("File size:")); - gtk_label_set_text(GTK_LABEL(filesize_label_val), _("N/A")); - - if ((fh->fd = aud_vfs_fopen(vte.filename, "r")) != NULL) { - g_mutex_lock(vf_mutex); - - if (ov_open_callbacks(fh, &vf, NULL, 0, vorbis_callbacks) == 0) { - comment = ov_comment(&vf, -1); - if ((vi = ov_info(&vf, 0)) != NULL) { - bitrate = vi->bitrate_nominal / 1000; - rate = vi->rate; - channels = vi->channels; - clear_vf = TRUE; - gtk_widget_set_sensitive(GTK_WIDGET(save_button), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(remove_button), TRUE); - } - else { - bitrate = 0; - rate = 0; - channels = 0; - gtk_widget_set_sensitive(GTK_WIDGET(save_button), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(remove_button), FALSE); - } - - time = ov_time_total(&vf, -1); - minutes = time / 60; - seconds = time % 60; - aud_vfs_fseek(fh->fd, 0, SEEK_END); - filesize = aud_vfs_ftell(fh->fd); - - label_set_text(GTK_LABEL(bitrate_label_val), - _("%d KBit/s (nominal)"), bitrate); - label_set_text(GTK_LABEL(rate_label_val), _("%d Hz"), rate); - label_set_text(GTK_LABEL(channel_label_val), _("%d"), channels); - label_set_text(GTK_LABEL(length_label_val), - _("%d:%.2d"), minutes, seconds); - label_set_text(GTK_LABEL(filesize_label_val), - _("%d Bytes"), filesize); - - } - else - aud_vfs_fclose(fh->fd); - } - - rg_track_gain = get_comment(comment, "replaygain_track_gain"); - if (*rg_track_gain == '\0') - rg_track_gain = get_comment(comment, "rg_radio"); /* Old */ - - rg_album_gain = get_comment(comment, "replaygain_album_gain"); - if (*rg_album_gain == '\0') - rg_album_gain = get_comment(comment, "rg_audiophile"); /* Old */ - - rg_track_peak = get_comment(comment, "replaygain_track_peak"); - if (*rg_track_peak == '\0') - rg_track_peak = get_comment(comment, "rg_peak"); /* Old */ - - rg_album_peak = get_comment(comment, "replaygain_album_peak"); /* Old had no album peak */ - - /* Fill it all in .. */ - gtk_entry_set_text(GTK_ENTRY(title_entry), - get_comment(comment, "title")); - gtk_entry_set_text(GTK_ENTRY(performer_entry), - get_comment(comment, "artist")); - gtk_entry_set_text(GTK_ENTRY(album_entry), - get_comment(comment, "album")); - gtk_entry_set_text(GTK_ENTRY(user_comment_entry), - get_comment(comment, "comment")); - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), - get_comment(comment, "genre")); - gtk_entry_set_text(GTK_ENTRY(tracknumber_entry), - get_comment(comment, "tracknumber")); - gtk_entry_set_text(GTK_ENTRY(date_entry), - get_comment(comment, "date")); -#ifdef ALL_VORBIS_TAGS - gtk_entry_set_text(GTK_ENTRY(version_entry), - get_comment(comment, "version")); - gtk_entry_set_text(GTK_ENTRY(description_entry), - get_comment(comment, "description")); - gtk_entry_set_text(GTK_ENTRY(organization_entry), - get_comment(comment, "organization")); - gtk_entry_set_text(GTK_ENTRY(copyright_entry), - get_comment(comment, "copyright")); - gtk_entry_set_text(GTK_ENTRY(isrc_entry), - get_comment(comment, "isrc")); - gtk_entry_set_text(GTK_ENTRY(location_entry), - get_comment(comment, "location")); -#endif - { - gchar *realfn = NULL; - realfn = g_filename_from_uri(vte.filename, NULL, NULL); - filename_utf8 = aud_filename_to_utf8(realfn ? realfn : vte.filename); - g_free(realfn); realfn = NULL; - } - - title = g_strdup_printf(_("%s - Audacious"), g_basename(filename_utf8)); - gtk_window_set_title(GTK_WINDOW(window), title); - g_free(title); - - gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); - gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1); - - g_free(filename_utf8); - - gtk_entry_set_text(GTK_ENTRY(rg_track_entry), rg_track_gain); - gtk_entry_set_text(GTK_ENTRY(rg_album_entry), rg_album_gain); - gtk_entry_set_text(GTK_ENTRY(rg_track_peak_entry), rg_track_peak); - gtk_editable_set_position(GTK_EDITABLE(rg_track_peak_entry), -1); - gtk_entry_set_text(GTK_ENTRY(rg_album_peak_entry), rg_album_peak); - gtk_editable_set_position(GTK_EDITABLE(rg_album_peak_entry), -1); - -/* if (*rg_track_gain == '\0' && *rg_album_gain == '\0' && - *rg_track_peak == '\0' && *rg_album_peak == '\0') { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_show_button), - FALSE); - } - else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_show_button), - TRUE);*/ - - /* ov_clear closes the file */ - if (clear_vf) ov_clear(&vf); - g_mutex_unlock(vf_mutex); - - - gtk_widget_set_sensitive(tag_frame, aud_vfs_is_writeable(vte.filename)); - - g_signal_connect_swapped(title_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(performer_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(album_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(date_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(user_comment_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(tracknumber_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(GTK_COMBO(genre_combo)->entry, "changed", - G_CALLBACK(change_buttons), save_button); - g_signal_connect_swapped(rg_track_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(rg_track_peak_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(rg_album_entry, "changed", change_buttons, - save_button); - g_signal_connect_swapped(rg_album_peak_entry, "changed", change_buttons, - save_button); - - gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); - gtk_widget_show_all(window); - gtk_widget_hide(rg_frame); - - gtk_widget_set_sensitive(save_button, FALSE); - gtk_widget_set_sensitive(remove_button, FALSE); - - g_free(fh); // see vorbis.c ovcb_close() --yaz -} diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/vorbis/ogg.xpm --- a/src/vorbis/ogg.xpm Fri Dec 07 12:08:47 2007 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,576 +0,0 @@ -/* XPM */ -static char * gnome_mime_audio_ogg_xpm[] = { -"48 52 521 2", -" c None", -". c #000000", -"+ c #232323", -"@ c #1F1F1F", -"# c #DADADA", -"$ c #FFFFFF", -"% c #F6F6F6", -"& c #CFCFCF", -"* c #707070", -"= c #FEFEFE", -"- c #FBFBFB", -"; c #EDEDED", -"> c #C0C0C0", -", c #F7F7F7", -"' c #D7D7D7", -") c #F1F1F1", -"! c #B7B7B7", -"~ c #E2E2E2", -"{ c #D2D2D2", -"] c #AEAEAE", -"^ c #070707", -"/ c #ABABAB", -"( c #FDFDFD", -"_ c #FCFCFC", -": c #B8B8B8", -"< c #FAFAFA", -"[ c #DCDCDC", -"} c #A4A4A3", -"| c #0E0E0E", -"1 c #B1B1B1", -"2 c #BEBEBE", -"3 c #F5F5F5", -"4 c #E5E5E5", -"5 c #C3C3C3", -"6 c #6F6F6F", -"7 c #2A2A2A", -"8 c #2C2C2C", -"9 c #2E2E2E", -"0 c #5B5B5B", -"a c #F9F9F9", -"b c #F5F5F4", -"c c #B5B5B5", -"d c #CBCBCB", -"e c #A5A5A5", -"f c #A9A9A9", -"g c #CDCDCD", -"h c #E9E9E9", -"i c #525253", -"j c #FBFCFD", -"k c #F3F6F9", -"l c #B7CADC", -"m c #90A5B9", -"n c #7E92A5", -"o c #7E90A3", -"p c #667684", -"q c #657583", -"r c #53606D", -"s c #292A2A", -"t c #FAFAF9", -"u c #F4F4F4", -"v c #ACACAC", -"w c #ECECEC", -"x c #C2C2C2", -"y c #C9C9C8", -"z c #A8A8A8", -"A c #D5D5D5", -"B c #BCBCBC", -"C c #BDBDBD", -"D c #F0F0F0", -"E c #90969B", -"F c #181818", -"G c #212121", -"H c #363636", -"I c #292929", -"J c #293036", -"K c #4D5964", -"L c #444445", -"M c #FCFCFB", -"N c #F4F4F3", -"O c #515151", -"P c #474747", -"Q c #464645", -"R c #464646", -"S c #5D5D5C", -"T c #E1E1E1", -"U c #D1D1D1", -"V c #959BA2", -"W c #282828", -"X c #858585", -"Y c #595959", -"Z c #2D2D2D", -"` c #555F68", -" . c #F8F8F8", -".. c #F2F2F2", -"+. c #F3F3F3", -"@. c #AAAAAA", -"#. c #A0A09F", -"$. c #8A8A8A", -"%. c #7A7A7A", -"&. c #6C6C6C", -"*. c #454545", -"=. c #B0B0B0", -"-. c #939393", -";. c #F7F9FB", -">. c #1B1C1C", -",. c #333333", -"'. c #7F7F7F", -"). c #BABABA", -"!. c #636363", -"~. c #5A6976", -"{. c #202020", -"]. c #EFEFEF", -"^. c #F8F8F7", -"/. c #E7E7E7", -"(. c #C6C6C5", -"_. c #BABAB9", -":. c #6E6E6E", -"<. c #A5BACE", -"[. c #C1C1C1", -"}. c #373737", -"|. c #718498", -"1. c #F7F7F6", -"2. c #F6F6F5", -"3. c #EDEDEB", -"4. c #D3D3D3", -"5. c #989898", -"6. c #6D6D6D", -"7. c #94A9C0", -"8. c #353535", -"9. c #8195A8", -"0. c #505050", -"a. c #DADAD9", -"b. c #DDDDDC", -"c. c #F1F1F0", -"d. c #EDEDEC", -"e. c #E3E3E3", -"f. c #C9C9C9", -"g. c #979797", -"h. c #9B9B9B", -"i. c #FDFDFC", -"j. c #9C9EA0", -"k. c #A5B4C2", -"l. c #94A6B9", -"m. c #5A5D5F", -"n. c #C4D1DE", -"o. c #A5B5C3", -"p. c #8291A2", -"q. c #1A1D21", -"r. c #DEDEDE", -"s. c #F2F2F1", -"t. c #DDDDDD", -"u. c #F3F3F2", -"v. c #A1A1A1", -"w. c #676869", -"x. c #FBFCFC", -"y. c #CFD7DF", -"z. c #B2BFCC", -"A. c #C6C6C6", -"B. c #D9D9D9", -"C. c #BBBBBB", -"D. c #808589", -"E. c #F5F7FA", -"F. c #F3F5F8", -"G. c #AFBBC6", -"H. c #8F9DAB", -"I. c #4B535C", -"J. c #E0E0DF", -"K. c #E0E0E0", -"L. c #808283", -"M. c #FAFBFC", -"N. c #FBFBFC", -"O. c #9C9C9C", -"P. c #888888", -"Q. c #EAEAEA", -"R. c #8D9399", -"S. c #F6F7FA", -"T. c #F7F8FA", -"U. c #D1DAE3", -"V. c #B6C3CE", -"W. c #494F55", -"X. c #E6E6E5", -"Y. c #EFEFEE", -"Z. c #DEDEDD", -"`. c #DBDBDA", -" + c #E7E7E6", -".+ c #AFAFAF", -"++ c #656769", -"@+ c #DAE1E8", -"#+ c #DEE4E9", -"$+ c #F5F7F8", -"%+ c #EBEBEB", -"&+ c #262626", -"*+ c #929292", -"=+ c #999999", -"-+ c #828282", -";+ c #82898F", -">+ c #C2CCD5", -",+ c #F3F5F7", -"'+ c #B7C1CB", -")+ c #404548", -"!+ c #E4E4E3", -"~+ c #F2F2F0", -"{+ c #E4E4E4", -"]+ c #E6E6E6", -"^+ c #ADADAD", -"/+ c #FBFBFA", -"(+ c #54585C", -"_+ c #C2CEDA", -":+ c #C4CCD5", -"<+ c #C4CBD2", -"[+ c #DCAF00", -"}+ c #FFDC00", -"|+ c #878787", -"1+ c #6E747B", -"2+ c #99A5AF", -"3+ c #9DA9B4", -"4+ c #98A4AF", -"5+ c #88939E", -"6+ c #232426", -"7+ c #E2E2E1", -"8+ c #ECECEB", -"9+ c #F0F0EF", -"0+ c #DCDCDB", -"a+ c #EFEFED", -"b+ c #B2B2B2", -"c+ c #D8D8D8", -"d+ c #60666D", -"e+ c #A6B2BD", -"f+ c #A3ADB5", -"g+ c #FFF793", -"h+ c #FFF148", -"i+ c #FFE957", -"j+ c #EFE3A3", -"k+ c #482D00", -"l+ c #26282B", -"m+ c #626F7B", -"n+ c #616C78", -"o+ c #4F5A63", -"p+ c #1C2022", -"q+ c #CFCFCE", -"r+ c #DFDFDF", -"s+ c #EAEAE9", -"t+ c #EEEEED", -"u+ c #EEEEEC", -"v+ c #E9E9E8", -"w+ c #5F6871", -"x+ c #666D75", -"y+ c #151616", -"z+ c #995A00", -"A+ c #FFF461", -"B+ c #FFF1C1", -"C+ c #FFF1B5", -"D+ c #FFE600", -"E+ c #E1B500", -"F+ c #593800", -"G+ c #30383F", -"H+ c #CBC7C0", -"I+ c #0B0D0E", -"J+ c #B9B9B9", -"K+ c #CCCCCB", -"L+ c #DEDEDC", -"M+ c #EEEEEE", -"N+ c #DADAD8", -"O+ c #E8E8E8", -"P+ c #A6A6A5", -"Q+ c #EBC200", -"R+ c #FFEB84", -"S+ c #FFE71C", -"T+ c #AF6800", -"U+ c #C99300", -"V+ c #610000", -"W+ c #E3E1DC", -"X+ c #ADADAC", -"Y+ c #E3E3E2", -"Z+ c #D7D7D6", -"`+ c #D3D3D2", -" @ c #F9F9F8", -".@ c #D0D0D0", -"+@ c #DBDBDB", -"@@ c #D4D4D3", -"#@ c #C4C4C4", -"$@ c #C8C8C8", -"%@ c #DBC975", -"&@ c #D8AA00", -"*@ c #D9AB00", -"=@ c #B57300", -"-@ c #C08500", -";@ c #E3B800", -">@ c #2D0000", -",@ c #E7E4E1", -"'@ c #AFAFAE", -")@ c #C2C2C1", -"!@ c #D2D2D0", -"~@ c #E5E5E4", -"{@ c #E0E0DE", -"]@ c #D2D2D1", -"^@ c #D6D6D5", -"/@ c #E8E8E7", -"(@ c #A7A7A7", -"_@ c #E9D677", -":@ c #CC9A00", -"<@ c #DFB300", -"[@ c #E7BE00", -"}@ c #EDD700", -"|@ c #EEE3AD", -"1@ c #666666", -"2@ c #8D8D8D", -"3@ c #E6E4E0", -"4@ c #BAB5AB", -"5@ c #76736D", -"6@ c #CDCDCC", -"7@ c #CECECC", -"8@ c #D1D1D0", -"9@ c #EBEBEA", -"0@ c #B6B6B5", -"a@ c #3F3F3F", -"b@ c #818181", -"c@ c #E4E3E3", -"d@ c #B2B2B1", -"e@ c #C5C5C3", -"f@ c #D5D5D4", -"g@ c #EAEAE8", -"h@ c #D4D4D4", -"i@ c #757575", -"j@ c #676767", -"k@ c #CACACA", -"l@ c #DBD8D3", -"m@ c #CDC9C2", -"n@ c #454544", -"o@ c #BABAB8", -"p@ c #CBCBC9", -"q@ c #D8D8D7", -"r@ c #E1E1E0", -"s@ c #E9E9E7", -"t@ c #969696", -"u@ c #646464", -"v@ c #7D7C79", -"w@ c #F7F6F6", -"x@ c #79776F", -"y@ c #252525", -"z@ c #B3B3B2", -"A@ c #C5C5C5", -"B@ c #C7C7C7", -"C@ c #2F2F2F", -"D@ c #AFACA6", -"E@ c #161615", -"F@ c #A5A5A4", -"G@ c #B7B7B6", -"H@ c #E6E6E4", -"I@ c #E8E8E6", -"J@ c #B0B0AF", -"K@ c #B4B4B3", -"L@ c #BFBFBE", -"M@ c #656564", -"N@ c #898989", -"O@ c #8E8E8E", -"P@ c #191919", -"Q@ c #E4E2DF", -"R@ c #87847C", -"S@ c #3A3A3A", -"T@ c #B1B1B0", -"U@ c #C3C3C2", -"V@ c #E7E7E5", -"W@ c #CECECD", -"X@ c #D9D9D8", -"Y@ c #B6B6B6", -"Z@ c #F3F3F0", -"`@ c #ABABAA", -" # c #BFBFBF", -".# c #DDDDDB", -"+# c #BCBCBB", -"@# c #C8C8C7", -"## c #B3B3B3", -"$# c #EFEDEB", -"%# c #706E67", -"&# c #242424", -"*# c #A8A8A6", -"=# c #E5E5E3", -"-# c #B9B9B8", -";# c #B3B3B1", -"># c #6B6B6B", -",# c #F5F4F3", -"'# c #999998", -")# c #CCCCCA", -"!# c #D9D9D7", -"~# c #DFDFDE", -"{# c #151515", -"]# c #9F9F9F", -"^# c #7D7A73", -"/# c #A3A3A2", -"(# c #B8B8B6", -"_# c #CACAC8", -":# c #E3E3E1", -"<# c #414141", -"[# c #E1E0DF", -"}# c #F0EFED", -"|# c #9A9791", -"1# c #1B1B1A", -"2# c #A1A1A0", -"3# c #C6C6C4", -"4# c #D4D4D2", -"5# c #E2E2E0", -"6# c #E4E4E2", -"7# c #EBEBE9", -"8# c #565656", -"9# c #959595", -"0# c #FCF8E8", -"a# c #F9F3DB", -"b# c #1C0000", -"c# c #F7EFC6", -"d# c #A49F8F", -"e# c #F2F1F0", -"f# c #E5E3E0", -"g# c #AFAFAD", -"h# c #C1C1C0", -"i# c #D1D1CF", -"j# c #DBDBD9", -"k# c #D9D2BB", -"l# c #FFEA66", -"m# c #D8B400", -"n# c #B4B4B4", -"o# c #BAB8B4", -"p# c #6E6B62", -"q# c #CCC9C2", -"r# c #FAF3D8", -"s# c #FFED92", -"t# c #FBD700", -"u# c #F7D300", -"v# c #D7B300", -"w# c #616161", -"x# c #565248", -"y# c #23211D", -"z# c #ECECEA", -"A# c #D4CDA8", -"B# c #FFE400", -"C# c #F2CF00", -"D# c #EECB00", -"E# c #D7B400", -"F# c #7B7870", -"G# c #D5D4D1", -"H# c #D4D3D1", -"I# c #7A776F", -"J# c #827F78", -"K# c #DBDAD8", -"L# c #E1E1DF", -"M# c #DFDFDD", -"N# c #A7A5A0", -"O# c #7C7C7C", -"P# c #DED086", -"Q# c #EAC700", -"R# c #C9A700", -"S# c #D9D9D6", -"T# c #8D8A84", -"U# c #5C584F", -"V# c #8E8B85", -"W# c #D8D7D5", -"X# c #DDDCDA", -"Y# c #908E87", -"Z# c #605C53", -"`# c #6B685F", -" $ c #CBCAC7", -".$ c #E7DDAA", -"+$ c #FBE100", -"@$ c #DCB900", -"#$ c #947300", -"$$ c #666259", -"%$ c #67635A", -"&$ c #69665D", -"*$ c #141414", -"=$ c #A99500", -"-$ c #DCB800", -";$ c #D3B000", -">$ c #CFAC00", -",$ c #AF8A00", -"'$ c #836300", -")$ c #333332", -"!$ c #575349", -"~$ c #57544A", -"{$ c #8D8D8C", -"]$ c #50504F", -"^$ c #7C7C7B", -"/$ c #787877", -"($ c #7B7B79", -"_$ c #6D6D6C", -":$ c #5C5C5B", -"<$ c #656158", -"[$ c #59564C", -"}$ c #C4C4C2", -"|$ c #A9A9A8", -"1$ c #A7A7A6", -"2$ c #A7A7A5", -"3$ c #AAAAA9", -"4$ c #AEAEAC", -"5$ c #D9D8D6", -"6$ c #8D8A83", -"7$ c #8E8C85", -"8$ c #6D6A61", -"9$ c #C7C7C6", -"0$ c #C1C1BF", -"a$ c #BCBCBA", -"b$ c #BBBBBA", -"c$ c #BDBDBC", -"d$ c #7B7770", -"e$ c #D5D4D2", -"f$ c #EDECEB", -"g$ c #7C7971", -"h$ c #D7D6D3", -"i$ c #F3F2F2", -"j$ c #FDFCFC", -"k$ c #BFBDBA", -"l$ c #CBCBCA", -"m$ c #CDCDCB", -"n$ c #CFCFCD", -"o$ c #D0D0CE", -"p$ c #D8D8D6", -"q$ c #A2A2A1", -"r$ c #A1A19F", -"s$ c #A0A09E", -"t$ c #A3A3A1", -"u$ c #9A9A9A", -"v$ c #8C8C8C", -" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ ", -". # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & * . ", -". $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ = = = = = = = = = = = = - % ; > . ", -". $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ = = = = = = = = = = = = = = , ' $ ) ! . ", -". $ $ $ $ $ $ $ ~ $ $ $ $ $ $ $ $ $ $ = = = = = = = = = = = = = = = = , { $ $ ; ] ^ ", -". $ $ $ $ $ $ $ / $ $ $ $ $ $ $ $ = = = = ( ( _ _ _ _ _ ( ( = = = ( ( % : < ( $ [ } | ", -". $ $ $ $ $ $ $ 1 2 $ $ $ $ $ = 3 4 5 6 . . . + 7 8 9 8 0 a < _ ( ( ( b c < a _ $ d e . ", -". $ $ $ $ $ $ $ 1 f 2 g $ = = , h i j k l m n n o p q r r s , t _ _ _ u v w 5 d : x y z . ", -". $ $ $ $ $ $ $ 1 A B C C = = D i j E . . . . F G 9 H I J K L u _ _ M N / O P Q R R S f . ", -". $ $ $ $ $ $ $ 1 = = T C = = U j V . W . . . . . . X Y Z J ` 0 u .a ..+.> @.#.$.%.&.*.. ", -". $ $ $ $ $ $ = =.= = = T = = -.;.>.Z . . . . ,.'.).'.. !.. ~.{.].b ^.a - , , /.(.y _.%.. ", -". $ $ $ $ = = = =.= = ( ( ( ( :.<.. . . . . . . . : [.. . }.|.9 /.D % % ^.1.2.3 3 3 3.f . ", -". $ $ = 4./ 5./ f ( ( ( ( a % 6.7.. . . . . . . . . Z . . 8.9.0.a.b.c.u , 3 3 b d.+.+.1 . ", -". $ = = z e.f.g.h.( i._ < .j.k.l.. . . . . . . . . . . m.n.o.p.q.r.; s.b b u N t.u.u.c . ", -". $ ( ( z v g.g.v._ _ _ - w.x.y.z.. . A.B.$.. . C.f.. . D.E.F.G.H.I./.D +.N u.u.r.J.s.c . ", -". $ ( i.{ f g.f K._ M - % L.M.N.y.. O.; ; ' P.r.h Q.x . R.S.T.U.V.W.X.Y.s.u.....Z.`. +.+. ", -". $ _ _ _ _ M - - - - - ^.++@+#+$+. %+2 &+*+=+A.. -++.. ;+>+,+,+'+)+!+; D s.~+c.b.{+]+^+. ", -". $ M M - - - - /+/+< < 3 (+_+:+<+. t./ . [+}+-.. |+... 1+2+3+4+5+6+7+8+9+~+D D 0+Y.a+b+. ", -". $ - - - /+/+< < < < t ^.c+d+e+f+. 8 [+g+h+i+}+}+j+k+. l+m+n+o+p+q+r+s+a+9+9+Y.a.t+u+c . ", -". $ /+< < < < < 1.J.Q.a ) % v+w+x+y+z+A+B+C+D+}+}+}+E+F+. G+H+I+J+K+L+ +d.; M+t+N+d.d.c . ", -". $ < < t t a a +.f.{ b.Z.O+) {+P+. . [+Q+R+S+}+[+T+U+V+. . W+G X+y B.Y+7+Z+`+Z+Z+w 8+c . ", -". $ t a a a a @.@r., O++@@@c+#@$@. . %@&@*@T+=@-@;@>@. =+. ,@{.'@)@`+J.!@~@{@]@`+8+8+c . ", -". $ a @ @ @ . .f.^@b./@1.u T : (@. v.M+_@:@<@[@}@|@1@. 2@u 3@4@5@).6@`.7@0+8@]@4.9@9@c . ", -". $ . . . .1./@6@% /.[ `.7+@@0@Y a@U ) ) O+# M+w h r+b@. . I c@4@d@e@@@Z+!@q+f@Y+s+g@c . ", -". $ ^.1.1.1.% h@A b b N s.r.B i@. j@4.D { O+{ O+k@B.x #@. . b l@m@n@o@p@q@r@ +v+v+v+s@c . ", -". $ % % % 2.2.6@X.+.+...Y.b.t@. u@c+3 , .g %++.].{+4.' X . . v@w@x@y@)@!@0+Y+ +s@s@s@c . ", -". $ 2.2.y z@! A@t+u.u.c.8+f . . f.{+, < ./., 3 ) M+T [ B@. C@w@D@E@F@G@f.q@r@H@ +/@I@c . ", -". $ 3 u J@& K@L@t+..c.t+v+M@. N@) 3 .- - a t.3 ) M+%+/.{+O@. P@Q@R@S@T@U@4.t.!+V@I@I@c . ", -". $ N N W@C.C.X@s.c.Z+C Y@. . A ) 3 , < a r+w 3 ) M+%+/.e..+I Z@R@. g.`@ #8@.#7+X. +H@c . ", -". $ ..s.s.s.s.c.c.D +#@###. . k@D +.3 , , B.3 +.D ; Q.]+e..@. N@$#%#&#*#+#W@`.7+=#H@~@c . ", -". $ s.s.s.c.9+9+9+Y.@@-#;#. . X M+) +.3 3 B.+.) M+%+O+4 T [.>#,#R@. '#e _.)#!#~#Y+~@~@c . ", -". $ ) c.9+9+9+9+Y.d.g@Y+_.. . . : ' 4 ) ) [ D ].w h ]+e.K.O@{#]#Q@^#&#/#(#_#^@Z.:#=#=#c . ", -". $ 9+9+].Y.Y.Y.u+s+~@8@. . . . . . <#[.M+K.].%+h /.{+[#. . I }#|#1#y@2#z@3#4#.#5#6#6#c . ", -". $ Y.Y.Y.Y.a+d.7#!+^+8#9#0#a#. . . . . k@e.{+O+]+{+~ b#c#d#. . e#f#4@{.g#h#i#j#{@5#6#c . ", -". $ Y.Y.t+t+u+s+X.J.. . k#l#}+m#. . . . n#/.c+o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#o#p#", -". $ t+t+3.8+9@s@Y+. q#r#s#}+t#u#v#. w#x e.e.r.o#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#y#", -". $ 3.8+z#9@s+/@r@7 A#B#}+t#u#C#D#E#. U K.K.r+o#x#F#G#9@( z#H#I#x#J#K#L#_ M#N#x#J#K#L#_ M#N#x#y#", -". $ z#9@9@9@g@X.~#O#. P#t#u#C#D#Q#R#. g. #g 2 o#x#S#$ T#U#V#$ W#x#X#$ Y#Z#`# $x#X#$ Y#Z#`# $x#y#", -". $ 7#7#s+s+v+X.~#. .$+$u#C#D#Q#@$#$. . . . . o#x#, $ $$x#%$$ w@x#^.$ &$x#x#x#x#^.$ &$x#x#x#x#y#", -". $ s+s+s+g@s@~@~#*$=$-$E#;$>$,$'$. )$. . . . o#x#$ $ !$x#~$$ = x#$ $ x#$ $ $ x#$ $ x#$ $ $ x#y#", -". $ g@v+v+v+/@~@{@{$. . . . . . . ]$^$/$($_$:$o#x#, $ <$x#%$$ w@x#, $ [$x#$ $ x#, $ [$x#$ $ x#y#", -". $ v+v+v+I@ +~@r@`.i#}$-#.+|$1$2$1$3$4$J@1 d@o#x#5$$ 6$U#7$$ W#x#S#$ 8$x#$ $ x#S#$ 8$x#$ $ x#y#", -". $ s@ + + + +H@:#L+Z+q+9$0$a$_._.b$c$0$U@}$e@o#x#d$e$f$= d.G#I#x#g$h$i$j$z#k$x#g$h$i$j$z#k$x#y#", -". $ +V@V@V@X.X.!+r@.#!#`+q+K+l$l$m$n$o$!@`+`+o#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#x#y#", -". $ V@X.X.X.H@H@=#6#J.b.`.N+!#p$p$!#N+j#`.j#j#p#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#y#", -". $ X.H@H@H@H@~@!+6#:#5#L#{@{@M#M#{@{@{@{@{@L#{@P+q$q$2#2#2#r$s$s$r$r$2#q$t$t$t$t$t$t$2@. ", -". # H@H@H@=#6#6#6#6#6#6#6#6#6#6#Y+:#:#:#:#:#:#:#:#5#5#5#5#L#L#L#L#L#L#L#L#L#L#L#L#L#L#u$. ", -". x c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c u$v$. ", -" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", -" ", -" ", -" "}; diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/vorbis/vcupdate.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/vorbis/vcupdate.c Fri Dec 07 12:09:16 2007 -0600 @@ -0,0 +1,251 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2007 Audacious development team + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include "vorbis.h" +#include "vcedit.h" + +static gboolean write_and_pivot_files(vcedit_state * state); + +extern GMutex *vf_mutex; + +static mowgli_dictionary_t * +dictionary_from_vorbis_comment(vorbis_comment * vc) +{ + mowgli_dictionary_t *dict; + gint i; + gchar *val; + + dict = mowgli_dictionary_create(g_ascii_strcasecmp); + + for (i = 0; i < vc->comments; i++) { + gchar **frags; + + AUDDBG("%s\n", vc->user_comments[i]); + frags = g_strsplit(vc->user_comments[i], "=", 2); + + /* FIXME: need more rigorous checks to guard against + borqued comments */ + + /* No RHS? */ + val = frags[1] ? frags[1] : ""; + + mowgli_dictionary_add(dict, frags[0], g_strdup(val)); + + g_strfreev(frags); /* Don't use g_free() for string lists! --eugene */ + } + + return dict; +} + +static void +dictionary_to_vorbis_comment(vorbis_comment * vc, mowgli_dictionary_t * dict) +{ + mowgli_dictionary_iteration_state_t state; + gchar *field; + + vorbis_comment_clear(vc); + + MOWGLI_DICTIONARY_FOREACH(field, &state, dict) { + vorbis_comment_add_tag(vc, state.cur->key, field); + } +} + +static void +insert_str_tuple_field_to_dictionary(Tuple *tuple, int fieldn, mowgli_dictionary_t *dict, char *key) +{ + + if(mowgli_dictionary_find(dict, key) != NULL) g_free(mowgli_dictionary_delete(dict, key)); + + gchar *tmp = (gchar*)aud_tuple_get_string(tuple, fieldn, NULL); + if(tmp != NULL && strlen(tmp) != 0) mowgli_dictionary_add(dict, key, g_strdup(tmp)); +} + +static void +insert_int_tuple_field_to_dictionary(Tuple *tuple, int fieldn, mowgli_dictionary_t *dict, char *key) +{ + int val; + + if(mowgli_dictionary_find(dict, key) != NULL) g_free(mowgli_dictionary_delete(dict, key)); + + if(aud_tuple_get_value_type(tuple, fieldn, NULL) == TUPLE_INT && (val = aud_tuple_get_int(tuple, fieldn, NULL)) >= 0) { + gchar *tmp = g_strdup_printf("%d", val); + mowgli_dictionary_add(dict, key, tmp); + } +} + +static void +destroy_cb(mowgli_dictionary_elem_t *delem, void *privdata) +{ + g_free(delem->data); +} + +gboolean +vorbis_update_song_tuple (Tuple *tuple, VFSFile *fd) +{ + + vcedit_state *state; + vorbis_comment *comment; + mowgli_dictionary_t *dict; + gboolean ret; + + if(!tuple || !fd) return FALSE; + + g_mutex_lock(vf_mutex); + + state = vcedit_new_state(); + + if(vcedit_open(state, fd) < 0) { + vcedit_clear(state); + g_mutex_unlock(vf_mutex); + return FALSE; + } + + comment = vcedit_comments(state); + dict = dictionary_from_vorbis_comment(comment); + + insert_str_tuple_field_to_dictionary(tuple, FIELD_TITLE, dict, "title"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_ARTIST, dict, "artist"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_ALBUM, dict, "album"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_COMMENT, dict, "comment"); + insert_str_tuple_field_to_dictionary(tuple, FIELD_GENRE, dict, "genre"); + + insert_int_tuple_field_to_dictionary(tuple, FIELD_YEAR, dict, "date"); + insert_int_tuple_field_to_dictionary(tuple, FIELD_TRACK_NUMBER, dict, "tracknumber"); + + dictionary_to_vorbis_comment(comment, dict); + mowgli_dictionary_destroy(dict, destroy_cb, NULL); + + ret = write_and_pivot_files(state); + + vcedit_clear(state); + g_mutex_unlock(vf_mutex); + + return ret; +} + +/* from stdio VFS plugin */ +static gchar * +aud_vfs_stdio_urldecode_path(const gchar * encoded_path) +{ + const gchar *cur, *ext; + gchar *path, *tmp; + gint realchar; + + if (!encoded_path) + return NULL; + + if (!aud_str_has_prefix_nocase(encoded_path, "file:")) + return NULL; + + cur = encoded_path + 5; + + if (aud_str_has_prefix_nocase(cur, "//localhost")) + cur += 11; + + if (*cur == '/') + while (cur[1] == '/') + cur++; + + tmp = g_malloc0(strlen(cur) + 1); + + while ((ext = strchr(cur, '%')) != NULL) { + strncat(tmp, cur, ext - cur); + ext++; + cur = ext + 2; + if (!sscanf(ext, "%2x", &realchar)) { + /* Assume it is a literal '%'. Several file + * managers send unencoded file: urls on drag + * and drop. */ + realchar = '%'; + cur -= 2; + } + tmp[strlen(tmp)] = realchar; + } + + path = g_strconcat(tmp, cur, NULL); + g_free(tmp); + return path; +} + +gboolean +write_and_pivot_files(vcedit_state * state) +{ + gint retval; + gchar *tmpfn, *unq_tmpfn, *unq_in; + VFSFile *out; + + tmpfn = g_strdup_printf("%s.XXXXXX", ((VFSFile*)state->in)->uri); + mktemp(tmpfn); + + AUDDBG("creating temp file: %s\n", tmpfn); + + if ((out = aud_vfs_fopen(tmpfn, "wb")) == NULL) { + g_free(tmpfn); + AUDDBG("fileinfo.c: couldn't create temp file, %s\n", tmpfn); + return FALSE; + } + + if (vcedit_write(state, out) < 0) { + g_free(tmpfn); + aud_vfs_fclose(out); + AUDDBG("vcedit_write: %s\n", state->lasterror); + return FALSE; + } + + aud_vfs_fclose(out); + + unq_tmpfn = aud_vfs_stdio_urldecode_path(tmpfn); + unq_in = aud_vfs_stdio_urldecode_path(((VFSFile*)state->in)->uri); + + if((retval = rename(unq_tmpfn, unq_in)) == 0) { + AUDDBG("fileinfo.c: file %s renamed successfully to %s\n", unq_tmpfn, unq_in); + } else { + remove(unq_tmpfn); + AUDDBG("fileinfo.c: couldn't rename file\n"); + } + + g_free(unq_in); + g_free(unq_tmpfn); + g_free(tmpfn); + + return retval == 0; +} + diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/vorbis/vorbis.c --- a/src/vorbis/vorbis.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/vorbis/vorbis.c Fri Dec 07 12:09:16 2007 -0600 @@ -108,10 +108,10 @@ .pause = vorbis_pause, .seek = vorbis_seek, .cleanup = vorbis_cleanup, - .file_info_box = vorbis_file_info_box, /* file info box, tag editing */ .get_song_tuple = get_song_tuple, .is_our_file_from_vfs = vorbis_check_fd, .vfs_extensions = vorbis_fmts, + .update_song_tuple = vorbis_update_song_tuple, }; InputPlugin *vorbis_iplist[] = { &vorbis_ip, NULL }; @@ -538,8 +538,10 @@ if (!rg_peak_str) rg_peak_str = vorbis_comment_query(comment, "rg_peak", 0); /* Old */ - if (rg_peak_str) + if (rg_peak_str) { rg_peak = atof(rg_peak_str); + rg_peak = rg_peak == 0.0 ? 1.0 : rg_peak; /* be aware of incorrect formatted strings --eugene */ + } else rg_peak = 1; @@ -618,7 +620,7 @@ VFSVorbisFile *vfd = (VFSVorbisFile *) vorbisfile->datasource; Tuple *tuple = NULL; gint length; - vorbis_comment *comment; + vorbis_comment *comment = NULL; tuple = aud_tuple_new_from_filename(filename); @@ -629,6 +631,8 @@ /* associate with tuple */ aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); + /* maybe, it would be better to display nominal bitrate (like in main win), not average? --eugene */ + aud_tuple_associate_int(tuple, FIELD_BITRATE, NULL, ov_bitrate(vorbisfile, -1)/1000); if ((comment = ov_comment(vorbisfile, -1))) { gchar *tmps; @@ -641,18 +645,20 @@ if ((tmps = vorbis_comment_query(comment, "tracknumber", 0)) != NULL) aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(tmps)); + } - aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); + aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); - if (comment && comment->vendor) - { - gchar *codec = g_strdup_printf("Ogg Vorbis [%s]", comment->vendor); - aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, codec); - g_free(codec); - } - else - aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "Ogg Vorbis"); + if (comment && comment->vendor) + { + gchar *codec = g_strdup_printf("Ogg Vorbis [%s]", comment->vendor); + aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, codec); + g_free(codec); } + else + aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "Ogg Vorbis"); + + aud_tuple_associate_string(tuple, FIELD_MIMETYPE, NULL, "application/ogg"); return tuple; } diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/vorbis/vorbis.h --- a/src/vorbis/vorbis.h Fri Dec 07 12:08:47 2007 -0600 +++ b/src/vorbis/vorbis.h Fri Dec 07 12:09:16 2007 -0600 @@ -14,7 +14,7 @@ void vorbis_configure(void); -void vorbis_file_info_box(char *filename); +gboolean vorbis_update_song_tuple (Tuple *tuple, VFSFile *fd); char *convert_to_utf8(const char *string); char *convert_from_utf8(const char *string); diff -r 3673c7ec4ea2 -r 6a4d667a9183 src/xspf/xspf.c --- a/src/xspf/xspf.c Fri Dec 07 12:08:47 2007 -0600 +++ b/src/xspf/xspf.c Fri Dec 07 12:09:16 2007 -0600 @@ -18,6 +18,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* #define AUD_DEBUG 1 */ + #include #include @@ -78,14 +81,6 @@ static const gint xspf_nentries = (sizeof(xspf_entries) / sizeof(xspf_entry_t)); -/* we need encoding conversion */ -#ifdef DEBUG -# define XSDEBUG(...) { g_print("xspf[%s:%d]: ", __FUNCTION__, (int) __LINE__); g_print(__VA_ARGS__); } -#else -# define XSDEBUG(...) /* stub */ -#endif - - static gboolean is_uri(gchar *uri) { if (strstr(uri, "://")) @@ -203,8 +198,8 @@ aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, strrchr(realfn, '.')); - XSDEBUG("tuple->file_name = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); - XSDEBUG("tuple->file_path = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_PATH, NULL)); + AUDDBG("tuple->file_name = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); + AUDDBG("tuple->file_path = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_PATH, NULL)); /* add file to playlist */ aud_playlist_load_ins_file_tuple(playlist, location, filename, pos, tuple); @@ -259,7 +254,7 @@ g_return_if_fail(filename != NULL); - XSDEBUG("filename='%s', pos=%d\n", filename, pos); + AUDDBG("filename='%s', pos=%d\n", filename, pos); doc = xmlRecoverFile(filename); if (doc == NULL) @@ -273,7 +268,7 @@ base = (gchar *)xmlNodeGetBase(doc, nptr); - XSDEBUG("base @1 = %s\n", base); + AUDDBG("base = %s\n", base); // if filename is specified as a base, ignore it. tmp = xmlURIUnescapeString(base, -1, NULL); @@ -285,7 +280,7 @@ g_free(tmp); } - XSDEBUG("base @2 = %s\n", base); + AUDDBG("base = %s\n", base); for (nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) { @@ -359,7 +354,7 @@ gchar *base = NULL; Playlist *playlist = aud_playlist_get_active(); - XSDEBUG("filename='%s', pos=%d\n", filename, pos); + AUDDBG("filename='%s', pos=%d\n", filename, pos); doc = xmlNewDoc((xmlChar *)"1.0"); doc->charset = XML_CHAR_ENCODING_UTF8; @@ -407,7 +402,7 @@ g_free(base); base = tmp; baselen = tmplen; - XSDEBUG("base='%s', baselen=%d\n", base, baselen); + AUDDBG("base='%s', baselen=%d\n", base, baselen); } else g_free(tmp); } @@ -424,7 +419,7 @@ } if (!is_uri(base)) { - XSDEBUG("base is not uri. something is wrong.\n"); + AUDDBG("base is not uri. something is wrong.\n"); tmp = g_strdup_printf("file://%s", base); xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp); g_free(tmp); @@ -471,14 +466,14 @@ location = xmlNewNode(NULL, (xmlChar *)"location"); if (is_uri(entry->filename)) { /* uri */ - XSDEBUG("filename is uri\n"); + AUDDBG("filename is uri\n"); filename = g_strdup(entry->filename + baselen); // entry->filename is always uri now. } else { /* local file (obsolete) */ gchar *tmp = (gchar *) xspf_path_to_uri((const xmlChar *)entry->filename + baselen); if (base) { /* relative */ filename = g_strdup_printf("%s", tmp); } else { - XSDEBUG("absolute and local (obsolete)\n"); + AUDDBG("absolute and local (obsolete)\n"); filename = g_filename_to_uri(tmp, NULL, NULL); } g_free(tmp);