Mercurial > audlegacy-plugins
changeset 2208:201a47338baf
vorbis: removed fileinfo dialog, switched to mowgli_dictionary, some fixes
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Thu, 06 Dec 2007 03:20:39 +0300 |
parents | 0b67fb27db58 |
children | 190cc25a8510 |
files | src/vorbis/Makefile src/vorbis/fileinfo.c src/vorbis/ogg.xpm src/vorbis/vcupdate.c src/vorbis/vorbis.c src/vorbis/vorbis.h |
diffstat | 6 files changed, 259 insertions(+), 1663 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vorbis/Makefile Tue Dec 04 03:34:08 2007 +0300 +++ b/src/vorbis/Makefile Thu Dec 06 03:20:39 2007 +0300 @@ -1,7 +1,7 @@ PLUGIN = vorbis${PLUGIN_SUFFIX} SRCS = configure.c \ - fileinfo.c \ + vcupdate.c \ vcedit.c \ vorbis.c
--- a/src/vorbis/fileinfo.c Tue Dec 04 03:34:08 2007 +0300 +++ /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 <glib.h> -#include <gtk/gtk.h> -#include <ogg/ogg.h> -#include <vorbis/codec.h> -#include <vorbis/vorbisfile.h> - -#include <math.h> -#include <stdlib.h> -#include <string.h> - -#include <unistd.h> - -#include <audacious/strings.h> -#include <audacious/util.h> -#include <audacious/i18n.h> - -#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 -}
--- a/src/vorbis/ogg.xpm Tue Dec 04 03:34:08 2007 +0300 +++ /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$. ", -" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", -" ", -" ", -" "};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/vorbis/vcupdate.c Thu Dec 06 03:20:39 2007 +0300 @@ -0,0 +1,256 @@ +/* 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. + * + */ + +#define AUD_DEBUG + +#include "config.h" + +#include <glib.h> +#include <gtk/gtk.h> +#include <ogg/ogg.h> +#include <vorbis/codec.h> +#include <vorbis/vorbisfile.h> + +#include <math.h> +#include <stdlib.h> +#include <string.h> + +#include <unistd.h> + +#include <audacious/plugin.h> +#include <audacious/strings.h> +#include <audacious/util.h> +#include <audacious/i18n.h> + +#include <mowgli.h> + +#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; +} +
--- a/src/vorbis/vorbis.c Tue Dec 04 03:34:08 2007 +0300 +++ b/src/vorbis/vorbis.c Thu Dec 06 03:20:39 2007 +0300 @@ -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 };
--- a/src/vorbis/vorbis.h Tue Dec 04 03:34:08 2007 +0300 +++ b/src/vorbis/vorbis.h Thu Dec 06 03:20:39 2007 +0300 @@ -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);