summaryrefslogtreecommitdiffstats
path: root/abs/extra-testing/xmms/id3v2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'abs/extra-testing/xmms/id3v2.patch')
-rw-r--r--abs/extra-testing/xmms/id3v2.patch3379
1 files changed, 0 insertions, 3379 deletions
diff --git a/abs/extra-testing/xmms/id3v2.patch b/abs/extra-testing/xmms/id3v2.patch
deleted file mode 100644
index c8f8ba2..0000000
--- a/abs/extra-testing/xmms/id3v2.patch
+++ /dev/null
@@ -1,3379 +0,0 @@
-diff -Naur xmms-1.2.9-orig/Input/mpg123/charset.h xmms-1.2.9/Input/mpg123/charset.h
---- xmms-1.2.9-orig/Input/mpg123/charset.h Wed Dec 31 19:00:00 1969
-+++ xmms-1.2.9/Input/mpg123/charset.h Thu Jan 29 05:20:31 2004
-@@ -0,0 +1,420 @@
-+/* charset.h - 2001/12/04 */
-+/*
-+ * EasyTAG - Tag editor for MP3 and OGG files
-+ * Copyright (C) 2000-2002 Jerome Couderc <j.couderc@ifrance.com>
-+ *
-+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ */
-+
-+#ifndef FALSE
-+#define FALSE 0
-+#endif
-+#ifndef TRUE
-+#define TRUE 1
-+#endif
-+
-+/*
-+ * Standard gettext macros.
-+ */
-+#ifdef ENABLE_NLS
-+# include <libintl.h>
-+# define _(String) gettext (String)
-+# ifdef gettext_noop
-+# define N_(String) gettext_noop (String)
-+# else
-+# define N_(String) (String)
-+# endif
-+#else
-+# define textdomain(String) (String)
-+# define gettext(String) (String)
-+# define dgettext(Domain,Message) (Message)
-+# define dcgettext(Domain,Message,Type) (Message)
-+# define bindtextdomain(Domain,Directory) (Domain)
-+# define _(String) (String)
-+# define N_(String) (String)
-+#endif
-+
-+#ifndef DLL_H
-+#define DLL_H
-+typedef struct DLL_s
-+{
-+ void *prev;
-+ void *data;
-+ void *next;
-+} DLL;
-+#endif
-+
-+#ifndef __CHARSET_H__
-+#define __CHARSET_H__
-+
-+
-+/***************
-+ * Declaration *
-+ ***************/
-+
-+typedef struct {
-+ char *charset_title;
-+ char *charset_name;
-+} CharsetInfo;
-+
-+
-+/**************
-+ * Prototypes *
-+ **************/
-+
-+//static gchar* get_current_charset (void);
-+
-+/* Used for ogg tags */
-+char* convert_to_utf8 (const char *string);
-+char* convert_from_utf8 (const char *string);
-+
-+char* convert_from_file_to_user (const char *string);
-+char* convert_from_user_to_file (const char *string);
-+
-+DLL *Charset_Create_List (void);
-+char *Charset_Get_Name_From_Title (char *charset_title);
-+char *Charset_Get_Title_From_Name (char *charset_name);
-+
-+short int test_conversion_charset (char *from, char *to);
-+
-+
-+#endif /* __CHARSET_H__ */
-+
-+/*
-+ * Main part of code, written by:
-+ *
-+ * Copyright (C) 1999-2001 Håvard Kvålen <havardk@xmms.org>
-+ *
-+ * 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., 59 Temple Place - Suite 330, Boston, MA
-+ * 02111-1307, USA.
-+ *
-+ */
-+
-+#include <stdlib.h>
-+#include <string.h>
-+#include <errno.h>
-+
-+#ifdef HAVE_ICONV_OPEN
-+#include <iconv.h>
-+#endif
-+
-+#ifdef HAVE_LANGINFO_CODESET
-+#include <langinfo.h>
-+#endif
-+
-+/****************
-+ * Declarations *
-+ ****************/
-+
-+#define CHARSET_TRANS_ARRAY_LEN ( sizeof(charset_trans_array) / sizeof((charset_trans_array)[0]) )
-+const CharsetInfo charset_trans_array[] = {
-+ {N_("Arabic (IBM-864)"), "IBM864" },
-+ {N_("Arabic (ISO-8859-6)"), "ISO-8859-6" },
-+ {N_("Arabic (Windows-1256)"), "windows-1256" },
-+ {N_("Baltic (ISO-8859-13)"), "ISO-8859-13" },
-+ {N_("Baltic (ISO-8859-4)"), "ISO-8859-4" },
-+ {N_("Baltic (Windows-1257)"), "windows-1257" },
-+ {N_("Celtic (ISO-8859-14)"), "ISO-8859-14" },
-+ {N_("Central European (IBM-852)"), "IBM852" },
-+ {N_("Central European (ISO-8859-2)"), "ISO-8859-2" },
-+ {N_("Central European (Windows-1250)"), "windows-1250" },
-+ {N_("Chinese Simplified (GB18030)"), "gb18030" },
-+ {N_("Chinese Simplified (GB2312)"), "GB2312" },
-+ {N_("Chinese Traditional (Big5)"), "Big5" },
-+ {N_("Chinese Traditional (Big5-HKSCS)"), "Big5-HKSCS" },
-+ {N_("Cyrillic (IBM-855)"), "IBM855" },
-+ {N_("Cyrillic (ISO-8859-5)"), "ISO-8859-5" },
-+ {N_("Cyrillic (ISO-IR-111)"), "ISO-IR-111" },
-+ {N_("Cyrillic (KOI8-R)"), "KOI8-R" },
-+ {N_("Cyrillic (Windows-1251)"), "windows-1251" },
-+ {N_("Cyrillic/Russian (CP-866)"), "IBM866" },
-+ {N_("Cyrillic/Ukrainian (KOI8-U)"), "KOI8-U" },
-+ {N_("English (US-ASCII)"), "us-ascii" },
-+ {N_("Greek (ISO-8859-7)"), "ISO-8859-7" },
-+ {N_("Greek (Windows-1253)"), "windows-1253" },
-+ {N_("Hebrew (IBM-862)"), "IBM862" },
-+ {N_("Hebrew (Windows-1255)"), "windows-1255" },
-+ {N_("Japanese (EUC-JP)"), "EUC-JP" },
-+ {N_("Japanese (ISO-2022-JP)"), "ISO-2022-JP" },
-+ {N_("Japanese (Shift_JIS)"), "Shift_JIS" },
-+ {N_("Korean (EUC-KR)"), "EUC-KR" },
-+ {N_("Nordic (ISO-8859-10)"), "ISO-8859-10" },
-+ {N_("South European (ISO-8859-3)"), "ISO-8859-3" },
-+ {N_("Thai (TIS-620)"), "TIS-620" },
-+ {N_("Turkish (IBM-857)"), "IBM857" },
-+ {N_("Turkish (ISO-8859-9)"), "ISO-8859-9" },
-+ {N_("Turkish (Windows-1254)"), "windows-1254" },
-+ {N_("Unicode (UTF-7)"), "UTF-7" },
-+ {N_("Unicode (UTF-8)"), "UTF-8" },
-+ {N_("Unicode (UTF-16BE)"), "UTF-16BE" },
-+ {N_("Unicode (UTF-16LE)"), "UTF-16LE" },
-+ {N_("Unicode (UTF-32BE)"), "UTF-32BE" },
-+ {N_("Unicode (UTF-32LE)"), "UTF-32LE" },
-+ {N_("Vietnamese (VISCII)"), "VISCII" },
-+ {N_("Vietnamese (Windows-1258)"), "windows-1258" },
-+ {N_("Visual Hebrew (ISO-8859-8)"), "ISO-8859-8" },
-+ {N_("Western (IBM-850)"), "IBM850" },
-+ {N_("Western (ISO-8859-1)"), "ISO-8859-1" },
-+ {N_("Western (ISO-8859-15)"), "ISO-8859-15" },
-+ {N_("Western (Windows-1252)"), "windows-1252" }
-+
-+ /*
-+ * From this point, character sets aren't supported by iconv
-+ */
-+/* {N_("Arabic (IBM-864-I)"), "IBM864i" },
-+ {N_("Arabic (ISO-8859-6-E)"), "ISO-8859-6-E" },
-+ {N_("Arabic (ISO-8859-6-I)"), "ISO-8859-6-I" },
-+ {N_("Arabic (MacArabic)"), "x-mac-arabic" },
-+ {N_("Armenian (ARMSCII-8)"), "armscii-8" },
-+ {N_("Central European (MacCE)"), "x-mac-ce" },
-+ {N_("Chinese Simplified (GBK)"), "x-gbk" },
-+ {N_("Chinese Simplified (HZ)"), "HZ-GB-2312" },
-+ {N_("Chinese Traditional (EUC-TW)"), "x-euc-tw" },
-+ {N_("Croatian (MacCroatian)"), "x-mac-croatian" },
-+ {N_("Cyrillic (MacCyrillic)"), "x-mac-cyrillic" },
-+ {N_("Cyrillic/Ukrainian (MacUkrainian)"), "x-mac-ukrainian" },
-+ {N_("Farsi (MacFarsi)"), "x-mac-farsi"},
-+ {N_("Greek (MacGreek)"), "x-mac-greek" },
-+ {N_("Gujarati (MacGujarati)"), "x-mac-gujarati" },
-+ {N_("Gurmukhi (MacGurmukhi)"), "x-mac-gurmukhi" },
-+ {N_("Hebrew (ISO-8859-8-E)"), "ISO-8859-8-E" },
-+ {N_("Hebrew (ISO-8859-8-I)"), "ISO-8859-8-I" },
-+ {N_("Hebrew (MacHebrew)"), "x-mac-hebrew" },
-+ {N_("Hindi (MacDevanagari)"), "x-mac-devanagari" },
-+ {N_("Icelandic (MacIcelandic)"), "x-mac-icelandic" },
-+ {N_("Korean (JOHAB)"), "x-johab" },
-+ {N_("Korean (UHC)"), "x-windows-949" },
-+ {N_("Romanian (MacRomanian)"), "x-mac-romanian" },
-+ {N_("Turkish (MacTurkish)"), "x-mac-turkish" },
-+ {N_("User Defined"), "x-user-defined" },
-+ {N_("Vietnamese (TCVN)"), "x-viet-tcvn5712" },
-+ {N_("Vietnamese (VPS)"), "x-viet-vps" },
-+ {N_("Western (MacRoman)"), "x-mac-roman" },
-+ // charsets whithout posibly translatable names
-+ {"T61.8bit", "T61.8bit" },
-+ {"x-imap4-modified-utf7", "x-imap4-modified-utf7"},
-+ {"x-u-escaped", "x-u-escaped" },
-+ {"windows-936", "windows-936" }
-+*/
-+};
-+
-+
-+
-+
-+/*************
-+ * Functions *
-+ *************/
-+// Return the last item of an doubly linked list
-+static DLL *
-+dll_last_c (DLL *list)
-+{
-+ DLL *item = list;
-+
-+ while ( item->next )
-+ item = item->next;
-+
-+ return item;
-+}
-+
-+// Append an item to the doubly linked list
-+static DLL *
-+dll_append_c (DLL *list, void *data)
-+{
-+ DLL *item = malloc (sizeof(DLL));
-+
-+ item->data = data;
-+ item->prev = dll_last_c(list);
-+ item->next = NULL;
-+
-+ return item;
-+}
-+
-+static char* get_current_charset (void)
-+{
-+ char *charset = getenv("CHARSET");
-+
-+#ifdef HAVE_LANGINFO_CODESET
-+ if (!charset)
-+ charset = nl_langinfo(CODESET);
-+#endif
-+ if (!charset)
-+ charset = "ISO-8859-1";
-+
-+ return charset;
-+}
-+
-+
-+#ifdef HAVE_ICONV_OPEN
-+static char* convert_string (const char *string, char *from, char *to)
-+{
-+ size_t outleft, outsize, length;
-+ iconv_t cd;
-+ char *out, *outptr;
-+ const char *input = string;
-+
-+ if (!string)
-+ return NULL;
-+
-+ length = strlen(string);
-+
-+ /* g_message("converting %s from %s to %s", string, from, to); */
-+ if ((cd = iconv_open(to, from)) == (iconv_t)-1)
-+ {
-+ fprintf (stderr, "convert_string(): Conversion not supported. Charsets: %s -> %s", from, to);
-+ return strdup(string);
-+ }
-+
-+ /* Due to a GLIBC bug, round outbuf_size up to a multiple of 4 */
-+ /* + 1 for nul in case len == 1 */
-+ outsize = ((length + 3) & ~3) + 1;
-+ out = g_malloc(outsize);
-+ outleft = outsize - 1;
-+ outptr = out;
-+
-+ retry:
-+ if (iconv(cd, (char **)&input, &length, &outptr, &outleft) == -1)
-+ {
-+ int used;
-+ switch (errno)
-+ {
-+ case E2BIG:
-+ used = outptr - out;
-+ outsize = (outsize - 1) * 2 + 1;
-+ out = g_realloc(out, outsize);
-+ outptr = out + used;
-+ outleft = outsize - 1 - used;
-+ goto retry;
-+ case EINVAL:
-+ break;
-+ case EILSEQ:
-+ /* Invalid sequence, try to get the
-+ rest of the string */
-+ input++;
-+ length = strlen(input);
-+ goto retry;
-+ default:
-+ fprintf (stderr, "convert_string(): Conversion failed. Inputstring: %s; Error: %s", string, strerror(errno));
-+ break;
-+ }
-+ }
-+ *outptr = '\0';
-+
-+ iconv_close(cd);
-+ return out;
-+}
-+#else
-+static char* convert_string (const char *string, char *from, char *to)
-+{
-+ if (!string)
-+ return NULL;
-+ return strdup(string);
-+}
-+#endif
-+
-+
-+/*
-+ * Conversion with UTF-8 for ogg tags
-+ */
-+char* convert_to_utf8 (const char *string)
-+{
-+ char *charset = get_current_charset();
-+
-+ return convert_string(string, charset, "UTF-8");
-+}
-+
-+char* convert_from_utf8 (const char *string)
-+{
-+ char *charset = get_current_charset();
-+
-+ return convert_string(string, "UTF-8", charset);
-+}
-+
-+
-+DLL *Charset_Create_List (void)
-+{
-+ DLL *list = NULL;
-+ int i;
-+
-+ for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++)
-+ list = dll_append_c (list,_(charset_trans_array[i].charset_title));
-+ return list;
-+}
-+
-+
-+/*
-+ * Return charset_name from charset_title
-+ */
-+char *Charset_Get_Name_From_Title (char *charset_title)
-+{
-+ int i;
-+
-+ if (charset_title)
-+ for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++)
-+ if ( strcasecmp(_(charset_title),_(charset_trans_array[i].charset_title)) == 0 )
-+ return charset_trans_array[i].charset_name;
-+ return "";
-+}
-+
-+
-+/*
-+ * Return charset_title from charset_name
-+ */
-+char *Charset_Get_Title_From_Name (char *charset_name)
-+{
-+ int i;
-+
-+ if (charset_name)
-+ for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++)
-+ if ( strcasecmp(charset_name,charset_trans_array[i].charset_name) == 0 )
-+ return _(charset_trans_array[i].charset_title);
-+ return "";
-+}
-+
-+
-+
-+/*
-+ * Test if the conversion is supported between two character sets ('from' and 'to)
-+ */
-+#ifdef HAVE_ICONV_OPEN
-+short int test_conversion_charset (char *from, char *to)
-+{
-+ iconv_t cd;
-+
-+ if ((cd=iconv_open(to,from)) == (iconv_t)-1)
-+ {
-+ /* Conversion not supported */
-+ return FALSE;
-+ }
-+ iconv_close(cd);
-+ return TRUE;
-+}
-+#else
-+short int test_conversion_charset (char *from, char *to)
-+{
-+ return TRUE;
-+}
-+#endif
-diff -Naur xmms-1.2.9-orig/Input/mpg123/fileinfo.c xmms-1.2.9/Input/mpg123/fileinfo.c
---- xmms-1.2.9-orig/Input/mpg123/fileinfo.c Thu Jan 29 06:43:24 2004
-+++ xmms-1.2.9/Input/mpg123/fileinfo.c Thu Jan 29 06:39:47 2004
-@@ -25,28 +25,36 @@
- #include <errno.h>
- #include <libxmms/xentry.h>
- #include "mpg123.h"
-+#include "lib_id3v2.h"
-+
-+#define MAX_STR_LEN 100
-+#define MAX_ENTRY_LEN2 1023
-
- static GtkWidget *window = NULL;
--static GtkWidget *filename_entry, *id3_frame;
--static GtkWidget *title_entry, *artist_entry, *album_entry, *year_entry;
--static GtkWidget *tracknum_entry, *comment_entry, *genre_combo;
-+static GtkWidget *notebook = NULL;
-+static GtkWidget *filename_entry, *id3v1_frame, *id3v2_frame;
-+static GtkWidget *v1_checkbox, *v2_checkbox;
-+static GtkWidget *v1_title_entry, *v1_artist_entry, *v1_album_entry, *v1_year_entry, *v1_tracknum_entry, *v1_comment_entry;
-+static GtkWidget *v2_title_entry, *v2_artist_entry, *v2_album_entry, *v2_year_entry, *v2_tracknum_entry, *v2_comment_entry,
-+ *v2_composer_entry, *v2_orig_artist_entry, *v2_url_entry, *v2_encoded_by_entry;
-+static GtkWidget *v1_genre_combo, *v2_genre_combo;
- static GtkWidget *mpeg_level, *mpeg_bitrate, *mpeg_samplerate, *mpeg_flags;
- static GtkWidget *mpeg_fileinfo;
-
-+static GPtrArray *v1_labels_list = NULL, *v2_labels_list = NULL; // TODO: Where will these be freed?
- static GList *genre_list;
- struct genre_item {
- const char *name;
- int id;
- };
--static int current_genre;
-+static int v1_current_genre;
-+static int v2_current_genre;
- static char *current_filename;
-
- extern char *mpg123_filename;
- extern int mpg123_bitrate, mpg123_frequency, mpg123_layer, mpg123_lsf, mpg123_mode;
- extern gboolean mpg123_stereo, mpg123_mpeg25;
-
--#define MAX_STR_LEN 100
--
- static void label_set_text(GtkWidget * label, char *str, ...)
- G_GNUC_PRINTF(2, 3);
-
-@@ -66,6 +74,12 @@
- strncpy(tag, gtk_entry_get_text(entry), length);
- }
-
-+void copy_entry_tag(GtkEntry * src, GtkEntry * dest, int length)
-+{
-+ set_entry_tag(dest, gtk_entry_get_text(src), length);
-+ return;
-+}
-+
- static int genre_find_index(GList *genre_list, int id)
- {
- int idx = 0;
-@@ -80,15 +94,29 @@
- return idx;
- }
-
-+static int genre_find_index_str(GList *genre_list, const char* str)
-+{
-+ int idx = 0;
-+ while (genre_list)
-+ {
-+ struct genre_item *item = genre_list->data;
-+ if (strcmp(item->name, str) == 0)
-+ break;
-+ idx++;
-+ genre_list = genre_list->next;
-+ }
-+ return idx;
-+}
-+
- static int genre_comp_func(gconstpointer a, gconstpointer b)
- {
- const struct genre_item *ga = a, *gb = b;
- return strcasecmp(ga->name, gb->name);
- }
-
--static void save_cb(GtkWidget * w, gpointer data)
-+static void remove_id3v1(void)
- {
-- int fd;
-+ int fd, len;
- struct id3v1tag_t tag;
- char *msg = NULL;
-
-@@ -97,71 +125,36 @@
-
- if ((fd = open(current_filename, O_RDWR)) != -1)
- {
-- int tracknum;
--
-- lseek(fd, -128, SEEK_END);
-+ len = lseek(fd, -128, SEEK_END);
- read(fd, &tag, sizeof (struct id3v1tag_t));
-
- if (!strncmp(tag.tag, "TAG", 3))
-- lseek(fd, -128, SEEK_END);
-- else
-- lseek(fd, 0, SEEK_END);
-- tag.tag[0] = 'T';
-- tag.tag[1] = 'A';
-- tag.tag[2] = 'G';
-- get_entry_tag(GTK_ENTRY(title_entry), tag.title, 30);
-- get_entry_tag(GTK_ENTRY(artist_entry), tag.artist, 30);
-- get_entry_tag(GTK_ENTRY(album_entry), tag.album, 30);
-- get_entry_tag(GTK_ENTRY(year_entry), tag.year, 4);
-- tracknum = atoi(gtk_entry_get_text(GTK_ENTRY(tracknum_entry)));
-- if (tracknum > 0)
- {
-- get_entry_tag(GTK_ENTRY(comment_entry),
-- tag.u.v1_1.comment, 28);
-- tag.u.v1_1.__zero = 0;
-- tag.u.v1_1.track_number = MIN(tracknum, 255);
-+ if (ftruncate(fd, len))
-+ msg = g_strdup_printf(_("%s\n"
-+ "Unable to truncate file: %s"),
-+ _("Couldn't remove tag!"),
-+ strerror(errno));
- }
-- else
-- get_entry_tag(GTK_ENTRY(comment_entry),
-- tag.u.v1_0.comment, 30);
-- tag.genre = current_genre;
-- if (write(fd, &tag, sizeof (tag)) != sizeof (tag))
-- msg = g_strdup_printf(_("%s\nUnable to write to file: %s"),
-- _("Couldn't write tag!"),
-- strerror(errno));
- close(fd);
- }
- else
- msg = g_strdup_printf(_("%s\nUnable to open file: %s"),
-- _("Couldn't write tag!"),
-+ _("Couldn't remove tag!"),
- strerror(errno));
- if (msg)
- {
-- GtkWidget *mwin = xmms_show_message(_("File Info"), msg,
-- _("Ok"), FALSE, NULL, NULL);
-+ GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"),
-+ FALSE, NULL, NULL);
- gtk_window_set_transient_for(GTK_WINDOW(mwin),
- GTK_WINDOW(window));
- g_free(msg);
- }
-- else
-- gtk_widget_destroy(window);
--}
--
--static void label_set_text(GtkWidget * label, char *str, ...)
--{
-- va_list args;
-- char tempstr[MAX_STR_LEN];
--
-- va_start(args, str);
-- g_vsnprintf(tempstr, MAX_STR_LEN, str, args);
-- va_end(args);
--
-- gtk_label_set_text(GTK_LABEL(label), tempstr);
- }
-
--static void remove_id3_cb(GtkWidget * w, gpointer data)
-+static void save_cb(GtkWidget * w, gpointer data)
- {
-- int fd, len;
-+ int fd;
- struct id3v1tag_t tag;
- char *msg = NULL;
-
-@@ -170,36 +163,95 @@
-
- if ((fd = open(current_filename, O_RDWR)) != -1)
- {
-- len = lseek(fd, -128, SEEK_END);
-- read(fd, &tag, sizeof (struct id3v1tag_t));
-+ if (!GTK_TOGGLE_BUTTON(v1_checkbox)->active) {
-+ // Try to save id3v1 tag
-+ int tracknum;
-
-- if (!strncmp(tag.tag, "TAG", 3))
-- {
-- if (ftruncate(fd, len))
-- msg = g_strdup_printf(
-- _("%s\n"
-- "Unable to truncate file: %s"),
-- _("Couldn't remove tag!"),
-- strerror(errno));
-+ lseek(fd, -128, SEEK_END);
-+ read(fd, &tag, sizeof (struct id3v1tag_t));
-+
-+ if (!strncmp(tag.tag, "TAG", 3))
-+ lseek(fd, -128, SEEK_END);
-+ else
-+ lseek(fd, 0, SEEK_END);
-+ tag.tag[0] = 'T';
-+ tag.tag[1] = 'A';
-+ tag.tag[2] = 'G';
-+ get_entry_tag(GTK_ENTRY(v1_title_entry), tag.title, 30);
-+ get_entry_tag(GTK_ENTRY(v1_artist_entry), tag.artist, 30);
-+ get_entry_tag(GTK_ENTRY(v1_album_entry), tag.album, 30);
-+ get_entry_tag(GTK_ENTRY(v1_year_entry), tag.year, 4);
-+ tracknum = atoi(gtk_entry_get_text(GTK_ENTRY(v1_tracknum_entry)));
-+ if (tracknum > 0)
-+ {
-+ get_entry_tag(GTK_ENTRY(v1_comment_entry),
-+ tag.u.v1_1.comment, 28);
-+ tag.u.v1_1.__zero = 0;
-+ tag.u.v1_1.track_number = MIN(tracknum, 255);
-+ }
-+ else
-+ get_entry_tag(GTK_ENTRY(v1_comment_entry),
-+ tag.u.v1_0.comment, 30);
-+ tag.genre = v1_current_genre;
-+ if (write(fd, &tag, sizeof (tag)) != sizeof (tag))
-+ msg = g_strdup_printf(_("%s\nUnable to write to file: %s"),
-+ _("Couldn't write tag!"),
-+ strerror(errno));
-+ } else {
-+ // Remove the id3v1 tag from the file
-+ remove_id3v1();
- }
-- else
-- msg = strdup(_("No tag to remove!"));
-- close(fd);
-+
-+ if (!GTK_TOGGLE_BUTTON(v2_checkbox)->active) {
-+
-+ id3Tag v2_tag;
-+ strncpy(v2_tag.title, gtk_entry_get_text(GTK_ENTRY(v2_title_entry)), MAX_ENTRY_LEN2);
-+ strncpy(v2_tag.artist, gtk_entry_get_text(GTK_ENTRY(v2_artist_entry)), MAX_ENTRY_LEN2);
-+ strncpy(v2_tag.album, gtk_entry_get_text(GTK_ENTRY(v2_album_entry)), MAX_ENTRY_LEN2);
-+ strncpy(v2_tag.year, gtk_entry_get_text(GTK_ENTRY(v2_year_entry)), 4);
-+ strncpy(v2_tag.comment, gtk_entry_get_text(GTK_ENTRY(v2_comment_entry)), MAX_ENTRY_LEN2);
-+ strncpy(v2_tag.track, gtk_entry_get_text(GTK_ENTRY(v2_tracknum_entry)), 3);
-+ snprintf(v2_tag.genre, 6, "(%d)", v2_current_genre);
-+
-+ strncpy(v2_tag.composer, gtk_entry_get_text(GTK_ENTRY(v2_composer_entry)), MAX_ENTRY_LEN2);
-+ strncpy(v2_tag.url, gtk_entry_get_text(GTK_ENTRY(v2_url_entry)), MAX_ENTRY_LEN2);
-+ strncpy(v2_tag.orig_artist, gtk_entry_get_text(GTK_ENTRY(v2_orig_artist_entry)), MAX_ENTRY_LEN2);
-+ strncpy(v2_tag.enc_by, gtk_entry_get_text(GTK_ENTRY(v2_encoded_by_entry)), MAX_ENTRY_LEN2);
-+
-+ set_id3v2_tag(&v2_tag, current_filename);
-+
-+ } else {
-+ // remove the id3v2 tag from the file
-+ del_id3v2_tag(current_filename);
-+ }
-+
-+ if (fd)
-+ close(fd);
- }
- else
- msg = g_strdup_printf(_("%s\nUnable to open file: %s"),
-- _("Couldn't remove tag!"),
-+ _("Couldn't write tag!"),
- strerror(errno));
- if (msg)
- {
-- GtkWidget *mwin = xmms_show_message(_("File Info"), msg,
-- _("Ok"), FALSE, NULL, NULL);
-+ GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"),
-+ FALSE, NULL, NULL);
- gtk_window_set_transient_for(GTK_WINDOW(mwin),
- GTK_WINDOW(window));
- g_free(msg);
- }
-- else
-- gtk_widget_destroy(window);
-+}
-+
-+static void label_set_text(GtkWidget * label, char *str, ...)
-+{
-+ va_list args;
-+ char tempstr[MAX_STR_LEN];
-+
-+ va_start(args, str);
-+ g_vsnprintf(tempstr, MAX_STR_LEN, str, args);
-+ va_end(args);
-+
-+ gtk_label_set_text(GTK_LABEL(label), tempstr);
- }
-
- static void set_mpeg_level_label(gboolean mpeg25, int lsf, int layer)
-@@ -222,28 +274,144 @@
-
- static void file_info_http(char *filename)
- {
-- gtk_widget_set_sensitive(id3_frame, FALSE);
-+ gtk_widget_set_sensitive(id3v1_frame, FALSE);
-+ gtk_widget_set_sensitive(id3v2_frame, FALSE);
- if (mpg123_filename && !strcmp(filename, mpg123_filename) &&
- mpg123_bitrate != 0)
- {
-- set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, mpg123_layer);
-+ set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf,
-+ mpg123_layer);
- label_set_text(mpeg_bitrate, _("Bitrate: %d kb/s"),
-- mpg123_bitrate);
-+ mpg123_bitrate);
- label_set_text(mpeg_samplerate, _("Samplerate: %d Hz"),
-- mpg123_frequency);
-+ mpg123_frequency);
- label_set_text(mpeg_flags, "%s",
-- channel_mode_name(mpg123_mode));
-+ channel_mode_name(mpg123_mode));
- }
- }
-
--static void genre_selected(GtkList *list, GtkWidget *w, gpointer data)
-+void copy_v2_to_v1_cb(GtkButton *button, gpointer user_data)
-+{
-+ copy_entry_tag(GTK_ENTRY(v2_title_entry), GTK_ENTRY(v1_title_entry), 30);
-+ copy_entry_tag(GTK_ENTRY(v2_artist_entry), GTK_ENTRY(v1_artist_entry), 30);
-+ copy_entry_tag(GTK_ENTRY(v2_album_entry), GTK_ENTRY(v1_album_entry), 30);
-+ copy_entry_tag(GTK_ENTRY(v2_year_entry), GTK_ENTRY(v1_year_entry), 4);
-+ copy_entry_tag(GTK_ENTRY(v2_comment_entry), GTK_ENTRY(v1_comment_entry), 30);
-+ copy_entry_tag(GTK_ENTRY(v2_tracknum_entry), GTK_ENTRY(v1_tracknum_entry), 3);
-+
-+ gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), genre_find_index(genre_list, v2_current_genre));
-+ return;
-+}
-+
-+void copy_v1_to_v2_cb(GtkButton *button, gpointer user_data)
-+{
-+ copy_entry_tag(GTK_ENTRY(v1_title_entry), GTK_ENTRY(v2_title_entry), MAX_ENTRY_LEN2);
-+ copy_entry_tag(GTK_ENTRY(v1_artist_entry), GTK_ENTRY(v2_artist_entry), MAX_ENTRY_LEN2);
-+ copy_entry_tag(GTK_ENTRY(v1_album_entry), GTK_ENTRY(v2_album_entry), MAX_ENTRY_LEN2);
-+ copy_entry_tag(GTK_ENTRY(v1_year_entry), GTK_ENTRY(v2_year_entry), 4);
-+ copy_entry_tag(GTK_ENTRY(v1_comment_entry), GTK_ENTRY(v2_comment_entry), MAX_ENTRY_LEN2);
-+ copy_entry_tag(GTK_ENTRY(v1_tracknum_entry), GTK_ENTRY(v2_tracknum_entry), 3);
-+
-+ gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), genre_find_index(genre_list, v1_current_genre));
-+ //int genreID = find_genre_id(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(v1_genre_combo)->entry)));
-+ //gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list),
-+ // g_list_index(genre_list, (char *) mpg123_id3_genres[genreID]));
-+ return;
-+}
-+
-+void v1_toggle_cb (GtkWidget *widget, gpointer data)
-+{
-+ int i = 0;
-+ if (GTK_TOGGLE_BUTTON (widget)->active)
-+ {
-+ // If control reaches here, the toggle button is down
-+ // Gray out labels
-+ for (i = 0; i < v1_labels_list->len; i++) {
-+ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v1_labels_list, i) ), FALSE);
-+ }
-+ gtk_widget_set_sensitive(v1_title_entry, FALSE);
-+ gtk_widget_set_sensitive(v1_artist_entry, FALSE);
-+ gtk_widget_set_sensitive(v1_album_entry, FALSE);
-+ gtk_widget_set_sensitive(v1_year_entry, FALSE);
-+ gtk_widget_set_sensitive(v1_tracknum_entry, FALSE);
-+ gtk_widget_set_sensitive(v1_comment_entry, FALSE);
-+ gtk_widget_set_sensitive(v1_genre_combo, FALSE);
-+ } else {
-+
-+ // If control reaches here, the toggle button is up
-+ // Enable labels
-+ for (i = 0; i < v1_labels_list->len; i++) {
-+ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v1_labels_list, i) ), TRUE);
-+ }
-+ gtk_widget_set_sensitive(v1_title_entry, TRUE);
-+ gtk_widget_set_sensitive(v1_artist_entry, TRUE);
-+ gtk_widget_set_sensitive(v1_album_entry, TRUE);
-+ gtk_widget_set_sensitive(v1_year_entry, TRUE);
-+ gtk_widget_set_sensitive(v1_tracknum_entry, TRUE);
-+ gtk_widget_set_sensitive(v1_comment_entry, TRUE);
-+ gtk_widget_set_sensitive(v1_genre_combo, TRUE);
-+ }
-+}
-+
-+void v2_toggle_cb (GtkWidget *widget, gpointer data)
-+{
-+ int i = 0;
-+ if (GTK_TOGGLE_BUTTON (widget)->active)
-+ {
-+ // If control reaches here, the toggle button is down
-+ // Gray out labels
-+ for (i = 0; i < v2_labels_list->len; i++) {
-+ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v2_labels_list, i) ), FALSE);
-+ }
-+ gtk_widget_set_sensitive(v2_title_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_artist_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_album_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_year_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_tracknum_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_comment_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_composer_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_orig_artist_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_url_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_encoded_by_entry, FALSE);
-+ gtk_widget_set_sensitive(v2_genre_combo, FALSE);
-+ } else {
-+
-+ // If control reaches here, the toggle button is up
-+ // Enable labels
-+ for (i = 0; i < v2_labels_list->len; i++) {
-+ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v2_labels_list, i) ), TRUE);
-+ }
-+ gtk_widget_set_sensitive(v2_title_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_artist_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_album_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_year_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_tracknum_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_comment_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_composer_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_orig_artist_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_url_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_encoded_by_entry, TRUE);
-+ gtk_widget_set_sensitive(v2_genre_combo, TRUE);
-+ }
-+}
-+static void v1_genre_selected(GtkList *list, GtkWidget *w, gpointer data)
-+{
-+ void * p;
-+ p = gtk_object_get_data(GTK_OBJECT(w), "genre_id");
-+ if (p != NULL)
-+ v1_current_genre = GPOINTER_TO_INT(p);
-+ else
-+ v1_current_genre = 0;
-+}
-+
-+static void v2_genre_selected(GtkList *list, GtkWidget *w, gpointer data)
- {
- void * p;
- p = gtk_object_get_data(GTK_OBJECT(w), "genre_id");
- if (p != NULL)
-- current_genre = GPOINTER_TO_INT(p);
-+ v2_current_genre = GPOINTER_TO_INT(p);
- else
-- current_genre = 0;
-+ v2_current_genre = 0;
- }
-
- static void genre_set_popdown(GtkWidget *combo, GList *genres)
-@@ -266,11 +434,12 @@
- void mpg123_file_info_box(char *filename)
- {
- int i;
-- struct id3v1tag_t tag;
-+ struct id3v1tag_t id3v1tag;
- FILE *fh;
- char *tmp, *title;
- const char *emphasis[4];
- const char *bool_label[2];
-+ struct id3tag_t id3v2tag;
-
- emphasis[0] = _("None");
- emphasis[1] = _("50/15 ms");
-@@ -281,116 +450,123 @@
-
- if (!window)
- {
-- GtkWidget *vbox, *hbox, *left_vbox, *table;
-- GtkWidget *mpeg_frame, *mpeg_box;
-- GtkWidget *label, *filename_hbox;
-- GtkWidget *bbox, *save, *remove_id3, *cancel;
--
-- window = gtk_window_new(GTK_WINDOW_DIALOG);
-- gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
-- gtk_signal_connect(GTK_OBJECT(window), "destroy",
-- 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);
-+ GtkWidget *window_vbox,
-+ *id3v1_vbox, *id3v2_vbox, *id3v1_frame_vbox, *id3v2_frame_vbox,
-+ *mpeg_lvbox, *mpeg_rvbox, *mpeg_hbox, *mpeg_box, *mpeg_frame,
-+ *bbox, *save, *close, *copy_to, *copy_from,
-+ *table, *label, *filename_hbox;
-+
-+ v1_labels_list = g_ptr_array_new();
-+ v2_labels_list = g_ptr_array_new();
-+
-+ window = gtk_window_new(GTK_WINDOW_DIALOG);
-+ //gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
-+ gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window);
-+ gtk_container_set_border_width(GTK_CONTAINER(window), 10);
-
-+ window_vbox = gtk_vbox_new(FALSE,10);
- filename_hbox = gtk_hbox_new(FALSE, 5);
-- gtk_box_pack_start(GTK_BOX(vbox), filename_hbox,
-- FALSE, TRUE, 0);
-+ gtk_box_pack_start(GTK_BOX(window_vbox), filename_hbox, FALSE, TRUE, 0);
-
- label = gtk_label_new(_("Filename:"));
-- gtk_box_pack_start(GTK_BOX(filename_hbox), label,
-- FALSE, TRUE, 0);
-+ gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0);
- filename_entry = xmms_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_vbox_new(FALSE, 10);
-- gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0);
--
-- id3_frame = gtk_frame_new(_("ID3 Tag:"));
-- gtk_box_pack_start(GTK_BOX(left_vbox), id3_frame,
-- FALSE, FALSE, 0);
--
-- 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_with_max_length(30);
-- 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_with_max_length(30);
-- 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_with_max_length(30);
-- 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_with_max_length(30);
-- 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_with_max_length(4);
-- 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_with_max_length(3);
-- 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);
-+ gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0);
-+
-+ id3v1_vbox = gtk_vbox_new(FALSE, 10);
-+ id3v1_frame = gtk_frame_new("ID3v1 Information");
-+ gtk_box_pack_start(GTK_BOX(id3v1_vbox), id3v1_frame, TRUE, TRUE, 0);
-+
-+ id3v1_frame_vbox = gtk_vbox_new(FALSE,10);
-+ gtk_container_add(GTK_CONTAINER(id3v1_frame), id3v1_frame_vbox);
-+
-+ table = gtk_table_new(6, 6, FALSE);
-+ gtk_container_set_border_width(GTK_CONTAINER(table), 5);
-+ //gtk_widget_set_usize(GTK_WIDGET(table), 325, -1);
-+ //gtk_container_add(GTK_CONTAINER(id3v1_frame), table);
-+ gtk_box_pack_start(GTK_BOX(id3v1_frame_vbox), table, FALSE, FALSE, 0);
-+
-+ v1_checkbox = gtk_check_button_new_with_label ("Disable ID3v1 Tag");
-+ gtk_signal_connect(GTK_OBJECT(v1_checkbox), "toggled", GTK_SIGNAL_FUNC(v1_toggle_cb), NULL);
-+ gtk_table_attach(GTK_TABLE(table), v1_checkbox, 1, 3, 0, 1,
-+ GTK_FILL, GTK_FILL, 0, 2);
-+
-+ label = gtk_label_new("Track number:");
-+ g_ptr_array_add(v1_labels_list, (gpointer)label);
-+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
-+ gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1,
-+ GTK_FILL, GTK_FILL, 5,5);
-+
-+ v1_tracknum_entry = gtk_entry_new_with_max_length(3);
-+ gtk_widget_set_usize(v1_tracknum_entry, 20, -1);
-+ gtk_table_attach(GTK_TABLE(table), v1_tracknum_entry, 4, 5, 0, 1,
-+ GTK_FILL, GTK_FILL, 0, 2);
-+
-+ label = gtk_label_new("Title:");
-+ g_ptr_array_add(v1_labels_list, (gpointer)label);
-+ 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);
-+
-+ v1_title_entry = gtk_entry_new_with_max_length(30);
-+ gtk_table_attach(GTK_TABLE(table), v1_title_entry, 1, 5, 1, 2,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Artist:");
-+ g_ptr_array_add(v1_labels_list, (gpointer)label);
-+ 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);
-+
-+ v1_artist_entry = gtk_entry_new_with_max_length(30);
-+ gtk_table_attach(GTK_TABLE(table), v1_artist_entry, 1, 5, 2, 3,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Album:");
-+ g_ptr_array_add(v1_labels_list, (gpointer)label);
-+ 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);
-+
-+ v1_album_entry = gtk_entry_new_with_max_length(30);
-+ gtk_table_attach(GTK_TABLE(table), v1_album_entry, 1, 5, 3, 4,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Comment:");
-+ g_ptr_array_add(v1_labels_list, (gpointer)label);
-+ 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);
-+
-+ v1_comment_entry = gtk_entry_new_with_max_length(30);
-+ gtk_table_attach(GTK_TABLE(table), v1_comment_entry, 1, 5, 4, 5,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Year:");
-+ g_ptr_array_add(v1_labels_list, (gpointer)label);
-+ 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);
-+
-+ v1_year_entry = gtk_entry_new_with_max_length(4);
-+ gtk_widget_set_usize(v1_year_entry, 45, -1);
-+ gtk_table_attach(GTK_TABLE(table), v1_year_entry, 1, 2, 5, 6,
-+ GTK_FILL, GTK_FILL, 0, 2);
-+
-+ label = gtk_label_new("Genre:");
-+ g_ptr_array_add(v1_labels_list, (gpointer)label);
-+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
-+ gtk_table_attach(GTK_TABLE(table), label, 2, 3, 5, 6,
-+ GTK_FILL, GTK_FILL, 5, 5);
-+
-+ v1_genre_combo = gtk_combo_new();
-+ gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(v1_genre_combo)->entry),
-+ FALSE);
- if (!genre_list)
- {
- struct genre_item *item;
-@@ -408,77 +584,278 @@
- genre_list = g_list_prepend(genre_list, item);
- genre_list = g_list_sort(genre_list, genre_comp_func);
- }
-- genre_set_popdown(genre_combo, genre_list);
-- gtk_signal_connect(GTK_OBJECT(GTK_COMBO(genre_combo)->list),
-- "select-child", genre_selected, NULL);
--
-- 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_button_box_set_layout(GTK_BUTTON_BOX(bbox),
-- GTK_BUTTONBOX_END);
-- gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
-- gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0);
--
-- save = gtk_button_new_with_label(_("Save"));
-- gtk_signal_connect(GTK_OBJECT(save), "clicked", save_cb, NULL);
-- GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT);
-- gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 0);
-- gtk_widget_grab_default(save);
--
-- remove_id3 = gtk_button_new_with_label(_("Remove ID3"));
-- gtk_signal_connect(GTK_OBJECT(remove_id3), "clicked",
-- remove_id3_cb, NULL);
-- GTK_WIDGET_SET_FLAGS(remove_id3, GTK_CAN_DEFAULT);
-- gtk_box_pack_start(GTK_BOX(bbox), remove_id3, TRUE, TRUE, 0);
--
-- cancel = gtk_button_new_with_label(_("Cancel"));
-- gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked",
-- gtk_widget_destroy, GTK_OBJECT(window));
-- GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
-- gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
--
-- mpeg_frame = gtk_frame_new(_("MPEG Info:"));
-- gtk_box_pack_start(GTK_BOX(hbox), mpeg_frame, FALSE, FALSE, 0);
--
-- 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_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);
-+ genre_set_popdown(v1_genre_combo, genre_list);
-+ gtk_signal_connect(GTK_OBJECT(GTK_COMBO(v1_genre_combo)->list),
-+ "select-child", v1_genre_selected, NULL);
-+
-+ gtk_table_attach(GTK_TABLE(table), v1_genre_combo, 3, 5, 5, 6,
-+ GTK_FILL | GTK_SHRINK, GTK_FILL |
-+ GTK_SHRINK, 0, 2);
-+
-+ bbox = gtk_hbutton_box_new();
-+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
-+ gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0);
-+ gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
-+ gtk_box_pack_start(GTK_BOX(id3v1_frame_vbox), bbox, FALSE, FALSE, 0);
-+
-+ copy_from = gtk_button_new_with_label("ID3v1 to ID3v2");
-+ gtk_signal_connect(GTK_OBJECT(copy_from), "clicked", GTK_SIGNAL_FUNC(copy_v1_to_v2_cb), NULL);
-+ // remove the next line to thicken the button width
-+ GTK_WIDGET_SET_FLAGS(copy_from, GTK_CAN_DEFAULT);
-+ gtk_box_pack_start(GTK_BOX(bbox), copy_from, FALSE, TRUE, 0);
-+
-+
-+ notebook = gtk_notebook_new ();
-+ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
-+
-+ label = gtk_label_new ("ID3v1");
-+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), id3v1_vbox, label);
-+
-+
-+ ////////////////////////////////////////////////////////////////////////////////////////////////////
-+ ////////////////////////////////////////////////////////////////////////////////////////////////////
-+
-+ id3v2_vbox = gtk_vbox_new(FALSE, 0);
-+
-+ id3v2_frame = gtk_frame_new("ID3v2 Information");
-+ gtk_box_pack_start(GTK_BOX(id3v2_vbox), id3v2_frame, FALSE, FALSE, 0);
-+
-+ id3v2_frame_vbox = gtk_vbox_new(FALSE, 0);
-+ gtk_container_add(GTK_CONTAINER(id3v2_frame), id3v2_frame_vbox);
-+
-+ table = gtk_table_new(6, 6, FALSE);
-+ gtk_container_set_border_width(GTK_CONTAINER(table), 5);
-+ gtk_widget_set_usize(GTK_WIDGET(table), 400, -1);
-+ //gtk_container_add(GTK_CONTAINER(id3v2_frame), table);
-+ gtk_box_pack_start(GTK_BOX(id3v2_frame_vbox), table, FALSE, FALSE, 0);
-+
-+ v2_checkbox = gtk_check_button_new_with_label ("Disable ID3v2 Tag");
-+ gtk_signal_connect(GTK_OBJECT(v2_checkbox), "toggled", GTK_SIGNAL_FUNC(v2_toggle_cb), NULL);
-+ gtk_table_attach(GTK_TABLE(table), v2_checkbox, 1, 3, 0, 1,
-+ GTK_FILL, GTK_FILL, 0, 2);
-+
-+ label = gtk_label_new("Track number:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
-+ gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1,
-+ GTK_FILL, GTK_FILL, 5,5);
-+
-+ v2_tracknum_entry = gtk_entry_new_with_max_length(3);
-+ gtk_widget_set_usize(v2_tracknum_entry, 20, -1);
-+ gtk_table_attach(GTK_TABLE(table), v2_tracknum_entry, 4, 5, 0, 1,
-+ GTK_FILL, GTK_FILL, 0, 2);
-+
-+ label = gtk_label_new("Title:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_title_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_title_entry, 1, 5, 1, 2,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Artist:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_artist_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_artist_entry, 1, 5, 2, 3,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Album:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_album_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_album_entry, 1, 5, 3, 4,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Comment:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_comment_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_comment_entry, 1, 5, 4, 5,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Year:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_year_entry = gtk_entry_new_with_max_length(4);
-+ gtk_widget_set_usize(v2_year_entry, 45, -1);
-+ gtk_table_attach(GTK_TABLE(table), v2_year_entry, 1, 2, 5, 6,
-+ GTK_FILL, GTK_FILL, 0, 2);
-+
-+ label = gtk_label_new("Genre:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
-+ gtk_table_attach(GTK_TABLE(table), label, 2, 3, 5, 6,
-+ GTK_FILL, GTK_FILL, 5, 5);
-+
-+ v2_genre_combo = gtk_combo_new();
-+ gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(v2_genre_combo)->entry), FALSE);
-+ genre_set_popdown(v2_genre_combo, genre_list);
-+ gtk_signal_connect(GTK_OBJECT(GTK_COMBO(v2_genre_combo)->list),
-+ "select-child", v2_genre_selected, NULL);
-+
-+ gtk_table_attach(GTK_TABLE(table), v2_genre_combo, 3, 5, 5, 6,
-+ GTK_FILL | GTK_SHRINK, GTK_FILL |
-+ GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Composer:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_composer_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_composer_entry, 1, 5, 6, 7,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("Orig. Artist:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_orig_artist_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_orig_artist_entry, 1, 5, 7, 8,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ label = gtk_label_new("URL:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_url_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_url_entry, 1, 5, 8, 9,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+ label = gtk_label_new("Encoded By:");
-+ g_ptr_array_add(v2_labels_list, (gpointer)label);
-+ 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);
-+
-+ v2_encoded_by_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2);
-+ gtk_table_attach(GTK_TABLE(table), v2_encoded_by_entry, 1, 5, 9, 10,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK,
-+ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2);
-+
-+ bbox = gtk_hbutton_box_new();
-+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START);
-+ gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0);
-+ gtk_container_set_border_width(GTK_CONTAINER(bbox), 5);
-+ gtk_box_pack_start(GTK_BOX(id3v2_frame_vbox), bbox, FALSE, FALSE, 0);
-+
-+ copy_to = gtk_button_new_with_label("ID3v2 to ID3v1");
-+ gtk_signal_connect(GTK_OBJECT(copy_to), "clicked", GTK_SIGNAL_FUNC(copy_v2_to_v1_cb), NULL);
-+ // remove the next line to thicken the button width
-+ GTK_WIDGET_SET_FLAGS(copy_to, GTK_CAN_DEFAULT);
-+ gtk_box_pack_start(GTK_BOX(bbox), copy_to, FALSE, TRUE, 0);
-+
-+ label = gtk_label_new ("ID3v2");
-+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), id3v2_vbox, label);
-+
-+
-+ ////////////////////////////////////////////////////////////////////////////////////////////////////
-+ ////////////////////////////////////////////////////////////////////////////////////////////////////
-+
-+ mpeg_frame = gtk_frame_new("MPEG Information");
-+ mpeg_hbox = gtk_hbox_new(FALSE,50);
-+ gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_hbox);
-+
-+ mpeg_lvbox = gtk_vbox_new(FALSE, 5);
-+ gtk_container_set_border_width(GTK_CONTAINER(mpeg_lvbox), 10);
-+ gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_lvbox, FALSE, FALSE, 0);
-+
-+ //gtk_container_set_border_width(GTK_CONTAINER(table), 5);
-+ //gtk_widget_set_usize(GTK_WIDGET(table), 325, -1);
-+ //gtk_container_add(GTK_CONTAINER(mpeg_frame), table);
-+
-+ mpeg_box = gtk_vbox_new(FALSE, 5);
-+ gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_box, FALSE, FALSE, 0);
-+ 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_label_set_justify (GTK_LABEL(mpeg_level), GTK_JUSTIFY_LEFT);
-+ gtk_misc_set_alignment(GTK_MISC(mpeg_level), 0, 0.5);
-+ gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_level, FALSE, FALSE, 0);
-+
-+ mpeg_samplerate = gtk_label_new("");
-+ gtk_label_set_justify (GTK_LABEL(mpeg_samplerate), GTK_JUSTIFY_LEFT);
-+ gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 0, 0.5);
-+ gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_samplerate, FALSE, FALSE, 0);
-+
-+ mpeg_fileinfo = gtk_label_new("");
-+ gtk_label_set_justify (GTK_LABEL(mpeg_fileinfo), GTK_JUSTIFY_LEFT);
-+ gtk_misc_set_alignment(GTK_MISC(mpeg_fileinfo), 0, 0.5);
-+ gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_fileinfo, FALSE, FALSE, 0);
-+
-+ mpeg_rvbox = gtk_vbox_new(FALSE, 5);
-+ gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_rvbox, FALSE, FALSE, 0);
-+ gtk_container_set_border_width(GTK_CONTAINER(mpeg_rvbox), 10);
-+
-+ mpeg_bitrate = gtk_label_new("");
-+ gtk_label_set_justify (GTK_LABEL(mpeg_bitrate), GTK_JUSTIFY_LEFT);
-+ gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 0, 0.5);
-+ gtk_box_pack_start(GTK_BOX(mpeg_rvbox), mpeg_bitrate, FALSE, FALSE, 0);
-+
-+ mpeg_flags = gtk_label_new("");
-+ gtk_label_set_justify (GTK_LABEL(mpeg_flags), GTK_JUSTIFY_LEFT);
-+ gtk_misc_set_alignment(GTK_MISC(mpeg_flags), 0, 0.5);
-+ gtk_box_pack_start(GTK_BOX(mpeg_rvbox), mpeg_flags, FALSE, FALSE, 0);
-+
-+ label = gtk_label_new ("MPEG");
-+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), mpeg_frame, label);
-+
-+ //////////////////////////////////////////////////////////////////
-+ //////////////////////////////////////////////////////////////////
-+
-+ // add notebook to window vbox
-+ gtk_box_pack_start(GTK_BOX(window_vbox), notebook, FALSE, FALSE, 0);
-+
-+ // add button box to window vbox
-+ bbox = gtk_hbutton_box_new();
-+ gtk_box_pack_start(GTK_BOX(window_vbox), bbox, FALSE, FALSE, 0);
-+
-+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
-+ gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 5);
-+ //gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);
-+
-+ save = gtk_button_new_with_label("Save");
-+ gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_cb), NULL);
-+ //GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT);
-+ gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 5);
-+ //gtk_widget_grab_default(save);
-+
-+ close = gtk_button_new_with_label("Close");
-+ gtk_signal_connect_object(GTK_OBJECT(close), "clicked",
-+ GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window));
-+ //GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT);
-+ gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5);
-
-- gtk_widget_show_all(window);
-+ gtk_container_add(GTK_CONTAINER(window), window_vbox);
-+ gtk_widget_show_all(window);
- }
-
- if (current_filename)
-@@ -495,29 +872,43 @@
- title = g_strdup(g_basename(filename));
- if ((tmp = strrchr(title, '.')) != NULL)
- *tmp = '\0';
-- gtk_entry_set_text(GTK_ENTRY(title_entry), title);
-+ gtk_entry_set_text(GTK_ENTRY(v1_title_entry), title);
-+ gtk_entry_set_text(GTK_ENTRY(v2_title_entry), title);
- g_free(title);
-
-- gtk_entry_set_text(GTK_ENTRY(artist_entry), "");
-- gtk_entry_set_text(GTK_ENTRY(album_entry), "");
-- gtk_entry_set_text(GTK_ENTRY(year_entry), "");
-- gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
-- gtk_entry_set_text(GTK_ENTRY(comment_entry), "");
-- gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list),
-+ gtk_entry_set_text(GTK_ENTRY(v1_artist_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v1_album_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v1_year_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v1_comment_entry), "");
-+ gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list),
-+ genre_find_index(genre_list, 0xff));
-+
-+ gtk_entry_set_text(GTK_ENTRY(v2_artist_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_album_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_year_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_tracknum_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_comment_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_composer_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_orig_artist_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_url_entry), "");
-+ gtk_entry_set_text(GTK_ENTRY(v2_encoded_by_entry), "");
-+ gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list),
- genre_find_index(genre_list, 0xff));
-+
- gtk_label_set_text(GTK_LABEL(mpeg_level), "MPEG ?, layer ?");
- gtk_label_set_text(GTK_LABEL(mpeg_bitrate), "");
- gtk_label_set_text(GTK_LABEL(mpeg_samplerate), "");
- gtk_label_set_text(GTK_LABEL(mpeg_flags), "");
- gtk_label_set_text(GTK_LABEL(mpeg_fileinfo), "");
--
- if (!strncasecmp(filename, "http://", 7))
- {
- file_info_http(filename);
- return;
- }
-
-- gtk_widget_set_sensitive(id3_frame, TRUE);
-+ gtk_widget_set_sensitive(id3v1_frame, TRUE);
-+ gtk_widget_set_sensitive(id3v2_frame, TRUE);
-
- if ((fh = fopen(current_filename, "rb")) != NULL)
- {
-@@ -525,40 +916,95 @@
- unsigned char tmp[4];
- struct frame frm;
- gboolean id3_found = FALSE;
-+ char *temp = NULL;
-+ struct id3_tag *id3 = NULL;
-
-- fseek(fh, -sizeof (tag), SEEK_END);
-- if (fread(&tag, 1, sizeof (tag), fh) == sizeof (tag))
-+ /*
-+ * Try reading ID3v2 tag.
-+ */
-+ if (!mpg123_cfg.disable_id3v2)
- {
-- if (!strncmp(tag.tag, "TAG", 3))
-+ fseek(fh, 0, SEEK_SET);
-+ id3 = id3_open_fp(fh, 0);
-+ if (id3)
- {
-- id3_found = TRUE;
-- set_entry_tag(GTK_ENTRY(title_entry),
-- tag.title, 30);
-- set_entry_tag(GTK_ENTRY(artist_entry),
-- tag.artist, 30);
-- set_entry_tag(GTK_ENTRY(album_entry),
-- tag.album, 30);
-- set_entry_tag(GTK_ENTRY(year_entry),
-- tag.year, 4);
-- /* Check for v1.1 tags */
-- if (tag.u.v1_1.__zero == 0)
-- {
-- char *temp = g_strdup_printf("%d", tag.u.v1_1.track_number);
-- set_entry_tag(GTK_ENTRY(comment_entry),
-- tag.u.v1_1.comment, 28);
-- gtk_entry_set_text(GTK_ENTRY(tracknum_entry), temp);
-- g_free(temp);
-- }
-- else
-- {
-- set_entry_tag(GTK_ENTRY(comment_entry),
-- tag.u.v1_0.comment, 30);
-- gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
-- }
-+ mpg123_get_id3v2(id3, &id3v2tag);
-+ set_entry_tag(GTK_ENTRY(v2_title_entry),
-+ id3v2tag.title, 128);
-+ set_entry_tag(GTK_ENTRY(v2_artist_entry),
-+ id3v2tag.artist, 128);
-+ set_entry_tag(GTK_ENTRY(v2_album_entry),
-+ id3v2tag.album, 128);
-+ set_entry_tag(GTK_ENTRY(v2_comment_entry),
-+ id3v2tag.comment, 256);
-+ set_entry_tag(GTK_ENTRY(v2_composer_entry),
-+ id3v2tag.composer, MAX_ENTRY_LEN2);
-+ set_entry_tag(GTK_ENTRY(v2_orig_artist_entry),
-+ id3v2tag.orig_artist, MAX_ENTRY_LEN2);
-+ set_entry_tag(GTK_ENTRY(v2_url_entry),
-+ id3v2tag.url, MAX_ENTRY_LEN2);
-+ set_entry_tag(GTK_ENTRY(v2_encoded_by_entry),
-+ id3v2tag.encoded_by, MAX_ENTRY_LEN2);
-
-- gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list), genre_find_index(genre_list, tag.genre));
-+ temp = g_strdup_printf("%d", id3v2tag.track_number);
-+ gtk_entry_set_text(GTK_ENTRY(v2_tracknum_entry), temp);
-+ g_free(temp);
-+
-+ temp = g_strdup_printf("%d", id3v2tag.year);
-+ gtk_entry_set_text(GTK_ENTRY(v2_year_entry), temp);
-+ g_free(temp);
-+
-+ printf("Loading genre: %s", id3v2tag.genre);
-+ gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), genre_find_index_str(genre_list, id3v2tag.genre));
-+ id3_close(id3);
- }
-+ else
-+ {
-+ // Grey out the id3v2 tab
-+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(v2_checkbox), TRUE);
-+ }
-+ }
-+
-+ /*
-+ * Try reading ID3v1 tag.
-+ */
-+ fseek(fh, -sizeof (id3v1tag), SEEK_END);
-+ if ( (fread(&id3v1tag, 1, sizeof (id3v1tag), fh) == sizeof (id3v1tag)) &&
-+ !strncmp(id3v1tag.tag, "TAG", 3))
-+ {
-+ id3_found = TRUE;
-+ set_entry_tag(GTK_ENTRY(v1_title_entry),
-+ id3v1tag.title, 30);
-+ set_entry_tag(GTK_ENTRY(v1_artist_entry),
-+ id3v1tag.artist, 30);
-+ set_entry_tag(GTK_ENTRY(v1_album_entry),
-+ id3v1tag.album, 30);
-+ set_entry_tag(GTK_ENTRY(v1_year_entry),
-+ id3v1tag.year, 4);
-+ /* Check for v1.1 tags */
-+ if (id3v1tag.u.v1_1.__zero == 0)
-+ {
-+ char *temp = g_strdup_printf("%d", id3v1tag.u.v1_1.track_number);
-+ set_entry_tag(GTK_ENTRY(v1_comment_entry),
-+ id3v1tag.u.v1_1.comment, 28);
-+ gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), temp);
-+ g_free(temp);
-+ }
-+ else
-+ {
-+ set_entry_tag(GTK_ENTRY(v1_comment_entry),
-+ id3v1tag.u.v1_0.comment, 30);
-+ gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), "");
-+ }
-+
-+ gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), genre_find_index(genre_list, id3v1tag.genre));
- }
-+ else
-+ {
-+ // Grey out id3v1 tab
-+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(v1_checkbox), TRUE);
-+ }
-+
- rewind(fh);
- if (fread(tmp, 1, 4, fh) != 4)
- {
-diff -Naur xmms-1.2.9-orig/Input/mpg123/id3.h xmms-1.2.9/Input/mpg123/id3.h
---- xmms-1.2.9-orig/Input/mpg123/id3.h Thu Jan 29 06:43:24 2004
-+++ xmms-1.2.9/Input/mpg123/id3.h Thu Jan 29 05:20:31 2004
-@@ -351,6 +351,7 @@
- int id3_set_text(struct id3_frame *, char *);
- int id3_set_text_number(struct id3_frame *, int);
- gboolean id3_frame_is_text(struct id3_frame *frame);
-+char* id3_get_comm(struct id3_frame *frame);
-
- /* From id3_frame_content.c */
- char *id3_get_content(struct id3_frame *);
-diff -Naur xmms-1.2.9-orig/Input/mpg123/id3_frame_text.c xmms-1.2.9/Input/mpg123/id3_frame_text.c
---- xmms-1.2.9-orig/Input/mpg123/id3_frame_text.c Thu Jan 29 06:43:24 2004
-+++ xmms-1.2.9/Input/mpg123/id3_frame_text.c Thu Jan 29 05:18:54 2004
-@@ -38,15 +38,15 @@
-
- char *id3_utf16_to_ascii(void *utf16)
- {
-- char ascii[256];
-- char *uc = (char *) utf16 + 2;
-- int i;
--
-- for (i = 0; *uc != 0 && i < sizeof(ascii); i++, uc += 2)
-- ascii[i] = *uc;
--
-- ascii[i] = 0;
-- return g_strdup(ascii);
-+ char ascii[256];
-+ char *uc = (char *) utf16 + 2;
-+ int i;
-+
-+ for (i = 0; *uc != 0 && i < sizeof(ascii); i++, uc += 2)
-+ ascii[i] = *uc;
-+
-+ ascii[i] = 0;
-+ return g_strdup(ascii);
- }
-
-
-@@ -59,25 +59,25 @@
- */
- gint8 id3_get_encoding(struct id3_frame *frame)
- {
-- /* Type check */
-- if (!id3_frame_is_text(frame) &&
-- frame->fr_desc->fd_id != ID3_WXXX &&
-- frame->fr_desc->fd_id != ID3_IPLS &&
-- frame->fr_desc->fd_id != ID3_USLT &&
-- frame->fr_desc->fd_id != ID3_SYLT &&
-- frame->fr_desc->fd_id != ID3_COMM &&
-- frame->fr_desc->fd_id != ID3_APIC &&
-- frame->fr_desc->fd_id != ID3_GEOB &&
-- frame->fr_desc->fd_id != ID3_USER &&
-- frame->fr_desc->fd_id != ID3_OWNE &&
-- frame->fr_desc->fd_id != ID3_COMR)
-- return -1;
--
-- /* Check if frame is compressed */
-- if (id3_decompress_frame(frame) == -1)
-- return -1;
-+ /* Type check */
-+ if (!id3_frame_is_text(frame) &&
-+ frame->fr_desc->fd_id != ID3_WXXX &&
-+ frame->fr_desc->fd_id != ID3_IPLS &&
-+ frame->fr_desc->fd_id != ID3_USLT &&
-+ frame->fr_desc->fd_id != ID3_SYLT &&
-+ frame->fr_desc->fd_id != ID3_COMM &&
-+ frame->fr_desc->fd_id != ID3_APIC &&
-+ frame->fr_desc->fd_id != ID3_GEOB &&
-+ frame->fr_desc->fd_id != ID3_USER &&
-+ frame->fr_desc->fd_id != ID3_OWNE &&
-+ frame->fr_desc->fd_id != ID3_COMR)
-+ return -1;
-+
-+ /* Check if frame is compressed */
-+ if (id3_decompress_frame(frame) == -1)
-+ return -1;
-
-- return *(gint8 *) frame->fr_data;
-+ return *(gint8 *) frame->fr_data;
- }
-
-
-@@ -92,25 +92,25 @@
- {
- /* Type check */
- if ( frame->fr_desc->fd_idstr[0] != 'T' &&
-- frame->fr_desc->fd_id != ID3_WXXX &&
-- frame->fr_desc->fd_id != ID3_IPLS &&
-- frame->fr_desc->fd_id != ID3_USLT &&
-- frame->fr_desc->fd_id != ID3_SYLT &&
-- frame->fr_desc->fd_id != ID3_COMM &&
-- frame->fr_desc->fd_id != ID3_APIC &&
-- frame->fr_desc->fd_id != ID3_GEOB &&
-- frame->fr_desc->fd_id != ID3_USER &&
-- frame->fr_desc->fd_id != ID3_OWNE &&
-- frame->fr_desc->fd_id != ID3_COMR )
-- return -1;
-+ frame->fr_desc->fd_id != ID3_WXXX &&
-+ frame->fr_desc->fd_id != ID3_IPLS &&
-+ frame->fr_desc->fd_id != ID3_USLT &&
-+ frame->fr_desc->fd_id != ID3_SYLT &&
-+ frame->fr_desc->fd_id != ID3_COMM &&
-+ frame->fr_desc->fd_id != ID3_APIC &&
-+ frame->fr_desc->fd_id != ID3_GEOB &&
-+ frame->fr_desc->fd_id != ID3_USER &&
-+ frame->fr_desc->fd_id != ID3_OWNE &&
-+ frame->fr_desc->fd_id != ID3_COMR )
-+ return -1;
-
- /* Check if frame is compressed */
- if (id3_decompress_frame(frame) == -1)
-- return -1;
-+ return -1;
-
- /* Changing the encoding of frames is not supported yet */
- if ( *(gint8 *) frame->fr_data != encoding )
-- return -1;
-+ return -1;
-
- /* Set encoding */
- *(gint8 *) frame->fr_data = encoding;
-@@ -128,44 +128,44 @@
- {
- /* Type check */
- if ( frame->fr_desc->fd_idstr[0] != 'T' )
-- return NULL;
-+ return NULL;
-
- /* Check if frame is compressed */
- if (id3_decompress_frame(frame) == -1)
-- return NULL;
-+ return NULL;
-
- if ( frame->fr_desc->fd_id == ID3_TXXX ) {
-- /*
-- * This is a user defined text frame. Skip the description.
-- */
-- switch ( *(guint8 *) frame->fr_data ) {
-- case ID3_ENCODING_ISO_8859_1:
-- {
-- char *text = (char *) frame->fr_data + 1;
--
-- while ( *text != 0 )
-- text++;
--
-- return g_strdup(++text);
-- }
-- case ID3_ENCODING_UTF16:
-- {
-- char *text16 = (char *) frame->fr_data + 1;
--
-- while (*text16 != 0 || *(text16 + 1) != 0)
-- text16 += 2;
--
-- return id3_utf16_to_ascii(text16 + 2);
-- }
-- default:
-- return NULL;
-- }
-+ /*
-+ * This is a user defined text frame. Skip the description.
-+ */
-+ switch ( *(guint8 *) frame->fr_data ) {
-+ case ID3_ENCODING_ISO_8859_1:
-+ {
-+ char *text = (char *) frame->fr_data + 1;
-+
-+ while ( *text != 0 )
-+ text++;
-+
-+ return g_strdup(++text);
-+ }
-+ case ID3_ENCODING_UTF16:
-+ {
-+ char *text16 = (char *) frame->fr_data + 1;
-+
-+ while (*text16 != 0 || *(text16 + 1) != 0)
-+ text16 += 2;
-+
-+ return id3_utf16_to_ascii(text16 + 2);
-+ }
-+ default:
-+ return NULL;
-+ }
- }
-
- if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1)
-- return g_strdup((char *) frame->fr_data + 1);
-+ return g_strdup((char *) frame->fr_data + 1);
- else
-- return id3_utf16_to_ascii(((char *) frame->fr_data + 1));
-+ return id3_utf16_to_ascii(((char *) frame->fr_data + 1));
- }
-
-
-@@ -179,20 +179,20 @@
- {
- /* Type check */
- if ( frame->fr_desc->fd_idstr[0] != 'T' )
-- return NULL;
-+ return NULL;
-
- /* If predefined text frame, return description. */
- if ( frame->fr_desc->fd_id != ID3_TXXX )
-- return frame->fr_desc->fd_description;
-+ return frame->fr_desc->fd_description;
-
- /* Check if frame is compressed */
- if (id3_decompress_frame(frame) == -1)
-- return NULL;
-+ return NULL;
-
- if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1)
-- return g_strdup((char *) frame->fr_data + 1);
-+ return g_strdup((char *) frame->fr_data + 1);
- else
-- return id3_utf16_to_ascii((char *) frame->fr_data + 1);
-+ return id3_utf16_to_ascii((char *) frame->fr_data + 1);
- }
-
-
-@@ -209,42 +209,42 @@
-
- /* Check if frame is compressed */
- if (id3_decompress_frame(frame) == -1)
-- return -1;
-+ return -1;
-
- /*
- * Generate integer according to encoding.
- */
- switch ( *(guint8 *) frame->fr_data ) {
-- case ID3_ENCODING_ISO_8859_1:
-- {
-- char *text = ((char *) frame->fr_data) + 1;
--
-- while ( *text >= '0' && *text <= '9' ) {
-- number *= 10;
-- number += *text - '0';
-- text++;
-- }
-+ case ID3_ENCODING_ISO_8859_1:
-+ {
-+ char *text = ((char *) frame->fr_data) + 1;
-+
-+ while ( *text >= '0' && *text <= '9' ) {
-+ number *= 10;
-+ number += *text - '0';
-+ text++;
-+ }
-+
-+ return number;
-+ }
-+ case ID3_ENCODING_UTF16:
-+ {
-+ char *text = ((char *) frame->fr_data) + 3;
-+
-+/* if (*(gint16 *) frame->fr_data == 0xfeff) */
-+/* text++; */
-+
-+ while ( *text >= '0' && *text <= '9' ) {
-+ number *= 10;
-+ number += *text - '0';
-+ text++;
-+ }
-
-- return number;
-- }
-- case ID3_ENCODING_UTF16:
-- {
-- char *text = ((char *) frame->fr_data) + 3;
--
--/* if (*(gint16 *) frame->fr_data == 0xfeff) */
--/* text++; */
--
-- while ( *text >= '0' && *text <= '9' ) {
-- number *= 10;
-- number += *text - '0';
-- text++;
-- }
-+ return number;
-+ }
-
-- return number;
-- }
--
-- default:
-- return -1;
-+ default:
-+ return -1;
- }
- }
-
-@@ -260,7 +260,7 @@
- {
- /* Type check */
- if ( frame->fr_desc->fd_idstr[0] != 'T' )
-- return -1;
-+ return -1;
-
- /*
- * Release memory occupied by previous data.
-@@ -289,6 +289,58 @@
- }
-
-
-+
-+
-+char* id3_get_comm(struct id3_frame *frame)
-+{
-+
-+ /* Type check */
-+ if ( frame->fr_desc->fd_id != ID3_COMM )
-+ return NULL;
-+
-+ /* Check if frame is compressed */
-+ if (id3_decompress_frame(frame) == -1)
-+ return NULL;
-+
-+ /*
-+ * <Header for 'Comment', ID: "COMM">
-+ * Text encoding $xx
-+ * Language $xx xx xx
-+ * Short content descrip. <text string according to encoding> $00 (00)
-+ * The actual text <full text string according to encoding>
-+ *
-+ * Skip language and short description.
-+ */
-+ switch ( *(guint8 *) frame->fr_data ) {
-+ case ID3_ENCODING_ISO_8859_1:
-+ {
-+ char *text = (char *) frame->fr_data + 4;
-+
-+ while ( *text != 0 )
-+ text++;
-+
-+ return g_strdup(++text);
-+ }
-+ case ID3_ENCODING_UTF16:
-+ {
-+ char *text16 = (char *) frame->fr_data + 4;
-+
-+ while (*text16 != 0 || *(text16 + 1) != 0)
-+ text16 += 2;
-+
-+ return id3_utf16_to_ascii(text16 + 2);
-+ }
-+ default:
-+ return NULL;
-+ }
-+
-+ if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1)
-+ return g_strdup((char *) frame->fr_data + 1);
-+ else
-+ return id3_utf16_to_ascii(((char *) frame->fr_data + 1));
-+}
-+
-+
- /*
- * Function id3_set_text_number (frame, number)
- *
-@@ -304,25 +356,25 @@
-
- /* Type check */
- if ( frame->fr_desc->fd_idstr[0] != 'T' )
-- return -1;
-+ return -1;
-
- /*
- * Release memory occupied by previous data.
- */
- id3_frame_clear_data(frame);
--
-+
- /*
- * Create a string with a reversed number.
- */
- pos = 0;
- while ( number > 0 && pos < 64 ) {
-- buf[pos++] = (number % 10) + '0';
-- number /= 10;
-+ buf[pos++] = (number % 10) + '0';
-+ number /= 10;
- }
- if ( pos == 64 )
-- return -1;
-+ return -1;
- if ( pos == 0 )
-- buf[pos++] = '0';
-+ buf[pos++] = '0';
-
- /*
- * Allocate memory for new data.
-@@ -336,7 +388,7 @@
- *(gint8 *) frame->fr_raw_data = ID3_ENCODING_ISO_8859_1;
- text = (char *) frame->fr_raw_data + 1;
- while ( --pos >= 0 )
-- *text++ = buf[pos];
-+ *text++ = buf[pos];
- *text = '\0';
-
- frame->fr_altered = 1;
-@@ -350,9 +402,9 @@
-
- gboolean id3_frame_is_text(struct id3_frame *frame)
- {
-- if (frame && frame->fr_desc &&
-- (frame->fr_desc->fd_idstr[0] == 'T' ||
-- frame->fr_desc->fd_idstr[0] == 'W' ))
-- return TRUE;
-- return FALSE;
-+ if (frame && frame->fr_desc &&
-+ (frame->fr_desc->fd_idstr[0] == 'T' ||
-+ frame->fr_desc->fd_idstr[0] == 'W' ))
-+ return TRUE;
-+ return FALSE;
- }
-diff -Naur xmms-1.2.9-orig/Input/mpg123/lib_id3v2.h xmms-1.2.9/Input/mpg123/lib_id3v2.h
---- xmms-1.2.9-orig/Input/mpg123/lib_id3v2.h Wed Dec 31 19:00:00 1969
-+++ xmms-1.2.9/Input/mpg123/lib_id3v2.h Thu Jan 29 05:20:31 2004
-@@ -0,0 +1,1280 @@
-+/* the id3v2.3 library.
-+ * (c)2002 by Samuel Abels (sam@manicsadness.com)
-+ * This project's homepage is: http://software.manicsadness.com/cantus
-+ *
-+ * This library is designed for easyest possible access to id3 V2 tags.
-+ *
-+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#ifndef DLL_H
-+#define DLL_H
-+typedef struct DLL_s
-+{
-+ void *prev;
-+ void *data;
-+ void *next;
-+} DLL;
-+#endif
-+
-+#ifndef FALSE
-+#define FALSE 0
-+#endif
-+#ifndef TRUE
-+#define TRUE 1
-+#endif
-+
-+#ifndef id3Tag_def
-+#define id3Tag_def
-+
-+typedef struct id3Tag_s
-+{
-+ char title[1024];
-+ char artist[1024];
-+ char album[1024];
-+ char year[5];
-+ char comment[1024];
-+ char track[3];
-+ char genre[512];
-+ char composer[1024];
-+ char url[1024];
-+ char orig_artist[1024];
-+ char enc_by[1024];
-+ unsigned int size;
-+ short int has_footer;
-+} id3Tag;
-+
-+typedef struct id3v2Tag_s
-+{
-+// header
-+ int tag_size;
-+ short int unsync;
-+ short int has_extheader;
-+ short int is_experimental;
-+//extheader
-+ int extheader_size;
-+ int padding_size;
-+ short int crc_data_present;
-+ char crc_data[4];
-+// frames
-+ DLL *frames;
-+} id3v2Tag;
-+
-+typedef struct id3v2Frame_s
-+{
-+ unsigned char id[4];
-+ int datasize;
-+ short int tagalter;
-+ short int filealter;
-+ short int readonly;
-+ short int compression;
-+ short int encryption;
-+ short int grouping;
-+ char *data;
-+} id3v2Frame;
-+
-+#endif
-+
-+/* the id3v2.3 library.
-+ * (c)2002 by Samuel Abels (sam@manicsadness.com)
-+ * This project's homepage is: http://software.manicsadness.com/cantus
-+ *
-+ * This library is designed for easyest possible access to id3 V2 tags.
-+ *
-+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <stdio.h>
-+#include <string.h>
-+#include <stdlib.h>
-+#include <ctype.h>
-+#include "charset.h"
-+
-+
-+
-+/***************************************************************************************
-+ * BELOW FOLLOW THE STATICS
-+ ***************************************************************************************/
-+// Return the last item of an doubly linked list
-+static DLL *
-+dll_last (DLL *list)
-+{
-+ if( list == NULL )
-+ return (NULL);
-+
-+ while ( list->next != NULL )
-+ list = list->next;
-+
-+ return (list);
-+}
-+
-+// Append an item to the doubly linked list
-+static DLL *
-+dll_append (DLL *list, void *data)
-+{
-+ DLL *item = malloc (sizeof(DLL));
-+ DLL *lastitem = dll_last(list);
-+
-+ item->data = data;
-+ item->next = NULL;
-+
-+ if ( lastitem == NULL )
-+ {
-+ item->prev = NULL;
-+ return (item);
-+ }
-+ else
-+ {
-+ item->prev = lastitem;
-+ lastitem->next = item;
-+ }
-+
-+ return list;
-+}
-+
-+static DLL *
-+dll_remove (DLL *list, void *data)
-+{
-+ DLL *item = list;
-+
-+ while ( item )
-+ {
-+ if ( item->data == data )
-+ {
-+ if ( item->prev == NULL
-+ && item->next == NULL )
-+ {
-+// No other items there? Then return a zero pointer.
-+ free (item);
-+ return (NULL);
-+ }
-+ if ( item->prev == NULL )
-+ {
-+// remove the first item of the list here...
-+ list = item->next;
-+ list->prev = NULL;
-+ free (item);
-+
-+ break;
-+ }
-+ if ( item->next == NULL )
-+ {
-+// ...remove the last item of the list here...
-+ ((DLL*)(item->prev))->next = NULL;
-+ free (item);
-+
-+ break;
-+ }
-+// ...or other items here
-+ ((DLL*)(item->prev))->next = item->next;
-+ ((DLL*)(item->next))->prev = item->prev;
-+ free (item);
-+
-+ break;
-+ }
-+ item = item->next;
-+ }
-+
-+ return list;
-+}
-+
-+// Free a doubly linked list
-+static DLL *
-+dll_free (DLL *list)
-+{
-+ DLL *item = list;
-+ DLL *current = NULL;
-+
-+ while (item)
-+ {
-+ current = item;
-+ item = item->next;
-+
-+ free (current);
-+ }
-+
-+ return NULL;
-+}
-+
-+/*
-+ * Converts all occurences of a CR/LF to LF
-+ */
-+static void
-+crlf2cr (char *source)
-+{
-+ char *psource = source;
-+ char destination[2048];
-+
-+ if(source != NULL)
-+ {
-+ memset (destination, 0, 2048);
-+ for (psource = source; *psource != '\0'; psource++)
-+ {
-+ if(*psource == 13
-+ && *(psource+1) == 10 )
-+ {
-+ psource++;
-+ }
-+ destination[strlen(destination)] = *psource;
-+ }
-+ }
-+
-+ strncpy (source, destination, strlen(destination)+1);
-+}
-+
-+
-+/*
-+ * Converts all occurences of a LF to CR/LF
-+ */
-+static void
-+cr2crlf (char *source)
-+{
-+ char *psource = source;
-+ char destination[2048];
-+
-+ if( source != NULL )
-+ {
-+ memset (destination, 0, 2048);
-+ for (psource = source; *psource != '\0'; psource++)
-+ {
-+ if (*psource == 10)
-+ destination[strlen(destination)] = 13;
-+ destination[strlen(destination)] = *psource;
-+ }
-+ }
-+
-+ strncpy (source, destination, strlen(destination)+1);
-+}
-+
-+
-+
-+
-+/*
-+ * Reads the first ten bytes of an file and checks, if it's a valid ID3 V2.3 file
-+ * If it is, the header flags are stored in the tag struct.
-+ * Returns TRUE on a valid header, otherwise FALSE.
-+ */
-+static short int
-+check_header (FILE *mp3file, id3v2Tag *v2)
-+{
-+ unsigned char buf[10];
-+
-+// get header (=first ten bytes of the file)
-+ fseek (mp3file, 0, SEEK_SET);
-+ if ( fread (buf, 1, 10, mp3file) < 10 )
-+ return (FALSE);
-+
-+// a valid tag must begin with "ID3" followed by the version (checked below)
-+// followed by a flag byte, where the last five bytes are unused and must be FALSE
-+ if ( memcmp(buf, "ID3", 3) != 0
-+ || (buf[5] & 31) != 0 )
-+ return (FALSE);
-+
-+// check if version is supported
-+ if ( buf[3] != 3
-+ || buf[4] != 0 )
-+ return (FALSE);
-+
-+// The next thing to come is the tag size. These are 4 bytes, the MSB should always be set to zero. check!
-+ if ( (buf[6] & 128) != 0
-+ || (buf[7] & 128) != 0
-+ || (buf[8] & 128) != 0
-+ || (buf[9] & 128) != 0 )
-+ return (FALSE);
-+
-+// The tag size is encoded to be syncsave, so I got to decode it.
-+// The tag size is the size of the complete tag EXCLUDING the 10-byte header.
-+ v2->tag_size = buf[9] + (buf[8] << 7) + (buf[7] << 14) + (buf[6] << 21);
-+
-+// ok, so were save. put the flags in the nicer struct.
-+ v2->unsync = (buf[5] & 128) >> 7;
-+ v2->has_extheader = (buf[5] & 64) >> 6;
-+ v2->is_experimental = (buf[5] & 32) >> 5;
-+
-+ return (TRUE);
-+}
-+
-+
-+
-+
-+
-+/*
-+ * Reads the extheader of a valid ID3V2.3 file and checks, if it's a valid.
-+ * If it is, the extheader flags are stored in the tag struct.
-+ * Returns TRUE on a valid extheader, otherwise FALSE.
-+ */
-+static short int
-+check_extheader (FILE *mp3file, id3v2Tag *v2)
-+{
-+ unsigned char buf[10];
-+
-+// Read id3 extheader intro (5 bytes)
-+ fseek (mp3file, 10, SEEK_SET);
-+ if ( fread(buf, 1, 5, mp3file) < 5 )
-+ return (FALSE);
-+
-+// First comes the extheader size. These are 4 bytes, the MSB should always be set to zero. check!
-+ if( (buf[0] & 128) != 0
-+ || (buf[1] & 128) != 0
-+ || (buf[2] & 128) != 0
-+ || (buf[3] & 128) != 0 )
-+ return (FALSE);
-+
-+// OK. In ID3V2.3 only six byte or ten byte extheaders are allowed.
-+ if( v2->extheader_size != 6
-+ && v2->extheader_size != 10 )
-+ return (FALSE);
-+
-+// The first four bytes specify the extheader size.
-+ v2->extheader_size = buf[3] + (buf[2] << 7) + (buf[1] << 14) + (buf[0] << 21);
-+
-+// The fifth byte specifies extendened flags. (in fact, only one flag is used for ID3V2.3
-+// The MSB of the byte 5 specifies, if there is CRC data to come, appended to the extheader.
-+ if( (buf[4] & 127) != 0
-+ || buf[5] != 0 )
-+ return (FALSE);
-+
-+ v2->crc_data_present = (buf[4] & 128) >> 7;
-+
-+// if crc data is present, the extheader size must be ten bytes, otherwise 6.
-+ if ( (v2->extheader_size == 6 && v2->crc_data_present == TRUE)
-+ || (v2->extheader_size == 10 && v2->crc_data_present == FALSE) )
-+ return (FALSE);
-+
-+// now come four bytes specifying the padding size
-+ if ( (buf[6] & 128) != 0
-+ || (buf[7] & 128) != 0
-+ || (buf[8] & 128) != 0
-+ || (buf[9] & 128) != 0 )
-+ return (FALSE);
-+
-+ v2->padding_size = buf[9] + (buf[8] << 7) + (buf[7] << 14) + (buf[6] << 21);
-+
-+// Now to the optional crc data.
-+ if( v2->crc_data_present )
-+ {
-+ if( fread (buf, 1, 4, mp3file) < 4 )
-+ return (FALSE);
-+
-+ memcpy (v2->crc_data, buf, 4);
-+ }
-+
-+ return (TRUE);
-+}
-+
-+
-+
-+
-+
-+/*
-+ * Reads the complete frames of a valid ID3V2.3 file and checks, if they are valid.
-+ * If they are, the flags are stored in a DLL and appended to the tag struct.
-+ * Returns TRUE on success, otherwise FALSE.
-+ */
-+static short int
-+read_frames (FILE *mp3file, id3v2Tag *v2)
-+{
-+ unsigned char buf[10];
-+ int numframes = 0;
-+ unsigned int totalframesize = 0;
-+ id3v2Frame *frame = NULL;
-+
-+// set the position to the first frame header (header = 10 bytes + extheadersize + 4 bytes "extheaderheader")
-+ if (v2->has_extheader)
-+ fseek (mp3file, 10 + v2->extheader_size + 4, SEEK_SET);
-+ else
-+ fseek (mp3file, 10, SEEK_SET);
-+
-+// If the tag size is too small for frames, return with an error.
-+ if ( ((v2->tag_size + 10) - v2->padding_size) <= ftell(mp3file) )
-+ return FALSE;
-+
-+// now read all the frames
-+ numframes = 0;
-+ v2->frames = NULL;
-+ while ( ftell (mp3file) < ((v2->tag_size + 10) - v2->padding_size) )
-+ {
-+ frame = calloc (1, sizeof(id3v2Frame));
-+
-+// the frame header is ten bytes long
-+ if ( fread (buf, 1, 10, mp3file) < 10 )
-+ goto error;
-+
-+// if we are already in the padding, we must no longer look for frames...
-+ if ( buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0 )
-+ {
-+ if (numframes == 0)
-+ goto error;
-+
-+ free (frame);
-+ break;
-+ }
-+
-+// first come four characters identifying the frame. It must be alphanumeric.
-+ if ( !isalnum(buf[0]) || !isalnum(buf[1]) || !isalnum(buf[2]) || !isalnum(buf[3]) )
-+ goto error;
-+
-+ *(frame->id) = buf[0];
-+ *(frame->id + 1) = buf[1];
-+ *(frame->id + 2) = buf[2];
-+ *(frame->id + 3) = buf[3];
-+
-+// then, the frame size is to come. Again, the four MSBs must be zero.
-+ if ( (buf[4] & 128) != 0
-+ || (buf[5] & 128) != 0
-+ || (buf[6] & 128) != 0
-+ || (buf[7] & 128) != 0 )
-+ goto error;
-+
-+ frame->datasize = buf[7] + (buf[6] << 7) + (buf[5] << 14) + (buf[4] << 21);
-+
-+// A minimum size must be present!
-+ if ( frame->datasize <= 0 )
-+ goto error;
-+
-+// The two following frame header flags have the 5 LSBs not set.
-+ if ( (buf[8] & 31) != 0
-+ || (buf[9] & 31) != 0 )
-+ goto error;
-+
-+// now, put the flags in the struct.
-+ frame->tagalter = (buf[8] & 128) >> 7;
-+ frame->filealter = (buf[8] & 64) >> 6;
-+ frame->readonly = (buf[8] & 32) >> 5;
-+
-+ frame->compression = (buf[9] & 128) >> 7;
-+ frame->encryption = (buf[8] & 64) >> 6;
-+ frame->grouping = (buf[8] & 32) >> 5;
-+
-+// ok, we are done with the frame header, so now we read the frame data.
-+ frame->data = calloc (1, frame->datasize + 1);
-+ if( fread (frame->data, 1, frame->datasize, mp3file) < frame->datasize )
-+ goto error;
-+
-+ numframes++;
-+ totalframesize += 10 + frame->datasize;
-+
-+// we append it to a glist, which is appended to the v2 struct.
-+ v2->frames = dll_append (v2->frames, frame);
-+ }
-+
-+// if we have no extheader, that means, we don't know how much padding we have!
-+// thus, i calculate it here.
-+ if ( !v2->has_extheader )
-+ v2->padding_size = v2->tag_size - totalframesize;
-+
-+// A minimum of one frame is mandatory.
-+ if( numframes > 0 )
-+ return (TRUE);
-+
-+error:
-+// cleanups in case of an error.
-+ if( frame && frame->data )
-+ free (frame->data);
-+ if( frame )
-+ free (frame);
-+ return (FALSE);
-+}
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+/*
-+ * Reads all tag information of a valid ID3V2.3 file.
-+ * When successful, the info is stored in the tag struct.
-+ * Returns:
-+ * 0 = success
-+ * 1 = Cannot open file.
-+ * 2 = No header or wrong version.
-+ * 3 = broken extheader.
-+ * 4 = broken frames.
-+ */
-+static int
-+get_id3v2tag_raw (id3v2Tag *v2, char *filename)
-+{
-+ FILE *mp3file = NULL;
-+ int error = 0;
-+
-+// open file
-+ error = 1;
-+ mp3file = fopen (filename, "rb");
-+ if (!mp3file)
-+ goto done;
-+
-+// check/get header
-+ error = 2;
-+ if( !check_header (mp3file, v2) )
-+ goto done;
-+
-+// check/get extheader
-+ error = 3;
-+ if( v2->has_extheader
-+ && !check_extheader (mp3file, v2) )
-+ goto done;
-+
-+// get the content frames
-+ error = 4;
-+ if( !read_frames (mp3file, v2) )
-+ goto done;
-+
-+ error = 0;
-+done:
-+ fclose (mp3file);
-+ return (error);
-+}
-+
-+
-+
-+
-+
-+/*
-+ * Find one frames data and give back its data in the correct format.
-+ * Returns TRUE on success, otherwise FALSE;
-+ */
-+static short int
-+frame_find (id3v2Tag *v2, char *name, char *value)
-+{
-+ DLL *curframe = NULL;
-+ id3v2Frame *frame = NULL;
-+
-+ // we parse through the whole list of frames, giving back the correct frame value.
-+ curframe = v2->frames;
-+ while ( curframe )
-+ {
-+ frame = (id3v2Frame *)curframe->data;
-+
-+ // Just to be sure...
-+ if( frame->datasize <= 0 )
-+ goto nextframe;
-+
-+ // Matches the users request? Otherwise try the next frame.
-+ if( memcmp (frame->id, name, 4) != 0 )
-+ goto nextframe;
-+
-+ // These types don't need much change, just give the whole data back to the user according to the encoding.
-+ // The first byte is the encoding.
-+ // TPE1: Artist
-+ // TIT2: Song Title
-+ // TALB: Album Title
-+ // TYER: Year
-+ // TRCK: Track
-+ // TCON: Genre
-+ // COMM: Comment
-+ // TCOM: Composer
-+ // TOPE: TOPE Original artist(s)/performer(s)
-+ // TENC: Encoded by
-+ if ( memcmp (frame->id, "TPE1", 4) == 0
-+ || memcmp (frame->id, "TIT2", 4) == 0
-+ || memcmp (frame->id, "TALB", 4) == 0
-+ || memcmp (frame->id, "TYER", 4) == 0
-+ || memcmp (frame->id, "TRCK", 4) == 0
-+ || memcmp (frame->id, "TCON", 4) == 0
-+ || memcmp (frame->id, "TCOM", 4) == 0
-+ || memcmp (frame->id, "TOPE", 4) == 0
-+ || memcmp (frame->id, "TENC", 4) == 0)
-+ //|| memcmp (frame->id, "WXXX", 4) == 0)
-+ {
-+ if ( *frame->data == 0 )
-+ memcpy(value, frame->data + 1, frame->datasize - 1);
-+ if ( *frame->data == 1 )
-+ {
-+ char nulltermvalue[frame->datasize];
-+ char *isovalue = NULL;
-+
-+ // the tag is not null terminated, so i have to create a null terminated string first.
-+ memset (nulltermvalue, 0, frame->datasize);
-+ memcpy (nulltermvalue, frame->data + 1, frame->datasize - 1);
-+
-+ // Convert from UTF to ISO and copy to the users variable.
-+ isovalue = convert_from_utf8 (nulltermvalue);
-+ strncpy (value, isovalue, sizeof(value) - 1);
-+ free (isovalue);
-+ }
-+
-+ // change linefeeds to a single "return" key.
-+ crlf2cr (value);
-+ return (TRUE);
-+ }
-+ if ( memcmp (frame->id, "WCOM", 4) == 0
-+ || memcmp (frame->id, "WCOP", 4) == 0
-+ || memcmp (frame->id, "WOAF", 4) == 0
-+ || memcmp (frame->id, "WOAR", 4) == 0
-+ || memcmp (frame->id, "WOAS", 4) == 0
-+ || memcmp (frame->id, "WPAY", 4) == 0
-+ || memcmp (frame->id, "WPUB", 4) == 0)
-+ {
-+ memcpy(value, frame->data, frame->datasize - 1);
-+
-+ // change linefeeds to a single "return" key.
-+ crlf2cr (value);
-+ return (TRUE);
-+ }
-+
-+ // The comment requires special handling.
-+ // Its data has: One byte "encoding" (0 = ISO-8859-1, 1 = UNICODE)
-+ // followed by the language (three bytes, e.g. "eng"),
-+ // followed by a short description,
-+ // then a NULL,
-+ // and the full description
-+ // For now, i simply drop the short description
-+ if( memcmp(frame->id, "COMM", 4) == 0 )
-+ {
-+ // check for the right format. (minsize 5, must contain a "\0" after the language)
-+ if ( frame->datasize < 5 )
-+ goto nextframe;
-+ if ( !memchr (frame->data + 4, '\0', frame->datasize - 4) )
-+ goto nextframe;
-+
-+ // now, give the data back to the user, according to the encoding.
-+ if ( *frame->data == 0 )
-+ memcpy (value, frame->data + 5, frame->datasize - 5);
-+ if ( *frame->data == 1 )
-+ {
-+ char nulltermvalue[frame->datasize];
-+ char *isovalue = NULL;
-+
-+ // the tag is not null terminated, so i have to create a null terminated string first.
-+ memset (nulltermvalue, 0, frame->datasize);
-+ memcpy (nulltermvalue, frame->data + 5, frame->datasize - 5);
-+
-+ // Convert from UTF to ISO and copy to the users variable.
-+ isovalue = convert_from_utf8 (nulltermvalue);
-+ strncpy (value, isovalue, sizeof(value) - 1);
-+ free (isovalue);
-+ }
-+
-+ // change linefeeds to a single "return" key.
-+ crlf2cr (value);
-+ return TRUE;
-+ }
-+
-+nextframe:
-+ curframe = curframe->next;
-+ }
-+
-+ return FALSE;
-+}
-+
-+
-+
-+
-+/*
-+ * Remove one frame out of the id3v2Tag struct
-+ * Returns TRUE on success, otherwise FALSE;
-+ */
-+static short int
-+frame_remove (id3v2Tag *v2, char *name)
-+{
-+ id3v2Frame *frame = NULL;
-+ DLL *curframe = NULL;
-+ DLL *tempframe = NULL;
-+
-+// Parse through the list of frames.
-+ curframe = v2->frames;
-+ while ( curframe )
-+ {
-+ frame = (id3v2Frame *)curframe->data;
-+ tempframe = curframe;
-+ curframe = curframe->next;
-+
-+ if ( memcmp (frame->id, name, 4) == 0 )
-+ {
-+// we have found the item! removing will NOT shrink the tag, but increase the padding.
-+ v2->padding_size += (frame->datasize + 10);
-+// and free memory.
-+ v2->frames = dll_remove (v2->frames, tempframe->data);
-+ free (frame->data);
-+ free (frame);
-+
-+ return TRUE;
-+ }
-+ }
-+
-+ return FALSE;
-+}
-+
-+
-+
-+/*
-+ * Add a frame to the framelist. If the frame name is already in the list, it will be replaced.
-+ * Returns:
-+ * TRUE: The tag size HAS BEEN increased.
-+ * FALSE: The tag size has NOT been increased.
-+ */
-+static short int
-+frame_set (id3v2Tag *v2, char *name, char *value)
-+{
-+ id3v2Frame *frame = NULL;
-+ short int sizechange = FALSE;
-+
-+// prevent the user to send CR/LF, which is forbidden.
-+ cr2crlf (value);
-+// eventually remove an existing item!
-+ frame_remove (v2, name);
-+
-+// alloc space for the new frame.
-+ frame = malloc (sizeof(id3v2Frame));
-+
-+ memcpy (frame->id, name, 4);
-+ frame->datasize = strlen (value);
-+ frame->tagalter = 0;
-+ frame->filealter = 0;
-+ frame->readonly = 0;
-+ frame->compression = 0;
-+ frame->encryption = 0;
-+ frame->grouping = 0;
-+
-+// The comment requires special handling. If you need to know why, look at the documentation
-+// of the "frame_find" function above.
-+ if( memcmp (frame->id, "COMM", 4) == 0 )
-+ {
-+ char fullvalue[frame->datasize + 6];
-+
-+ sprintf(fullvalue, "%ceng%c%s", 0, 0, value);
-+
-+ frame->datasize += 5;
-+ frame->data = malloc (frame->datasize);
-+ memcpy (frame->data, fullvalue, frame->datasize);
-+ }
-+ else if ((memcmp(frame->id, "WCOM", 4) == 0)
-+ || memcmp (frame->id, "WCOP", 4) == 0
-+ || memcmp (frame->id, "WOAF", 4) == 0
-+ || memcmp (frame->id, "WOAR", 4) == 0
-+ || memcmp (frame->id, "WOAS", 4) == 0
-+ || memcmp (frame->id, "WPAY", 4) == 0
-+ || memcmp (frame->id, "WPUB", 4) == 0)
-+ {
-+ frame->data = malloc (frame->datasize);
-+ memcpy (frame->data, value, frame->datasize);
-+ }
-+ else
-+ {
-+ char fullvalue[frame->datasize + 2];
-+
-+ // Put encoding type just before the value
-+ sprintf (fullvalue, "%c%s", 0, value);
-+
-+ frame->datasize += 1;
-+ frame->data = malloc (frame->datasize);
-+ memcpy (frame->data, fullvalue, frame->datasize);
-+ }
-+
-+// Ok. This decreases the available padding. If we have no padding left, we must increase the padding (and thus, the tag).
-+ if( v2->padding_size - (frame->datasize + 10) <= 0 )
-+ {
-+// add: framesize + frameheadersize + padding.
-+ v2->padding_size += frame->datasize + 10 + 1024;
-+ v2->tag_size += frame->datasize + 10 + 1024;
-+
-+ sizechange = TRUE;
-+ }
-+
-+// In every case, we must subtract the new allocated space from the padding.
-+ v2->padding_size -= frame->datasize + 10;
-+
-+ v2->frames = dll_append (v2->frames, frame);
-+
-+ return sizechange;
-+}
-+
-+
-+
-+/*
-+ * Create raw header.
-+ * Returns:
-+ * TRUE: successful.
-+ * FALSE: unsuccessful.
-+ */
-+static int
-+create_header_raw (char *raw, id3v2Tag *v2)
-+{
-+// now we are going to write the tags raw data into the raw string
-+ memset (raw, 0, v2->tag_size + 10);
-+// ID3 identifier bytes
-+ memcpy (raw, "ID3", 3);
-+ raw += 3;
-+// major version byte
-+ *raw++ = 3;
-+// minor version byte
-+ *raw++ = 0;
-+// Flags byte
-+ *raw++ = ((v2->unsync & 1) << 7)
-+ | ((v2->has_extheader & 1) << 6)
-+ | ((v2->is_experimental & 1) << 5);
-+// Tag size. It must be syncsafe!
-+ *raw++ = ((v2->tag_size & 0x800000) >> 23) | (((v2->tag_size & 0x7f000000) >> 24) << 1);
-+ *raw++ = ((v2->tag_size & 0x8000) >> 15) | (((v2->tag_size & 0x7f0000) >> 16) << 1);
-+ *raw++ = ((v2->tag_size & 0x80) >> 7) | (((v2->tag_size & 0x7f00) >> 8) << 1);
-+ *raw++ = (v2->tag_size & 0x7f);
-+
-+ return TRUE;
-+}
-+
-+
-+
-+
-+/*
-+ * Generates the frames. btw.: ID3 sucks!
-+ * Returns: TRUE if succesful, otherwise FALSE.
-+ */
-+static short int
-+create_frames_raw (char *raw, id3v2Tag *v2)
-+{
-+ id3v2Frame *frame = NULL;
-+ DLL *curframe = NULL;
-+
-+// if we have no frames, just quit.
-+ if ( v2->frames == NULL )
-+ return FALSE;
-+
-+// the header and extheader have already been written.
-+ raw += 10;
-+ if ( v2->has_extheader )
-+ raw += 4 + v2->extheader_size;
-+
-+ curframe = v2->frames;
-+ while ( curframe )
-+ {
-+ frame = (id3v2Frame *)curframe->data;
-+
-+// secure is secure
-+ if ( frame->datasize <= 0 )
-+ goto nextframe;
-+
-+// add the frame id
-+ memcpy(raw, frame->id, 4);
-+ raw += 4;
-+// add the frame size (syncsafe)
-+ *raw++ = ((frame->datasize & 0x800000) >> 23) | (((frame->datasize & 0x7f000000) >> 24) << 1);
-+ *raw++ = ((frame->datasize & 0x8000) >> 15) | (((frame->datasize & 0x7f0000) >> 16) << 1);
-+ *raw++ = ((frame->datasize & 0x80) >> 7) | (((frame->datasize & 0x7f00) >> 8) << 1);
-+ *raw++ = (frame->datasize & 0x7f);
-+
-+// The two flagbytes
-+ *raw++ = ((frame->tagalter & 1) << 7)
-+ | ((frame->filealter & 1) << 6)
-+ | ((frame->readonly & 1) << 5);
-+
-+ *raw++ = ((frame->compression & 1) << 7)
-+ | ((frame->encryption & 1) << 6)
-+ | ((frame->grouping & 1) << 5);
-+
-+// now the frame data.
-+ memcpy(raw, frame->data, frame->datasize);
-+ raw += frame->datasize;
-+
-+nextframe:
-+ curframe = curframe->next;
-+ }
-+
-+ return TRUE;
-+}
-+
-+/***************************************************************************************
-+ * END OF STATICS
-+ ***************************************************************************************/
-+
-+
-+
-+
-+
-+
-+
-+/*
-+ * Purpose: Reads the ID3 tag from a file.
-+ * Parameters: tag - The structure to store the tag in, filename - The name of the file to operate on.
-+ * Returns:
-+ * 0 if successful,
-+ * 1 if an error occured when opening the file
-+ * 2 if error while reading tag.
-+ * 3 if no TAG found.
-+ */
-+int
-+get_id3v2_tag (id3Tag *tag, char *filename)
-+{
-+ id3v2Tag *v2 = calloc (1, sizeof(id3v2Tag));
-+ DLL *curframe = NULL;
-+ int error = 0;
-+
-+// Read the tag.
-+ error = get_id3v2tag_raw (v2, filename);
-+
-+// Init the users tag
-+ memset (tag, 0, sizeof (id3Tag));
-+
-+ if( error == 0 )
-+ {
-+// if we have a valid tag we copy the raw data to the users struct
-+ tag->size = v2->tag_size;
-+
-+ frame_find (v2, "TPE1", tag->artist);
-+ frame_find (v2, "TIT2", tag->title);
-+ frame_find (v2, "TALB", tag->album);
-+ frame_find (v2, "TYER", tag->year);
-+ frame_find (v2, "COMM", tag->comment);
-+ frame_find (v2, "TRCK", tag->track);
-+ frame_find (v2, "TCON", tag->genre);
-+ frame_find (v2, "TCOM", tag->composer); // Composer
-+ frame_find (v2, "TOPE", tag->orig_artist); // Original artist(s)/performer(s)
-+ frame_find (v2, "WCOM", tag->url); // URL
-+ frame_find (v2, "TENC", tag->enc_by); // Encoded by
-+ }
-+
-+// Free all the stuff
-+ if (v2->frames)
-+ {
-+ id3v2Frame *frame = NULL;
-+
-+ curframe = v2->frames;
-+ while ( curframe )
-+ {
-+ frame = (id3v2Frame *)curframe->data;
-+
-+ free (frame->data);
-+ free (frame);
-+
-+ curframe = curframe->next;
-+ }
-+ v2->frames = dll_free (v2->frames);
-+ }
-+
-+ free (v2);
-+ return (error);
-+}
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+/*
-+ * Purpose: Clear the ID3 tag of a file.
-+ * Parameters: a filename.
-+ * Returns:
-+ * 0 if successful,
-+ * 1 if an error occured when opening the file
-+ * 2 if an error while reading/writing the tag.
-+ */
-+int
-+del_id3v2_tag (char *filename)
-+{
-+ id3v2Tag *v2 = calloc (1, sizeof(id3v2Tag));
-+ long file_len;
-+ FILE *file;
-+ void *ptr;
-+
-+// check if an valid old id3v2 tag is present
-+// In these two error-cases we don't know how big the tag is.
-+ if( get_id3v2tag_raw (v2, filename) == 1
-+ || get_id3v2tag_raw (v2, filename) == 2 )
-+ return(0);
-+
-+ ptr = malloc (4096);
-+
-+// open file read/write
-+ file = fopen (filename, "r+b");
-+ if (!file)
-+ return (1);
-+
-+ fseek (file, 0, SEEK_END);
-+ file_len = ftell (file);
-+ if ( file_len < 11
-+ || v2->tag_size < 11 )
-+ return (2);
-+
-+// set anything but the header in tag to zero. I'll not really remove the tag,
-+// because this would be much slower and if we write a new tag, this would mean we´d have to
-+// rewrite the complete tag.
-+/*
-+ fseek (file, 10, SEEK_SET);
-+ for (read = 0; read < v2->tag_size - 10; read++)
-+ fputc (0, file);
-+
-+*/
-+ {
-+ FILE *file = NULL;
-+ FILE *tempfile = NULL;
-+ char *tempfilename = NULL;
-+ int read = 0;
-+ char buf[4096];
-+ int error = 0;
-+
-+ // Open a tempfile
-+ error = 2;
-+ tempfilename = malloc (strlen (filename) + 11);
-+ sprintf (tempfilename, "%s%s", filename, ".tempXXXXX");
-+ if( !(tempfile = fopen(tempfilename, "wb")) )
-+ {
-+ remove (tempfilename);
-+ free (tempfilename);
-+ goto done;
-+ }
-+
-+ // Write the tag to the tempfile.
-+
-+ // Open the mp3file.
-+ error = 4;
-+ if( !(file = fopen(filename, "r+b")) )
-+ {
-+ fclose (file);
-+ remove (tempfilename);
-+ free (tempfilename);
-+ goto done;
-+ }
-+ // skip the old tag (if one existed)
-+ fseek (file, v2->tag_size + 10, SEEK_SET);
-+
-+ // copy the rest of the file to the tempfile.
-+ while ( !feof(file) )
-+ {
-+ error = 5;
-+ read = fread (buf, 1, 4096, file);
-+ if( fwrite (buf, 1, read, tempfile) != read
-+ && !feof (file) )
-+ {
-+ remove (tempfilename);
-+ free (tempfilename);
-+ fflush (tempfile);
-+ fclose (tempfile);
-+ fflush (file);
-+ fclose (file);
-+ goto done;
-+ }
-+ }
-+
-+ fflush (file);
-+ fclose (file);
-+ fflush (tempfile);
-+ fclose (tempfile);
-+
-+ // rename the tempfile, so it is the mp3file.
-+ rename (tempfilename, filename);
-+ free (tempfilename);
-+ }
-+
-+done:
-+ if (v2) free (v2);
-+ if (ptr) free (ptr);
-+
-+ return(0);
-+}
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+
-+int
-+set_id3v2_tag (id3Tag *tag, char *filename)
-+{
-+ id3v2Tag *v2 = malloc (sizeof(id3v2Tag));
-+ id3v2Frame *frame = NULL;
-+ unsigned char *rawdata = NULL;
-+ DLL *curframe = NULL;
-+ int oldsize = 0;
-+ char track[3];
-+ int error = 0;
-+
-+// Try to get the content of an old tag
-+ error = 1;
-+ memset (v2, 0, sizeof(id3v2Tag));
-+ get_id3v2tag_raw (v2, filename);
-+
-+ oldsize = v2->tag_size;
-+
-+// If the old tag had an extheader, I'll add its size to my tag, because i don't plan to add it again.
-+ if ( v2->has_extheader )
-+ {
-+ v2->padding_size += v2->extheader_size;
-+ v2->has_extheader = FALSE;
-+ v2->extheader_size = 0;
-+ }
-+
-+// first of all I'll generate a valid id3v2 tag struct out of the tag struct we got by the user.
-+// Set the flags...
-+ v2->unsync = FALSE;
-+ v2->is_experimental = FALSE;
-+ v2->crc_data_present = FALSE;
-+
-+// Set the contentframes
-+ frame_set (v2, "TIT2", tag->title);
-+ frame_set (v2, "TPE1", tag->artist);
-+ frame_set (v2, "TALB", tag->album);
-+ frame_set (v2, "TYER", tag->year);
-+ frame_set (v2, "COMM", tag->comment);
-+ frame_set (v2, "TCON", tag->genre);
-+ frame_set (v2, "TCOM", tag->composer); // Composer
-+ frame_set (v2, "TOPE", tag->orig_artist); // TOPE Original artist(s)/performer(s)
-+ frame_set (v2, "WCOM", tag->url); // URL
-+ frame_set (v2, "TENC", tag->enc_by); // Encoded by
-+ if ( atoi (tag->track) < 10 )
-+ snprintf (track, 3, "0%i", atoi(tag->track));
-+ else
-+ snprintf (track, 3, "%i", atoi(tag->track));
-+ frame_set (v2, "TRCK", track);
-+
-+// Create a header in the raw data string
-+ rawdata = calloc (1, v2->tag_size + 10);
-+ create_header_raw (rawdata, v2);
-+
-+// Create frames raw data.
-+ create_frames_raw (rawdata, v2);
-+
-+// is the new tag bigger than the old one? Then we'll have to completely rewrite the file...
-+ if ( v2->tag_size > oldsize )
-+ {
-+ FILE *file = NULL;
-+ FILE *tempfile = NULL;
-+ char *tempfilename = NULL;
-+ int read = 0;
-+ char buf[4096];
-+
-+// Open a tempfile
-+ error = 2;
-+ tempfilename = malloc (strlen (filename) + 11);
-+ sprintf (tempfilename, "%s%s", filename, ".tempXXXXX");
-+ if( !(tempfile = fopen(tempfilename, "wb")) )
-+ {
-+ remove (tempfilename);
-+ free (tempfilename);
-+ goto done;
-+ }
-+
-+// Write the tag to the tempfile.
-+ error = 3;
-+ fseek (tempfile, 0, SEEK_SET);
-+ if( fwrite (rawdata, 1, v2->tag_size + 10, tempfile) < v2->tag_size )
-+ {
-+ fclose (tempfile);
-+ remove (tempfilename);
-+ free (tempfilename);
-+ goto done;
-+ }
-+
-+// Open the mp3file.
-+ error = 4;
-+ if( !(file = fopen(filename, "r+b")) )
-+ {
-+ fclose (file);
-+ remove (tempfilename);
-+ free (tempfilename);
-+ goto done;
-+ }
-+// skip the old tag (if one existed)
-+ fseek (file, oldsize? oldsize + 10 : oldsize, SEEK_SET);
-+
-+// copy the rest of the file to the tempfile.
-+ while ( !feof(file) )
-+ {
-+ error = 5;
-+ read = fread (buf, 1, 4096, file);
-+ if( fwrite (buf, 1, read, tempfile) != read
-+ && !feof (file) )
-+ {
-+ remove (tempfilename);
-+ free (tempfilename);
-+ fflush (tempfile);
-+ fclose (tempfile);
-+ fflush (file);
-+ fclose (file);
-+ goto done;
-+ }
-+ }
-+
-+ fflush (file);
-+ fclose (file);
-+ fflush (tempfile);
-+ fclose (tempfile);
-+
-+// rename the tempfile, so it is the mp3file.
-+ rename (tempfilename, filename);
-+ free (tempfilename);
-+ }
-+ else
-+ {
-+ FILE *file = NULL;
-+
-+// If the old tag was bigger than the new one, we can simply overwrite it!
-+// open.
-+ error = 10;
-+ if( !(file = fopen(filename, "r+b")) )
-+ goto done;
-+
-+// write.
-+ error = 11;
-+ fseek (file, 0, SEEK_SET);
-+ if( fwrite (rawdata, 1, v2->tag_size + 10, file) < v2->tag_size )
-+ {
-+ fflush (file);
-+ fclose (file);
-+ goto done;
-+ }
-+
-+ fflush (file);
-+ fclose (file);
-+ }
-+
-+ error = 0;
-+
-+done:
-+// Free all the stuff
-+ curframe = v2->frames;
-+ while ( curframe )
-+ {
-+ frame = (id3v2Frame *)curframe->data;
-+
-+ free (frame->data);
-+ free (frame);
-+
-+ curframe = curframe->next;
-+ }
-+ dll_free (v2->frames);
-+
-+ if ( rawdata != NULL )
-+ free (rawdata);
-+ free (v2);
-+ return (error);
-+}
-diff -Naur xmms-1.2.9-orig/Input/mpg123/mpg123.c xmms-1.2.9/Input/mpg123/mpg123.c
---- xmms-1.2.9-orig/Input/mpg123/mpg123.c Thu Jan 29 06:43:24 2004
-+++ xmms-1.2.9/Input/mpg123/mpg123.c Thu Jan 29 05:18:54 2004
-@@ -607,8 +607,13 @@
- { \
- id3frm = id3_get_frame( id3d, _tid, 1 ); \
- if (id3frm) { \
-- txt = _tid == ID3_TCON ? id3_get_content(id3frm) \
-- : id3_get_text(id3frm); \
-+ if (_tid == ID3_COMM) \
-+ txt = id3_get_comm(id3frm); \
-+ else if (id3frm->fr_desc->fd_idstr[0] == 'W') \
-+ txt = id3_get_url(id3frm); \
-+ else \
-+ txt = _tid == ID3_TCON ? id3_get_content(id3frm) \
-+ : id3_get_text(id3frm); \
- if(txt) \
- { \
- tlen = strlen(txt); \
-@@ -644,6 +649,10 @@
- ID3_SET_NUM (ID3_TRCK, track_number);
- ID3_SET (ID3_COMM, comment);
- ID3_SET (ID3_TCON, genre);
-+ ID3_SET (ID3_TCOM, composer);
-+ ID3_SET (ID3_TOPE, orig_artist);
-+ ID3_SET (ID3_WCOM, url);
-+ ID3_SET (ID3_TENC, encoded_by);
- }
-
- /*
-diff -Naur xmms-1.2.9-orig/Input/mpg123/mpg123.h xmms-1.2.9/Input/mpg123/mpg123.h
---- xmms-1.2.9-orig/Input/mpg123/mpg123.h Thu Jan 29 06:43:24 2004
-+++ xmms-1.2.9/Input/mpg123/mpg123.h Thu Jan 29 05:20:31 2004
-@@ -78,6 +78,10 @@
- char genre[256];
- int year;
- int track_number;
-+ char composer[1024];
-+ char orig_artist[1024];
-+ char url[1024];
-+ char encoded_by[1024];
- };
-
- typedef struct