summaryrefslogtreecommitdiffstats
path: root/media-libs
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/gdk-pixbuf/Manifest9
-rw-r--r--media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch48
-rw-r--r--media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_secure.patch19
-rw-r--r--media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-loaders.patch134
-rw-r--r--media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-m4.patch9
-rw-r--r--media-libs/gdk-pixbuf/files/gdk-pixbuf-ds-png.diff47
-rw-r--r--media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r5.ebuild70
-rw-r--r--media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r6.ebuild73
-rw-r--r--media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r7.ebuild73
-rw-r--r--media-libs/id3lib/Manifest12
-rw-r--r--media-libs/id3lib/files/1.diff19
-rw-r--r--media-libs/id3lib/files/id3lib-3.8.3-autoconf259.patch31
-rw-r--r--media-libs/id3lib/files/id3lib-3.8.3-doxyinput.patch23
-rw-r--r--media-libs/id3lib/files/id3lib-3.8.3-gcc-4.3.patch82
-rw-r--r--media-libs/id3lib/files/id3lib-3.8.3-security.patch50
-rw-r--r--media-libs/id3lib/files/id3lib-3.8.3-test_io.patch10
-rw-r--r--media-libs/id3lib/files/id3lib-3.8.3-unicode16.patch39
-rw-r--r--media-libs/id3lib/files/id3lib-3.8.3-zlib.patch23
-rw-r--r--media-libs/id3lib/files/id3lib-ds-rcc.patch169
-rw-r--r--media-libs/id3lib/id3lib-3.8.3-r5.ebuild56
-rw-r--r--media-libs/id3lib/id3lib-3.8.3-r8.ebuild66
-rw-r--r--media-libs/imlib/Manifest9
-rw-r--r--media-libs/imlib/files/imlib-1.9.15-asneeded.patch38
-rw-r--r--media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch11
-rw-r--r--media-libs/imlib/files/imlib-1.9.15-fix-rendering.patch105
-rw-r--r--media-libs/imlib/files/imlib-1.9.15-libpng15.patch142
-rw-r--r--media-libs/imlib/files/imlib-1.9.15.patch70
-rw-r--r--media-libs/imlib/files/imlib-security.patch510
-rw-r--r--media-libs/imlib/imlib-1.9.15-r99.ebuild60
-rw-r--r--media-libs/libaudclient/Manifest2
-rw-r--r--media-libs/libaudclient/libaudclient-3.5_rc2.ebuild25
-rw-r--r--media-libs/libid3tag/Manifest14
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-64bit-long.patch24
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-a_capella.patch35
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-compat.patch13
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-file-write.patch52
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-fix_overflow.patch11
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-tag.patch17
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-unknown-encoding.patch27
-rw-r--r--media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-utf16.patchlibid3tag-0.15.1b-utf16.patch22
-rw-r--r--media-libs/libid3tag/files/id3tag.pc11
-rw-r--r--media-libs/libid3tag/files/libid3tag-0.15.1b-ds-rcc.patch300
-rw-r--r--media-libs/libid3tag/libid3tag-0.15.1b-r1.ebuild47
-rw-r--r--media-libs/libid3tag/libid3tag-0.15.1b-r3.ebuild55
-rw-r--r--media-libs/libid3tag/libid3tag-0.15.1b-r4.ebuild56
-rw-r--r--media-libs/mac/Manifest7
-rw-r--r--media-libs/mac/files/mac-3.99-u4-b5-s4-ds-fix.patch12
-rw-r--r--media-libs/mac/files/mac-3.99-u4-b5-s4-ds-gcc44.patch27
-rw-r--r--media-libs/mac/mac-3.99-r1.ebuild35
-rw-r--r--media-libs/mac/mac-3.99-r2.ebuild36
-rw-r--r--media-libs/mac/mac-3.99.ebuild34
-rw-r--r--media-libs/nv-codec-headers/Manifest2
-rw-r--r--media-libs/nv-codec-headers/nv-codec-headers-9.0.18.1.ebuild31
-rw-r--r--media-libs/taglib/Manifest10
-rw-r--r--media-libs/taglib/files/taglib-1.10-ds-rusxmms.patch1339
-rw-r--r--media-libs/taglib/files/taglib-1.6.1-install-examples.patch16
-rw-r--r--media-libs/taglib/files/taglib-1.9.1-abi-breakage.patch107
-rw-r--r--media-libs/taglib/files/taglib-1.9.1-bytevector-simpler.patch131
-rw-r--r--media-libs/taglib/files/taglib-1.9.1-ds-rusxmms-enforce.patch20
-rw-r--r--media-libs/taglib/files/taglib-1.9.1-ds-rusxmms.patch676
-rw-r--r--media-libs/taglib/files/taglib-1.9.1-missing-deletes.patch48
-rw-r--r--media-libs/taglib/files/taglib-1.9.1-order-big-endian.patch33
-rw-r--r--media-libs/taglib/taglib-1.9.1-r4.ebuild83
-rw-r--r--media-libs/win32codecs/Manifest2
-rw-r--r--media-libs/win32codecs/win32codecs-20071007-r5.ebuild57
65 files changed, 5424 insertions, 0 deletions
diff --git a/media-libs/gdk-pixbuf/Manifest b/media-libs/gdk-pixbuf/Manifest
new file mode 100644
index 0000000..d9c5120
--- /dev/null
+++ b/media-libs/gdk-pixbuf/Manifest
@@ -0,0 +1,9 @@
+AUX gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch 1157 SHA256 d3196c1666f560997bc5cd5be4787156c64f92dc0fd8dada8ad3c16793b90970 SHA512 e4aa5edc91ae1319f062a518612f6776bc03beb6db5a6a0e7b9c22b94d5f6433b26040b6a2c27fcb91b4094da45dcf1fddb7cb702bac64952ee0899b5b005a6c WHIRLPOOL 255040e3941fdc0dc16d57ef2802d1c3b8610f7eec26d4d828d120121402731f53a4427430060b1d61aef5ff007ee5c16de50877c6111e58a489c40f2bb9bdac
+AUX gdk-pixbuf-0.22.0-bmp_secure.patch 557 SHA256 1bb9330c75e8ceb927620f03717d442185b84602b9ec67bb6940518aabdff5f8 SHA512 5d9ceab886f606bb9983ed6ab21a58edbade392ac7cb57ee77ad3a1e5e2fd192739d3a0ea3f30981d637a21fdda2de3747c9fd805335072516afa727ec6e32d3 WHIRLPOOL 14f6c01d013a78de367a66223ff264d0c369eff88138e4a88f8e2ed779e69994ea6bec8015fbdd7570a06c8d19318e80791b8c98a8c692fcf09d89d6ea8f1739
+AUX gdk-pixbuf-0.22.0-loaders.patch 3589 SHA256 310824874429c26b277c985b218e133ded4e94c51de389979875de38ddb57400 SHA512 ce20cc96c7e4d540eec9f2b53c424ed8e0aaf51ae4f58f4c521380b357bf69ccff89b0865fac8b792cca9a42892602af651ab5965edb569cad7b5ecee1ea36ae WHIRLPOOL cbcf25a12b614f276b350b042f3471aefcc09cd517e4710157fe9b707ecc37ff32c0468b5d51c1d594c9343e82d5568e966a544d751d3ef9d5bd734ad484f72c
+AUX gdk-pixbuf-0.22.0-m4.patch 276 SHA256 4a62476624319a09c000d01d45689167ea5cf1665e4c7e988032ffff11920132 SHA512 b22c73982d13a0a6200e48f436cdf1a34fe8882c70da8ce0bb86a0cc1e0f7887e25ceeb6affb57222a7158d05112fb711a8f1d34c05085b47750eed04a094901 WHIRLPOOL ad974a9ba450c62f00bbd84dff3c469b2033109adb0ca09f5e5c9eb5bff3ef7487bf555363bfab691079ba6528bf1c2eff13c5f05349214938099c0bacffa7d3
+AUX gdk-pixbuf-ds-png.diff 1309 SHA256 db45815b76f01f888581e4dfe5affb45febf370ec85e0a59e4ae079adff29137 SHA512 bfd483dd030de81a3ecb1de16a9ce0d666a9dcafee0243e4bcc9b68a632d4e4739d9b9a0ce4bc61ae5615f6c2b309f22c0d9132c3e5e85ce0768e3f9c15bbce8 WHIRLPOOL a29bc0eb96c8b5326e51a4b2984f03860f2090ff27936710d683ca8a16f3d49372777d1d42d57c9665e95d22cf6a539ab25ee86d5079112de603db2fabcff6ed
+DIST gdk-pixbuf-0.22.0.tar.bz2 398208 SHA256 411f2a1c27c3afadc5d034f2213d9f6c3a37f564eb5989cf6e8a53729280ae22 SHA512 69ebc3030f978283a3014dc6037304dd67daf912e6a1eda8d6853aa2ad10a226b310c82049ce78de3665dda363083b08eb3c7942f77a7cd0fc76282d8cfc5a95 WHIRLPOOL 403d1fe50d97683f86aacb0fcb3a9cf7bb7e22568bff04dc511da22c854e3edb615bd0c8ab95d3cef06541a3ae83de6f7f15b01d7b1274fc46626264fa2218ec
+EBUILD gdk-pixbuf-0.22.0-r5.ebuild 1779 SHA256 da124f65e28024d47ee693071b14ecdd4b86cd7b1f44dfa8b5c18014bf7a4859 SHA512 f8de7c177412af76aac602d4fca180414872a759af597365b5d3d90b104930e1748b293ddf69d0627f717e4d58e8c22a1190a4622cb4014ecdd4aea58015e08b WHIRLPOOL 178d1294600757d5ba3c9fcfe7f4c56b6bc5bec3f9ea347d2451f39bd9ebc5883233d708398e8f527b385d640c7dc176485788c767773aef168206f3f3465249
+EBUILD gdk-pixbuf-0.22.0-r6.ebuild 1835 SHA256 310b5d95375290f4b0b989f884decb38d147ed431bd4b2ffd4d6660e1d9e524f SHA512 77230088acb6c2bfc1f2f3c0ca457cf7a7813949441fb15b3b0b59c1dfb1fad4d78a2080d8cb0986a095458f8f9bde8b7f6c023e75e8b89f1d5dd2176e5724d9 WHIRLPOOL 38e05d2207138451733bc7027ffc08eeccc799c4f4a0b06a2d440825ce6021a40a6ea41b583cd466181a49167e6ae232df1dda9470a211f91259fc21c321bf6f
+EBUILD gdk-pixbuf-0.22.0-r7.ebuild 1834 SHA256 ef6eed63155a9dc0754f2443d96aa64dcda56fd64a9559db9988f92e2296bc92 SHA512 e49f66688f766566483fdf8d13ec15e746ac1b2c5d440357a6f7960d20265d7c6c34f37213a1743f5217d135b071066183fb54720f2f7b65f5dc0e96fd1e47a4 WHIRLPOOL 7cd04d85aeb782b47a3a926a2523fbbed5610f1048520fe0fd467f604cc018f2b847508f0591758bb64078e3f5bf46c0302d94698b71646894935edc69434df6
diff --git a/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch
new file mode 100644
index 0000000..ffb4378
--- /dev/null
+++ b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch
@@ -0,0 +1,48 @@
+--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-bmp.c 2002-09-27 23:12:40.000000000 +0200
++++ gdk-pixbuf-0.22.0.patched/gdk-pixbuf/io-bmp.c 2005-03-30 01:33:06.000000000 +0200
+@@ -31,8 +31,6 @@
+ #include "gdk-pixbuf-private.h"
+ #include "gdk-pixbuf-io.h"
+
+-
+-
+ #if 0
+ /* If these structures were unpacked, they would define the two headers of the
+ * BMP file. After them comes the palette, and then the image data.
+@@ -206,7 +204,7 @@
+
+ if (State == NULL)
+ return NULL;
+-
++
+ while (feof(f) == 0) {
+ length = fread(membuf, 1, sizeof (membuf), f);
+ if (length > 0)
+@@ -245,11 +243,26 @@
+ static gboolean
+ grow_buffer (struct bmp_progressive_state *State)
+ {
+- guchar *tmp = realloc (State->buff, State->BufferSize);
++ guchar *tmp;
++
++ if (State->BufferSize == 0) {
++#if 0
++ g_set_error (error,
++ GDK_PIXBUF_ERROR,
++ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
++ _("BMP image has bogus header data"));
++#endif
++ State->read_state = READ_STATE_ERROR;
++ return FALSE;
++ }
++
++ tmp = realloc (State->buff, State->BufferSize);
++
+ if (!tmp) {
+ State->read_state = READ_STATE_ERROR;
+ return FALSE;
+ }
++
+ State->buff = tmp;
+ return TRUE;
+ }
diff --git a/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_secure.patch b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_secure.patch
new file mode 100644
index 0000000..29471f1
--- /dev/null
+++ b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-bmp_secure.patch
@@ -0,0 +1,19 @@
+Index: io-bmp.c
+===================================================================
+RCS file: /cvs/gnome/gtk+/gdk-pixbuf/io-bmp.c,v
+retrieving revision 1.41
+diff -u -p -r1.41 io-bmp.c
+--- gdk-pixbuf/io-bmp.c 13 Aug 2004 02:26:57 -0000 1.41
++++ gdk-pixbuf/io-bmp.c 20 Aug 2004 00:18:14 -0000
+@@ -876,8 +876,10 @@ DoCompressed(struct bmp_progressive_stat
+ guchar c;
+ gint idx;
+
+- if (context->compr.y >= context->Header.height)
++ if (context->compr.y >= context->Header.height) {
++ context->BufferDone = 0;
+ return TRUE;
++ }
+
+ y = context->compr.y;
+
diff --git a/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-loaders.patch b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-loaders.patch
new file mode 100644
index 0000000..0686538
--- /dev/null
+++ b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-loaders.patch
@@ -0,0 +1,134 @@
+diff -NurdB gdk-pixbuf-0.22.0/gdk-pixbuf/io-ico.c gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-ico.c
+--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-ico.c 2002-09-27 17:19:15.000000000 -0500
++++ gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-ico.c 2005-10-27 11:28:23.000000000 -0500
+@@ -330,6 +330,9 @@
+
+ State->HeaderSize+=I;
+
++ if (State->HeaderSize < 0)
++ return FALSE;
++
+ if (State->HeaderSize>State->BytesInHeaderBuf) {
+ guchar *tmp=realloc(State->HeaderBuf,State->HeaderSize);
+ if (!tmp)
+diff -NurdB gdk-pixbuf-0.22.0/gdk-pixbuf/io-xpm.c gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-xpm.c
+--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-xpm.c 2001-03-01 15:16:28.000000000 -0500
++++ gdk-pixbuf-0.22.0-patched/gdk-pixbuf/io-xpm.c 2005-10-27 11:29:14.000000000 -0500
+@@ -243,8 +243,8 @@
+ break;
+ else {
+ if (numnames > 0) {
+- space -= 1;
+- strcat (color, " ");
++ strncat (color, " ", space);
++ space -= MIN (space, 1);
+ }
+
+ strncat (color, temp, space);
+@@ -281,7 +281,8 @@
+ /* Fall through to the xpm_read_string. */
+
+ case op_body:
+- xpm_read_string (h->infile, &h->buffer, &h->buffer_size);
++ if(!xpm_read_string (h->infile, &h->buffer, &h->buffer_size))
++ return NULL;
+ return h->buffer;
+
+ default:
+@@ -317,13 +318,6 @@
+ return NULL;
+ }
+
+-/* Destroy notification function for the pixbuf */
+-static void
+-free_buffer (guchar *pixels, gpointer data)
+-{
+- free (pixels);
+-}
+-
+ static gboolean
+ xpm_color_parse (const char *spec, XColor *color)
+ {
+@@ -342,7 +336,8 @@
+ gchar pixel_str[32];
+ GHashTable *color_hash;
+ _XPMColor *colors, *color, *fallbackcolor;
+- guchar *pixels, *pixtmp;
++ guchar *pixtmp;
++ GdkPixbuf* pixbuf;
+
+ fallbackcolor = NULL;
+
+@@ -352,16 +347,33 @@
+ return NULL;
+ }
+ sscanf (buffer, "%d %d %d %d", &w, &h, &n_col, &cpp);
+- if (cpp >= 32) {
+- g_warning ("XPM has more than 31 chars per pixel.");
++ if (cpp <= 0 || cpp >= 32) {
++ g_warning ("XPM has invalid number of chars per pixel.");
+ return NULL;
+ }
++ if (n_col <= 0 ||
++ n_col >= G_MAXINT / (cpp + 1) ||
++ n_col >= G_MAXINT / sizeof (_XPMColor)) {
++ g_warning ("XPM file has invalid number of colors");
++ return NULL;
++ }
+
+ /* The hash is used for fast lookups of color from chars */
+ color_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+- name_buf = g_new (gchar, n_col * (cpp + 1));
+- colors = g_new (_XPMColor, n_col);
++ name_buf = g_new (gchar, n_col * (cpp + 1));
++ if (!name_buf) {
++ g_warning ("Cannot allocate memory for loading XPM image");
++ g_hash_table_destroy (color_hash);
++ return NULL;
++ }
++ colors = g_new (_XPMColor, n_col);
++ if (!colors) {
++ g_warning ("Cannot allocate memory for loading XPM image");
++ g_hash_table_destroy (color_hash);
++ g_free (name_buf);
++ return NULL;
++ }
+
+ for (cnt = 0; cnt < n_col; cnt++) {
+ gchar *color_name;
+@@ -397,12 +409,8 @@
+ fallbackcolor = color;
+ }
+
+- if (is_trans)
+- pixels = malloc (w * h * 4);
+- else
+- pixels = malloc (w * h * 3);
+-
+- if (!pixels) {
++ pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, is_trans, 8, w, h);
++ if (!pixbuf) {
+ g_hash_table_destroy (color_hash);
+ g_free (colors);
+ g_free (name_buf);
+@@ -410,7 +418,7 @@
+ }
+
+ wbytes = w * cpp;
+- pixtmp = pixels;
++ pixtmp = pixbuf->pixels;
+
+ for (ycnt = 0; ycnt < h; ycnt++) {
+ buffer = (*get_buf) (op_body, handle);
+@@ -443,9 +451,7 @@
+ g_free (colors);
+ g_free (name_buf);
+
+- return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, is_trans, 8,
+- w, h, is_trans ? (w * 4) : (w * 3),
+- free_buffer, NULL);
++ return pixbuf;
+ }
+
+ /* Shared library entry point for file loading */
diff --git a/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-m4.patch b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-m4.patch
new file mode 100644
index 0000000..032976d
--- /dev/null
+++ b/media-libs/gdk-pixbuf/files/gdk-pixbuf-0.22.0-m4.patch
@@ -0,0 +1,9 @@
+Fix aclocal warning:
+/usr/share/aclocal/gdk-pixbuf.m4:12: warning: underquoted definition of AM_PATH_GDK_PIXBUF
+--- gdk-pixbuf-0.22.0/gdk-pixbuf.m4
++++ gdk-pixbuf-0.22.0/gdk-pixbuf.m4
+@@ -11,3 +11,3 @@
+ dnl
+-AC_DEFUN(AM_PATH_GDK_PIXBUF,
++AC_DEFUN([AM_PATH_GDK_PIXBUF],
+ [dnl
diff --git a/media-libs/gdk-pixbuf/files/gdk-pixbuf-ds-png.diff b/media-libs/gdk-pixbuf/files/gdk-pixbuf-ds-png.diff
new file mode 100644
index 0000000..39b4cb6
--- /dev/null
+++ b/media-libs/gdk-pixbuf/files/gdk-pixbuf-ds-png.diff
@@ -0,0 +1,47 @@
+diff -dPNur gdk-pixbuf-0.22.0/gdk-pixbuf/io-png.c gdk-pixbuf-0.22.0-png15/gdk-pixbuf/io-png.c
+--- gdk-pixbuf-0.22.0/gdk-pixbuf/io-png.c 2001-01-24 21:59:23.000000000 +0100
++++ gdk-pixbuf-0.22.0-png15/gdk-pixbuf/io-png.c 2012-11-16 14:32:15.000000000 +0100
+@@ -174,11 +174,12 @@
+ png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
+ return NULL;
+ }
+-
++/*
+ if (setjmp (png_ptr->jmpbuf)) {
+ png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+ return NULL;
+ }
++*/
+
+ png_init_io (png_ptr, f);
+ png_read_info (png_ptr, info_ptr);
+@@ -311,12 +312,12 @@
+ return NULL;
+ }
+
+- if (setjmp (lc->png_read_ptr->jmpbuf)) {
++/* if (setjmp (lc->png_read_ptr->jmpbuf)) {
+ if (lc->png_info_ptr)
+ png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
+ g_free(lc);
+ return NULL;
+- }
++ }*/
+
+ /* Create the auxiliary context struct */
+
+@@ -366,11 +367,11 @@
+ lc->max_row_seen_in_chunk = -1;
+
+ /* Invokes our callbacks as needed */
+- if (setjmp (lc->png_read_ptr->jmpbuf)) {
++/* if (setjmp (lc->png_read_ptr->jmpbuf)) {
+ return FALSE;
+- } else {
++ } else {*/
+ png_process_data(lc->png_read_ptr, lc->png_info_ptr, buf, size);
+- }
++/* }*/
+
+ if (lc->fatal_error_occurred)
+ return FALSE;
diff --git a/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r5.ebuild b/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r5.ebuild
new file mode 100644
index 0000000..d488cb0
--- /dev/null
+++ b/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r5.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r5.ebuild,v 1.3 2005/11/20 06:36:49 hardave Exp $
+
+#For the sake of virtualx compatibility (DS)
+EAPI=2
+
+inherit virtualx libtool gnome.org eutils
+
+DESCRIPTION="GNOME Image Library"
+HOMEPAGE="http://www.gtk.org/"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sparc x86"
+IUSE="doc mmx"
+
+RDEPEND="media-libs/jpeg
+ media-libs/tiff
+ =x11-libs/gtk+-1.2*
+ <media-libs/libpng-1.5
+ amd64? ( sys-libs/db )
+ !amd64? ( <sys-libs/db-2 )
+ >=gnome-base/gnome-libs-1.4.1.2-r1"
+# We need gnome-libs here, else gnome support do not get compiled into
+# gdk-pixbuf (the GnomeCanvasPixbuf library )
+DEPEND="${RDEPEND}
+ doc? ( dev-util/gtk-doc )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}-m4.patch
+ # security fix (#64230)
+ epatch "${FILESDIR}"/${P}-bmp_secure.patch
+ epatch "${FILESDIR}"/${P}-loaders.patch
+ # reject corrupt bmps (#64230)
+ epatch "${FILESDIR}"/${P}-bmp_reject_corrupt.patch
+
+ #update libtool, else we get the "relink bug"
+ elibtoolize
+}
+
+src_compile() {
+ local myconf=""
+ use mmx || myconf="${myconf} --disable-mmx"
+ econf \
+ --sysconfdir=/etc/X11/gdk-pixbuf \
+ $(use_enable doc gtk-doc) \
+ ${myconf} \
+ || die
+
+ #build needs to be able to
+ #connect to an X display.
+ Xemake || die
+}
+
+src_install() {
+ einstall \
+ sysconfdir=${D}/etc/X11/gdk-pixbuf \
+ localstatedir=${D}/var/lib || die
+
+ dosed -e "s:${D}::g" /usr/bin/gdk-pixbuf-config
+ #fix permissions on the loaders
+ chmod a+rx ${D}/usr/$(get_libdir)/gdk-pixbuf/loaders
+ chmod a+r ${D}/usr/$(get_libdir)/gdk-pixbuf/loaders/*
+
+ dodoc AUTHORS ChangeLog INSTALL README NEWS TODO
+}
diff --git a/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r6.ebuild b/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r6.ebuild
new file mode 100644
index 0000000..09a4598
--- /dev/null
+++ b/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r6.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r5.ebuild,v 1.3 2005/11/20 06:36:49 hardave Exp $
+
+#For the sake of virtualx compatibility (DS)
+EAPI=2
+
+inherit virtualx libtool gnome.org eutils
+
+DESCRIPTION="GNOME Image Library"
+HOMEPAGE="http://www.gtk.org/"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sparc x86"
+IUSE="doc mmx"
+
+RDEPEND="media-libs/jpeg
+ media-libs/tiff
+ =x11-libs/gtk+-1.2*
+ >=media-libs/libpng-1.5
+ amd64? ( sys-libs/db )
+ !amd64? ( <sys-libs/db-2 )
+ >=gnome-base/gnome-libs-1.4.1.2-r1"
+# We need gnome-libs here, else gnome support do not get compiled into
+# gdk-pixbuf (the GnomeCanvasPixbuf library )
+DEPEND="${RDEPEND}
+ doc? ( dev-util/gtk-doc )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}-m4.patch
+ # security fix (#64230)
+ epatch "${FILESDIR}"/${P}-bmp_secure.patch
+ epatch "${FILESDIR}"/${P}-loaders.patch
+ # reject corrupt bmps (#64230)
+ epatch "${FILESDIR}"/${P}-bmp_reject_corrupt.patch
+#SDS
+ epatch "${FILESDIR}"/gdk-pixbuf-ds-png.diff
+#EDS
+
+ #update libtool, else we get the "relink bug"
+ elibtoolize
+}
+
+src_compile() {
+ local myconf=""
+ use mmx || myconf="${myconf} --disable-mmx"
+ econf \
+ --sysconfdir=/etc/X11/gdk-pixbuf \
+ $(use_enable doc gtk-doc) \
+ ${myconf} \
+ || die
+
+ #build needs to be able to
+ #connect to an X display.
+ Xemake || die
+}
+
+src_install() {
+ einstall \
+ sysconfdir=${D}/etc/X11/gdk-pixbuf \
+ localstatedir=${D}/var/lib || die
+
+ dosed -e "s:${D}::g" /usr/bin/gdk-pixbuf-config
+ #fix permissions on the loaders
+ chmod a+rx ${D}/usr/$(get_libdir)/gdk-pixbuf/loaders
+ chmod a+r ${D}/usr/$(get_libdir)/gdk-pixbuf/loaders/*
+
+ dodoc AUTHORS ChangeLog INSTALL README NEWS TODO
+}
diff --git a/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r7.ebuild b/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r7.ebuild
new file mode 100644
index 0000000..137f850
--- /dev/null
+++ b/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r7.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/gdk-pixbuf/gdk-pixbuf-0.22.0-r5.ebuild,v 1.3 2005/11/20 06:36:49 hardave Exp $
+
+#For the sake of virtualx compatibility (DS)
+EAPI=2
+
+inherit virtualx libtool gnome.org eutils
+
+DESCRIPTION="GNOME Image Library"
+HOMEPAGE="http://www.gtk.org/"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sparc x86"
+IUSE="doc mmx"
+
+RDEPEND="virtual/jpeg:0
+ media-libs/tiff
+ =x11-libs/gtk+-1.2*
+ >=media-libs/libpng-1.5
+ amd64? ( sys-libs/db )
+ !amd64? ( <sys-libs/db-2 )
+ >=gnome-base/gnome-libs-1.4.1.2-r1"
+# We need gnome-libs here, else gnome support do not get compiled into
+# gdk-pixbuf (the GnomeCanvasPixbuf library )
+DEPEND="${RDEPEND}
+ doc? ( dev-util/gtk-doc )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}-m4.patch
+ # security fix (#64230)
+ epatch "${FILESDIR}"/${P}-bmp_secure.patch
+ epatch "${FILESDIR}"/${P}-loaders.patch
+ # reject corrupt bmps (#64230)
+ epatch "${FILESDIR}"/${P}-bmp_reject_corrupt.patch
+#SDS
+ epatch "${FILESDIR}"/gdk-pixbuf-ds-png.diff
+#EDS
+
+ #update libtool, else we get the "relink bug"
+ elibtoolize
+}
+
+src_compile() {
+ local myconf=""
+ use mmx || myconf="${myconf} --disable-mmx"
+ econf \
+ --sysconfdir=/etc/X11/gdk-pixbuf \
+ $(use_enable doc gtk-doc) \
+ ${myconf} \
+ || die
+
+ #build needs to be able to
+ #connect to an X display.
+ Xemake || die
+}
+
+src_install() {
+ einstall \
+ sysconfdir=${D}/etc/X11/gdk-pixbuf \
+ localstatedir=${D}/var/lib || die
+
+ dosed -e "s:${D}::g" /usr/bin/gdk-pixbuf-config
+ #fix permissions on the loaders
+ chmod a+rx ${D}/usr/$(get_libdir)/gdk-pixbuf/loaders
+ chmod a+r ${D}/usr/$(get_libdir)/gdk-pixbuf/loaders/*
+
+ dodoc AUTHORS ChangeLog INSTALL README NEWS TODO
+}
diff --git a/media-libs/id3lib/Manifest b/media-libs/id3lib/Manifest
new file mode 100644
index 0000000..615bfb9
--- /dev/null
+++ b/media-libs/id3lib/Manifest
@@ -0,0 +1,12 @@
+AUX 1.diff 717 RMD160 525c017d38a38a80feaed8ed37b84a8586ef0a81 SHA1 43e8e5a11c5890bf5dcfa1dcc983a9ada3ca3ee2 SHA256 9b90416204e0c83f9a919e3978239e58eceebe88ba22d5d365d32b0a8988cd27
+AUX id3lib-3.8.3-autoconf259.patch 1130 RMD160 bd5205973dfa31542935daa35ad04c6709c08b9d SHA1 6006f32d29461136ec029dda2ae7339fde6df1df SHA256 ffde572cb263cce4585292143a4396ebd12592ac34b398da19d1608f1c2374f9
+AUX id3lib-3.8.3-doxyinput.patch 977 RMD160 102b5cad0637776a26505d53d3722e549a7448d3 SHA1 b92df9fe9e7b0f124eba03d43a63b0da5b3718de SHA256 e7cd2eafe39229fee1195524872be3465d247590b7ead4a9cfa2178102a3d9ea
+AUX id3lib-3.8.3-gcc-4.3.patch 2971 RMD160 686fa49e1108684a652435afcc56fd062ed516a4 SHA1 d25b5e69e633e12f929e0d656b87f3f72b4b5849 SHA256 536f6bb5dddd48df3c7fc080c04f03a2053ab11429094f2f31d6e2d5f21a987e
+AUX id3lib-3.8.3-security.patch 1601 RMD160 165fcc3773343c36394207f833b9336859ec13f4 SHA1 e9a835fc14e8a83468206eba08ca4d5e0fc5e9c1 SHA256 aa5f4e12a0a625acd58199f3e2d8d6d39290480fea7767adbbc1f8379964e01c
+AUX id3lib-3.8.3-test_io.patch 281 RMD160 773e84752a84cd746def0ff4878f4b248d6611e6 SHA1 76f6bab888f1d47e75006f7bcb44df0205693d76 SHA256 cc124f8805bcb977a1673f0b04fff368dac1af70d78c21da6f0415ce067d7687
+AUX id3lib-3.8.3-unicode16.patch 1542 RMD160 1b60e40e5cb1f172e4020ba2b87a10b557521572 SHA1 f3644a7f637b65b46afdea04195c48cde03edcd7 SHA256 71c79002d9485965a3a93e87ecbd7fed8f89f64340433b7ccd263d21385ac969
+AUX id3lib-3.8.3-zlib.patch 833 RMD160 477f5e846ef7070bd3c10203bbaaa7eeaaedf6f2 SHA1 231721feb310f5ef6d820d1c1397e3605b5689cb SHA256 0b5531089422bda659deddcccf0562fcaa96529e74778065e35c848d6cf2a502
+AUX id3lib-ds-rcc.patch 4773 RMD160 b08e67f6d900e02a3de0e31ece6e6d15ace9c3e1 SHA1 67dfcfa4028d4ebd1a1f75c76b0861aa49db3296 SHA256 e9f54621938a9ea3657ca5a601141d4c7fb9adf4af23dea41eb61df9517ea3f8
+DIST id3lib-3.8.3.tar.gz 950726 RMD160 bfa2499ec649ed40815ad0a370c78eb1517952c4 SHA1 c92c880da41d1ec0b242745a901702ae87970838 SHA256 2749cc3c0cd7280b299518b1ddf5a5bcfe2d1100614519b68702230e26c7d079
+EBUILD id3lib-3.8.3-r5.ebuild 1312 RMD160 d643251d7f9d319931cecb64539761f976e79c30 SHA1 8d31263ea96c57fe3b93dc3ebfedf79ad5f09910 SHA256 633fb7d85cf94052f71f9ebe7d9012a6b9a1264470c40dc619a7bbd7098e9d9f
+EBUILD id3lib-3.8.3-r8.ebuild 1485 RMD160 c018b53e9a81bb8aa9cf9037f163f033f5108c28 SHA1 5eb6cf089c99cdb92efa0a084b428e36ecf32983 SHA256 864341b5f608079a51af2cd51de07dad4a0870ec56bf5146e0cdcf932dfd9a89
diff --git a/media-libs/id3lib/files/1.diff b/media-libs/id3lib/files/1.diff
new file mode 100644
index 0000000..7617737
--- /dev/null
+++ b/media-libs/id3lib/files/1.diff
@@ -0,0 +1,19 @@
+--- old 2008-09-17 11:32:53.000000000 +0200
++++ id3lib-ds-rcc.patch 2008-09-17 11:27:54.000000000 +0200
+@@ -93,9 +93,9 @@
+
+ libid3_la_LDFLAGS = \
+ + @LIBRCC_LIBS@ \
+- -lz \
+ -version-info $(LT_VERSION) \
+ -release $(LT_RELEASE) \
++ -export-dynamic
+ diff -dPNur id3lib-3.8.3-orig/src/rccpatch.cpp id3lib-3.8.3-new/src/rccpatch.cpp
+ --- id3lib-3.8.3-orig/src/rccpatch.cpp 1970-01-01 01:00:00.000000000 +0100
+ +++ id3lib-3.8.3-new/src/rccpatch.cpp 2005-07-19 22:10:47.000000000 +0200
+@@ -166,4 +166,4 @@
+ @@ -0,0 +1,3 @@
+ +void rccPatchFree();
+ +void rccPatchInit();
+-+char *rccPatchRecode(const char *str, size_t size_t, size_t *size_t);
+++char *rccPatchRecode(const char *str, size_t len, size_t *rlen);
diff --git a/media-libs/id3lib/files/id3lib-3.8.3-autoconf259.patch b/media-libs/id3lib/files/id3lib-3.8.3-autoconf259.patch
new file mode 100644
index 0000000..16921e1
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-3.8.3-autoconf259.patch
@@ -0,0 +1,31 @@
+Index: id3lib-3.8.3/configure.in
+===================================================================
+--- id3lib-3.8.3.orig/configure.in
++++ id3lib-3.8.3/configure.in
+@@ -168,7 +168,7 @@ if test $has_iconv = 1; then
+ iconv_oldstyle=1, iconv_oldstyle=0)
+ if test $iconv_oldstyle = 1; then
+ AC_MSG_RESULT(const char **)
+- AC_DEFINE(ID3LIB_ICONV_OLDSTYLE)
++ AC_DEFINE(ID3LIB_ICONV_OLDSTYLE, [], [Unknown])
+ #we'll check out the need of
+ #typecast in the call of iconv_open
+ AC_MSG_CHECKING(whether to typecast in iconv)
+@@ -184,7 +184,7 @@ if test $has_iconv = 1; then
+ iconv_cast=0, iconv_cast=1)
+ if test $iconv_cast = 1; then
+ AC_MSG_RESULT(yes)
+- AC_DEFINE(ID3LIB_ICONV_CAST_OK)
++ AC_DEFINE(ID3LIB_ICONV_CAST_OK, [], [Unknown])
+ else
+ AC_MSG_RESULT(no)
+ fi
+@@ -206,7 +206,7 @@ if test $has_iconv = 1; then
+ iconv_cast=0, iconv_cast=1)
+ if test $iconv_cast = 1; then
+ AC_MSG_RESULT(yes)
+- AC_DEFINE(ID3LIB_ICONV_CAST_OK)
++ AC_DEFINE(ID3LIB_ICONV_CAST_OK, [], [Unknown])
+ else
+ AC_MSG_RESULT(no)
+ fi
diff --git a/media-libs/id3lib/files/id3lib-3.8.3-doxyinput.patch b/media-libs/id3lib/files/id3lib-3.8.3-doxyinput.patch
new file mode 100644
index 0000000..b118f48
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-3.8.3-doxyinput.patch
@@ -0,0 +1,23 @@
+Index: id3lib-3.8.3/doc/Doxyfile
+===================================================================
+--- id3lib-3.8.3.orig/doc/Doxyfile
++++ id3lib-3.8.3/doc/Doxyfile
+@@ -262,17 +262,7 @@ WARN_FORMAT = "$file:$line: $
+ # with spaces.
+
+ INPUT = ../src \
+- ../include/id3/field.h \
+- ../include/id3/frame.h \
+- ../include/id3/globals.h \
+- ../include/id3/misc_support.h \
+- ../include/id3/reader.h \
+- ../include/id3/readers.h \
+- ../include/id3/sized_types.h \
+- ../include/id3/tag.h \
+- ../include/id3/tag.h \
+- ../include/id3/writer.h \
+- ../include/id3/writers.h
++ ../include/id3 \
+
+
+ # If the value of the INPUT tag contains directories, you can use the
diff --git a/media-libs/id3lib/files/id3lib-3.8.3-gcc-4.3.patch b/media-libs/id3lib/files/id3lib-3.8.3-gcc-4.3.patch
new file mode 100644
index 0000000..090dc0b
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-3.8.3-gcc-4.3.patch
@@ -0,0 +1,82 @@
+diff -Naur id3lib-3.8.3-orig/configure.in id3lib-3.8.3/configure.in
+--- id3lib-3.8.3-orig/configure.in 2008-03-05 18:03:25.000000000 -0600
++++ id3lib-3.8.3/configure.in 2008-03-05 18:15:42.000000000 -0600
+@@ -227,7 +227,6 @@
+ )
+ AC_CHECK_HEADERS( \
+ string \
+- iomanip.h \
+ ,,AC_MSG_ERROR([Missing a vital header file for id3lib])
+ )
+
+diff -Naur id3lib-3.8.3-orig/include/id3/id3lib_strings.h id3lib-3.8.3/include/id3/id3lib_strings.h
+--- id3lib-3.8.3-orig/include/id3/id3lib_strings.h 2008-03-05 18:19:46.000000000 -0600
++++ id3lib-3.8.3/include/id3/id3lib_strings.h 2008-03-05 18:19:38.000000000 -0600
+@@ -30,6 +30,7 @@
+ #define _ID3LIB_STRINGS_H_
+
+ #include <string>
++#include <cstring>
+
+ #if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000))
+ namespace std
+diff -Naur id3lib-3.8.3-orig/include/id3/writers.h id3lib-3.8.3/include/id3/writers.h
+--- id3lib-3.8.3-orig/include/id3/writers.h 2003-03-01 18:23:00.000000000 -0600
++++ id3lib-3.8.3/include/id3/writers.h 2008-03-05 18:23:05.000000000 -0600
+@@ -30,7 +30,7 @@
+
+ #include "id3/writer.h"
+ #include "id3/id3lib_streams.h"
+-//#include <string.h>
++#include <string.h>
+
+ class ID3_CPP_EXPORT ID3_OStreamWriter : public ID3_Writer
+ {
+diff -Naur id3lib-3.8.3-orig/examples/demo_convert.cpp id3lib-3.8.3/examples/demo_convert.cpp
+--- id3lib-3.8.3-orig/examples/demo_convert.cpp 2003-03-01 18:23:00.000000000 -0600
++++ id3lib-3.8.3/examples/demo_convert.cpp 2008-03-05 18:26:50.000000000 -0600
+@@ -84,7 +84,7 @@
+ }
+ }
+
+-int main( unsigned int argc, char * const argv[])
++int main( int argc, char * const argv[])
+ {
+ flags_t ulFlag = ID3TT_ALL;
+ gengetopt_args_info args;
+diff -Naur id3lib-3.8.3-orig/examples/demo_info.cpp id3lib-3.8.3/examples/demo_info.cpp
+--- id3lib-3.8.3-orig/examples/demo_info.cpp 2003-03-01 18:23:00.000000000 -0600
++++ id3lib-3.8.3/examples/demo_info.cpp 2008-03-05 18:27:40.000000000 -0600
+@@ -309,7 +309,7 @@
+
+ #define DEBUG
+
+-int main( unsigned int argc, char * const argv[])
++int main( int argc, char * const argv[])
+ {
+ ID3D_INIT_DOUT();
+
+diff -Naur id3lib-3.8.3-orig/examples/demo_tag.cpp id3lib-3.8.3/examples/demo_tag.cpp
+--- id3lib-3.8.3-orig/examples/demo_tag.cpp 2003-03-01 18:23:00.000000000 -0600
++++ id3lib-3.8.3/examples/demo_tag.cpp 2008-03-05 18:31:20.000000000 -0600
+@@ -46,7 +46,7 @@
+ os << "v2";
+ }
+
+-int main( unsigned int argc, char * const argv[])
++int main( int argc, char * const argv[])
+ {
+ int ulFlag = ID3TT_ID3;
+ ID3D_INIT_DOUT();
+diff -Naur id3lib-3.8.3-orig/examples/demo_copy.cpp id3lib-3.8.3/examples/demo_copy.cpp
+--- id3lib-3.8.3-orig/examples/demo_copy.cpp 2003-03-01 18:23:00.000000000 -0600
++++ id3lib-3.8.3/examples/demo_copy.cpp 2008-03-05 18:32:44.000000000 -0600
+@@ -81,7 +81,7 @@
+ }
+ }
+
+-int main( unsigned int argc, char * const argv[])
++int main( int argc, char * const argv[])
+ {
+ int ulFlag = ID3TT_ID3;
+ ID3D_INIT_DOUT();
diff --git a/media-libs/id3lib/files/id3lib-3.8.3-security.patch b/media-libs/id3lib/files/id3lib-3.8.3-security.patch
new file mode 100644
index 0000000..e56d32c
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-3.8.3-security.patch
@@ -0,0 +1,50 @@
+diff -ur id3lib-3.8.3.orig/src/tag_file.cpp id3lib-3.8.3/src/tag_file.cpp
+--- id3lib-3.8.3.orig/src/tag_file.cpp 2003-03-02 02:23:00.000000000 +0200
++++ id3lib-3.8.3/src/tag_file.cpp 2007-08-20 19:40:16.000000000 +0300
+@@ -242,8 +242,8 @@
+ strcpy(sTempFile, filename.c_str());
+ strcat(sTempFile, sTmpSuffix.c_str());
+
+-#if ((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP))
+- // This section is for Windows folk && gcc 3.x folk
++#if !defined(HAVE_MKSTEMP)
++ // This section is for Windows folk
+ fstream tmpOut;
+ createFile(sTempFile, tmpOut);
+
+@@ -257,7 +257,7 @@
+ tmpOut.write((char *)tmpBuffer, nBytes);
+ }
+
+-#else //((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP))
++#else //!defined(HAVE_MKSTEMP)
+
+ // else we gotta make a temp file, copy the tag into it, copy the
+ // rest of the old file after the tag, delete the old file, rename
+@@ -270,7 +270,7 @@
+ //ID3_THROW_DESC(ID3E_NoFile, "couldn't open temp file");
+ }
+
+- ofstream tmpOut(fd);
++ ofstream tmpOut(sTempFile);
+ if (!tmpOut)
+ {
+ tmpOut.close();
+@@ -285,14 +285,14 @@
+ uchar tmpBuffer[BUFSIZ];
+ while (file)
+ {
+- file.read(tmpBuffer, BUFSIZ);
++ file.read((char *)tmpBuffer, BUFSIZ);
+ size_t nBytes = file.gcount();
+- tmpOut.write(tmpBuffer, nBytes);
++ tmpOut.write((char *)tmpBuffer, nBytes);
+ }
+
+ close(fd); //closes the file
+
+-#endif ////((defined(__GNUC__) && __GNUC__ >= 3 ) || !defined(HAVE_MKSTEMP))
++#endif ////!defined(HAVE_MKSTEMP)
+
+ tmpOut.close();
+ file.close();
diff --git a/media-libs/id3lib/files/id3lib-3.8.3-test_io.patch b/media-libs/id3lib/files/id3lib-3.8.3-test_io.patch
new file mode 100644
index 0000000..b4a0d24
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-3.8.3-test_io.patch
@@ -0,0 +1,10 @@
+--- id3lib-3.8.3/examples/test_io.cpp.orig 2004-09-21 23:40:48.398826320 +0200
++++ id3lib-3.8.3/examples/test_io.cpp 2004-09-21 23:40:55.408760648 +0200
+@@ -16,6 +16,7 @@
+ using std::cerr;
+
+ using namespace dami;
++using namespace std;
+
+ int
+ main(size_t argc, const char** argv)
diff --git a/media-libs/id3lib/files/id3lib-3.8.3-unicode16.patch b/media-libs/id3lib/files/id3lib-3.8.3-unicode16.patch
new file mode 100644
index 0000000..b05d2cf
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-3.8.3-unicode16.patch
@@ -0,0 +1,39 @@
+diff -ruN id3lib-3.8.3.orig/ChangeLog id3lib-3.8.3/ChangeLog
+--- id3lib-3.8.3.orig/ChangeLog 2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3/ChangeLog 2006-02-22 00:33:59.946214472 +0100
+@@ -1,3 +1,8 @@
++2006-02-17 Jerome Couderc
++
++ * Patch from Spoon to fix UTF-16 writing bug
++ http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979
++
+ 2003-03-02 Sunday 17:38 Thijmen Klok <thijmen@id3lib.org>
+
+ * THANKS (1.20): added more people
+diff -ruN id3lib-3.8.3.orig/src/io_helpers.cpp id3lib-3.8.3/src/io_helpers.cpp
+--- id3lib-3.8.3.orig/src/io_helpers.cpp 2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3/src/io_helpers.cpp 2006-02-22 00:35:02.926639992 +0100
+@@ -363,11 +363,22 @@
+ // Write the BOM: 0xFEFF
+ unicode_t BOM = 0xFEFF;
+ writer.writeChars((const unsigned char*) &BOM, 2);
++ // Patch from Spoon : 2004-08-25 14:17
++ // http://sourceforge.net/tracker/index.php?func=detail&aid=1016290&group_id=979&atid=300979
++ // Wrong code
++ //for (size_t i = 0; i < size; i += 2)
++ //{
++ // unicode_t ch = (data[i] << 8) | data[i+1];
++ // writer.writeChars((const unsigned char*) &ch, 2);
++ //}
++ // Right code
++ unsigned char *pdata = (unsigned char *) data.c_str();
+ for (size_t i = 0; i < size; i += 2)
+ {
+- unicode_t ch = (data[i] << 8) | data[i+1];
++ unicode_t ch = (pdata[i] << 8) | pdata[i+1];
+ writer.writeChars((const unsigned char*) &ch, 2);
+ }
++ // End patch
+ }
+ return writer.getCur() - beg;
+ }
diff --git a/media-libs/id3lib/files/id3lib-3.8.3-zlib.patch b/media-libs/id3lib/files/id3lib-3.8.3-zlib.patch
new file mode 100644
index 0000000..177320b
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-3.8.3-zlib.patch
@@ -0,0 +1,23 @@
+diff -Naur id3lib-3.8.3.orig/Makefile.am id3lib-3.8.3/Makefile.am
+--- id3lib-3.8.3.orig/Makefile.am 2003-03-01 16:23:00.000000000 -0800
++++ id3lib-3.8.3/Makefile.am 2004-09-12 19:05:39.564456828 -0700
+@@ -28,7 +28,7 @@
+ endif
+
+ SUBDIRS = . m4 $(zlib_subdir) doc include id3com src examples
+-DIST_SUBDIRS = . m4 zlib doc include id3com src examples prj libprj
++DIST_SUBDIRS = . m4 $(zlib_subdir) doc include id3com src examples prj libprj
+
+ INCLUDES = @ID3LIB_DEBUG_FLAGS@
+
+diff -Naur id3lib-3.8.3.orig/src/Makefile.am id3lib-3.8.3/src/Makefile.am
+--- id3lib-3.8.3.orig/src/Makefile.am 2003-03-01 16:23:00.000000000 -0800
++++ id3lib-3.8.3/src/Makefile.am 2004-09-12 19:08:30.814149521 -0700
+@@ -77,6 +77,7 @@
+ endif
+
+ libid3_la_LDFLAGS = \
++ -lz \
+ -version-info $(LT_VERSION) \
+ -release $(LT_RELEASE) \
+ -export-dynamic
diff --git a/media-libs/id3lib/files/id3lib-ds-rcc.patch b/media-libs/id3lib/files/id3lib-ds-rcc.patch
new file mode 100644
index 0000000..90f770d
--- /dev/null
+++ b/media-libs/id3lib/files/id3lib-ds-rcc.patch
@@ -0,0 +1,169 @@
+diff -dPNur id3lib-3.8.3-orig/configure.in id3lib-3.8.3-new/configure.in
+--- id3lib-3.8.3-orig/configure.in 2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3-new/configure.in 2005-07-19 22:03:12.000000000 +0200
+@@ -217,6 +217,20 @@
+ LIBS="$LIBS $ICONV_LIB"
+ fi
+
++AC_CHECK_LIB(rcc, rccInit,[
++ AC_CHECK_HEADERS(librcc.h,[
++ LIBRCC_LIBS="-lrcc"
++ LIBRCC_INCLUDES="-DHAVE_LIBRCC"
++ ],[
++ LIBRCC_LIBS=""
++ LIBRCC_INCLUDES=""
++])],[
++ LIBRCC_LIBS=""
++ LIBRCC_INCLUDES=""
++])
++AC_SUBST(LIBRCC_LIBS)
++AC_SUBST(LIBRCC_INCLUDES)
++
+ dnl Check for c++ features
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+@@ -315,5 +329,5 @@
+ src/Makefile \
+ examples/Makefile \
+ prj/Makefile \
+- libprj/Makefile
++ libprj/Makefile
+ )
+diff -dPNur id3lib-3.8.3-orig/src/field_string_ascii.cpp id3lib-3.8.3-new/src/field_string_ascii.cpp
+--- id3lib-3.8.3-orig/src/field_string_ascii.cpp 2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3-new/src/field_string_ascii.cpp 2005-07-19 21:34:12.000000000 +0200
+@@ -27,6 +27,7 @@
+ #include "field_impl.h"
+ #include "id3/utils.h" // has <config.h> "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h"
+ #include "io_helpers.h"
++#include "rccpatch.h"
+
+ using namespace dami;
+
+@@ -92,8 +93,15 @@
+ buffer != NULL && maxLength > 0)
+ {
+ String data = this->GetText();
++ char *recoded = rccPatchRecode(data.data(), (size_t)data.size(), (size_t*)&size);
++ if (recoded) {
++ size = dami::min(maxLength, size);
++ ::memcpy(buffer, recoded, size);
++ free(recoded);
++ } else {
+ size = dami::min(maxLength, data.size());
+ ::memcpy(buffer, data.data(), size);
++ }
+ if (size < maxLength)
+ {
+ buffer[size] = '\0';
+diff -dPNur id3lib-3.8.3-orig/src/Makefile.am id3lib-3.8.3-new/src/Makefile.am
+--- id3lib-3.8.3-orig/src/Makefile.am 2003-03-02 01:23:00.000000000 +0100
++++ id3lib-3.8.3-new/src/Makefile.am 2005-07-19 21:38:31.000000000 +0200
+@@ -17,7 +17,7 @@
+ zlib_include =
+ endif
+
+-INCLUDES = \
++INCLUDES = @LIBRCC_INCLUDES@ \
+ @ID3LIB_DEBUG_FLAGS@ -I$(top_srcdir)/include/id3 -I$(top_srcdir)/include $(zlib_include)
+
+ noinst_HEADERS = \
+@@ -31,7 +31,8 @@
+ header_tag.h \
+ mp3_header.h \
+ tag_impl.h \
+- spec.h
++ spec.h \
++ rccpatch.h
+
+ id3lib_sources = \
+ c_wrapper.cpp \
+@@ -66,7 +67,8 @@
+ tag_parse_v1.cpp \
+ tag_render.cpp \
+ utils.cpp \
+- writers.cpp
++ writers.cpp \
++ rccpatch.cpp
+
+ lib_LTLIBRARIES = libid3.la
+
+@@ -77,6 +79,7 @@
+ endif
+
+ libid3_la_LDFLAGS = \
++ @LIBRCC_LIBS@ \
+ -lz \
+ -version-info $(LT_VERSION) \
+ -release $(LT_RELEASE) \
+diff -dPNur id3lib-3.8.3-orig/src/rccpatch.cpp id3lib-3.8.3-new/src/rccpatch.cpp
+--- id3lib-3.8.3-orig/src/rccpatch.cpp 1970-01-01 01:00:00.000000000 +0100
++++ id3lib-3.8.3-new/src/rccpatch.cpp 2005-07-19 22:10:47.000000000 +0200
+@@ -0,0 +1,60 @@
++#include <stdlib.h>
++
++#include "../config.h"
++
++#ifdef HAVE_LIBRCC
++# include <librcc.h>
++#endif /* HAVE_LIBRCC */
++
++
++#ifdef HAVE_LIBRCC
++# define ID3_CLASS 0
++# define OUT_CLASS 1
++static rcc_class classes[] = {
++ { "id3", RCC_CLASS_STANDARD, NULL, NULL, "ID3 Encoding", 0 },
++ { "out", RCC_CLASS_STANDARD, NULL, NULL, "Output Encoding", 0 },
++ { NULL, RCC_CLASS_STANDARD, NULL, NULL, NULL, 0 }
++};
++
++static int rcc_initialized = 0;
++#endif /* HAVE_LIBRCC */
++
++
++void rccPatchFree() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) {
++ rccFree();
++ rcc_initialized = 0;
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++void rccPatchInit() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) return;
++ rccInit();
++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
++ rccLoad(NULL, "xmms");
++ rccInitDb4(NULL, NULL, 0);
++ rcc_initialized = 1;
++#endif /* HAVE_LIBRCC */
++}
++
++static void rccPatchTryInit() {
++#ifdef HAVE_LIBRCC
++ if (!rcc_initialized) {
++ rccPatchInit();
++ if (rcc_initialized) atexit(rccPatchFree);
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++char *rccPatchRecode(const char *str, size_t len, size_t *rlen) {
++#ifdef HAVE_LIBRCC
++ char *res;
++ rccPatchTryInit();
++ return rccSizedRecode(NULL, ID3_CLASS, OUT_CLASS, str, len, rlen);
++#else
++ return NULL;
++#endif /* HAVE_LIBRCC */
++}
+diff -dPNur id3lib-3.8.3-orig/src/rccpatch.h id3lib-3.8.3-new/src/rccpatch.h
+--- id3lib-3.8.3-orig/src/rccpatch.h 1970-01-01 01:00:00.000000000 +0100
++++ id3lib-3.8.3-new/src/rccpatch.h 2005-07-19 21:34:51.000000000 +0200
+@@ -0,0 +1,3 @@
++void rccPatchFree();
++void rccPatchInit();
++char *rccPatchRecode(const char *str, size_t len, size_t *rlen);
diff --git a/media-libs/id3lib/id3lib-3.8.3-r5.ebuild b/media-libs/id3lib/id3lib-3.8.3-r5.ebuild
new file mode 100644
index 0000000..8ea2a33
--- /dev/null
+++ b/media-libs/id3lib/id3lib-3.8.3-r5.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header:
+
+inherit eutils
+
+MY_P=${P/_/}
+S=${WORKDIR}/${MY_P}
+
+DESCRIPTION="Id3 library for C/C++"
+HOMEPAGE="http://id3lib.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sparc x86"
+IUSE="doc rcc"
+
+RDEPEND="sys-libs/zlib
+ rcc? ( app-i18n/librcc )"
+
+DEPEND="${RDEPEND}
+ sys-devel/autoconf
+ sys-devel/libtool"
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+
+ epatch ${FILESDIR}/${P}-zlib.patch
+ epatch ${FILESDIR}/${P}-test_io.patch
+ use rcc && ( epatch ${FILESDIR}/id3lib-ds-rcc.patch || die )
+
+ export WANT_AUTOMAKE=1.6
+ export WANT_AUTOCONF=2.5
+
+ libtoolize --force --copy || die
+ aclocal || die
+ automake || die
+ autoconf || die
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "Install failed"
+ dosym /usr/$(get_libdir)/libid3-3.8.so.3 /usr/$(get_libdir)/libid3-3.8.so.0.0.0
+ dosym /usr/$(get_libdir)/libid3-3.8.so.0.0.0 /usr/$(get_libdir)/libid3-3.8.so.0
+
+ dodoc AUTHORS ChangeLog HISTORY INSTALL README THANKS TODO
+
+ # some example programs to be placed in docs dir.
+ if use doc; then
+ cp -a examples ${D}/usr/share/doc/${PF}/examples
+ cd ${D}/usr/share/doc/${PF}/examples
+ make distclean
+ fi
+}
diff --git a/media-libs/id3lib/id3lib-3.8.3-r8.ebuild b/media-libs/id3lib/id3lib-3.8.3-r8.ebuild
new file mode 100644
index 0000000..ff6998a
--- /dev/null
+++ b/media-libs/id3lib/id3lib-3.8.3-r8.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/id3lib/id3lib-3.8.3-r7.ebuild,v 1.1 2008/07/29 15:04:05 yngwin Exp $
+
+WANT_AUTOCONF="latest"
+WANT_AUTOMAKE="latest"
+
+inherit eutils autotools
+
+MY_P=${P/_/}
+S="${WORKDIR}"/${MY_P}
+
+DESCRIPTION="Id3 library for C/C++"
+HOMEPAGE="http://id3lib.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sh sparc x86 ~x86-fbsd"
+IUSE="doc rcc"
+
+RESTRICT="test"
+
+RDEPEND="sys-libs/zlib
+ rcc? ( app-i18n/librcc )"
+
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}-zlib.patch
+ epatch "${FILESDIR}"/${P}-test_io.patch
+ epatch "${FILESDIR}"/${P}-autoconf259.patch
+ epatch "${FILESDIR}"/${P}-doxyinput.patch
+ epatch "${FILESDIR}"/${P}-unicode16.patch
+ epatch "${FILESDIR}"/${P}-gcc-4.3.patch
+
+ # Security fix for bug 189610.
+ epatch "${FILESDIR}"/${P}-security.patch
+
+ use rcc && ( epatch "${FILESDIR}"/id3lib-ds-rcc.patch || die )
+
+ AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+ econf || die "econf failed."
+ emake || die "emake failed."
+
+ if use doc; then
+ cd doc/
+ doxygen Doxyfile || die "doxygen failed"
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "Install failed"
+ dodoc AUTHORS ChangeLog HISTORY README THANKS TODO
+
+ if use doc; then
+ dohtml -r doc
+ fi
+}
diff --git a/media-libs/imlib/Manifest b/media-libs/imlib/Manifest
new file mode 100644
index 0000000..8ef9bf5
--- /dev/null
+++ b/media-libs/imlib/Manifest
@@ -0,0 +1,9 @@
+AUX imlib-1.9.15-asneeded.patch 1120 SHA256 60f8a3f9bee11c0987b663ec86d48f208d7d96f35463f9babdd43389f466ce94 SHA512 d0cb21e5b7ecb928d25a6afbedbd40e5e2374ea33a3d546efdd65b26c0877d001985710462604c71a507c30f345f7e1a316719208e2d06c4a740e640a9b07cb3 WHIRLPOOL fd8c373299dddab50acd04b232df4780d6fb90e8a095ca2d09e6f624bcaf994eb56746ad2aef52e7f7ca872d4c8560547c0b44634e68974a4203b980447e5762
+AUX imlib-1.9.15-bpp16-CVE-2007-3568.patch 457 SHA256 f0097c1db200b19a3e8f06d85765dd8b8f757dd0bc6fd9bafa0c31cd9c14d8ec SHA512 545936b5620fea74993a079db0555780d612d38865b56845330e36b7d04327fd93eb31b2d7841cd050c54ca450e305e923fb7d779c9c9948158041ec2734cf2b WHIRLPOOL 6ab4e66d57fca46c138600189a1184475cd3c2cf3af579dd569c15c979f404e1a48e90532ee8b2f2320f5f63f64eab28625c84c7096a74e9a07b98d00518fbcc
+AUX imlib-1.9.15-fix-rendering.patch 3263 SHA256 7f5f8967ec52658e776a0a60a3a3c93d367ccf877d92569a9313e78bbd510604 SHA512 4e94da8de3f18b711bdfcf4184dbc2220ef566aa61b72c6139e490e55051b3090dc5330929b218f6fab1764c8c2ee8acdd630a0c64010b56b4b4f1b8c55c3f89 WHIRLPOOL d25d7be59ad63e97a8f12baf41532d1da4ea0b8cb004074c681e08e5c8c473fa4b68d46285e5cf7361601bb99d42b523c1299ffe5bdd7c69b120d8559de48d03
+AUX imlib-1.9.15-libpng15.patch 3785 SHA256 0306f872438822888d436f9e151e4875ffa3ee1b261f7a092738ea87e4ca589b SHA512 e7a6d48ef04fbcfcab998e6968130796ab3da1fd9def14ab2ccc713e0956f1f2be3f3a8f680ded5f00cb7ac9ea31d2f94de04aaa039ec5b03cece71f36f14294 WHIRLPOOL 72bc3ce8fa6bb86cbac53e6a0e2a346bc8906cbcec6e43f2f29f56e47d8fc0a2e1c13dbd43e079e77e7c450e1b5d6bc43e10c1c369d597a7d19b5018384e26ff
+AUX imlib-1.9.15.patch 2253 SHA256 43dd12dae7913475f968f35a4fa4b1ef4670451e58c712cbd6e5460f20fc9197 SHA512 4de2fb6e28a6b9da3f474153ef618aad199d1fe6e365670d3d2070afa5b123597f108cac0972454dbcf38b8d84a9a6eb8f011d92a9d754248af41e3abd799b6d WHIRLPOOL d5417943c318d6d9371f5826ccaa6ccee9d84ac128db5ea46ae7a570e9a64fba2de7ff0fbc6a935026defc5ef0c0a45c62ca0459c0f1211c96cf1451cc653bb2
+AUX imlib-security.patch 13040 SHA256 d67a7faa2dba8d361cf25b6fc8125c1da92f25b612bffe909daacdeda577dd57 SHA512 a75537267e9e276920fbc0360cd4832f727c6c9857401889bdb1466f3088c98e5ea2ef84a94a5873a3c12dda0b9aed36a5e2039fece87e51154a3b773d97aa5c WHIRLPOOL 5f892847f9aa86896ecefc50d77575066a4ae1e573a9d631247a104a8d51d1f907cfb405a5d19f3a738912140900843c916661399e469b5f44c5ac5efdab6121
+DIST gtk-1-for-imlib.m4.bz2 2742 SHA256 e024d822d64819e23f7ad7c8283086ffd1e112b859b4669f1624dda1c56d8c47 SHA512 83708af1c7d7cf10960463b785bad096d77e985be5907dd59c73c2cb86c4b89fb5453a02ffddca1519185b91d205dbd96c4c4c1df4da4b67e64bad413cd8a40e WHIRLPOOL 5490f53e1559b9f505cd0ac4b8d0a9c74d8cb323daf4e048b4123725b1f1c12dae936595a0173cdb9d74e2377f6c8942d14e783977d91e6d920342bd5d2e724e
+DIST imlib-1.9.15.tar.bz2 683242 SHA256 4e6a270308a9ae16586bfc133c1a3dfb2e56f431edb66aaa3a80e36e5ed84ce0 SHA512 f50d9141b3c54b44921aa09c0a5ea848aefaa904efdd6da132dace42604671f8dbd3e4b71a596f054f0db4525ba2002864b5e5b21f8805cf1b5514b661ac254a WHIRLPOOL b9127c602a69eb52ab2bbe66733e8d35c8311a6decf569dd3d63dcff8d1d69ca8ed5572fac4ab795685beef46fb039a68325b70e697e7257d4ee92ad2c4edde2
+EBUILD imlib-1.9.15-r99.ebuild 1690 SHA256 7ba14afc388532d466802c01c8e3c94a125ab0436db2098c3902c47d6bfc687d SHA512 ffd39f9e7b41c9bbd9b8039f6a4a998090f000f4666a683d9589e2cd9739bbbea5c780254513d38d39767f6c637df1c98d5453bac55ecfb235139c6781f6c5f3 WHIRLPOOL 5fcda324cb359a0c0ec3f69424af1ccea63f75ab54b6934771802cbaab3a24339ef40f94aba6a8d9c9bb4cac3066b5c97ca6ee9a03ab1d851715d722cbd1ab7b
diff --git a/media-libs/imlib/files/imlib-1.9.15-asneeded.patch b/media-libs/imlib/files/imlib-1.9.15-asneeded.patch
new file mode 100644
index 0000000..3b7dd8a
--- /dev/null
+++ b/media-libs/imlib/files/imlib-1.9.15-asneeded.patch
@@ -0,0 +1,38 @@
+This code is broken with the newer libtool. Just dropping it is more or less
+safe as in any case if libtool does not supports shared libraries it'll issue
+an error...
+
+Adding include is necessary for gcc-4.3.
+
+--- configure.in 2008-07-16 09:18:35 +0000
++++ configure.in 2008-07-16 09:18:43 +0000
+@@ -61,6 +61,7 @@
+ AC_TRY_RUN([
+ #include <glib.h>
+ #include <gmodule.h>
++#include <stdlib.h>
+ main ()
+ {
+ if (g_module_supported ())
+@@ -74,21 +74,6 @@
+ CFLAGS="$oCFLAGS"
+ fi
+
+-dnl Now we check to see if our libtool supports shared lib deps
+-dnl (in a rather ugly way even)
+-builddir=`pwd`
+-if $dynworks; then
+- imlib_libtool_config="$builddir/libtool --config"
+- imlib_deplibs_check=`$imlib_libtool_config | \
+- grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
+- sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
+- if test "x$imlib_deplibs_check" = "xnone" || \
+- test "x$imlib_deplibs_check" = "xunknown" || \
+- test "x$imlib_deplibs_check" = "x"; then
+- dynworks=false
+- fi
+-fi
+-
+ if $dynworks; then
+ AC_DEFINE(USE_GMODULE, 1, [ ])
+ GMODULE_LIBS="`glib-config --libs gmodule`"
diff --git a/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch b/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch
new file mode 100644
index 0000000..94595ff
--- /dev/null
+++ b/media-libs/imlib/files/imlib-1.9.15-bpp16-CVE-2007-3568.patch
@@ -0,0 +1,11 @@
+--- Imlib/load.c.orig 2007-08-13 23:06:20.000000000 -0300
++++ Imlib/load.c 2007-08-13 23:06:51.000000000 -0300
+@@ -645,7 +645,7 @@
+ planes = (int)word;
+ fread(&word, 2, 1, file);
+ bpp = (int)word;
+- if (bpp != 1 && bpp != 4 && bpp != 8 && bpp && 16 && bpp != 24 && bpp != 32)
++ if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32)
+ {
+ fprintf(stderr, "IMLIB ERROR: unknown bitdepth in file\n");
+ return NULL;
diff --git a/media-libs/imlib/files/imlib-1.9.15-fix-rendering.patch b/media-libs/imlib/files/imlib-1.9.15-fix-rendering.patch
new file mode 100644
index 0000000..6212ed3
--- /dev/null
+++ b/media-libs/imlib/files/imlib-1.9.15-fix-rendering.patch
@@ -0,0 +1,105 @@
+Michel Dänzer <daenzer AT debian.org>
+
+* The boolean value returned via the last parameter to XShmQueryVersion()
+ isn't honoured everywhere.
+* The init functions that take parameters allow the caller to enable shared
+ pixmaps when they aren't supported (or disabled by configuration files).
+
+
+These result in incorrect rendering when the MIT-SHM extension doesn't support
+shared pixmaps, e.g. using EXA with current versions of Xorg.
+
+http://bugs.gentoo.org/show_bug.cgi?id=197489
+
+diff -up -ru imlib-1.9.15.orig/gdk_imlib/misc.c imlib-1.9.15/gdk_imlib/misc.c
+--- imlib-1.9.15.orig/gdk_imlib/misc.c 2002-03-04 18:06:32.000000000 +0100
++++ imlib-1.9.15/gdk_imlib/misc.c 2007-10-28 14:00:04.000000000 +0100
+@@ -674,6 +674,10 @@ gdk_imlib_init_params(GdkImlibInitParams
+ visual = gdk_rgb_get_visual();
+ id->x.visual = GDK_VISUAL_XVISUAL(visual); /* the visual type */
+ id->x.depth = visual->depth; /* the depth of the screen in bpp */
++
++ id->x.shm = 0;
++ id->x.shmp = 0;
++ id->max_shm = 0;
+ #ifdef HAVE_SHM
+ if (XShmQueryExtension(id->x.disp))
+ {
+@@ -689,17 +693,14 @@ gdk_imlib_init_params(GdkImlibInitParams
+ id->x.last_xim = NULL;
+ id->x.last_sxim = NULL;
+ id->max_shm = 0x7fffffff;
+- if (XShmPixmapFormat(id->x.disp) == ZPixmap)
++ if ((XShmPixmapFormat(id->x.disp) == ZPixmap) &&
++ (pm == True))
+ id->x.shmp = 1;
+ }
+ }
+ }
+- else
+ #endif
+- {
+- id->x.shm = 0;
+- id->x.shmp = 0;
+- }
++
+ id->cache.on_image = 0;
+ id->cache.size_image = 0;
+ id->cache.num_image = 0;
+@@ -935,8 +936,8 @@ gdk_imlib_init_params(GdkImlibInitParams
+ }
+ if (p->flags & PARAMS_SHAREDPIXMAPS)
+ {
+- if (id->x.shm)
+- id->x.shmp = p->sharedpixmaps;
++ if (!p->sharedpixmaps)
++ id->x.shmp = 0;
+ }
+ if (p->flags & PARAMS_PALETTEOVERRIDE)
+ override = p->paletteoverride;
+diff -up -ru imlib-1.9.15.orig/Imlib/misc.c imlib-1.9.15/Imlib/misc.c
+--- imlib-1.9.15.orig/Imlib/misc.c 2004-09-21 02:22:59.000000000 +0200
++++ imlib-1.9.15/Imlib/misc.c 2007-10-28 14:00:23.000000000 +0100
+@@ -675,6 +675,10 @@ Imlib_init_with_params(Display * disp, I
+ id->x.root = DefaultRootWindow(disp); /* the root window id */
+ id->x.visual = DefaultVisual(disp, id->x.screen); /* the visual type */
+ id->x.depth = DefaultDepth(disp, id->x.screen); /* the depth of the screen in bpp */
++
++ id->x.shm = 0;
++ id->x.shmp = 0;
++ id->max_shm = 0;
+ #ifdef HAVE_SHM
+ if (XShmQueryExtension(id->x.disp))
+ {
+@@ -690,17 +694,14 @@ Imlib_init_with_params(Display * disp, I
+ id->x.last_xim = NULL;
+ id->x.last_sxim = NULL;
+ id->max_shm = 0x7fffffff;
+- if (XShmPixmapFormat(id->x.disp) == ZPixmap)
++ if ((XShmPixmapFormat(id->x.disp) == ZPixmap &&
++ (pm == True)))
+ id->x.shmp = 1;
+ }
+ }
+ }
+- else
+ #endif
+- {
+- id->x.shm = 0;
+- id->x.shmp = 0;
+- }
++
+ id->cache.on_image = 0;
+ id->cache.size_image = 0;
+ id->cache.num_image = 0;
+@@ -952,8 +953,8 @@ Imlib_init_with_params(Display * disp, I
+ }
+ if (p->flags & PARAMS_SHAREDPIXMAPS)
+ {
+- if (id->x.shm)
+- id->x.shmp = p->sharedpixmaps;
++ if (!p->sharedpixmaps)
++ id->x.shmp = 0;
+ }
+ if (p->flags & PARAMS_PALETTEOVERRIDE)
+ override = p->paletteoverride;
diff --git a/media-libs/imlib/files/imlib-1.9.15-libpng15.patch b/media-libs/imlib/files/imlib-1.9.15-libpng15.patch
new file mode 100644
index 0000000..7837cd4
--- /dev/null
+++ b/media-libs/imlib/files/imlib-1.9.15-libpng15.patch
@@ -0,0 +1,142 @@
+--- gdk_imlib/io-png.c
++++ gdk_imlib/io-png.c
+@@ -40,13 +40,13 @@
+ return NULL;
+ }
+
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+ }
+
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -275,13 +275,13 @@
+ return NULL;
+ }
+
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+ }
+
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -301,6 +301,9 @@
+ /* Setup Translators */
+ if (color_type == PNG_COLOR_TYPE_PALETTE)
+ png_set_expand(png_ptr);
++ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
++ png_set_expand(png_ptr);
++
+ png_set_strip_16(png_ptr);
+ png_set_packing(png_ptr);
+ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+@@ -440,13 +443,13 @@
+ return NULL;
+ }
+
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+ }
+
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -635,7 +638,7 @@
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ return 0;
+ }
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ fclose(f);
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+--- Imlib/load.c
++++ Imlib/load.c
+@@ -197,12 +197,12 @@
+ png_destroy_read_struct(&png_ptr, NULL, NULL);
+ return NULL;
+ }
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+ }
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+@@ -260,7 +260,8 @@
+ png_read_image(png_ptr, lines);
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ ptr = data;
+- if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
++ if (color_type == PNG_COLOR_TYPE_GRAY
++ || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ {
+ for (y = 0; y < *h; y++)
+ {
+@@ -285,6 +286,7 @@
+ }
+ }
+ }
++#if 0
+ else if (color_type == PNG_COLOR_TYPE_GRAY)
+ {
+ for (y = 0; y < *h; y++)
+@@ -300,6 +302,7 @@
+ }
+ }
+ }
++#endif
+ else
+ {
+ for (y = 0; y < *h; y++)
+--- Imlib/save.c
++++ Imlib/save.c
+@@ -342,7 +342,7 @@
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+ return 0;
+ }
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ fclose(f);
+ png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+--- Imlib/utils.c
++++ Imlib/utils.c
+@@ -1981,14 +1981,13 @@
+ png_destroy_read_struct(&png_ptr, NULL, NULL);
+ return NULL;
+ }
+-
+- if (setjmp(png_ptr->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
+ }
+
+- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA)
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return NULL;
diff --git a/media-libs/imlib/files/imlib-1.9.15.patch b/media-libs/imlib/files/imlib-1.9.15.patch
new file mode 100644
index 0000000..c78aea9
--- /dev/null
+++ b/media-libs/imlib/files/imlib-1.9.15.patch
@@ -0,0 +1,70 @@
+diff -ur imlib-1.9.15.orig/configure.in imlib-1.9.15/configure.in
+--- imlib-1.9.15.orig/configure.in 2004-09-23 04:13:45.000000000 +0300
++++ imlib-1.9.15/configure.in 2007-02-05 23:43:18.000000000 +0200
+@@ -17,11 +17,26 @@
+ dnl incase it is broken for example.
+ AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]], echo $enable_shm, enable_shm="yes")
+
++AC_ARG_ENABLE(gdk, [ --enable-gdk enable gdk_imlib compilation [default=yes]],[
++ if test x$enableval = xyes; then
++ disable_gdk="no"
++ else
++ disable_gdk="yes"
++ fi],disable_gdk=no)
++
++if test x$disable_gdk = xno; then
++ AC_MSG_RESULT(no)
++
+ AM_PATH_GTK(1.2.1,[
+ GDK_IMLIB="gdk_imlib utils"],[
+ GDK_IMLIB=""
+ AC_MSG_WARN([*** gdk_imlib will not be built ***])])
+
++else
++ AC_MSG_RESULT(yes)
++ GDK_IMLIB=""
++fi
++
+ AC_MSG_CHECKING(whether to build gmodulized imlib)
+
+ AC_ARG_ENABLE(modules, [ --disable-modules Disables dynamic module loading],[
+diff -ur imlib-1.9.15.orig/imlib-config.in imlib-1.9.15/imlib-config.in
+--- imlib-1.9.15.orig/imlib-config.in 2004-08-27 19:03:11.000000000 +0300
++++ imlib-1.9.15/imlib-config.in 2007-02-05 23:46:34.000000000 +0200
+@@ -46,15 +46,9 @@
+ echo @VERSION@
+ ;;
+ --cflags)
+- if test @includedir@ != /usr/include ; then
+- includes=-I@includedir@
+- fi
+ echo $includes @X_CFLAGS@
+ ;;
+ --cflags-gdk)
+- if test @includedir@ != /usr/include ; then
+- includes=-I@includedir@
+- fi
+ echo `@GTK_CONFIG@ --cflags` $includes @X_CFLAGS@
+ ;;
+ --libs)
+diff -ur imlib-1.9.15.orig/imlib.m4 imlib-1.9.15/imlib.m4
+--- imlib-1.9.15.orig/imlib.m4 2004-08-27 19:03:11.000000000 +0300
++++ imlib-1.9.15/imlib.m4 2007-02-05 23:42:57.000000000 +0200
+@@ -6,7 +6,7 @@
+ dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+ dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS
+ dnl
+-AC_DEFUN(AM_PATH_IMLIB,
++AC_DEFUN([AM_PATH_IMLIB],
+ [dnl
+ dnl Get the cflags and libraries from the imlib-config script
+ dnl
+@@ -164,7 +164,7 @@
+ ])
+
+ # Check for gdk-imlib
+-AC_DEFUN(AM_PATH_GDK_IMLIB,
++AC_DEFUN([AM_PATH_GDK_IMLIB],
+ [dnl
+ dnl Get the cflags and libraries from the imlib-config script
+ dnl
diff --git a/media-libs/imlib/files/imlib-security.patch b/media-libs/imlib/files/imlib-security.patch
new file mode 100644
index 0000000..c820270
--- /dev/null
+++ b/media-libs/imlib/files/imlib-security.patch
@@ -0,0 +1,510 @@
+diff -urN imlib-1.9.13.orig/Imlib/load.c imlib-1.9.13/Imlib/load.c
+--- imlib-1.9.13.orig/Imlib/load.c Wed Mar 13 19:06:29 2002
++++ imlib-1.9.13/Imlib/load.c Thu Sep 16 17:21:01 2004
+@@ -4,6 +4,8 @@
+ #include "Imlib_private.h"
+ #include <setjmp.h>
+
++#define G_MAXINT ((int) 0x7fffffff)
++
+ /* Split the ID - damages input */
+
+ static char *
+@@ -41,13 +43,17 @@
+
+ /*
+ * Make sure we don't wrap on our memory allocations
++ * we check G_MAXINT/4 because rend.c malloc's w * h * bpp
++ * + 3 is safety margin
+ */
+
+ void * _imlib_malloc_image(unsigned int w, unsigned int h)
+ {
+- if( w > 32767 || h > 32767)
+- return NULL;
+- return malloc(w * h * 3);
++ if (w <= 0 || w > 32767 ||
++ h <= 0 || h > 32767 ||
++ h >= (G_MAXINT/4 - 1) / w)
++ return NULL;
++ return malloc(w * h * 3 + 3);
+ }
+
+ #ifdef HAVE_LIBJPEG
+@@ -360,7 +366,9 @@
+ npix = ww * hh;
+ *w = (int)ww;
+ *h = (int)hh;
+- if(ww > 32767 || hh > 32767)
++ if (ww <= 0 || ww > 32767 ||
++ hh <= 0 || hh > 32767 ||
++ hh >= (G_MAXINT/sizeof(uint32)) / ww)
+ {
+ TIFFClose(tif);
+ return NULL;
+@@ -463,7 +471,7 @@
+ }
+ *w = gif->Image.Width;
+ *h = gif->Image.Height;
+- if (*h > 32767 || *w > 32767)
++ if (*h <= 0 || *h > 32767 || *w <= 0 || *w > 32767)
+ {
+ return NULL;
+ }
+@@ -965,7 +973,12 @@
+ comment = 0;
+ quote = 0;
+ context = 0;
++ memset(lookup, 0, sizeof(lookup));
++
+ line = malloc(lsz);
++ if (!line)
++ return NULL;
++
+ while (!done)
+ {
+ pc = c;
+@@ -994,25 +1007,25 @@
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", w, h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM files wth colors > 32766 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM files with characters per pixel > 5 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (*w > 32767)
++ if (*w <= 0 || *w > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image width > 32767 pixels for file\n");
+ free(line);
+ return NULL;
+ }
+- if (*h > 32767)
++ if (*h <= 0 || *h > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image height > 32767 pixels for file\n");
+ free(line);
+@@ -1045,11 +1058,13 @@
+ {
+ int slen;
+ int hascolor, iscolor;
++ int space;
+
+ iscolor = 0;
+ hascolor = 0;
+ tok[0] = 0;
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ s[0] = 0;
+ len = strlen(line);
+ strncpy(cmap[j].str, line, cpp);
+@@ -1072,10 +1087,10 @@
+ {
+ if (k >= len)
+ {
+- if (col[0])
+- strcat(col, " ");
+- if (strlen(col) + strlen(s) < sizeof(col))
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strcat(col, " "), space -= 1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ if (col[0])
+ {
+@@ -1105,14 +1120,17 @@
+ }
+ }
+ }
+- strcpy(tok, s);
++ if (slen < sizeof(tok));
++ strcpy(tok, s);
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ }
+ else
+ {
+- if (col[0])
+- strcat(col, " ");
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strcat(col, " "), space -=1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ }
+ }
+@@ -1341,12 +1359,12 @@
+ sscanf(s, "%i %i", w, h);
+ a = *w;
+ b = *h;
+- if (a > 32767)
++ if (a <= 0 || a > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image width > 32767 pixels for file\n");
+ return NULL;
+ }
+- if (b > 32767)
++ if (b <= 0 || b > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image height > 32767 pixels for file\n");
+ return NULL;
+diff -urN imlib-1.9.13.orig/Imlib/utils.c imlib-1.9.13/Imlib/utils.c
+--- imlib-1.9.13.orig/Imlib/utils.c Mon Mar 4 17:45:28 2002
++++ imlib-1.9.13/Imlib/utils.c Thu Sep 16 17:21:15 2004
+@@ -1496,36 +1496,56 @@
+ context = 0;
+ ptr = NULL;
+ end = NULL;
++ memset(lookup, 0, sizeof(lookup));
+
+ while (!done)
+ {
+ line = data[count++];
++ if (!line)
++ break;
++ line = strdup(line);
++ if (!line)
++ break;
++ len = strlen(line);
++ for (i = 0; i < len; ++i)
++ {
++ c = line[i];
++ if (c < 32)
++ line[i] = 32;
++ else if (c > 127)
++ line[i] = 127;
++ }
++
+ if (context == 0)
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", &w, &h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM data wth colors > 32766 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "IMLIB ERROR: XPM data with characters per pixel > 5 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (w > 32767)
++ if (w <= 0 || w > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image width > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (h > 32767)
++ if (h <= 0 || h > 32767)
+ {
+ fprintf(stderr, "IMLIB ERROR: Image height > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+ cmap = malloc(sizeof(struct _cmap) * ncolors);
+@@ -1533,6 +1553,7 @@
+ if (!cmap)
+ {
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->rgb_width = w;
+@@ -1542,6 +1563,7 @@
+ {
+ free(cmap);
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->alpha_data = NULL;
+@@ -1817,6 +1839,7 @@
+ }
+ if ((ptr) && ((ptr - im->rgb_data) >= w * h * 3))
+ done = 1;
++ free(line);
+ }
+ if (!transp)
+ {
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-gif.c imlib-1.9.13/gdk_imlib/io-gif.c
+--- imlib-1.9.13.orig/gdk_imlib/io-gif.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-gif.c Thu Sep 16 16:11:31 2004
+@@ -55,7 +55,7 @@
+ }
+ *w = gif->Image.Width;
+ *h = gif->Image.Height;
+- if(*h > 32767 || *w > 32767)
++ if(*h <= 0 || *h > 32767 || *w <= 0 || *w > 32767)
+ {
+ return NULL;
+ }
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-ppm.c imlib-1.9.13/gdk_imlib/io-ppm.c
+--- imlib-1.9.13.orig/gdk_imlib/io-ppm.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-ppm.c Thu Sep 16 16:13:13 2004
+@@ -53,12 +53,12 @@
+ sscanf(s, "%i %i", w, h);
+ a = *w;
+ b = *h;
+- if (a > 32767)
++ if (a <= 0 || a > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image width > 32767 pixels for file\n");
+ return NULL;
+ }
+- if (b > 32767)
++ if (b <= 0 || b > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image height > 32767 pixels for file\n");
+ return NULL;
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-tiff.c imlib-1.9.13/gdk_imlib/io-tiff.c
+--- imlib-1.9.13.orig/gdk_imlib/io-tiff.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-tiff.c Thu Sep 16 16:13:57 2004
+@@ -36,7 +36,9 @@
+ npix = ww * hh;
+ *w = (int)ww;
+ *h = (int)hh;
+- if(ww > 32767 || hh > 32767)
++ if (ww <= 0 || ww > 32767 ||
++ hh <= 0 || hh > 32767 ||
++ hh >= (G_MAXINT/sizeof(uint32)) / ww)
+ {
+ TIFFClose(tif);
+ return NULL;
+diff -urN imlib-1.9.13.orig/gdk_imlib/io-xpm.c imlib-1.9.13/gdk_imlib/io-xpm.c
+--- imlib-1.9.13.orig/gdk_imlib/io-xpm.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/io-xpm.c Thu Sep 16 17:08:24 2004
+@@ -40,8 +40,12 @@
+ context = 0;
+ i = j = 0;
+ cmap = NULL;
++ memset(lookup, 0, sizeof(lookup));
+
+ line = malloc(lsz);
++ if (!line)
++ return NULL;
++
+ while (!done)
+ {
+ pc = c;
+@@ -70,25 +74,25 @@
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", w, h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM files wth colors > 32766 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM files with characters per pixel > 5 not supported\n");
+ free(line);
+ return NULL;
+ }
+- if (*w > 32767)
++ if (*w <= 0 || *w > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image width > 32767 pixels for file\n");
+ free(line);
+ return NULL;
+ }
+- if (*h > 32767)
++ if (*h <= 0 || *h > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image height > 32767 pixels for file\n");
+ free(line);
+@@ -120,11 +124,13 @@
+ {
+ int slen;
+ int hascolor, iscolor;
++ int space;
+
+ hascolor = 0;
+ iscolor = 0;
+ tok[0] = 0;
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ s[0] = 0;
+ len = strlen(line);
+ strncpy(cmap[j].str, line, cpp);
+@@ -147,10 +153,10 @@
+ {
+ if (k >= len)
+ {
+- if (col[0])
+- strcat(col, " ");
+- if (strlen(col) + strlen(s) < sizeof(col))
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strncat(col, " ", space), space -= 1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ if (col[0])
+ {
+@@ -180,14 +186,17 @@
+ }
+ }
+ }
+- strcpy(tok, s);
++ if (slen < sizeof(tok))
++ strcpy(tok, s);
+ col[0] = 0;
++ space = sizeof(col) - 1;
+ }
+ else
+ {
+- if (col[0])
+- strcat(col, " ");
+- strcat(col, s);
++ if (col[0] && space > 0)
++ strcat(col, " "), space -= 1;
++ if (slen <= space)
++ strcat(col, s), space -= slen;
+ }
+ }
+ }
+diff -urN imlib-1.9.13.orig/gdk_imlib/misc.c imlib-1.9.13/gdk_imlib/misc.c
+--- imlib-1.9.13.orig/gdk_imlib/misc.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/misc.c Thu Sep 16 16:35:32 2004
+@@ -1355,11 +1355,16 @@
+
+ /*
+ * Make sure we don't wrap on our memory allocations
++ * we check G_MAX_INT/4 because rend.c malloc's w * h * bpp
++ * + 3 is safety margin
+ */
+
+ void *_gdk_malloc_image(unsigned int w, unsigned int h)
+ {
+- if( w > 32767 || h > 32767)
++ if (w <= 0 || w > 32767 ||
++ h <= 0 || h > 32767 ||
++ h >= (G_MAXINT/4 - 1) / w)
+ return NULL;
+- return malloc(w * h * 3);
++ return malloc(w * h * 3 + 3);
+ }
++
+diff -urN imlib-1.9.13.orig/gdk_imlib/utils.c imlib-1.9.13/gdk_imlib/utils.c
+--- imlib-1.9.13.orig/gdk_imlib/utils.c Mon Mar 4 17:26:51 2002
++++ imlib-1.9.13/gdk_imlib/utils.c Thu Sep 16 17:28:35 2004
+@@ -1236,36 +1236,56 @@
+ context = 0;
+ ptr = NULL;
+ end = NULL;
++ memset(lookup, 0, sizeof(lookup));
+
+ while (!done)
+ {
+ line = data[count++];
++ if (!line)
++ break;
++ line = strdup(line);
++ if (!line)
++ break;
++ len = strlen(line);
++ for (i = 0; i < len; ++i)
++ {
++ c = line[i];
++ if (c < 32)
++ line[i] = 32;
++ else if (c > 127)
++ line[i] = 127;
++ }
++
+ if (context == 0)
+ {
+ /* Header */
+ sscanf(line, "%i %i %i %i", &w, &h, &ncolors, &cpp);
+- if (ncolors > 32766)
++ if (ncolors <= 0 || ncolors > 32766)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM data wth colors > 32766 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (cpp > 5)
++ if (cpp <= 0 || cpp > 5)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: XPM data with characters per pixel > 5 not supported\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (w > 32767)
++ if (w <= 0 || w > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image width > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+- if (h > 32767)
++ if (h <= 0 || h > 32767)
+ {
+ fprintf(stderr, "gdk_imlib ERROR: Image height > 32767 pixels for data\n");
+ free(im);
++ free(line);
+ return NULL;
+ }
+ cmap = malloc(sizeof(struct _cmap) * ncolors);
+@@ -1273,6 +1293,7 @@
+ if (!cmap)
+ {
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->rgb_width = w;
+@@ -1282,6 +1303,7 @@
+ {
+ free(cmap);
+ free(im);
++ free(line);
+ return NULL;
+ }
+ im->alpha_data = NULL;
+@@ -1355,7 +1377,7 @@
+ strcpy(col + colptr, " ");
+ colptr++;
+ }
+- if (colptr + ls <= sizeof(col))
++ if (colptr + ls < sizeof(col))
+ {
+ strcpy(col + colptr, s);
+ colptr += ls;
+@@ -1558,6 +1580,7 @@
+ }
+ if ((ptr) && ((ptr - im->rgb_data) >= w * h * 3))
+ done = 1;
++ free(line);
+ }
+ if (!transp)
+ {
diff --git a/media-libs/imlib/imlib-1.9.15-r99.ebuild b/media-libs/imlib/imlib-1.9.15-r99.ebuild
new file mode 100644
index 0000000..940c65f
--- /dev/null
+++ b/media-libs/imlib/imlib-1.9.15-r99.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/imlib/imlib-1.9.15-r3.ebuild,v 1.7 2011/10/11 20:19:49 ssuominen Exp $
+
+EAPI=2
+inherit autotools eutils
+
+PVP=(${PV//[-\._]/ })
+DESCRIPTION="Image loading and rendering library"
+HOMEPAGE="http://ftp.acc.umu.se/pub/GNOME/sources/imlib/1.9/"
+SRC_URI="mirror://gnome/sources/${PN}/${PVP[0]}.${PVP[1]}/${P}.tar.bz2
+ mirror://gentoo/gtk-1-for-imlib.m4.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sh sparc x86 ~x86-fbsd"
+IUSE="doc static-libs"
+
+RDEPEND=">=media-libs/tiff-3.5.5
+ >=media-libs/giflib-4.1.0
+ >=media-libs/libpng-1.2.1
+ virtual/jpeg
+ x11-libs/libICE
+ x11-libs/libSM
+ x11-libs/libXext"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ # Fix aclocal underquoted definition warnings.
+ # Conditionalize gdk functions for bug 40453.
+ # Fix imlib-config for bug 3425.
+ epatch "${FILESDIR}"/${P}.patch
+ epatch "${FILESDIR}"/${PN}-security.patch #security #72681
+ epatch "${FILESDIR}"/${P}-bpp16-CVE-2007-3568.patch # security #201887
+ epatch "${FILESDIR}"/${P}-fix-rendering.patch #197489
+ epatch "${FILESDIR}"/${P}-asneeded.patch #207638
+ epatch "${FILESDIR}"/${P}-libpng15.patch #357167
+
+ mkdir m4 && cp "${WORKDIR}"/gtk-1-for-imlib.m4 m4
+
+ AT_M4DIR="m4" eautoreconf
+}
+
+src_configure() {
+ econf \
+ --sysconfdir=/etc/imlib \
+ $(use_enable static-libs static) \
+ --disable-gtktest
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ dodoc AUTHORS ChangeLog README
+ use doc && dohtml doc/*
+
+ # Punt unused files
+ rm -f "${D}"/usr/lib*/pkgconfig/imlibgdk.pc
+ find "${D}" -name '*.la' -exec rm -f {} +
+}
diff --git a/media-libs/libaudclient/Manifest b/media-libs/libaudclient/Manifest
new file mode 100644
index 0000000..c42905f
--- /dev/null
+++ b/media-libs/libaudclient/Manifest
@@ -0,0 +1,2 @@
+DIST libaudclient_3.5~rc2.orig.tar.bz2 91995 SHA256 57b59936adee309308bebe6d37709ea7e833e53529164cca0720a337c17f175a SHA512 8dd8e14caca7dd7d0aeb1bb710c95c487bf9c05ddb8c21ae8291cb05974d9c5875f42fd11d4f10c2e045b9dfcede87f9e8322454b07f50a8927782240896e951 WHIRLPOOL 79d15af62c3503c290d53abe85a020e7cf5e0733ad6c07979ff77cb66eb056ae4c0cf93a46f8c9336897c91303ec962e7dae1406f56eb7dcac9abb1b62300699
+EBUILD libaudclient-3.5_rc2.ebuild 497 SHA256 abad4db5cf9db6324f1bba03b2bd993c7c095c780986f18f4025ae4956287bd3 SHA512 c50e6aaa75d88304c23c3d49a3403bfef5a1fee6311e25e297da6845e8241bfeaaa45e00728840d2ec9c1ea0443e25cc87d196624475537ffd0bebe20a8adb48 WHIRLPOOL 1743fa411bf176255bd173348f2375c91c0b3ab73033007157efb71b26aad95b1999c7e34c6ef69a906f8f4ff160b1750f8600980e69edc6e1e89f0cd75b33e9
diff --git a/media-libs/libaudclient/libaudclient-3.5_rc2.ebuild b/media-libs/libaudclient/libaudclient-3.5_rc2.ebuild
new file mode 100644
index 0000000..8cf7848
--- /dev/null
+++ b/media-libs/libaudclient/libaudclient-3.5_rc2.ebuild
@@ -0,0 +1,25 @@
+inherit eutils
+
+DESCRIPTION="Obsoleted Audacious library for wmauda"
+HOMEPAGE="http://packages.debian.org/sid/libaudclient2"
+SRC_URI="http://darksoft.org/files/darklin/${PN}_3.5~rc2.orig.tar.bz2"
+
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+DEPEND=""
+
+S="${WORKDIR}/${PN}-3.5-rc2"
+
+src_unpack() {
+ unpack "${PN}_3.5~rc2.orig.tar.bz2" || die "unpacking failed"
+}
+
+src_compile() {
+ econf || die "econf failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall || die "install failed"
+}
diff --git a/media-libs/libid3tag/Manifest b/media-libs/libid3tag/Manifest
new file mode 100644
index 0000000..43abd1b
--- /dev/null
+++ b/media-libs/libid3tag/Manifest
@@ -0,0 +1,14 @@
+AUX 0.15.1b/libid3tag-0.15.1b-64bit-long.patch 567 RMD160 b045933419998fb569f5be661b03e7bc5d862003 SHA1 f9778590811a050384b9bf8827345b61999f0da3 SHA256 5f8b3d3419addf90977832b0a6e563acc2c8e243bb826ebb6d0ec573ec122e1b
+AUX 0.15.1b/libid3tag-0.15.1b-a_capella.patch 1365 RMD160 cc588ded6d7a1d69d91ca714854e29232954baaa SHA1 d2bd03350f13198a36a189cd1e9042aeed41a4e9 SHA256 07bb9a3fa3e0e7e74987725dc8eb29924e5177048d8d09e43bbd19b0e4ad09b8
+AUX 0.15.1b/libid3tag-0.15.1b-compat.patch 452 RMD160 e8a422004935e18c2217c9ac623d4895c17ad471 SHA1 8c179b10bf49385e4334aab141e4cf270cb02182 SHA256 88f486c3d263a4dd5bb556232dcfe2fba175b5124bcdd72aa6c30f562fc87d53
+AUX 0.15.1b/libid3tag-0.15.1b-file-write.patch 1344 RMD160 4f3179f4164559a64339ceaa522b6643d999332d SHA1 b7baae1c87f90aac64a4d17725b2eaad521e42af SHA256 eff855cabd8a51866a29246a1b257da64f46aab72d4b8e163e2a4c0d15165bf1
+AUX 0.15.1b/libid3tag-0.15.1b-fix_overflow.patch 324 RMD160 d6ecbbb97a76872791447102da61748b1ccdca7a SHA1 ed80bc74bd81caa225952f72a1a28d54300e43e3 SHA256 43ea3e0b324fb25802dae6410564c947ce1982243c781ef54b023f060c3b0ac4
+AUX 0.15.1b/libid3tag-0.15.1b-tag.patch 527 RMD160 5ec862828df4fe66e47047f135d2b52aba285a29 SHA1 b7ef9a41a31a37b8bb6d8e064b0c0ba618d3fa03 SHA256 ca7262ddad158ab0be804429d705f8c6a1bb120371dec593323fa4876c1b277f
+AUX 0.15.1b/libid3tag-0.15.1b-unknown-encoding.patch 879 RMD160 c4b4ac0a7d013fe06075ae7ebb7b7a9f93805159 SHA1 093def535edb3d2f5be6b173eedf0f93a1c0314c SHA256 8b695c9c05e3885655b2e798326b804011615bc6c831cd55cdbacc456a6b9494
+AUX 0.15.1b/libid3tag-0.15.1b-utf16.patchlibid3tag-0.15.1b-utf16.patch 753 RMD160 337a896343f79e83737048bd0e7f56bb5154eced SHA1 dcc01e31d5131c9be5a4dd7efe72b4fad46df9a5 SHA256 8d28c8cc163caebb4a7f927f2d80f317dfd6d8927e3235d19c006b3881f9447e
+AUX id3tag.pc 222 RMD160 f2ef95aaed166edc84d837854086ddbd45a7ff76 SHA1 db4be8657dc22311fa2ef63355261df26449a126 SHA256 46465c31b4e7e873f10f6e7ca3e642b55cb48a398a04dd3b0605d4fdd58d3c05
+AUX libid3tag-0.15.1b-ds-rcc.patch 7724 RMD160 0a0d3e46800c2f1652237290330adfae1e3d6d74 SHA1 6a72832d58579125f406857169f33bff1184241f SHA256 d975f85e5c5ebe52b272739f3b942738b4cc193ac2467aef054abc913bbbaee6
+DIST libid3tag-0.15.1b.tar.gz 338143 RMD160 31a69b8ad7684aefdb675acc8ebf89bd6f432095 SHA1 4d867e8a8436e73cd7762fe0e85958e35f1e4306 SHA256 63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151
+EBUILD libid3tag-0.15.1b-r1.ebuild 1183 RMD160 281f90e28bbdcae932665b366e6be97ec8d44376 SHA1 cbb985b15036c40ce78cb17918d28d0a02c2cbbd SHA256 fafa7c2f99b3adfecfb6440dccb536807f30b02c5a0ae3666b978365543ff80b
+EBUILD libid3tag-0.15.1b-r3.ebuild 1320 RMD160 d3d52658a2659f7c08346a9c8feb85e3fe403921 SHA1 0a9f460b27c9f70803ad105b2515a484e19547f8 SHA256 7d31b906c7dc9e0ce03dedb72a6ca106b8587dbd732e5c3f33d551f726472c13
+EBUILD libid3tag-0.15.1b-r4.ebuild 1354 RMD160 0e78b26192098715978c8d9bfbc7494d752f7acd SHA1 98617f2bb90fafc8353a77ae4ff5b024d5bf1070 SHA256 3ccf661153e1658f3188bd9e04baeed6d4e01ad01365476e39a4342a63e8510e
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-64bit-long.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-64bit-long.patch
new file mode 100644
index 0000000..852d9ef
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-64bit-long.patch
@@ -0,0 +1,24 @@
+--- id3tag.h.orig 2004-01-23 18:22:46.000000000 -0500
++++ id3tag.h 2008-05-04 19:46:33.000000000 -0400
+@@ -25,6 +25,8 @@
+ # ifndef LIBID3TAG_ID3TAG_H
+ # define LIBID3TAG_ID3TAG_H
+
++#include <stdint.h>
++
+ # ifdef __cplusplus
+ extern "C" {
+ # endif
+@@ -36,10 +38,10 @@
+ typedef unsigned char id3_byte_t;
+ typedef unsigned long id3_length_t;
+
+-typedef unsigned long id3_ucs4_t;
++typedef uint32_t id3_ucs4_t;
+
+ typedef unsigned char id3_latin1_t;
+-typedef unsigned short id3_utf16_t;
++typedef uint16_t id3_utf16_t;
+ typedef signed char id3_utf8_t;
+
+ struct id3_tag {
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-a_capella.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-a_capella.patch
new file mode 100644
index 0000000..a453080
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-a_capella.patch
@@ -0,0 +1,35 @@
+diff -urNad /home/debian/mad/libid3tag-0.15.1b/libid3tag-0.15.1b/genre.dat libid3tag-0.15.1b/genre.dat
+--- /home/debian/mad/libid3tag-0.15.1b/libid3tag-0.15.1b/genre.dat 2004-02-16 21:34:39.000000000 -0500
++++ libid3tag-0.15.1b/genre.dat 2004-09-06 09:50:33.000000000 -0400
+@@ -277,8 +277,8 @@
+ { 'P', 'u', 'n', 'k', ' ', 'R', 'o', 'c', 'k', 0 };
+ static id3_ucs4_t const genre_DRUM_SOLO[] =
+ { 'D', 'r', 'u', 'm', ' ', 'S', 'o', 'l', 'o', 0 };
+-static id3_ucs4_t const genre_A_CAPPELLA[] =
+- { 'A', ' ', 'C', 'a', 'p', 'p', 'e', 'l', 'l', 'a', 0 };
++static id3_ucs4_t const genre_A_CAPELLA[] =
++ { 'A', ' ', 'C', 'a', 'p', 'e', 'l', 'l', 'a', 0 };
+ static id3_ucs4_t const genre_EURO_HOUSE[] =
+ { 'E', 'u', 'r', 'o', '-', 'H', 'o', 'u', 's', 'e', 0 };
+ static id3_ucs4_t const genre_DANCE_HALL[] =
+@@ -452,7 +452,7 @@
+ genre_DUET,
+ genre_PUNK_ROCK,
+ genre_DRUM_SOLO,
+- genre_A_CAPPELLA,
++ genre_A_CAPELLA,
+ genre_EURO_HOUSE,
+ genre_DANCE_HALL,
+ genre_GOA,
+diff -urNad /home/debian/mad/libid3tag-0.15.1b/libid3tag-0.15.1b/genre.dat.in libid3tag-0.15.1b/genre.dat.in
+--- /home/debian/mad/libid3tag-0.15.1b/libid3tag-0.15.1b/genre.dat.in 2004-01-23 04:41:32.000000000 -0500
++++ libid3tag-0.15.1b/genre.dat.in 2004-09-06 09:50:33.000000000 -0400
+@@ -153,7 +153,7 @@
+ Duet
+ Punk Rock
+ Drum Solo
+-A Cappella
++A Capella
+ Euro-House
+ Dance Hall
+ Goa
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-compat.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-compat.patch
new file mode 100644
index 0000000..6ef1a22
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-compat.patch
@@ -0,0 +1,13 @@
+diff -ur libid3tag-0.15.1b/compat.gperf libid3tag-0.15.1b.fixed/compat.gperf
+--- libid3tag-0.15.1b/compat.gperf Fri Jan 23 01:41:32 2004
++++ libid3tag-0.15.1b.fixed/compat.gperf Thu Oct 19 12:21:10 2006
+@@ -237,6 +237,9 @@
+ encoding = id3_parse_uint(&data, 1);
+ string = id3_parse_string(&data, end - data, encoding, 0);
+
++ if (string == 0)
++ continue;
++
+ if (id3_ucs4_length(string) < 4) {
+ free(string);
+ continue;
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-file-write.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-file-write.patch
new file mode 100644
index 0000000..aa61d09
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-file-write.patch
@@ -0,0 +1,52 @@
+diff -ur -x '*.lo' -x '*.o' -x config.h -x config.log libid3tag-0.15.1b/file.c libid3tag-0.15.1b-fixed/file.c
+--- libid3tag-0.15.1b/file.c 2004-01-23 12:41:32.000000000 +0300
++++ libid3tag-0.15.1b-fixed/file.c 2005-05-24 23:34:08.000000000 +0400
+@@ -37,6 +37,10 @@
+ # include <assert.h>
+ # endif
+
++# ifdef HAVE_SYS_STAT_H
++# include <sys/stat.h>
++# endif
++
+ # include "id3tag.h"
+ # include "file.h"
+ # include "tag.h"
+@@ -575,6 +579,10 @@
+ int v2_write(struct id3_file *file,
+ id3_byte_t const *data, id3_length_t length)
+ {
++ struct stat st;
++ char *buffer;
++ id3_length_t datalen, offset;
++
+ assert(!data || length > 0);
+
+ if (data &&
+@@ -592,9 +600,25 @@
+ }
+
+ /* hard general case: rewrite entire file */
++ if (stat(file->path, &st) == -1)
++ return -1;
+
+- /* ... */
++ offset = file->tags ? file->tags[0].length : 0;
++ datalen = st.st_size - offset;
++ if ((buffer = (char *) malloc(datalen)) == NULL)
++ return -1;
+
++ if (fseek(file->iofile, offset, SEEK_SET) == -1 ||
++ fread(buffer, datalen, 1, file->iofile) != 1 ||
++ fseek(file->iofile, 0, SEEK_SET) == -1 ||
++ fwrite(data, length, 1, file->iofile) != 1 ||
++ fwrite(buffer, datalen, 1, file->iofile) != 1 ||
++ fflush(file->iofile) == EOF) {
++ free(buffer);
++ return -1;
++ }
++ free(buffer);
++
+ done:
+ return 0;
+ }
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-fix_overflow.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-fix_overflow.patch
new file mode 100644
index 0000000..26c54c5
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-fix_overflow.patch
@@ -0,0 +1,11 @@
+--- field.c.orig 2008-05-05 09:49:15.000000000 -0400
++++ field.c 2008-05-05 09:49:25.000000000 -0400
+@@ -291,7 +291,7 @@
+
+ end = *ptr + length;
+
+- while (end - *ptr > 0) {
++ while (end - *ptr > 0 && **ptr != '\0') {
+ ucs4 = id3_parse_string(ptr, end - *ptr, *encoding, 0);
+ if (ucs4 == 0)
+ goto fail;
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-tag.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-tag.patch
new file mode 100644
index 0000000..2badfb3
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-tag.patch
@@ -0,0 +1,17 @@
+--- tag.c.orig Fri Apr 18 18:14:33 2003
++++ tag.c Mon Sep 26 22:29:24 2005
+@@ -714,9 +714,12 @@
+
+ frame = id3_tag_findframe(tag, ID3_FRAME_TRACK, 0);
+ if (frame) {
+- unsigned int track;
++ id3_ucs4_t const *string;
++ unsigned int track = 0;
+
+- track = id3_ucs4_getnumber(id3_field_getstrings(&frame->fields[1], 0));
++ string = id3_field_getstrings(&frame->fields[1], 0);
++ if (string)
++ track = id3_ucs4_getnumber(string);
+ if (track > 0 && track <= 0xff) {
+ ptr[-2] = 0;
+ ptr[-1] = track;
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-unknown-encoding.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-unknown-encoding.patch
new file mode 100644
index 0000000..7c70d00
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-unknown-encoding.patch
@@ -0,0 +1,27 @@
+diff -urNad libid3tag-0.15.1b~/compat.gperf libid3tag-0.15.1b/compat.gperf
+--- libid3tag-0.15.1b~/compat.gperf 2004-01-23 09:41:32.000000000 +0000
++++ libid3tag-0.15.1b/compat.gperf 2007-01-14 14:36:53.000000000 +0000
+@@ -236,6 +236,10 @@
+
+ encoding = id3_parse_uint(&data, 1);
+ string = id3_parse_string(&data, end - data, encoding, 0);
++ if (!string)
++ {
++ continue;
++ }
+
+ if (id3_ucs4_length(string) < 4) {
+ free(string);
+diff -urNad libid3tag-0.15.1b~/parse.c libid3tag-0.15.1b/parse.c
+--- libid3tag-0.15.1b~/parse.c 2004-01-23 09:41:32.000000000 +0000
++++ libid3tag-0.15.1b/parse.c 2007-01-14 14:37:34.000000000 +0000
+@@ -165,6 +165,9 @@
+ case ID3_FIELD_TEXTENCODING_UTF_8:
+ ucs4 = id3_utf8_deserialize(ptr, length);
+ break;
++ default:
++ /* FIXME: Unknown encoding! Print warning? */
++ return NULL;
+ }
+
+ if (ucs4 && !full) {
diff --git a/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-utf16.patchlibid3tag-0.15.1b-utf16.patch b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-utf16.patchlibid3tag-0.15.1b-utf16.patch
new file mode 100644
index 0000000..72ed118
--- /dev/null
+++ b/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-utf16.patchlibid3tag-0.15.1b-utf16.patch
@@ -0,0 +1,22 @@
+diff -urNad libid3tag-0.15.1b/utf16.c /tmp/dpep.tKvO7a/libid3tag-0.15.1b/utf16.c
+--- libid3tag-0.15.1b/utf16.c 2006-01-13 15:26:29.000000000 +0100
++++ /tmp/dpep.tKvO7a/libid3tag-0.15.1b/utf16.c 2006-01-13 15:27:19.000000000 +0100
+@@ -282,5 +282,18 @@
+
+ free(utf16);
+
++ if (end == *ptr && length % 2 != 0)
++ {
++ /* We were called with a bogus length. It should always
++ * be an even number. We can deal with this in a few ways:
++ * - Always give an error.
++ * - Try and parse as much as we can and
++ * - return an error if we're called again when we
++ * already tried to parse everything we can.
++ * - tell that we parsed it, which is what we do here.
++ */
++ (*ptr)++;
++ }
++
+ return ucs4;
+ }
diff --git a/media-libs/libid3tag/files/id3tag.pc b/media-libs/libid3tag/files/id3tag.pc
new file mode 100644
index 0000000..01678db
--- /dev/null
+++ b/media-libs/libid3tag/files/id3tag.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: id3tag
+Description: ID3 tag reading library
+Requires:
+Version: 0.15.0b
+Libs: -L${libdir} -lid3tag -lz
+Cflags: -L${includedir}
diff --git a/media-libs/libid3tag/files/libid3tag-0.15.1b-ds-rcc.patch b/media-libs/libid3tag/files/libid3tag-0.15.1b-ds-rcc.patch
new file mode 100644
index 0000000..4641f3d
--- /dev/null
+++ b/media-libs/libid3tag/files/libid3tag-0.15.1b-ds-rcc.patch
@@ -0,0 +1,300 @@
+diff -dPNur libid3tag-0.15.1b/configure.ac libid3tag-0.15.1b-ds/configure.ac
+--- libid3tag-0.15.1b/configure.ac 2004-01-24 00:22:46.000000000 +0100
++++ libid3tag-0.15.1b-ds/configure.ac 2008-04-12 21:36:35.000000000 +0200
+@@ -145,6 +145,22 @@
+ *** environment variable to specify its installed location, e.g. -L<dir>.])
+ ])
+
++
++AC_CHECK_LIB(rcc, rccInit,[
++ AC_CHECK_HEADERS(librcc.h,[
++ LIBRCC_LIBS="-lrcc"
++ LIBRCC_INCLUDES="-DHAVE_LIBRCC"
++ ],[
++ LIBRCC_LIBS=""
++ LIBRCC_INCLUDES=""
++])],[
++ LIBRCC_LIBS=""
++ LIBRCC_INCLUDES=""
++])
++AC_SUBST(LIBRCC_LIBS)
++AC_SUBST(LIBRCC_INCLUDES)
++
++
+ dnl handle --enable and --disable options
+
+ AC_CACHE_SAVE
+diff -dPNur libid3tag-0.15.1b/latin1.c libid3tag-0.15.1b-ds/latin1.c
+--- libid3tag-0.15.1b/latin1.c 2004-01-23 10:41:32.000000000 +0100
++++ libid3tag-0.15.1b-ds/latin1.c 2008-04-12 21:36:35.000000000 +0200
+@@ -31,6 +31,9 @@
+ # include "latin1.h"
+ # include "ucs4.h"
+
++# include "utf8.h"
++# include "rccpatch.h"
++
+ /*
+ * NAME: latin1->length()
+ * DESCRIPTION: return the number of ucs4 chars represented by a latin1 string
+@@ -172,6 +175,11 @@
+ id3_length_t size = 0;
+ id3_latin1_t latin1[1], *out;
+
++/*
++ Theoretically, we should add here a code for converting ucs4 to
++ recoded latin1 string. However, using non-standard latin1 tags
++ in ID3v.2 tags is completely idiotic. So, I'll not do that.
++*/
+ while (*ucs4) {
+ switch (id3_latin1_encodechar(out = latin1, *ucs4++)) {
+ case 1: size += id3_latin1_put(ptr, *out++);
+@@ -193,6 +201,7 @@
+ {
+ id3_byte_t const *end;
+ id3_latin1_t *latin1ptr, *latin1;
++ id3_utf8_t *utf8;
+ id3_ucs4_t *ucs4;
+
+ end = *ptr + length;
+@@ -207,6 +216,19 @@
+
+ *latin1ptr = 0;
+
++
++ utf8 = rccPatchLatin2UTF(latin1);
++ if (utf8) {
++ ucs4 = malloc((id3_utf8_length(utf8) + 1) * sizeof(*ucs4));
++ if (ucs4)
++ id3_utf8_decode(utf8, ucs4);
++ free(utf8);
++ free(latin1);
++
++
++ return ucs4;
++ }
++
+ ucs4 = malloc((id3_latin1_length(latin1) + 1) * sizeof(*ucs4));
+ if (ucs4)
+ id3_latin1_decode(latin1, ucs4);
+diff -dPNur libid3tag-0.15.1b/Makefile.am libid3tag-0.15.1b-ds/Makefile.am
+--- libid3tag-0.15.1b/Makefile.am 2004-02-17 03:11:28.000000000 +0100
++++ libid3tag-0.15.1b-ds/Makefile.am 2008-04-12 21:36:35.000000000 +0200
+@@ -81,6 +81,7 @@
+ libid3tag_la_SOURCES = version.c ucs4.c latin1.c utf16.c utf8.c \
+ parse.c render.c field.c frametype.c compat.c \
+ genre.c frame.c crc.c util.c tag.c file.c \
++ rccpatch.c rccpatch.h \
+ version.h ucs4.h latin1.h utf16.h utf8.h \
+ parse.h render.h field.h frametype.h compat.h \
+ genre.h frame.h crc.h util.h tag.h file.h \
+@@ -90,7 +91,8 @@
+ frametype.gperf compat.gperf genre.dat.in \
+ debug.c debug.h
+
+-libid3tag_la_LDFLAGS = -version-info $(version_info)
++INCLUDES = @LIBRCC_INCLUDES@
++libid3tag_la_LDFLAGS = -version-info $(version_info) @LIBRCC_LIBS@
+
+ BUILT_SOURCES = frametype.c compat.c genre.dat
+
+diff -dPNur libid3tag-0.15.1b/rccpatch.c libid3tag-0.15.1b-ds/rccpatch.c
+--- libid3tag-0.15.1b/rccpatch.c 1970-01-01 01:00:00.000000000 +0100
++++ libid3tag-0.15.1b-ds/rccpatch.c 2008-04-12 21:36:35.000000000 +0200
+@@ -0,0 +1,96 @@
++#include <stdlib.h>
++#include "rccpatch.h"
++
++#ifdef HAVE_LIBRCC
++# include <librcc.h>
++#endif /* HAVE_LIBRCC */
++
++
++#ifdef HAVE_LIBRCC
++# define ID3_CLASS 0
++# define ID3V2_CLASS 1
++# define UTF_CLASS 2
++# define OUT_CLASS 3
++static rcc_class classes[] = {
++ { "id3", RCC_CLASS_STANDARD, NULL, NULL, "ID3 Encoding", 0 },
++ { "id3v2", RCC_CLASS_STANDARD, "id3", NULL, "ID3 v.2 Encoding", 0 },
++ { "utf", RCC_CLASS_KNOWN, "UTF-8", NULL, "Unicode Encoding", 0},
++ { "out", RCC_CLASS_TRANSLATE_LOCALE, "LC_CTYPE", NULL, "Output Encoding", 0 },
++ { NULL, RCC_CLASS_STANDARD, NULL, NULL, NULL, 0 }
++};
++
++static int rcc_initialized = 0;
++
++static rcc_context ctx = NULL;
++#endif /* HAVE_LIBRCC */
++
++
++void rccPatchFree() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) {
++ rccFree();
++ rcc_initialized = 0;
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++void rccPatchInit() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) return;
++ rccInit();
++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
++ rccLoad(NULL, "xmms");
++ rccInitDb4(NULL, NULL, 0);
++ rcc_initialized = 1;
++#endif /* HAVE_LIBRCC */
++}
++
++void rccPatchSetContext(void *newctx) {
++#ifdef HAVE_LIBRCC
++ if (newctx) {
++ ctx = (rcc_context)newctx;
++ rcc_initialized = 1;
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++static void rccPatchTryInit() {
++#ifdef HAVE_LIBRCC
++ if (!rcc_initialized) {
++ rccPatchInit();
++ if (rcc_initialized) atexit(rccPatchFree);
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++
++id3_utf8_t *rccPatchLatin2UTF(id3_latin1_t *str) {
++#ifdef HAVE_LIBRCC
++ rccPatchTryInit();
++
++ return rccRecode(ctx, ID3_CLASS, UTF_CLASS, str);
++#else
++ return NULL;
++#endif /* HAVE_LIBRCC */
++}
++
++id3_latin1_t *rccPatchUTF2Latin(id3_utf8_t *str) {
++#ifdef HAVE_LIBRCC
++ rccPatchTryInit();
++
++ return rccRecode(ctx, UTF_CLASS, ID3_CLASS, str);
++#else
++ return NULL;
++#endif /* HAVE_LIBRCC */
++}
++
++id3_latin1_t *rccPatchUTF2Out(id3_utf8_t *str) {
++#ifdef HAVE_LIBRCC
++ rccPatchTryInit();
++
++ return rccRecode(ctx, UTF_CLASS, OUT_CLASS, str);
++#else
++ return NULL;
++#endif /* HAVE_LIBRCC */
++}
++
+diff -dPNur libid3tag-0.15.1b/rccpatch.h libid3tag-0.15.1b-ds/rccpatch.h
+--- libid3tag-0.15.1b/rccpatch.h 1970-01-01 01:00:00.000000000 +0100
++++ libid3tag-0.15.1b-ds/rccpatch.h 2008-04-12 21:36:35.000000000 +0200
+@@ -0,0 +1,15 @@
++#ifndef _RCC_PATCH_H
++#define _RCC_PATCH_H
++
++#include "id3tag.h"
++
++void rccPatchFree();
++void rccPatchInit();
++void rccPatchSetContext(void *newctx);
++
++id3_utf8_t *rccPatchLatin2UTF(id3_latin1_t *str);
++id3_latin1_t *rccPatchUTF2Latin(id3_utf8_t *str);
++id3_latin1_t *rccPatchUTF2Out(id3_utf8_t *str);
++
++
++#endif /* _RCC_PATCH_H */
+diff -dPNur libid3tag-0.15.1b/tag.c libid3tag-0.15.1b-ds/tag.c
+--- libid3tag-0.15.1b/tag.c 2004-02-17 03:04:10.000000000 +0100
++++ libid3tag-0.15.1b-ds/tag.c 2008-04-12 21:37:12.000000000 +0200
+@@ -45,6 +45,9 @@
+ # include "field.h"
+ # include "util.h"
+
++# include "utf8.h"
++# include "rccpatch.h"
++
+ /*
+ * NAME: tag->new()
+ * DESCRIPTION: allocate and return a new, empty tag
+@@ -335,6 +338,8 @@
+ {
+ struct id3_frame *frame;
+ id3_ucs4_t ucs4[31];
++
++ id3_utf8_t *utf8;
+
+ if (text) {
+ trim(text);
+@@ -350,9 +355,15 @@
+ ID3_FIELD_TEXTENCODING_ISO_8859_1) == -1)
+ goto fail;
+
+- if (text)
++ if (text) {
++ utf8 = rccPatchLatin2UTF(text);
++ if (utf8) {
++ if (strlen(utf8) > 30) utf8[30] = 0;
++ id3_utf8_decode(utf8, ucs4);
++ free(utf8);
++ } else
+ id3_latin1_decode(text, ucs4);
+- else
++ } else
+ id3_ucs4_putnumber(ucs4, number);
+
+ if (strcmp(id, ID3_FRAME_COMMENT) == 0) {
+diff -dPNur libid3tag-0.15.1b/ucs4.c libid3tag-0.15.1b-ds/ucs4.c
+--- libid3tag-0.15.1b/ucs4.c 2004-01-23 10:41:32.000000000 +0100
++++ libid3tag-0.15.1b-ds/ucs4.c 2008-04-12 21:36:35.000000000 +0200
+@@ -33,6 +33,9 @@
+ # include "utf16.h"
+ # include "utf8.h"
+
++# include <string.h>
++# include "rccpatch.h"
++
+ id3_ucs4_t const id3_ucs4_empty[] = { 0 };
+
+ /*
+@@ -125,6 +128,27 @@
+ {
+ id3_latin1_t *latin1;
+
++
++ id3_latin1_t *ltmp;
++ id3_utf8_t *utf8;
++
++ utf8 = malloc(id3_ucs4_utf8size(ucs4) * sizeof(*utf8));
++ if (utf8) {
++ id3_utf8_encode(utf8, ucs4);
++ ltmp = rccPatchUTF2Out(utf8);
++ free(utf8);
++
++ if (ltmp) {
++ latin1 = malloc((1+strlen(ltmp))*sizeof(char));
++ if (latin1) {
++ memcpy(latin1, ltmp, (1+strlen(ltmp)));
++ free(ltmp);
++ return release(latin1);
++ }
++ free(ltmp);
++ }
++ }
++
+ latin1 = malloc(id3_ucs4_latin1size(ucs4) * sizeof(*latin1));
+ if (latin1)
+ id3_latin1_encode(latin1, ucs4);
diff --git a/media-libs/libid3tag/libid3tag-0.15.1b-r1.ebuild b/media-libs/libid3tag/libid3tag-0.15.1b-r1.ebuild
new file mode 100644
index 0000000..ef16925
--- /dev/null
+++ b/media-libs/libid3tag/libid3tag-0.15.1b-r1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/libid3tag/libid3tag-0.15.1b.ebuild,v 1.24 2006/10/04 17:34:19 grobian Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="The MAD id3tag library"
+HOMEPAGE="http://www.underbit.com/products/mad/"
+SRC_URI="mirror://sourceforge/mad/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sh sparc x86 ~x86-fbsd"
+IUSE="debug"
+
+DEPEND=">=sys-libs/zlib-1.1.3"
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ epunt_cxx #74489
+
+#SDS
+ epatch "${FILESDIR}"/libid3tag-0.15.1b-ds-rcc.patch
+ libtoolize --copy --force
+ aclocal
+ automake
+ autoconf
+#EDS
+}
+
+src_compile() {
+ econf $(use_enable debug debugging) || die "configure failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ make install DESTDIR="${D}" || die "make install failed"
+
+ dodoc CHANGES CREDITS README TODO VERSION
+
+ # This file must be updated with every version update
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ${FILESDIR}/id3tag.pc
+ sed -i -e "s:libdir=\${exec_prefix}/lib:libdir=/usr/$(get_libdir):" \
+ ${D}/usr/$(get_libdir)/pkgconfig/id3tag.pc
+}
diff --git a/media-libs/libid3tag/libid3tag-0.15.1b-r3.ebuild b/media-libs/libid3tag/libid3tag-0.15.1b-r3.ebuild
new file mode 100644
index 0000000..87a041b
--- /dev/null
+++ b/media-libs/libid3tag/libid3tag-0.15.1b-r3.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/libid3tag/libid3tag-0.15.1b-r2.ebuild,v 1.6 2008/05/07 18:46:14 corsair Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="The MAD id3tag library"
+HOMEPAGE="http://www.underbit.com/products/mad/"
+SRC_URI="mirror://sourceforge/mad/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 ~sh sparc x86 ~x86-fbsd"
+IUSE="debug"
+
+DEPEND="dev-util/gperf
+ sys-devel/libtool"
+
+RDEPEND="${DEPEND}
+ >=sys-libs/zlib-1.1.3"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epunt_cxx #74489
+
+ epatch "${FILESDIR}/${PV}"/*.patch
+
+#SDS
+ epatch "${FILESDIR}"/libid3tag-0.15.1b-ds-rcc.patch || die
+ libtoolize --copy --force
+ aclocal
+ automake
+ autoconf
+#EDS
+
+}
+
+src_compile() {
+ econf $(use_enable debug debugging) || die "configure failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ make install DESTDIR="${D}" || die "make install failed"
+
+ dodoc CHANGES CREDITS README TODO VERSION
+
+ # This file must be updated with every version update
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins "${FILESDIR}/id3tag.pc"
+ sed -i -e "s:libdir=\${exec_prefix}/lib:libdir=/usr/$(get_libdir):" \
+ -e "s:0.15.0b:${PV}:" \
+ "${D}/usr/$(get_libdir)/pkgconfig/id3tag.pc"
+}
diff --git a/media-libs/libid3tag/libid3tag-0.15.1b-r4.ebuild b/media-libs/libid3tag/libid3tag-0.15.1b-r4.ebuild
new file mode 100644
index 0000000..7a1dfa9
--- /dev/null
+++ b/media-libs/libid3tag/libid3tag-0.15.1b-r4.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/libid3tag/libid3tag-0.15.1b-r2.ebuild,v 1.6 2008/05/07 18:46:14 corsair Exp $
+
+inherit eutils multilib autotools
+
+DESCRIPTION="The MAD id3tag library"
+HOMEPAGE="http://www.underbit.com/products/mad/"
+SRC_URI="mirror://sourceforge/mad/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 ~sh sparc x86 ~x86-fbsd"
+IUSE="debug"
+
+DEPEND="dev-util/gperf
+ sys-devel/libtool"
+
+RDEPEND="${DEPEND}
+ >=sys-libs/zlib-1.1.3"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epunt_cxx #74489
+
+ epatch "${FILESDIR}/${PV}"/*.patch
+
+#SDS
+ epatch "${FILESDIR}"/libid3tag-0.15.1b-ds-rcc.patch || die
+ eautoreconf || die
+# libtoolize --copy --force
+# aclocal
+# automake
+# autoconf
+#EDS
+
+}
+
+src_compile() {
+ econf $(use_enable debug debugging) || die "configure failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ make install DESTDIR="${D}" || die "make install failed"
+
+ dodoc CHANGES CREDITS README TODO VERSION
+
+ # This file must be updated with every version update
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins "${FILESDIR}/id3tag.pc"
+ sed -i -e "s:libdir=\${exec_prefix}/lib:libdir=/usr/$(get_libdir):" \
+ -e "s:0.15.0b:${PV}:" \
+ "${D}/usr/$(get_libdir)/pkgconfig/id3tag.pc"
+}
diff --git a/media-libs/mac/Manifest b/media-libs/mac/Manifest
new file mode 100644
index 0000000..d15855b
--- /dev/null
+++ b/media-libs/mac/Manifest
@@ -0,0 +1,7 @@
+AUX mac-3.99-u4-b5-s4-ds-fix.patch 600 RMD160 d5f9ba59fdca25213d1e09226f2e9a2d76f2c472 SHA1 456ed3d9ca86c76b0229c593e35d29fcec9afe85 SHA256 49b538c3cdf1b9955d8d77df03e7fdb09ef510f13ea81a60eae83ae3191e93c6
+AUX mac-3.99-u4-b5-s4-ds-gcc44.patch 1528 RMD160 c18e946581626d6f4446a590f8de721cfde83143 SHA1 777f4cfe380638abff85810aa4620281ec398a1e SHA256 e33426c49e3a1acd5c95771cb693d7b62ed20d50cc2b5713b8ab7fd2e6fb974d
+DIST mac-3.99-u4-b5-s4.tar.gz 427978 RMD160 986849a0f332e1d8f87f9954c34ecd90dbe4749c SHA1 fe706e1847b9c2f67f282c113d94305ac4e35bb2 SHA256 6270532925559bdc8dbc4ef4ca8befb5508c255a667e50382fc40b92a625544f
+DIST mac-3.99-u4-b5.tar.gz 421234 RMD160 34b5ba553f7ffa858249258dad9f64c60f0b6ac0 SHA1 f215c265c2cba719834c989498d5a8d2457b54de SHA256 d59ac5b1fa375a78eadbd5d9bb638ad0229185b42b562dbb04b0dab6475b6651
+EBUILD mac-3.99-r1.ebuild 875 RMD160 580f7ff0cf6cb87b6bd26800a10bc2bfdf92c28a SHA1 4141ede4d01712007bde23d5fae8201eb18b4997 SHA256 fa5830b87c76596567d410b80a56b1fa85495363e37c929870e8ca2b39573578
+EBUILD mac-3.99-r2.ebuild 937 RMD160 bdbdf7ab62d9150a52a3f795dda3ad849b84bee0 SHA1 cfe0b4abeeb26913e55b88257d9794e2d91356e6 SHA256 ec2df095b137e581b2f19b4617563927b0c13aa07fcf15dc957543d20941aeaa
+EBUILD mac-3.99.ebuild 812 RMD160 b8efc89ce4e9c817fec642bf69108ecee94cd7f5 SHA1 e74fefaee509f5b7d7377d9658dee68358683407 SHA256 67e57e0956f8f467580eea4d6f3c5b9165021b151cc285146a21aa838a7c786b
diff --git a/media-libs/mac/files/mac-3.99-u4-b5-s4-ds-fix.patch b/media-libs/mac/files/mac-3.99-u4-b5-s4-ds-fix.patch
new file mode 100644
index 0000000..aba0379
--- /dev/null
+++ b/media-libs/mac/files/mac-3.99-u4-b5-s4-ds-fix.patch
@@ -0,0 +1,12 @@
+diff -dPNur mac-3.99-u4-b5-s4/src/MACLib/APEDecompress.cpp mac-3.99-u4-b5-s4-new/src/MACLib/APEDecompress.cpp
+--- mac-3.99-u4-b5-s4/src/MACLib/APEDecompress.cpp 2006-06-01 11:00:58.000000000 +0200
++++ mac-3.99-u4-b5-s4-new/src/MACLib/APEDecompress.cpp 2008-04-12 17:39:39.000000000 +0200
+@@ -369,7 +369,7 @@
+ *****************************************************************************************/
+ intptr_t CAPEDecompress::GetInfo(APE_DECOMPRESS_FIELDS Field, intptr_t nParam1, intptr_t nParam2)
+ {
+- int nRetVal = 0;
++ intptr_t nRetVal = 0;
+ BOOL bHandled = TRUE;
+
+ switch (Field)
diff --git a/media-libs/mac/files/mac-3.99-u4-b5-s4-ds-gcc44.patch b/media-libs/mac/files/mac-3.99-u4-b5-s4-ds-gcc44.patch
new file mode 100644
index 0000000..5843f8b
--- /dev/null
+++ b/media-libs/mac/files/mac-3.99-u4-b5-s4-ds-gcc44.patch
@@ -0,0 +1,27 @@
+diff -dPNur mac-3.99-u4-b5-s4/src/MACLib/APELink.cpp mac-3.99-u4-b5-s4-new/src/MACLib/APELink.cpp
+--- mac-3.99-u4-b5-s4/src/MACLib/APELink.cpp 2006-06-01 11:00:57.000000000 +0200
++++ mac-3.99-u4-b5-s4-new/src/MACLib/APELink.cpp 2009-08-04 11:53:48.000000000 +0200
+@@ -63,10 +63,10 @@
+ if (pData != NULL)
+ {
+ // parse out the information
+- char * pHeader = strstr(pData, APE_LINK_HEADER);
+- char * pImageFile = strstr(pData, APE_LINK_IMAGE_FILE_TAG);
+- char * pStartBlock = strstr(pData, APE_LINK_START_BLOCK_TAG);
+- char * pFinishBlock = strstr(pData, APE_LINK_FINISH_BLOCK_TAG);
++ const char * pHeader = strstr(pData, APE_LINK_HEADER);
++ const char * pImageFile = strstr(pData, APE_LINK_IMAGE_FILE_TAG);
++ const char * pStartBlock = strstr(pData, APE_LINK_START_BLOCK_TAG);
++ const char * pFinishBlock = strstr(pData, APE_LINK_FINISH_BLOCK_TAG);
+
+ if (pHeader && pImageFile && pStartBlock && pFinishBlock)
+ {
+@@ -81,7 +81,7 @@
+
+ // get the path
+ char cImageFile[MAX_PATH + 1]; int nIndex = 0;
+- char * pImageCharacter = &pImageFile[strlen(APE_LINK_IMAGE_FILE_TAG)];
++ const char * pImageCharacter = &pImageFile[strlen(APE_LINK_IMAGE_FILE_TAG)];
+ while ((*pImageCharacter != 0) && (*pImageCharacter != '\r') && (*pImageCharacter != '\n'))
+ cImageFile[nIndex++] = *pImageCharacter++;
+ cImageFile[nIndex] = 0;
diff --git a/media-libs/mac/mac-3.99-r1.ebuild b/media-libs/mac/mac-3.99-r1.ebuild
new file mode 100644
index 0000000..4cc5a6c
--- /dev/null
+++ b/media-libs/mac/mac-3.99-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: current version of ebuild http://atrey.karlin.mff.cuni.cz/~sanda/mac/$
+
+inherit eutils
+
+MY_P=${PV}-u4-b5-s4
+MY_F=mac-${MY_P}
+DESCRIPTION="Monkey Audio Codec (MAC linux port)"
+HOMEPAGE="http://sourceforge.net/projects/mac-port/"
+SRC_URI="http://dside.dyndns.org/files/darklin/$MY_F.tar.gz"
+
+LICENSE="MAC"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc x86"
+IUSE=""
+
+DEPEND=""
+
+src_unpack() {
+ unpack ${MY_F}.tar.gz || die "unpacking failed"
+ cd ${WORKDIR}
+ epatch "${FILESDIR}"/mac-3.99-u4-b5-s4-ds-fix.patch || die
+ mv ${MY_F} ${P}
+}
+
+src_compile() {
+ econf || die "econf failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall || die "install failed"
+ dodoc AUTHORS README AUTHORS src/License.htm NEWS ChangeLog
+}
diff --git a/media-libs/mac/mac-3.99-r2.ebuild b/media-libs/mac/mac-3.99-r2.ebuild
new file mode 100644
index 0000000..d1200aa
--- /dev/null
+++ b/media-libs/mac/mac-3.99-r2.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: current version of ebuild http://atrey.karlin.mff.cuni.cz/~sanda/mac/$
+
+inherit eutils
+
+MY_P=${PV}-u4-b5-s4
+MY_F=mac-${MY_P}
+DESCRIPTION="Monkey Audio Codec (MAC linux port)"
+HOMEPAGE="http://sourceforge.net/projects/mac-port/"
+SRC_URI="http://dside.dyndns.org/files/darklin/$MY_F.tar.gz"
+
+LICENSE="MAC"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc x86"
+IUSE=""
+
+DEPEND=""
+
+src_unpack() {
+ unpack ${MY_F}.tar.gz || die "unpacking failed"
+ cd ${WORKDIR}
+ epatch "${FILESDIR}"/mac-3.99-u4-b5-s4-ds-fix.patch || die
+ epatch "${FILESDIR}"/mac-3.99-u4-b5-s4-ds-gcc44.patch || die
+ mv ${MY_F} ${P}
+}
+
+src_compile() {
+ econf || die "econf failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall || die "install failed"
+ dodoc AUTHORS README AUTHORS src/License.htm NEWS ChangeLog
+}
diff --git a/media-libs/mac/mac-3.99.ebuild b/media-libs/mac/mac-3.99.ebuild
new file mode 100644
index 0000000..d33a69e
--- /dev/null
+++ b/media-libs/mac/mac-3.99.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: current version of ebuild http://atrey.karlin.mff.cuni.cz/~sanda/mac/$
+
+inherit eutils
+
+MY_P=${PV}-u4-b5
+MY_F=mac-${MY_P}
+DESCRIPTION="Monkey Audio Codec (MAC linux port)"
+HOMEPAGE="http://sourceforge.net/projects/mac-port/"
+SRC_URI="http://dside.dyndns.org/files/darklin/$MY_F.tar.gz"
+
+LICENSE="MAC"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc x86"
+IUSE=""
+
+DEPEND=""
+
+src_unpack() {
+ unpack ${MY_F}.tar.gz || die "unpacking failed"
+ cd ${WORKDIR}
+ mv ${MY_F} ${P}
+}
+
+src_compile() {
+ econf || die "econf failed"
+ emake || die "make failed"
+}
+
+src_install() {
+ einstall || die "install failed"
+ dodoc AUTHORS README AUTHORS src/License.htm NEWS ChangeLog
+}
diff --git a/media-libs/nv-codec-headers/Manifest b/media-libs/nv-codec-headers/Manifest
new file mode 100644
index 0000000..b75f0ee
--- /dev/null
+++ b/media-libs/nv-codec-headers/Manifest
@@ -0,0 +1,2 @@
+DIST nv-codec-headers-9.0.18.1.tar.gz 58850 BLAKE2B 8e940ffb929f67c4e459cfd55113298527cf8430b94d20e9bb7148cf532dbed798138e63801f29d168d0b4b465c0eb6ef3c58596289063f461b7d5e8832ce7e8 SHA512 4306ee3c6e72e9e3172b28c5e6166ec3fb9dfdc32578aebda0588afc682f56286dd6f616284c9892907cd413f57770be3662572207a36d6ac65c75a03d381f6f
+EBUILD nv-codec-headers-9.0.18.1.ebuild 703 BLAKE2B 944e18e21756707bcc0eef24ff2898e576d1349c6031023ba056db13d2ec3dc6de3f92db4f4fe780e8e5bbb11577938d916c04fd8ba645c820ae91f51dcdcfad SHA512 e9dd681d1faf767fa7396679321310d7eeffd86a7e332a5188190961cd82995a59517fc5a482baee54a063e42b386692d424fe1cfd62264984bbcaa1db32f58b
diff --git a/media-libs/nv-codec-headers/nv-codec-headers-9.0.18.1.ebuild b/media-libs/nv-codec-headers/nv-codec-headers-9.0.18.1.ebuild
new file mode 100644
index 0000000..bee524e
--- /dev/null
+++ b/media-libs/nv-codec-headers/nv-codec-headers-9.0.18.1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit multilib-minimal
+
+DESCRIPTION="FFmpeg version of headers required to interface with Nvidias codec APIs"
+HOMEPAGE="https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git"
+SRC_URI="https://github.com/FFmpeg/nv-codec-headers/releases/download/n${PV}/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+
+S="${WORKDIR}/${PN}-n${PV}"
+
+src_prepare() {
+ multilib_copy_sources
+ default
+}
+
+multilib_src_compile() {
+ emake PREFIX="${EPREFIX}/usr" LIBDIR="$(get_libdir)"
+}
+
+multilib_src_install() {
+ emake PREFIX="${EPREFIX}/usr" LIBDIR="$(get_libdir)" DESTDIR="${D}" install
+}
diff --git a/media-libs/taglib/Manifest b/media-libs/taglib/Manifest
new file mode 100644
index 0000000..011a10b
--- /dev/null
+++ b/media-libs/taglib/Manifest
@@ -0,0 +1,10 @@
+AUX taglib-1.10-ds-rusxmms.patch 41838 BLAKE2B 9cdfdf376f08a916bfafd603fe1fb3fb89dd618cc08360cd4d35183e346acab23b24acd393e3249c9c08353e7afe988e4ec0d16bb452ba3ec45a91deb8b43dc6 SHA512 24be668fc9754bba3b39c22b842557176ddc1c964fd6493405838911dc8db6317f610a4ee4fc95a3404904f4512b41a0fee826f64ed9c1eda85192dea6880b64
+AUX taglib-1.6.1-install-examples.patch 581 BLAKE2B 65bc122295b1c28a59a56db7bb9894ee0b6ad6a74083bd5417cd098d5b87f47b4437684a556db311859f6439996451046328e2ada3c43ab3259d62b970e778ff SHA512 8af5b52b33c82f0d4961ad3ef0cd72844f84f442db2638ba0187ba808257e7d0602bc5f9c643252c7217d3119b1dd5a6fbf5f84a364f72c1d9154812b14e383b
+AUX taglib-1.9.1-abi-breakage.patch 3888 BLAKE2B 928c61111a3f45dfc6383bf53c3411cfb9ca6851401cd410231b97d4e7a60eb05616a8995e89d8b6e87cb48bf23a7a3cde2e8334ff4af7e529d44f2effecc0f6 SHA512 ec17447f97d83482fbf7fbafd99014344c638436fbadab2144a19679869603106e0f21cdfb738cf77743eb3230d244a81ed93d1bbf62efa1a8a3484d9e43e90b
+AUX taglib-1.9.1-bytevector-simpler.patch 3685 BLAKE2B 38018145649747dbf8ffa44dd6eadc86a162d0bedba5d7ab1603cab9cab938efec2015b53841ecdb83b67dc8bf620c19d0052bf82bd19cd3ff130f2ce593b53f SHA512 1d19d40766e8cb74cb60d5b13fb509c56ee1b0d10f622bfea954bbaf2c5a4908c81e026dc07e83764034647818eb875c71a505a6e1425c9d03820d8e0a3a4a11
+AUX taglib-1.9.1-ds-rusxmms-enforce.patch 844 BLAKE2B 3e6fb11c828f6e6860ababcf5206f18a1f6b787e61c707d9bbbd8937efda66185b2ed3aeade8731757093a71dc82a831a503ee97032b8b51a10a6343854becab SHA512 9f9d98d0778f3cde419d1afc91da122f5c75698ad5a7edc413c5ad3ed07fd894e024674c2ceb1a253ba6fbeae009cc66f6055a427258a48b39999b38a79d2883
+AUX taglib-1.9.1-ds-rusxmms.patch 21026 BLAKE2B 8d92aa3990dcae0c170d60746927e3c581ca2807e512d321f30bc6218667a652a64ef5395d657c6bc635ecc9b26a52865e9fbf09a69455c4f5826f8f48875f29 SHA512 7578e03a6d14c5f09cfd492ddd342f6ea36fd8819e59298f374aefb1be81ec7d2d07b3b8579be8580a3e49060e798f7b34d00324224ad73f8f22baf01a1d480b
+AUX taglib-1.9.1-missing-deletes.patch 1194 BLAKE2B 4559e86ea704f16d58e0e5e671c6f35f2062febfa7287a7abfef1eace5fc49f42db2a79d4895b4f7f05a5ec202dfee39876d18ca326d59aef3d47276bfdddf23 SHA512 1cc2796401dc1291b19245bd9a6bde9d77549d7ddab96b99b8e0f95c331a1ba7296f7107bd99f6f789cd04dd412d6e330db099ab49344c4dd1a10ccfef203fd1
+AUX taglib-1.9.1-order-big-endian.patch 884 BLAKE2B 9382802fe5bb4d2cf20a5a075ffeb5200b2cec5acfe33eb68031a80b7a1718c7578fe9f091f29be61a13bc7a3ec3ee87f1a54033ab271c56f3cf98de74e71263 SHA512 4f2c751f03e976da64fc1480e369443d724c420198600ae1a5e9e9cab3172289c73d15b66ec0c95165da30e52dff1d956314fd71fb067e10a11c350566671bd3
+DIST taglib-1.9.1.tar.gz 654074 BLAKE2B ce8384a9cc8ddfe93c0b24c695963ed43f70366931eb1f1748d5cb92eac08833154fbd5a05307154581854b4a59a414846a0e411722d56330d1bc51695d2be31 SHA512 17523b7ebdd089520289ae817b07f291be93fd0b9d3b2891eb4860a24e45943e94d25b99250c1ac477de5e51b08c39887ca13fdcc2dce17867eb60d1edb26154
+EBUILD taglib-1.9.1-r4.ebuild 2264 BLAKE2B 35ded2500e55ca37a3f84ca558222ac29ad6238fd58275e227f64e1a155aee393a3be5e74c8300a8e7182dbbb0ff36ad4d4536254375cdd4a22959acdf4c4964 SHA512 c1e08587ccec0cbe95624d12906f8cbb6f6eb1fdb9d248b8b3e951f58015ba30565d9b710395f434312cab09c44d532144e2abadc8cf3d03dbab2208d9066ae3
diff --git a/media-libs/taglib/files/taglib-1.10-ds-rusxmms.patch b/media-libs/taglib/files/taglib-1.10-ds-rusxmms.patch
new file mode 100644
index 0000000..584c237
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.10-ds-rusxmms.patch
@@ -0,0 +1,1339 @@
+diff -dPNur taglib-1.10/config.h.cmake taglib-1.10-ds/config.h.cmake
+--- taglib-1.10/config.h.cmake 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/config.h.cmake 2015-11-26 23:03:07.058061207 +0100
+@@ -25,4 +25,7 @@
+ /* Indicates whether debug messages are shown even in release mode */
+ #cmakedefine TRACE_IN_RELEASE 1
+
++/* Defined if you have LibRCC from RusXMMS project */
++#cmakedefine HAVE_LIBRCC 1
++
+ #cmakedefine TESTS_DIR "@TESTS_DIR@"
+diff -dPNur taglib-1.10/ConfigureChecks.cmake taglib-1.10-ds/ConfigureChecks.cmake
+--- taglib-1.10/ConfigureChecks.cmake 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/ConfigureChecks.cmake 2015-11-26 23:03:07.058061207 +0100
+@@ -201,6 +201,8 @@
+ endif()
+ endif()
+
++SET(HAVE_LIBRCC 1)
++
+ if(BUILD_TESTS)
+ find_package(CppUnit)
+ if(NOT CppUnit_FOUND)
+diff -dPNur taglib-1.10/examples/tagreader_c.c taglib-1.10-ds/examples/tagreader_c.c
+--- taglib-1.10/examples/tagreader_c.c 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/examples/tagreader_c.c 2015-11-26 23:03:07.059061228 +0100
+@@ -38,7 +38,7 @@
+ TagLib_Tag *tag;
+ const TagLib_AudioProperties *properties;
+
+- taglib_set_strings_unicode(FALSE);
++ //taglib_set_strings_unicode(FALSE);
+
+ for(i = 1; i < argc; i++) {
+ printf("******************** \"%s\" ********************\n", argv[i]);
+diff -dPNur taglib-1.10/examples/tagwriter.cpp taglib-1.10-ds/examples/tagwriter.cpp
+--- taglib-1.10/examples/tagwriter.cpp 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/examples/tagwriter.cpp 2015-11-26 23:03:07.059061228 +0100
+@@ -115,7 +115,7 @@
+ if(isArgument(argv[i]) && i + 1 < argc && !isArgument(argv[i + 1])) {
+
+ char field = argv[i][1];
+- TagLib::String value = argv[i + 1];
++ TagLib::String value(argv[i + 1], TagLib::String::Locale);
+
+ TagLib::List<TagLib::FileRef>::ConstIterator it;
+ for(it = fileList.begin(); it != fileList.end(); ++it) {
+diff -dPNur taglib-1.10/taglib/CMakeLists.txt taglib-1.10-ds/taglib/CMakeLists.txt
+--- taglib-1.10/taglib/CMakeLists.txt 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/taglib/CMakeLists.txt 2015-11-26 23:03:07.059061228 +0100
+@@ -38,6 +38,7 @@
+ audioproperties.h
+ taglib_export.h
+ ${CMAKE_CURRENT_BINARY_DIR}/../taglib_config.h
++ toolkit/rccpatch.h
+ toolkit/taglib.h
+ toolkit/tstring.h
+ toolkit/tlist.h
+@@ -291,6 +292,7 @@
+ )
+
+ set(toolkit_SRCS
++ toolkit/rccpatch.cpp
+ toolkit/tstring.cpp
+ toolkit/tstringlist.cpp
+ toolkit/tbytevector.cpp
+@@ -337,7 +339,7 @@
+ add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
+
+ if(ZLIB_FOUND)
+- target_link_libraries(tag ${ZLIB_LIBRARIES})
++ target_link_libraries(tag rcc ${ZLIB_LIBRARIES})
+ endif()
+
+ set_target_properties(tag PROPERTIES
+diff -dPNur taglib-1.10/taglib/mpeg/id3v1/id3v1tag.cpp taglib-1.10-ds/taglib/mpeg/id3v1/id3v1tag.cpp
+--- taglib-1.10/taglib/mpeg/id3v1/id3v1tag.cpp 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/taglib/mpeg/id3v1/id3v1tag.cpp 2015-11-26 23:03:07.059061228 +0100
+@@ -64,17 +64,18 @@
+
+ String ID3v1::StringHandler::parse(const ByteVector &data) const
+ {
+- return String(data, String::Latin1).stripWhiteSpace();
++ return String(data, String::Latin1ID3).stripWhiteSpace();
+ }
+
+ ByteVector ID3v1::StringHandler::render(const String &s) const
+ {
+ if(!s.isLatin1())
+ {
++ if (String::ID3WType(String::Latin1) == String::Latin1)
+ return ByteVector();
+ }
+
+- return s.data(String::Latin1);
++ return s.data(String::Latin1ID3);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+@@ -257,7 +258,7 @@
+ d->track = uchar(data[offset + 29]);
+ }
+ else
+- d->comment = data.mid(offset, 30);
++ d->comment = TagPrivate::stringHandler->parse(data.mid(offset, 30));
+
+ offset += 30;
+
+diff -dPNur taglib-1.10/taglib/mpeg/id3v2/frames/commentsframe.cpp taglib-1.10-ds/taglib/mpeg/id3v2/frames/commentsframe.cpp
+--- taglib-1.10/taglib/mpeg/id3v2/frames/commentsframe.cpp 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/taglib/mpeg/id3v2/frames/commentsframe.cpp 2015-11-26 23:03:07.059061228 +0100
+@@ -150,10 +150,10 @@
+ return;
+ }
+
+- d->textEncoding = String::Type(data[0]);
++ d->textEncoding = String::ID3Type(data[0]);
+ d->language = data.mid(1, 3);
+
+- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
++ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
+
+ ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
+
+@@ -173,11 +173,13 @@
+ ByteVector v;
+
+ String::Type encoding = d->textEncoding;
++
++ encoding = String::ID3WType(encoding);
+
+ encoding = checkTextEncoding(d->description, encoding);
+ encoding = checkTextEncoding(d->text, encoding);
+
+- v.append(char(encoding));
++ v.append(char(String::ID3RealType(encoding)));
+ v.append(d->language.size() == 3 ? d->language : "XXX");
+ v.append(d->description.data(encoding));
+ v.append(textDelimiter(encoding));
+diff -dPNur taglib-1.10/taglib/mpeg/id3v2/frames/textidentificationframe.cpp taglib-1.10-ds/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
+--- taglib-1.10/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2015-11-26 23:03:07.059061228 +0100
+@@ -187,12 +187,12 @@
+
+ // read the string data type (the first byte of the field data)
+
+- d->textEncoding = String::Type(data[0]);
++ d->textEncoding = String::ID3Type(data[0]);
+
+ // split the byte array into chunks based on the string type (two byte delimiter
+ // for unicode encodings)
+
+- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
++ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
+
+ // build a small counter to strip nulls off the end of the field
+
+@@ -223,11 +223,14 @@
+
+ ByteVector TextIdentificationFrame::renderFields() const
+ {
+- String::Type encoding = checkTextEncoding(d->fieldList, d->textEncoding);
++ String::Type encoding = d->textEncoding;
++
++ encoding = String::ID3WType(encoding);
++ encoding = checkTextEncoding(d->fieldList, encoding);
+
+ ByteVector v;
+
+- v.append(char(encoding));
++ v.append(char(String::ID3RealType(encoding)));
+
+ for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
+
+diff -dPNur taglib-1.10/taglib/mpeg/id3v2/id3v2frame.cpp taglib-1.10-ds/taglib/mpeg/id3v2/id3v2frame.cpp
+--- taglib-1.10/taglib/mpeg/id3v2/id3v2frame.cpp 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/taglib/mpeg/id3v2/id3v2frame.cpp 2015-11-26 23:03:07.060061249 +0100
+@@ -339,7 +339,7 @@
+ if((encoding == String::UTF8 || encoding == String::UTF16BE) && version != 4)
+ return String::UTF16;
+
+- if(encoding != String::Latin1)
++ if((encoding != String::Latin1)&&(encoding != String::Latin1ID3V2))
+ return encoding;
+
+ for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
+diff -dPNur taglib-1.10/taglib/toolkit/rccpatch.cpp taglib-1.10-ds/taglib/toolkit/rccpatch.cpp
+--- taglib-1.10/taglib/toolkit/rccpatch.cpp 1970-01-01 01:00:00.000000000 +0100
++++ taglib-1.10-ds/taglib/toolkit/rccpatch.cpp 2015-11-26 23:03:07.060061249 +0100
+@@ -0,0 +1,237 @@
++#include <stdlib.h>
++
++#include <string>
++#include "tstring.h"
++#include "tbytevector.h"
++
++//#define RCC_DEBUG
++
++
++#ifndef HAVE_LIBRCC
++# include <config.h>
++#endif
++
++#ifdef HAVE_LIBRCC
++# ifdef RCC_DEBUG
++# include <stdio.h>
++# endif /* RCC_DEBUG */
++# include <librcc.h>
++# include <string.h>
++#endif /* HAVE_LIBRCC */
++
++
++#ifdef HAVE_LIBRCC
++# define ID3_CLASS 0
++# define ID3V2_CLASS 1
++# define UTF_CLASS 2
++# define OUT_CLASS 3
++static rcc_class classes[] = {
++ { "id3", RCC_CLASS_STANDARD, NULL, NULL, "ID3 Encoding", 0 },
++ { "id3v2", RCC_CLASS_STANDARD, "id3", NULL, "ID3 v.2 Encoding", 0 },
++ { "utf", RCC_CLASS_KNOWN, "UTF-8", NULL, "Unicode Encoding", 0},
++ { "out", RCC_CLASS_TRANSLATE_LOCALE, "LC_CTYPE", NULL, "Output Encoding", 0 },
++ { NULL, RCC_CLASS_STANDARD, NULL, NULL, NULL, 0 }
++};
++
++static int rcc_initialized = 0;
++
++static rcc_context ctx = NULL;
++#endif /* HAVE_LIBRCC */
++
++
++void rccTaglibPatchFree() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) {
++ rccFree();
++ rcc_initialized = 0;
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++void rccTaglibPatchInit() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) return;
++ rccInit();
++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
++ rccLoad(NULL, "xmms");
++ rccInitDb4(NULL, NULL, 0);
++ rcc_initialized = 1;
++#endif /* HAVE_LIBRCC */
++}
++
++void rccTaglibPatchSetContext(void *newctx) {
++#ifdef HAVE_LIBRCC
++ if (newctx) {
++ ctx = (rcc_context)newctx;
++ rcc_initialized = 1;
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++static void rccTaglibPatchTryInit() {
++#ifdef HAVE_LIBRCC
++ if (!rcc_initialized) {
++ rccTaglibPatchInit();
++ if (rcc_initialized) atexit(rccTaglibPatchFree);
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++
++TagLib::ByteVector rccTaglibPatchRecodeOutput(const std::string &s) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, UTF_CLASS, OUT_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" Output: %s - %s\n", s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++
++ if (res) v.setData(res, rlen);
++ else v.setData("", 0);
++ //v.setData(s.c_str(), s.length());
++
++ return v;
++#else
++ v.setData("", 0);
++
++ return v;
++#endif /* HAVE_LIBRCC */
++}
++
++TagLib::ByteVector rccTaglibPatchRecodeOutputID3(const std::string &s, bool v2 = false) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, UTF_CLASS, v2?ID3V2_CLASS:ID3_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" OutputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++
++ if (res) v.setData(res, rlen);
++ else v.setData("", 0);
++ //v.setData(s.c_str(), s.length());
++
++ return v;
++#else
++ v.setData("", 0);
++
++ return v;
++#endif /* HAVE_LIBRCC */
++}
++
++TagLib::ByteVector rccTaglibPatchRecodeInput(const std::string &s) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, OUT_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" Input: %s - %s\n", s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++
++ if (res) v.setData(res, rlen);
++ else
++#endif /* HAVE_LIBRCC */
++ v.setData("", 0);
++
++ return v;
++}
++
++TagLib::ByteVector rccTaglibPatchRecodeInputID3(const std::string &s, bool v2 = false) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, v2?ID3V2_CLASS:ID3_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" InputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++ if (res) v.setData(res, rlen + 1);
++ else
++#endif /* HAVE_LIBRCC */
++ v.setData("", 0);
++
++ return v;
++}
++
++TagLib::String::Type rccTaglibPatchGetLocaleType() {
++#ifdef HAVE_LIBRCC
++ size_t len;
++ char charset[32];
++
++ rccTaglibPatchTryInit();
++ if (!rccLocaleGetCharset(charset, NULL, 31)) {
++ if (!strncmp(charset, "UTF", 3)) {
++ len = strlen(charset);
++
++ if (charset[len-1]=='8') return TagLib::String::UTF8;
++ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
++ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
++ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
++ }
++ return TagLib::String::Latin1;
++ }
++#endif /* HAVE_LIBRCC */
++ return TagLib::String::UTF8;
++}
++
++TagLib::String::Type rccTaglibPatchGetID3Type() {
++#ifdef HAVE_LIBRCC
++ size_t len;
++ const char *charset;
++
++ rccTaglibPatchTryInit();
++
++ charset = rccGetCurrentCharsetName(ctx, ID3V2_CLASS);
++ if (charset) {
++ if (!strncmp(charset, "UTF", 3)) {
++ len = strlen(charset);
++
++ if (charset[len-1]=='8') return TagLib::String::UTF8;
++ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
++ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
++ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
++ }
++ return TagLib::String::Latin1ID3V2;
++ } else {
++ // Error or no-language configured: If Latin1ID3V2 is returned we normally will use the default unicode encoding unless Latin1 is selected by taglib
++ return TagLib::String::Latin1ID3V2;
++ }
++#endif /* HAVE_LIBRCC */
++ return TagLib::String::Latin1;
++}
+diff -dPNur taglib-1.10/taglib/toolkit/rccpatch.h taglib-1.10-ds/taglib/toolkit/rccpatch.h
+--- taglib-1.10/taglib/toolkit/rccpatch.h 1970-01-01 01:00:00.000000000 +0100
++++ taglib-1.10-ds/taglib/toolkit/rccpatch.h 2015-11-26 23:03:07.060061249 +0100
+@@ -0,0 +1,20 @@
++#ifndef _RCC_PATCH_H
++#define _RCC_PATCH_H
++
++#include <string.h>
++#include "tstring.h"
++#include "tbytevector.h"
++
++void rccTaglibPatchFree();
++void rccTaglibPatchInit();
++void rccTaglibPatchSetContext(void *newctx);
++
++TagLib::ByteVector rccTaglibPatchRecodeOutput(const std::string &s);
++TagLib::ByteVector rccTaglibPatchRecodeInput(const std::string &s);
++TagLib::ByteVector rccTaglibPatchRecodeOutputID3(const std::string &s, bool v2 = false);
++TagLib::ByteVector rccTaglibPatchRecodeInputID3(const std::string &s, bool v2 = false);
++
++TagLib::String::Type rccTaglibPatchGetLocaleType();
++TagLib::String::Type rccTaglibPatchGetID3Type();
++
++#endif /* _RCC_PATCH_H */
+diff -dPNur taglib-1.10/taglib/toolkit/tstring.cpp taglib-1.10-ds/taglib/toolkit/tstring.cpp
+--- taglib-1.10/taglib/toolkit/tstring.cpp 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/taglib/toolkit/tstring.cpp 2015-11-26 23:10:01.286853654 +0100
+@@ -29,6 +29,7 @@
+ #include <config.h>
+ #endif
+
++#include "rccpatch.h"
+ #include "tstring.h"
+ #include "tdebug.h"
+ #include "tstringlist.h"
+@@ -167,8 +168,11 @@
+ String::String(const std::string &s, Type t)
+ : d(new StringPrivate())
+ {
+- if(t == Latin1)
+- copyFromLatin1(s.c_str(), s.length());
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
++ copyFromLatin1(&s[0], s.length(), true, t);
+ else if(t == String::UTF8)
+ copyFromUTF8(s.c_str(), s.length());
+ else {
+@@ -215,8 +219,11 @@
+ String::String(const char *s, Type t)
+ : d(new StringPrivate())
+ {
+- if(t == Latin1)
+- copyFromLatin1(s, ::strlen(s));
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
++ copyFromLatin1(s, ::strlen(s), true, t);
+ else if(t == String::UTF8)
+ copyFromUTF8(s, ::strlen(s));
+ else {
+@@ -237,7 +244,10 @@
+ String::String(char c, Type t)
+ : d(new StringPrivate(1, static_cast<uchar>(c)))
+ {
+- if(t != Latin1 && t != UTF8) {
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t != Latin1 && t != Latin1ID3 && t != Latin1ID3V2 && t != UTF8) {
+ debug("String::String() -- char should not contain UTF16.");
+ }
+ }
+@@ -248,8 +258,11 @@
+ if(v.isEmpty())
+ return;
+
+- if(t == Latin1)
+- copyFromLatin1(v.data(), v.size());
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
++ copyFromLatin1(v.data(), v.size(), true, t);
+ else if(t == UTF8)
+ copyFromUTF8(v.data(), v.size());
+ else
+@@ -396,8 +409,38 @@
+
+ ByteVector String::data(Type t) const
+ {
+- switch(t)
+- {
++ ByteVector v;
++
++ if (t == Locale) {
++ // The source is either Unicode or real Latin1 (if rcc is bypassed)
++ std::string s = to8Bit(true);
++
++ // In case of UTF8 locale, this probably will return NULL (no recoding needed), but we will take UTF8 path in the next swtich
++ v = rccTaglibPatchRecodeOutput(s);
++ if (v.size()) return v;
++
++ t = rccTaglibPatchGetLocaleType();
++ }
++
++ switch(t) {
++ case Latin1ID3:
++ case Latin1ID3V2:
++ {
++ std::string s = to8Bit(true);
++ if (t == Latin1ID3) v = rccTaglibPatchRecodeOutputID3(s, false);
++ else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeOutputID3(s, true);
++ if (v.size())
++ return v;
++
++ // we don't know if we got NULL because rcc is disabled (error) or UTF8 output is required
++ if ((t == Latin1ID3V2)&&(rccTaglibPatchGetID3Type() == UTF8)) {
++ v.setData(s.c_str(), s.length());
++ } else {
++ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
++ v.append(char(*it));
++ }
++ return v;
++ }
+ case Latin1:
+ {
+ ByteVector v(size(), 0);
+@@ -738,12 +781,30 @@
+ // private members
+ ////////////////////////////////////////////////////////////////////////////////
+
+-void String::copyFromLatin1(const char *s, size_t length)
++void String::copyFromLatin1(const char *s, size_t length, bool prepare, Type t)
+ {
+ d->data.resize(length);
+
+ for(size_t i = 0; i < length; ++i)
+ d->data[i] = static_cast<uchar>(s[i]);
++
++ // librcc conversation
++ if (prepare) {
++ std::string s = to8Bit(false);
++ ByteVector v;
++
++ if (t == Latin1ID3) v = rccTaglibPatchRecodeInputID3(s, false);
++ else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeInputID3(s, true);
++ else /* Latin1 converted from Locale */ v = rccTaglibPatchRecodeInput(s);
++
++ if (v.size()) {
++ copyFromUTF8(v.data(), v.size());
++ } else {
++ // We don't know if we got UTF-8 encoded string or either rcc is disable or something is failed,
++ // since standard applications are really expecting here Latin1, it is safe to just check if we have violations of UTF8
++ //if (Unicode::isLegalUTF8(s)) t = UTF8;
++ }
++ }
+ }
+
+ void String::copyFromUTF8(const char *s, size_t length)
+@@ -859,7 +920,33 @@
+
+ std::ostream &operator<<(std::ostream &s, const TagLib::String &str)
+ {
+- s << str.to8Bit();
++ TagLib::ByteVector bv = str.data(TagLib::String::Locale);
++ s << bv;
+ return s;
+ }
+
++TagLib::String::Type TagLib::String::ID3Type(int i)
++{
++ if(i == Latin1)
++ return Latin1ID3V2;
++ return Type(i);
++};
++
++TagLib::String::Type TagLib::String::ID3WType(Type type)
++{
++ Type rcc_type = rccTaglibPatchGetID3Type();
++ if((rcc_type == Latin1ID3)||(rcc_type == Latin1ID3V2)||(rcc_type == Latin1)) {
++ if(type == Latin1) return
++ rcc_type;
++ return type;
++ }
++
++ return rcc_type;
++};
++
++TagLib::String::Type TagLib::String::ID3RealType(Type type)
++{
++ if((type == Latin1ID3) || (type == Latin1ID3V2))
++ return Latin1;
++ return type;
++}
+diff -dPNur taglib-1.10/taglib/toolkit/tstring.h taglib-1.10-ds/taglib/toolkit/tstring.h
+--- taglib-1.10/taglib/toolkit/tstring.h 2015-11-11 22:41:59.000000000 +0100
++++ taglib-1.10-ds/taglib/toolkit/tstring.h 2015-11-26 23:03:07.061061271 +0100
+@@ -96,6 +96,18 @@
+ */
+ enum Type {
+ /*!
++ * Determine using current locale settings
++ */
++ Locale = -1,
++ /*!
++ * Latin1 for ID3 tags.
++ */
++ Latin1ID3 = 65,
++ /*!
++ * Latin1 for ID3v2 tags.
++ */
++ Latin1ID3V2 = 66,
++ /*!
+ * IS08859-1, or <i>Latin1</i> encoding. 8 bit characters.
+ */
+ Latin1 = 0,
+@@ -117,6 +129,10 @@
+ */
+ UTF16LE = 4
+ };
++
++ static Type ID3Type(int i);
++ static Type ID3WType(Type type);
++ static Type ID3RealType(Type type);
+
+ /*!
+ * Constructs an empty String.
+@@ -519,7 +535,7 @@
+ * Converts a \e Latin-1 string into \e UTF-16(without BOM/CPU byte order)
+ * and copies it to the internal buffer.
+ */
+- void copyFromLatin1(const char *s, size_t length);
++ void copyFromLatin1(const char *s, size_t length, bool prepare = false, Type t = Latin1);
+
+ /*!
+ * Converts a \e UTF-8 string into \e UTF-16(without BOM/CPU byte order)
+diff -dPNur taglib-1.10/taglib-1.10-ds-rusxmms.patch taglib-1.10-ds/taglib-1.10-ds-rusxmms.patch
+--- taglib-1.10/taglib-1.10-ds-rusxmms.patch 1970-01-01 01:00:00.000000000 +0100
++++ taglib-1.10-ds/taglib-1.10-ds-rusxmms.patch 2015-11-14 15:40:37.000000000 +0100
+@@ -0,0 +1,669 @@
++diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
++index 88980ea..e4f44d3 100644
++--- a/ConfigureChecks.cmake
+++++ b/ConfigureChecks.cmake
++@@ -201,6 +201,8 @@ if(NOT ZLIB_SOURCE)
++ endif()
++ endif()
++
+++SET(HAVE_LIBRCC 1)
+++
++ if(BUILD_TESTS)
++ find_package(CppUnit)
++ if(NOT CppUnit_FOUND)
++diff --git a/config.h.cmake b/config.h.cmake
++index ee0e67a..2abd49c 100644
++--- a/config.h.cmake
+++++ b/config.h.cmake
++@@ -25,4 +25,7 @@
++ /* Indicates whether debug messages are shown even in release mode */
++ #cmakedefine TRACE_IN_RELEASE 1
++
+++/* Defined if you have LibRCC from RusXMMS project */
+++#cmakedefine HAVE_LIBRCC 1
+++
++ #cmakedefine TESTS_DIR "@TESTS_DIR@"
++diff --git a/examples/tagreader_c.c b/examples/tagreader_c.c
++index 0436992..e0f17d8 100644
++--- a/examples/tagreader_c.c
+++++ b/examples/tagreader_c.c
++@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
++ TagLib_Tag *tag;
++ const TagLib_AudioProperties *properties;
++
++- taglib_set_strings_unicode(FALSE);
+++ //taglib_set_strings_unicode(FALSE);
++
++ for(i = 1; i < argc; i++) {
++ printf("******************** \"%s\" ********************\n", argv[i]);
++diff --git a/examples/tagwriter.cpp b/examples/tagwriter.cpp
++index ed8b0d7..6a7a263 100644
++--- a/examples/tagwriter.cpp
+++++ b/examples/tagwriter.cpp
++@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
++ if(isArgument(argv[i]) && i + 1 < argc && !isArgument(argv[i + 1])) {
++
++ char field = argv[i][1];
++- TagLib::String value = argv[i + 1];
+++ TagLib::String value(argv[i + 1], TagLib::String::Locale);
++
++ TagLib::List<TagLib::FileRef>::ConstIterator it;
++ for(it = fileList.begin(); it != fileList.end(); ++it) {
++diff --git a/taglib/CMakeLists.txt b/taglib/CMakeLists.txt
++index 73c1a2f..cd7ea22 100644
++--- a/taglib/CMakeLists.txt
+++++ b/taglib/CMakeLists.txt
++@@ -38,6 +38,7 @@ set(tag_HDRS
++ audioproperties.h
++ taglib_export.h
++ ${CMAKE_CURRENT_BINARY_DIR}/../taglib_config.h
+++ toolkit/rccpatch.h
++ toolkit/taglib.h
++ toolkit/tstring.h
++ toolkit/tlist.h
++@@ -291,6 +292,7 @@ set(xm_SRCS
++ )
++
++ set(toolkit_SRCS
+++ toolkit/rccpatch.cpp
++ toolkit/tstring.cpp
++ toolkit/tstringlist.cpp
++ toolkit/tbytevector.cpp
++@@ -337,7 +339,7 @@ set(tag_LIB_SRCS
++ add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
++
++ if(ZLIB_FOUND)
++- target_link_libraries(tag ${ZLIB_LIBRARIES})
+++ target_link_libraries(tag rcc ${ZLIB_LIBRARIES})
++ endif()
++
++ set_target_properties(tag PROPERTIES
++diff --git a/taglib/mpeg/id3v1/id3v1tag.cpp b/taglib/mpeg/id3v1/id3v1tag.cpp
++index 9fc8cfd..5352acc 100644
++--- a/taglib/mpeg/id3v1/id3v1tag.cpp
+++++ b/taglib/mpeg/id3v1/id3v1tag.cpp
++@@ -64,17 +64,18 @@ StringHandler::StringHandler()
++
++ String ID3v1::StringHandler::parse(const ByteVector &data) const
++ {
++- return String(data, String::Latin1).stripWhiteSpace();
+++ return String(data, String::Latin1ID3).stripWhiteSpace();
++ }
++
++ ByteVector ID3v1::StringHandler::render(const String &s) const
++ {
++ if(!s.isLatin1())
++ {
+++ if (String::ID3WType(String::Latin1) == String::Latin1)
++ return ByteVector();
++ }
++
++- return s.data(String::Latin1);
+++ return s.data(String::Latin1ID3);
++ }
++
++ ////////////////////////////////////////////////////////////////////////////////
++@@ -257,7 +258,7 @@ void ID3v1::Tag::parse(const ByteVector &data)
++ d->track = uchar(data[offset + 29]);
++ }
++ else
++- d->comment = data.mid(offset, 30);
+++ d->comment = TagPrivate::stringHandler->parse(data.mid(offset, 30));
++
++ offset += 30;
++
++diff --git a/taglib/mpeg/id3v2/frames/commentsframe.cpp b/taglib/mpeg/id3v2/frames/commentsframe.cpp
++index deaa9d9..c0aba2b 100644
++--- a/taglib/mpeg/id3v2/frames/commentsframe.cpp
+++++ b/taglib/mpeg/id3v2/frames/commentsframe.cpp
++@@ -150,10 +150,10 @@ void CommentsFrame::parseFields(const ByteVector &data)
++ return;
++ }
++
++- d->textEncoding = String::Type(data[0]);
+++ d->textEncoding = String::ID3Type(data[0]);
++ d->language = data.mid(1, 3);
++
++- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
+++ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
++
++ ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
++
++@@ -173,11 +173,13 @@ ByteVector CommentsFrame::renderFields() const
++ ByteVector v;
++
++ String::Type encoding = d->textEncoding;
+++
+++ encoding = String::ID3WType(encoding);
++
++ encoding = checkTextEncoding(d->description, encoding);
++ encoding = checkTextEncoding(d->text, encoding);
++
++- v.append(char(encoding));
+++ v.append(char(String::ID3RealType(encoding)));
++ v.append(d->language.size() == 3 ? d->language : "XXX");
++ v.append(d->description.data(encoding));
++ v.append(textDelimiter(encoding));
++diff --git a/taglib/mpeg/id3v2/frames/textidentificationframe.cpp b/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
++index b77dd54..a4a7277 100644
++--- a/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
+++++ b/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
++@@ -187,12 +187,12 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
++
++ // read the string data type (the first byte of the field data)
++
++- d->textEncoding = String::Type(data[0]);
+++ d->textEncoding = String::ID3Type(data[0]);
++
++ // split the byte array into chunks based on the string type (two byte delimiter
++ // for unicode encodings)
++
++- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
+++ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
++
++ // build a small counter to strip nulls off the end of the field
++
++@@ -223,11 +223,14 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
++
++ ByteVector TextIdentificationFrame::renderFields() const
++ {
++- String::Type encoding = checkTextEncoding(d->fieldList, d->textEncoding);
+++ String::Type encoding = d->textEncoding;
+++
+++ encoding = String::ID3WType(encoding);
+++ encoding = checkTextEncoding(d->fieldList, encoding);
++
++ ByteVector v;
++
++- v.append(char(encoding));
+++ v.append(char(String::ID3RealType(encoding)));
++
++ for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
++
++diff --git a/taglib/mpeg/id3v2/id3v2frame.cpp b/taglib/mpeg/id3v2/id3v2frame.cpp
++index bee5375..fea5ab3 100644
++--- a/taglib/mpeg/id3v2/id3v2frame.cpp
+++++ b/taglib/mpeg/id3v2/id3v2frame.cpp
++@@ -339,7 +339,7 @@ String::Type Frame::checkEncoding(const StringList &fields, String::Type encodin
++ if((encoding == String::UTF8 || encoding == String::UTF16BE) && version != 4)
++ return String::UTF16;
++
++- if(encoding != String::Latin1)
+++ if((encoding != String::Latin1)&&(encoding != String::Latin1ID3V2))
++ return encoding;
++
++ for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
++diff --git a/taglib/toolkit/rccpatch.cpp b/taglib/toolkit/rccpatch.cpp
++new file mode 100644
++index 0000000..af99323
++--- /dev/null
+++++ b/taglib/toolkit/rccpatch.cpp
++@@ -0,0 +1,237 @@
+++#include <stdlib.h>
+++
+++#include <string>
+++#include "tstring.h"
+++#include "tbytevector.h"
+++
+++//#define RCC_DEBUG
+++
+++
+++#ifndef HAVE_LIBRCC
+++# include <config.h>
+++#endif
+++
+++#ifdef HAVE_LIBRCC
+++# ifdef RCC_DEBUG
+++# include <stdio.h>
+++# endif /* RCC_DEBUG */
+++# include <librcc.h>
+++# include <string.h>
+++#endif /* HAVE_LIBRCC */
+++
+++
+++#ifdef HAVE_LIBRCC
+++# define ID3_CLASS 0
+++# define ID3V2_CLASS 1
+++# define UTF_CLASS 2
+++# define OUT_CLASS 3
+++static rcc_class classes[] = {
+++ { "id3", RCC_CLASS_STANDARD, NULL, NULL, "ID3 Encoding", 0 },
+++ { "id3v2", RCC_CLASS_STANDARD, "id3", NULL, "ID3 v.2 Encoding", 0 },
+++ { "utf", RCC_CLASS_KNOWN, "UTF-8", NULL, "Unicode Encoding", 0},
+++ { "out", RCC_CLASS_TRANSLATE_LOCALE, "LC_CTYPE", NULL, "Output Encoding", 0 },
+++ { NULL, RCC_CLASS_STANDARD, NULL, NULL, NULL, 0 }
+++};
+++
+++static int rcc_initialized = 0;
+++
+++static rcc_context ctx = NULL;
+++#endif /* HAVE_LIBRCC */
+++
+++
+++void rccTaglibPatchFree() {
+++#ifdef HAVE_LIBRCC
+++ if (rcc_initialized) {
+++ rccFree();
+++ rcc_initialized = 0;
+++ }
+++#endif /* HAVE_LIBRCC */
+++}
+++
+++void rccTaglibPatchInit() {
+++#ifdef HAVE_LIBRCC
+++ if (rcc_initialized) return;
+++ rccInit();
+++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
+++ rccLoad(NULL, "xmms");
+++ rccInitDb4(NULL, NULL, 0);
+++ rcc_initialized = 1;
+++#endif /* HAVE_LIBRCC */
+++}
+++
+++void rccTaglibPatchSetContext(void *newctx) {
+++#ifdef HAVE_LIBRCC
+++ if (newctx) {
+++ ctx = (rcc_context)newctx;
+++ rcc_initialized = 1;
+++ }
+++#endif /* HAVE_LIBRCC */
+++}
+++
+++static void rccTaglibPatchTryInit() {
+++#ifdef HAVE_LIBRCC
+++ if (!rcc_initialized) {
+++ rccTaglibPatchInit();
+++ if (rcc_initialized) atexit(rccTaglibPatchFree);
+++ }
+++#endif /* HAVE_LIBRCC */
+++}
+++
+++
+++TagLib::ByteVector rccTaglibPatchRecodeOutput(const std::string &s) {
+++ TagLib::ByteVector v;
+++#ifdef HAVE_LIBRCC
+++ size_t rlen;
+++ char *res;
+++
+++ rccTaglibPatchTryInit();
+++
+++ res = rccSizedRecode(ctx, UTF_CLASS, OUT_CLASS, s.c_str(), s.length(), &rlen);
+++#ifdef RCC_DEBUG
+++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+++ if (*c > 127) {
+++ printf(" Output: %s - %s\n", s.c_str(), res?res:"null");
+++ break;
+++ }
+++ }
+++#endif /* RCC_DEBUG */
+++
+++ if (res) v.setData(res, rlen);
+++ else v.setData("", 0);
+++ //v.setData(s.c_str(), s.length());
+++
+++ return v;
+++#else
+++ v.setData("", 0);
+++
+++ return v;
+++#endif /* HAVE_LIBRCC */
+++}
+++
+++TagLib::ByteVector rccTaglibPatchRecodeOutputID3(const std::string &s, bool v2 = false) {
+++ TagLib::ByteVector v;
+++#ifdef HAVE_LIBRCC
+++ size_t rlen;
+++ char *res;
+++
+++ rccTaglibPatchTryInit();
+++
+++ res = rccSizedRecode(ctx, UTF_CLASS, v2?ID3V2_CLASS:ID3_CLASS, s.c_str(), s.length(), &rlen);
+++#ifdef RCC_DEBUG
+++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+++ if (*c > 127) {
+++ printf(" OutputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
+++ break;
+++ }
+++ }
+++#endif /* RCC_DEBUG */
+++
+++ if (res) v.setData(res, rlen);
+++ else v.setData("", 0);
+++ //v.setData(s.c_str(), s.length());
+++
+++ return v;
+++#else
+++ v.setData("", 0);
+++
+++ return v;
+++#endif /* HAVE_LIBRCC */
+++}
+++
+++TagLib::ByteVector rccTaglibPatchRecodeInput(const std::string &s) {
+++ TagLib::ByteVector v;
+++#ifdef HAVE_LIBRCC
+++ size_t rlen;
+++ char *res;
+++
+++ rccTaglibPatchTryInit();
+++
+++ res = rccSizedRecode(ctx, OUT_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
+++#ifdef RCC_DEBUG
+++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+++ if (*c > 127) {
+++ printf(" Input: %s - %s\n", s.c_str(), res?res:"null");
+++ break;
+++ }
+++ }
+++#endif /* RCC_DEBUG */
+++
+++ if (res) v.setData(res, rlen);
+++ else
+++#endif /* HAVE_LIBRCC */
+++ v.setData("", 0);
+++
+++ return v;
+++}
+++
+++TagLib::ByteVector rccTaglibPatchRecodeInputID3(const std::string &s, bool v2 = false) {
+++ TagLib::ByteVector v;
+++#ifdef HAVE_LIBRCC
+++ size_t rlen;
+++ char *res;
+++
+++ rccTaglibPatchTryInit();
+++
+++ res = rccSizedRecode(ctx, v2?ID3V2_CLASS:ID3_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
+++#ifdef RCC_DEBUG
+++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
+++ if (*c > 127) {
+++ printf(" InputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
+++ break;
+++ }
+++ }
+++#endif /* RCC_DEBUG */
+++ if (res) v.setData(res, rlen + 1);
+++ else
+++#endif /* HAVE_LIBRCC */
+++ v.setData("", 0);
+++
+++ return v;
+++}
+++
+++TagLib::String::Type rccTaglibPatchGetLocaleType() {
+++#ifdef HAVE_LIBRCC
+++ size_t len;
+++ char charset[32];
+++
+++ rccTaglibPatchTryInit();
+++ if (!rccLocaleGetCharset(charset, NULL, 31)) {
+++ if (!strncmp(charset, "UTF", 3)) {
+++ len = strlen(charset);
+++
+++ if (charset[len-1]=='8') return TagLib::String::UTF8;
+++ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
+++ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
+++ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
+++ }
+++ return TagLib::String::Latin1;
+++ }
+++#endif /* HAVE_LIBRCC */
+++ return TagLib::String::UTF8;
+++}
+++
+++TagLib::String::Type rccTaglibPatchGetID3Type() {
+++#ifdef HAVE_LIBRCC
+++ size_t len;
+++ const char *charset;
+++
+++ rccTaglibPatchTryInit();
+++
+++ charset = rccGetCurrentCharsetName(ctx, ID3V2_CLASS);
+++ if (charset) {
+++ if (!strncmp(charset, "UTF", 3)) {
+++ len = strlen(charset);
+++
+++ if (charset[len-1]=='8') return TagLib::String::UTF8;
+++ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
+++ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
+++ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
+++ }
+++ return TagLib::String::Latin1ID3V2;
+++ } else {
+++ // Error or no-language configured: If Latin1ID3V2 is returned we normally will use the default unicode encoding unless Latin1 is selected by taglib
+++ return TagLib::String::Latin1ID3V2;
+++ }
+++#endif /* HAVE_LIBRCC */
+++ return TagLib::String::Latin1;
+++}
++diff --git a/taglib/toolkit/rccpatch.h b/taglib/toolkit/rccpatch.h
++new file mode 100644
++index 0000000..31f4410
++--- /dev/null
+++++ b/taglib/toolkit/rccpatch.h
++@@ -0,0 +1,20 @@
+++#ifndef _RCC_PATCH_H
+++#define _RCC_PATCH_H
+++
+++#include <string.h>
+++#include "tstring.h"
+++#include "tbytevector.h"
+++
+++void rccTaglibPatchFree();
+++void rccTaglibPatchInit();
+++void rccTaglibPatchSetContext(void *newctx);
+++
+++TagLib::ByteVector rccTaglibPatchRecodeOutput(const std::string &s);
+++TagLib::ByteVector rccTaglibPatchRecodeInput(const std::string &s);
+++TagLib::ByteVector rccTaglibPatchRecodeOutputID3(const std::string &s, bool v2 = false);
+++TagLib::ByteVector rccTaglibPatchRecodeInputID3(const std::string &s, bool v2 = false);
+++
+++TagLib::String::Type rccTaglibPatchGetLocaleType();
+++TagLib::String::Type rccTaglibPatchGetID3Type();
+++
+++#endif /* _RCC_PATCH_H */
++diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp
++index 258e1fc..70ff160 100644
++--- a/taglib/toolkit/tstring.cpp
+++++ b/taglib/toolkit/tstring.cpp
++@@ -29,6 +29,7 @@
++ #include <config.h>
++ #endif
++
+++#include "rccpatch.h"
++ #include "tstring.h"
++ #include "tdebug.h"
++ #include "tstringlist.h"
++@@ -167,8 +168,11 @@ String::String(const String &s)
++ String::String(const std::string &s, Type t)
++ : d(new StringPrivate())
++ {
++- if(t == Latin1)
++- copyFromLatin1(s.c_str(), s.length());
+++ if(t == Locale)
+++ t = rccTaglibPatchGetLocaleType();
+++
+++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
+++ copyFromLatin1(&s[0], s.length(), true, t);
++ else if(t == String::UTF8)
++ copyFromUTF8(s.c_str(), s.length());
++ else {
++@@ -215,8 +219,11 @@ String::String(const wchar_t *s, Type t)
++ String::String(const char *s, Type t)
++ : d(new StringPrivate())
++ {
++- if(t == Latin1)
++- copyFromLatin1(s, ::strlen(s));
+++ if(t == Locale)
+++ t = rccTaglibPatchGetLocaleType();
+++
+++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
+++ copyFromLatin1(s, ::strlen(s), true, t);
++ else if(t == String::UTF8)
++ copyFromUTF8(s, ::strlen(s));
++ else {
++@@ -248,8 +255,11 @@ String::String(const ByteVector &v, Type t)
++ if(v.isEmpty())
++ return;
++
++- if(t == Latin1)
++- copyFromLatin1(v.data(), v.size());
+++ if(t == Locale)
+++ t = rccTaglibPatchGetLocaleType();
+++
+++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
+++ copyFromLatin1(v.data(), v.size(), true, t);
++ else if(t == UTF8)
++ copyFromUTF8(v.data(), v.size());
++ else
++@@ -396,8 +406,38 @@ bool String::isNull() const
++
++ ByteVector String::data(Type t) const
++ {
++- switch(t)
++- {
+++ ByteVector v;
+++
+++ if (t == Locale) {
+++ // The source is either Unicode or real Latin1 (if rcc is bypassed)
+++ std::string s = to8Bit(true);
+++
+++ // In case of UTF8 locale, this probably will return NULL (no recoding needed), but we will take UTF8 path in the next swtich
+++ v = rccTaglibPatchRecodeOutput(s);
+++ if (v.size()) return v;
+++
+++ t = rccTaglibPatchGetLocaleType();
+++ }
+++
+++ switch(t) {
+++ case Latin1ID3:
+++ case Latin1ID3V2:
+++ {
+++ std::string s = to8Bit(true);
+++ if (t == Latin1ID3) v = rccTaglibPatchRecodeOutputID3(s, false);
+++ else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeOutputID3(s, true);
+++ if (v.size())
+++ return v;
+++
+++ // we don't know if we got NULL because rcc is disabled (error) or UTF8 output is required
+++ if ((t == Latin1ID3V2)&&(rccTaglibPatchGetID3Type() == UTF8)) {
+++ v.setData(s.c_str(), s.length());
+++ } else {
+++ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
+++ v.append(char(*it));
+++ }
+++ return v;
+++ }
++ case Latin1:
++ {
++ ByteVector v(size(), 0);
++@@ -738,12 +778,30 @@ void String::detach()
++ // private members
++ ////////////////////////////////////////////////////////////////////////////////
++
++-void String::copyFromLatin1(const char *s, size_t length)
+++void String::copyFromLatin1(const char *s, size_t length, bool prepare, Type t)
++ {
++ d->data.resize(length);
++
++ for(size_t i = 0; i < length; ++i)
++ d->data[i] = static_cast<uchar>(s[i]);
+++
+++ // librcc conversation
+++ if (prepare) {
+++ std::string s = to8Bit(false);
+++ ByteVector v;
+++
+++ if (t == Latin1ID3) v = rccTaglibPatchRecodeInputID3(s, false);
+++ else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeInputID3(s, true);
+++ else /* Latin1 converted from Locale */ v = rccTaglibPatchRecodeInput(s);
+++
+++ if (v.size()) {
+++ copyFromUTF8(v.data(), v.size());
+++ } else {
+++ // We don't know if we got UTF-8 encoded string or either rcc is disable or something is failed,
+++ // since standard applications are really expecting here Latin1, it is safe to just check if we have violations of UTF8
+++ //if (Unicode::isLegalUTF8(s)) t = UTF8;
+++ }
+++ }
++ }
++
++ void String::copyFromUTF8(const char *s, size_t length)
++@@ -859,7 +917,33 @@ const TagLib::String operator+(const TagLib::String &s1, const char *s2)
++
++ std::ostream &operator<<(std::ostream &s, const TagLib::String &str)
++ {
++- s << str.to8Bit();
+++ TagLib::ByteVector bv = str.data(TagLib::String::Locale);
+++ s << bv;
++ return s;
++ }
++
+++TagLib::String::Type TagLib::String::ID3Type(int i)
+++{
+++ if(i == Latin1)
+++ return Latin1ID3V2;
+++ return Type(i);
+++};
+++
+++TagLib::String::Type TagLib::String::ID3WType(Type type)
+++{
+++ Type rcc_type = rccTaglibPatchGetID3Type();
+++ if((rcc_type == Latin1ID3)||(rcc_type == Latin1ID3V2)||(rcc_type == Latin1)) {
+++ if(type == Latin1) return
+++ rcc_type;
+++ return type;
+++ }
+++
+++ return rcc_type;
+++};
+++
+++TagLib::String::Type TagLib::String::ID3RealType(Type type)
+++{
+++ if((type == Latin1ID3) || (type == Latin1ID3V2))
+++ return Latin1;
+++ return type;
+++}
++diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h
++index 8b73988..8efca25 100644
++--- a/taglib/toolkit/tstring.h
+++++ b/taglib/toolkit/tstring.h
++@@ -96,6 +96,18 @@ namespace TagLib {
++ */
++ enum Type {
++ /*!
+++ * Determine using current locale settings
+++ */
+++ Locale = -1,
+++ /*!
+++ * Latin1 for ID3 tags.
+++ */
+++ Latin1ID3 = 65,
+++ /*!
+++ * Latin1 for ID3v2 tags.
+++ */
+++ Latin1ID3V2 = 66,
+++ /*!
++ * IS08859-1, or <i>Latin1</i> encoding. 8 bit characters.
++ */
++ Latin1 = 0,
++@@ -117,6 +129,10 @@ namespace TagLib {
++ */
++ UTF16LE = 4
++ };
+++
+++ static Type ID3Type(int i);
+++ static Type ID3WType(Type type);
+++ static Type ID3RealType(Type type);
++
++ /*!
++ * Constructs an empty String.
++@@ -519,7 +535,7 @@ namespace TagLib {
++ * Converts a \e Latin-1 string into \e UTF-16(without BOM/CPU byte order)
++ * and copies it to the internal buffer.
++ */
++- void copyFromLatin1(const char *s, size_t length);
+++ void copyFromLatin1(const char *s, size_t length, bool prepare = false, Type t = Latin1);
++
++ /*!
++ * Converts a \e UTF-8 string into \e UTF-16(without BOM/CPU byte order)
diff --git a/media-libs/taglib/files/taglib-1.6.1-install-examples.patch b/media-libs/taglib/files/taglib-1.6.1-install-examples.patch
new file mode 100644
index 0000000..f537681
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.6.1-install-examples.patch
@@ -0,0 +1,16 @@
+diff -purN taglib-1.6.1.orig/examples/CMakeLists.txt taglib-1.6.1/examples/CMakeLists.txt
+--- taglib-1.6.1.orig/examples/CMakeLists.txt 2009-09-09 14:16:38.000000000 -0400
++++ taglib-1.6.1/examples/CMakeLists.txt 2009-12-14 18:47:33.405385063 -0500
+@@ -45,6 +45,12 @@ ADD_EXECUTABLE(strip-id3v1 strip-id3v1.c
+
+ TARGET_LINK_LIBRARIES(strip-id3v1 tag )
+
++INSTALL(TARGETS
++ tagreader tagreader_c tagwriter framelist strip-id3v1
++ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
++ RUNTIME DESTINATION ${BIN_INSTALL_DIR}
++ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
++)
+
+ endif(BUILD_EXAMPLES)
+
diff --git a/media-libs/taglib/files/taglib-1.9.1-abi-breakage.patch b/media-libs/taglib/files/taglib-1.9.1-abi-breakage.patch
new file mode 100644
index 0000000..930439f
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.9.1-abi-breakage.patch
@@ -0,0 +1,107 @@
+From 3bf30af66c8fd77a88d9379a0956ddb2fc70dc20 Mon Sep 17 00:00:00 2001
+From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
+Date: Wed, 6 Nov 2013 17:01:21 +0900
+Subject: [PATCH 2/6] Fixed ABI breakage in TagLib::String
+
+---
+ taglib/toolkit/tstring.cpp | 20 ++++++++++++++++++--
+ taglib/toolkit/tstring.h | 12 ++++++++++--
+ tests/test_string.cpp | 14 ++++++++++++++
+ 3 files changed, 42 insertions(+), 4 deletions(-)
+
+diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp
+index 75a9833..fb6e947 100644
+--- a/taglib/toolkit/tstring.cpp
++++ b/taglib/toolkit/tstring.cpp
+@@ -209,8 +209,16 @@ String::String(const std::string &s, Type t)
+ String::String(const wstring &s, Type t)
+ : d(new StringPrivate())
+ {
+- if(t == UTF16 || t == UTF16BE || t == UTF16LE)
++ if(t == UTF16 || t == UTF16BE || t == UTF16LE) {
++ // This looks ugly but needed for the compatibility with TagLib1.8.
++ // Should be removed in TabLib2.0.
++ if (t == UTF16BE)
++ t = WCharByteOrder;
++ else if (t == UTF16LE)
++ t = (WCharByteOrder == UTF16LE ? UTF16BE : UTF16LE);
++
+ copyFromUTF16(s.c_str(), s.length(), t);
++ }
+ else {
+ debug("String::String() -- A TagLib::wstring should not contain Latin1 or UTF-8.");
+ }
+@@ -219,8 +227,16 @@ String::String(const wstring &s, Type t)
+ String::String(const wchar_t *s, Type t)
+ : d(new StringPrivate())
+ {
+- if(t == UTF16 || t == UTF16BE || t == UTF16LE)
++ if(t == UTF16 || t == UTF16BE || t == UTF16LE) {
++ // This looks ugly but needed for the compatibility with TagLib1.8.
++ // Should be removed in TabLib2.0.
++ if (t == UTF16BE)
++ t = WCharByteOrder;
++ else if (t == UTF16LE)
++ t = (WCharByteOrder == UTF16LE ? UTF16BE : UTF16LE);
++
+ copyFromUTF16(s, ::wcslen(s), t);
++ }
+ else {
+ debug("String::String() -- A const wchar_t * should not contain Latin1 or UTF-8.");
+ }
+diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h
+index 57945be..605b9c2 100644
+--- a/taglib/toolkit/tstring.h
++++ b/taglib/toolkit/tstring.h
+@@ -134,13 +134,21 @@ namespace TagLib {
+
+ /*!
+ * Makes a deep copy of the data in \a s.
++ *
++ * /note If \a t is UTF16LE, the byte order of \a s will be swapped regardless
++ * of the CPU byte order. If UTF16BE, it will not be swapped. This behavior
++ * will be changed in TagLib2.0.
+ */
+- String(const wstring &s, Type t = WCharByteOrder);
++ String(const wstring &s, Type t = UTF16BE);
+
+ /*!
+ * Makes a deep copy of the data in \a s.
++ *
++ * /note If \a t is UTF16LE, the byte order of \a s will be swapped regardless
++ * of the CPU byte order. If UTF16BE, it will not be swapped. This behavior
++ * will be changed in TagLib2.0.
+ */
+- String(const wchar_t *s, Type t = WCharByteOrder);
++ String(const wchar_t *s, Type t = UTF16BE);
+
+ /*!
+ * Makes a deep copy of the data in \a c.
+diff --git a/tests/test_string.cpp b/tests/test_string.cpp
+index a815a0b..9a574b3 100644
+--- a/tests/test_string.cpp
++++ b/tests/test_string.cpp
+@@ -75,6 +75,20 @@ public:
+ String unicode3(L"\u65E5\u672C\u8A9E");
+ CPPUNIT_ASSERT(*(unicode3.toCWString() + 1) == L'\u672C');
+
++ String unicode4(L"\u65e5\u672c\u8a9e", String::UTF16BE);
++ CPPUNIT_ASSERT(unicode4[1] == L'\u672c');
++
++ String unicode5(L"\u65e5\u672c\u8a9e", String::UTF16LE);
++ CPPUNIT_ASSERT(unicode5[1] == L'\u2c67');
++
++ wstring stduni = L"\u65e5\u672c\u8a9e";
++
++ String unicode6(stduni, String::UTF16BE);
++ CPPUNIT_ASSERT(unicode6[1] == L'\u672c');
++
++ String unicode7(stduni, String::UTF16LE);
++ CPPUNIT_ASSERT(unicode7[1] == L'\u2c67');
++
+ CPPUNIT_ASSERT(strcmp(String::number(0).toCString(), "0") == 0);
+ CPPUNIT_ASSERT(strcmp(String::number(12345678).toCString(), "12345678") == 0);
+ CPPUNIT_ASSERT(strcmp(String::number(-12345678).toCString(), "-12345678") == 0);
+--
+1.8.4.2
+
diff --git a/media-libs/taglib/files/taglib-1.9.1-bytevector-simpler.patch b/media-libs/taglib/files/taglib-1.9.1-bytevector-simpler.patch
new file mode 100644
index 0000000..0b134ec
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.9.1-bytevector-simpler.patch
@@ -0,0 +1,131 @@
+From 4a7d31c87bf41c1de21cb725176d5b34c2a95720 Mon Sep 17 00:00:00 2001
+From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
+Date: Thu, 14 Nov 2013 14:05:32 +0900
+Subject: [PATCH 3/6] Rewrote ByteVector::replace() simpler
+
+---
+ taglib/toolkit/tbytevector.cpp | 77 +++++++++++++++---------------------------
+ tests/test_bytevector.cpp | 5 +++
+ 2 files changed, 33 insertions(+), 49 deletions(-)
+
+diff --git a/taglib/toolkit/tbytevector.cpp b/taglib/toolkit/tbytevector.cpp
+index b658246..566a20f 100644
+--- a/taglib/toolkit/tbytevector.cpp
++++ b/taglib/toolkit/tbytevector.cpp
+@@ -31,6 +31,7 @@
+ #include <iostream>
+ #include <cstdio>
+ #include <cstring>
++#include <cstddef>
+
+ #include <tstring.h>
+ #include <tdebug.h>
+@@ -508,62 +509,40 @@ ByteVector &ByteVector::replace(const ByteVector &pattern, const ByteVector &wit
+ if(pattern.size() == 0 || pattern.size() > size())
+ return *this;
+
+- const uint withSize = with.size();
+- const uint patternSize = pattern.size();
+- int offset = 0;
++ const size_t withSize = with.size();
++ const size_t patternSize = pattern.size();
++ const ptrdiff_t diff = withSize - patternSize;
++
++ size_t offset = 0;
++ while (true)
++ {
++ offset = find(pattern, offset);
++ if(offset == static_cast<size_t>(-1)) // Use npos in taglib2.
++ break;
+
+- if(withSize == patternSize) {
+- // I think this case might be common enough to optimize it
+ detach();
+- offset = find(pattern);
+- while(offset >= 0) {
+- ::memcpy(data() + offset, with.data(), withSize);
+- offset = find(pattern, offset + withSize);
+- }
+- return *this;
+- }
+
+- // calculate new size:
+- uint newSize = 0;
+- for(;;) {
+- int next = find(pattern, offset);
+- if(next < 0) {
+- if(offset == 0)
+- // pattern not found, do nothing:
+- return *this;
+- newSize += size() - offset;
+- break;
++ if(diff < 0) {
++ ::memmove(
++ data() + offset + withSize,
++ data() + offset + patternSize,
++ size() - offset - patternSize);
++ resize(size() + diff);
+ }
+- newSize += (next - offset) + withSize;
+- offset = next + patternSize;
+- }
+-
+- // new private data of appropriate size:
+- ByteVectorPrivate *newData = new ByteVectorPrivate(newSize, 0);
+- char *target = DATA(newData);
+- const char *source = data();
+-
+- // copy modified data into new private data:
+- offset = 0;
+- for(;;) {
+- int next = find(pattern, offset);
+- if(next < 0) {
+- ::memcpy(target, source + offset, size() - offset);
+- break;
++ else if(diff > 0) {
++ resize(size() + diff);
++ ::memmove(
++ data() + offset + withSize,
++ data() + offset + patternSize,
++ size() - diff - offset - patternSize);
+ }
+- int chunkSize = next - offset;
+- ::memcpy(target, source + offset, chunkSize);
+- target += chunkSize;
+- ::memcpy(target, with.data(), withSize);
+- target += withSize;
+- offset += chunkSize + patternSize;
+- }
+
+- // replace private data:
+- if(d->deref())
+- delete d;
++ ::memcpy(data() + offset, with.data(), with.size());
+
+- d = newData;
++ offset += withSize;
++ if(offset > size() - patternSize)
++ break;
++ }
+
+ return *this;
+ }
+diff --git a/tests/test_bytevector.cpp b/tests/test_bytevector.cpp
+index 9efd23a..eca74f8 100644
+--- a/tests/test_bytevector.cpp
++++ b/tests/test_bytevector.cpp
+@@ -239,6 +239,11 @@ public:
+ a.replace(ByteVector("ab"), ByteVector());
+ CPPUNIT_ASSERT_EQUAL(ByteVector("cdf"), a);
+ }
++ {
++ ByteVector a("abcdabf");
++ a.replace(ByteVector("bf"), ByteVector("x"));
++ CPPUNIT_ASSERT_EQUAL(ByteVector("abcdax"), a);
++ }
+ }
+
+ };
+--
+1.8.4.2
+
diff --git a/media-libs/taglib/files/taglib-1.9.1-ds-rusxmms-enforce.patch b/media-libs/taglib/files/taglib-1.9.1-ds-rusxmms-enforce.patch
new file mode 100644
index 0000000..e980b7a
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.9.1-ds-rusxmms-enforce.patch
@@ -0,0 +1,20 @@
+--- taglib-1.9.1/taglib/mpeg/id3v1/id3v1tag.h 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-taurus/taglib/mpeg/id3v1/id3v1tag.h 2013-11-12 00:24:31.206495291 +0100
+@@ -68,7 +68,7 @@
+ * Decode a string from \a data. The default implementation assumes that
+ * \a data is an ISO-8859-1 (Latin1) character array.
+ */
+- virtual String parse(const ByteVector &data) const;
++ String parse(const ByteVector &data) const;
+
+ /*!
+ * Encode a ByteVector with the data from \a s. The default implementation
+@@ -79,7 +79,7 @@
+ * instead do not write an ID3v1 tag in the case that the data is not
+ * ISO-8859-1.
+ */
+- virtual ByteVector render(const String &s) const;
++ ByteVector render(const String &s) const;
+ };
+
+ //! The main class in the ID3v1 implementation
diff --git a/media-libs/taglib/files/taglib-1.9.1-ds-rusxmms.patch b/media-libs/taglib/files/taglib-1.9.1-ds-rusxmms.patch
new file mode 100644
index 0000000..b64b5b5
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.9.1-ds-rusxmms.patch
@@ -0,0 +1,676 @@
+diff -dPNur taglib-1.9.1/config.h.cmake taglib-1.9.1-ds/config.h.cmake
+--- taglib-1.9.1/config.h.cmake 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/config.h.cmake 2013-11-11 13:43:48.500304915 +0100
+@@ -31,6 +31,9 @@
+ /* Defined if you have libz */
+ #cmakedefine HAVE_ZLIB 1
+
++/* Defined if you have LibRCC from RusXMMS project */
++#cmakedefine HAVE_LIBRCC 1
++
+ /* Indicates whether debug messages are shown even in release mode */
+ #cmakedefine TRACE_IN_RELEASE 1
+
+diff -dPNur taglib-1.9.1/ConfigureChecks.cmake taglib-1.9.1-ds/ConfigureChecks.cmake
+--- taglib-1.9.1/ConfigureChecks.cmake 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/ConfigureChecks.cmake 2013-11-11 13:42:53.017126134 +0100
+@@ -216,6 +216,7 @@
+ set(HAVE_ZLIB 0)
+ endif()
+
++SET(HAVE_LIBRCC 1)
+
+ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+
+diff -dPNur taglib-1.9.1/examples/tagreader_c.c taglib-1.9.1-ds/examples/tagreader_c.c
+--- taglib-1.9.1/examples/tagreader_c.c 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/examples/tagreader_c.c 2013-11-11 13:42:53.017126134 +0100
+@@ -38,7 +38,7 @@
+ TagLib_Tag *tag;
+ const TagLib_AudioProperties *properties;
+
+- taglib_set_strings_unicode(FALSE);
++// taglib_set_strings_unicode(FALSE);
+
+ for(i = 1; i < argc; i++) {
+ printf("******************** \"%s\" ********************\n", argv[i]);
+diff -dPNur taglib-1.9.1/examples/tagwriter.cpp taglib-1.9.1-ds/examples/tagwriter.cpp
+--- taglib-1.9.1/examples/tagwriter.cpp 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/examples/tagwriter.cpp 2013-11-11 13:42:53.028126368 +0100
+@@ -92,7 +92,7 @@
+ if(isArgument(argv[i]) && i + 1 < argc && !isArgument(argv[i + 1])) {
+
+ char field = argv[i][1];
+- TagLib::String value = argv[i + 1];
++ TagLib::String value(argv[i + 1], TagLib::String::Locale);
+
+ TagLib::List<TagLib::FileRef>::Iterator it;
+ for(it = fileList.begin(); it != fileList.end(); ++it) {
+diff -dPNur taglib-1.9.1/taglib/CMakeLists.txt taglib-1.9.1-ds/taglib/CMakeLists.txt
+--- taglib-1.9.1/taglib/CMakeLists.txt 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/taglib/CMakeLists.txt 2013-11-11 13:42:53.042126665 +0100
+@@ -36,6 +36,7 @@
+ audioproperties.h
+ taglib_export.h
+ ${CMAKE_BINARY_DIR}/taglib_config.h
++ toolkit/rccpatch.h
+ toolkit/taglib.h
+ toolkit/tstring.h
+ toolkit/tlist.h
+@@ -281,6 +282,7 @@
+ )
+
+ set(toolkit_SRCS
++ toolkit/rccpatch.cpp
+ toolkit/tstring.cpp
+ toolkit/tstringlist.cpp
+ toolkit/tbytevector.cpp
+@@ -310,7 +312,7 @@
+ add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
+
+ if(ZLIB_FOUND)
+- target_link_libraries(tag ${ZLIB_LIBRARIES})
++ target_link_libraries(tag rcc ${ZLIB_LIBRARIES})
+ endif()
+
+ set_target_properties(tag PROPERTIES
+diff -dPNur taglib-1.9.1/taglib/mpeg/id3v1/id3v1tag.cpp taglib-1.9.1-ds/taglib/mpeg/id3v1/id3v1tag.cpp
+--- taglib-1.9.1/taglib/mpeg/id3v1/id3v1tag.cpp 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/taglib/mpeg/id3v1/id3v1tag.cpp 2013-11-11 13:42:53.043126686 +0100
+@@ -64,17 +64,18 @@
+
+ String ID3v1::StringHandler::parse(const ByteVector &data) const
+ {
+- return String(data, String::Latin1).stripWhiteSpace();
++ return String(data, String::Latin1ID3).stripWhiteSpace();
+ }
+
+ ByteVector ID3v1::StringHandler::render(const String &s) const
+ {
+ if(!s.isLatin1())
+ {
++ if (String::ID3WType(String::Latin1) == String::Latin1)
+ return ByteVector();
+ }
+
+- return s.data(String::Latin1);
++ return s.data(String::Latin1ID3);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+@@ -257,7 +258,7 @@
+ d->track = uchar(data[offset + 29]);
+ }
+ else
+- d->comment = data.mid(offset, 30);
++ d->comment = TagPrivate::stringHandler->parse(data.mid(offset, 30));
+
+ offset += 30;
+
+diff -dPNur taglib-1.9.1/taglib/mpeg/id3v2/frames/commentsframe.cpp taglib-1.9.1-ds/taglib/mpeg/id3v2/frames/commentsframe.cpp
+--- taglib-1.9.1/taglib/mpeg/id3v2/frames/commentsframe.cpp 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/taglib/mpeg/id3v2/frames/commentsframe.cpp 2013-11-11 13:42:53.043126686 +0100
+@@ -150,10 +150,10 @@
+ return;
+ }
+
+- d->textEncoding = String::Type(data[0]);
++ d->textEncoding = String::ID3Type(data[0]);
+ d->language = data.mid(1, 3);
+
+- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
++ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
+
+ ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
+
+@@ -174,10 +174,12 @@
+
+ String::Type encoding = d->textEncoding;
+
++ encoding = String::ID3WType(encoding);
++
+ encoding = checkTextEncoding(d->description, encoding);
+ encoding = checkTextEncoding(d->text, encoding);
+
+- v.append(char(encoding));
++ v.append(char(String::ID3RealType(encoding)));
+ v.append(d->language.size() == 3 ? d->language : "XXX");
+ v.append(d->description.data(encoding));
+ v.append(textDelimiter(encoding));
+diff -dPNur taglib-1.9.1/taglib/mpeg/id3v2/frames/textidentificationframe.cpp taglib-1.9.1-ds/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
+--- taglib-1.9.1/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2013-11-11 13:42:53.044126708 +0100
+@@ -187,12 +187,12 @@
+
+ // read the string data type (the first byte of the field data)
+
+- d->textEncoding = String::Type(data[0]);
++ d->textEncoding = String::ID3Type(data[0]);
+
+ // split the byte array into chunks based on the string type (two byte delimiter
+ // for unicode encodings)
+
+- int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
++ int byteAlign = (d->textEncoding == String::Latin1 || d->textEncoding == String::Latin1ID3 || d->textEncoding == String::Latin1ID3V2 || d->textEncoding == String::UTF8) ? 1 : 2;
+
+ // build a small counter to strip nulls off the end of the field
+
+@@ -223,11 +223,14 @@
+
+ ByteVector TextIdentificationFrame::renderFields() const
+ {
+- String::Type encoding = checkTextEncoding(d->fieldList, d->textEncoding);
++ String::Type encoding = d->textEncoding;
++
++ encoding = String::ID3WType(encoding);
++ encoding = checkTextEncoding(d->fieldList, encoding);
+
+ ByteVector v;
+
+- v.append(char(encoding));
++ v.append(char(String::ID3RealType(encoding)));
+
+ for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
+
+diff -dPNur taglib-1.9.1/taglib/mpeg/id3v2/id3v2frame.cpp taglib-1.9.1-ds/taglib/mpeg/id3v2/id3v2frame.cpp
+--- taglib-1.9.1/taglib/mpeg/id3v2/id3v2frame.cpp 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/taglib/mpeg/id3v2/id3v2frame.cpp 2013-11-11 13:42:53.045126729 +0100
+@@ -302,7 +302,7 @@
+ if((encoding == String::UTF8 || encoding == String::UTF16BE) && version != 4)
+ return String::UTF16;
+
+- if(encoding != String::Latin1)
++ if((encoding != String::Latin1)&&(encoding != String::Latin1ID3V2))
+ return encoding;
+
+ for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
+diff -dPNur taglib-1.9.1/taglib/toolkit/rccpatch.cpp taglib-1.9.1-ds/taglib/toolkit/rccpatch.cpp
+--- taglib-1.9.1/taglib/toolkit/rccpatch.cpp 1970-01-01 01:00:00.000000000 +0100
++++ taglib-1.9.1-ds/taglib/toolkit/rccpatch.cpp 2013-11-11 13:42:53.045126729 +0100
+@@ -0,0 +1,237 @@
++#include <stdlib.h>
++
++#include <string>
++#include "tstring.h"
++#include "tbytevector.h"
++
++//#define RCC_DEBUG
++
++
++#ifndef HAVE_LIBRCC
++# include <config.h>
++#endif
++
++#ifdef HAVE_LIBRCC
++# ifdef RCC_DEBUG
++# include <stdio.h>
++# endif /* RCC_DEBUG */
++# include <librcc.h>
++# include <string.h>
++#endif /* HAVE_LIBRCC */
++
++
++#ifdef HAVE_LIBRCC
++# define ID3_CLASS 0
++# define ID3V2_CLASS 1
++# define UTF_CLASS 2
++# define OUT_CLASS 3
++static rcc_class classes[] = {
++ { "id3", RCC_CLASS_STANDARD, NULL, NULL, "ID3 Encoding", 0 },
++ { "id3v2", RCC_CLASS_STANDARD, "id3", NULL, "ID3 v.2 Encoding", 0 },
++ { "utf", RCC_CLASS_KNOWN, "UTF-8", NULL, "Unicode Encoding", 0},
++ { "out", RCC_CLASS_TRANSLATE_LOCALE, "LC_CTYPE", NULL, "Output Encoding", 0 },
++ { NULL, RCC_CLASS_STANDARD, NULL, NULL, NULL, 0 }
++};
++
++static int rcc_initialized = 0;
++
++static rcc_context ctx = NULL;
++#endif /* HAVE_LIBRCC */
++
++
++void rccTaglibPatchFree() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) {
++ rccFree();
++ rcc_initialized = 0;
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++void rccTaglibPatchInit() {
++#ifdef HAVE_LIBRCC
++ if (rcc_initialized) return;
++ rccInit();
++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
++ rccLoad(NULL, "xmms");
++ rccInitDb4(NULL, NULL, 0);
++ rcc_initialized = 1;
++#endif /* HAVE_LIBRCC */
++}
++
++void rccTaglibPatchSetContext(void *newctx) {
++#ifdef HAVE_LIBRCC
++ if (newctx) {
++ ctx = (rcc_context)newctx;
++ rcc_initialized = 1;
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++static void rccTaglibPatchTryInit() {
++#ifdef HAVE_LIBRCC
++ if (!rcc_initialized) {
++ rccTaglibPatchInit();
++ if (rcc_initialized) atexit(rccTaglibPatchFree);
++ }
++#endif /* HAVE_LIBRCC */
++}
++
++
++TagLib::ByteVector rccTaglibPatchRecodeOutput(const std::string &s) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, UTF_CLASS, OUT_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" Output: %s - %s\n", s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++
++ if (res) v.setData(res, rlen);
++ else v.setData("", 0);
++ //v.setData(s.c_str(), s.length());
++
++ return v;
++#else
++ v.setData("", 0);
++
++ return v;
++#endif /* HAVE_LIBRCC */
++}
++
++TagLib::ByteVector rccTaglibPatchRecodeOutputID3(const std::string &s, bool v2 = false) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, UTF_CLASS, v2?ID3V2_CLASS:ID3_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" OutputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++
++ if (res) v.setData(res, rlen);
++ else v.setData("", 0);
++ //v.setData(s.c_str(), s.length());
++
++ return v;
++#else
++ v.setData("", 0);
++
++ return v;
++#endif /* HAVE_LIBRCC */
++}
++
++TagLib::ByteVector rccTaglibPatchRecodeInput(const std::string &s) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, OUT_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" Input: %s - %s\n", s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++
++ if (res) v.setData(res, rlen);
++ else
++#endif /* HAVE_LIBRCC */
++ v.setData("", 0);
++
++ return v;
++}
++
++TagLib::ByteVector rccTaglibPatchRecodeInputID3(const std::string &s, bool v2 = false) {
++ TagLib::ByteVector v;
++#ifdef HAVE_LIBRCC
++ size_t rlen;
++ char *res;
++
++ rccTaglibPatchTryInit();
++
++ res = rccSizedRecode(ctx, v2?ID3V2_CLASS:ID3_CLASS, UTF_CLASS, s.c_str(), s.length(), &rlen);
++#ifdef RCC_DEBUG
++ for (const unsigned char *c = (const unsigned char*)s.c_str(); *c; c++) {
++ if (*c > 127) {
++ printf(" InputID3(%i): %s - %s\n", v2, s.c_str(), res?res:"null");
++ break;
++ }
++ }
++#endif /* RCC_DEBUG */
++ if (res) v.setData(res, rlen + 1);
++ else
++#endif /* HAVE_LIBRCC */
++ v.setData("", 0);
++
++ return v;
++}
++
++TagLib::String::Type rccTaglibPatchGetLocaleType() {
++#ifdef HAVE_LIBRCC
++ size_t len;
++ char charset[32];
++
++ rccTaglibPatchTryInit();
++ if (!rccLocaleGetCharset(charset, NULL, 31)) {
++ if (!strncmp(charset, "UTF", 3)) {
++ len = strlen(charset);
++
++ if (charset[len-1]=='8') return TagLib::String::UTF8;
++ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
++ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
++ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
++ }
++ return TagLib::String::Latin1;
++ }
++#endif /* HAVE_LIBRCC */
++ return TagLib::String::UTF8;
++}
++
++TagLib::String::Type rccTaglibPatchGetID3Type() {
++#ifdef HAVE_LIBRCC
++ size_t len;
++ const char *charset;
++
++ rccTaglibPatchTryInit();
++
++ charset = rccGetCurrentCharsetName(ctx, ID3V2_CLASS);
++ if (charset) {
++ if (!strncmp(charset, "UTF", 3)) {
++ len = strlen(charset);
++
++ if (charset[len-1]=='8') return TagLib::String::UTF8;
++ if (!strcmp(charset+(len-2),"16")) return TagLib::String::UTF16;
++ if (!strcmp(charset+(len-4),"16LE")) return TagLib::String::UTF16LE;
++ if (!strcmp(charset+(len-4),"16BE")) return TagLib::String::UTF16BE;
++ }
++ return TagLib::String::Latin1ID3V2;
++ } else {
++ // Error or no-language configured: If Latin1ID3V2 is returned we normally will use the default unicode encoding unless Latin1 is selected by taglib
++ return TagLib::String::Latin1ID3V2;
++ }
++#endif /* HAVE_LIBRCC */
++ return TagLib::String::Latin1;
++}
+diff -dPNur taglib-1.9.1/taglib/toolkit/rccpatch.h taglib-1.9.1-ds/taglib/toolkit/rccpatch.h
+--- taglib-1.9.1/taglib/toolkit/rccpatch.h 1970-01-01 01:00:00.000000000 +0100
++++ taglib-1.9.1-ds/taglib/toolkit/rccpatch.h 2013-11-11 13:42:53.045126729 +0100
+@@ -0,0 +1,20 @@
++#ifndef _RCC_PATCH_H
++#define _RCC_PATCH_H
++
++#include <string.h>
++#include "tstring.h"
++#include "tbytevector.h"
++
++void rccTaglibPatchFree();
++void rccTaglibPatchInit();
++void rccTaglibPatchSetContext(void *newctx);
++
++TagLib::ByteVector rccTaglibPatchRecodeOutput(const std::string &s);
++TagLib::ByteVector rccTaglibPatchRecodeInput(const std::string &s);
++TagLib::ByteVector rccTaglibPatchRecodeOutputID3(const std::string &s, bool v2 = false);
++TagLib::ByteVector rccTaglibPatchRecodeInputID3(const std::string &s, bool v2 = false);
++
++TagLib::String::Type rccTaglibPatchGetLocaleType();
++TagLib::String::Type rccTaglibPatchGetID3Type();
++
++#endif /* _RCC_PATCH_H */
+diff -dPNur taglib-1.9.1/taglib/toolkit/tstring.cpp taglib-1.9.1-ds/taglib/toolkit/tstring.cpp
+--- taglib-1.9.1/taglib/toolkit/tstring.cpp 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/taglib/toolkit/tstring.cpp 2013-11-11 13:42:53.046126750 +0100
+@@ -29,6 +29,7 @@
+ #include <config.h>
+ #endif
+
++#include "rccpatch.h"
+ #include "tstring.h"
+ #include "tdebug.h"
+ #include "tstringlist.h"
+@@ -197,8 +198,11 @@
+ String::String(const std::string &s, Type t)
+ : d(new StringPrivate())
+ {
+- if(t == Latin1)
+- copyFromLatin1(&s[0], s.length());
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
++ copyFromLatin1(&s[0], s.length(), true, t);
+ else if(t == String::UTF8)
+ copyFromUTF8(&s[0], s.length());
+ else {
+@@ -229,8 +233,11 @@
+ String::String(const char *s, Type t)
+ : d(new StringPrivate())
+ {
+- if(t == Latin1)
+- copyFromLatin1(s, ::strlen(s));
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
++ copyFromLatin1(s, ::strlen(s), true, t);
+ else if(t == String::UTF8)
+ copyFromUTF8(s, ::strlen(s));
+ else {
+@@ -251,7 +258,10 @@
+ String::String(char c, Type t)
+ : d(new StringPrivate(1, static_cast<uchar>(c)))
+ {
+- if(t != Latin1 && t != UTF8) {
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t != Latin1 && t != Latin1ID3 && t != Latin1ID3V2 && t != UTF8) {
+ debug("String::String() -- A char should not contain UTF16.");
+ }
+ }
+@@ -262,8 +272,11 @@
+ if(v.isEmpty())
+ return;
+
+- if(t == Latin1)
+- copyFromLatin1(v.data(), v.size());
++ if(t == Locale)
++ t = rccTaglibPatchGetLocaleType();
++
++ if(t == Latin1 || t == Latin1ID3 || t == Latin1ID3V2)
++ copyFromLatin1(v.data(), v.size(), true, t);
+ else if(t == UTF8)
+ copyFromUTF8(v.data(), v.size());
+ else
+@@ -428,16 +441,46 @@
+
+ ByteVector String::data(Type t) const
+ {
+- switch(t)
+- {
++ ByteVector v;
++
++ if (t == Locale) {
++ // The source is either Unicode or real Latin1 (if rcc is bypassed)
++ std::string s = to8Bit(true);
++
++ // In case of UTF8 locale, this probably will return NULL (no recoding needed), but we will take UTF8 path in the next swtich
++ v = rccTaglibPatchRecodeOutput(s);
++ if (v.size()) return v;
++
++ t = rccTaglibPatchGetLocaleType();
++ }
++
++ switch(t) {
++ case Latin1ID3:
++ case Latin1ID3V2:
++ {
++ std::string s = to8Bit(true);
++ if (t == Latin1ID3) v = rccTaglibPatchRecodeOutputID3(s, false);
++ else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeOutputID3(s, true);
++ if (v.size())
++ return v;
++
++ // we don't know if we got NULL because rcc is disabled (error) or UTF8 output is required
++ if ((t == Latin1ID3V2)&&(rccTaglibPatchGetID3Type() == UTF8)) {
++ v.setData(s.c_str(), s.length());
++ } else {
++ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
++ v.append(char(*it));
++ }
++ return v;
++ }
+ case Latin1:
+ {
+ ByteVector v(size(), 0);
+ char *p = v.data();
+-
++
+ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
+ *p++ = static_cast<char>(*it);
+-
++
+ return v;
+ }
+ case UTF8:
+@@ -763,12 +806,29 @@
+ // private members
+ ////////////////////////////////////////////////////////////////////////////////
+
+-void String::copyFromLatin1(const char *s, size_t length)
++void String::copyFromLatin1(const char *s, size_t length, bool prepare, Type t)
+ {
+ d->data.resize(length);
+-
+ for(size_t i = 0; i < length; ++i)
+ d->data[i] = static_cast<uchar>(s[i]);
++
++ // librcc conversation
++ if (prepare) {
++ std::string s = to8Bit(false);
++ ByteVector v;
++
++ if (t == Latin1ID3) v = rccTaglibPatchRecodeInputID3(s, false);
++ else if (t == Latin1ID3V2) v = rccTaglibPatchRecodeInputID3(s, true);
++ else /* Latin1 converted from Locale */ v = rccTaglibPatchRecodeInput(s);
++
++ if (v.size()) {
++ copyFromUTF8(v.data(), v.size());
++ } else {
++ // We don't know if we got UTF-8 encoded string or either rcc is disable or something is failed,
++ // since standard applications are really expecting here Latin1, it is safe to just check if we have violations of UTF8
++ //if (Unicode::isLegalUTF8(s)) t = UTF8;
++ }
++ }
+ }
+
+ void String::copyFromUTF8(const char *s, size_t length)
+@@ -874,7 +934,33 @@
+
+ std::ostream &operator<<(std::ostream &s, const TagLib::String &str)
+ {
+- s << str.to8Bit();
++ TagLib::ByteVector bv = str.data(TagLib::String::Locale);
++ s << bv;
+ return s;
+ }
+
++TagLib::String::Type TagLib::String::ID3Type(int i)
++{
++ if(i == Latin1)
++ return Latin1ID3V2;
++ return Type(i);
++};
++
++TagLib::String::Type TagLib::String::ID3WType(Type type)
++{
++ Type rcc_type = rccTaglibPatchGetID3Type();
++ if((rcc_type == Latin1ID3)||(rcc_type == Latin1ID3V2)||(rcc_type == Latin1)) {
++ if(type == Latin1) return
++ rcc_type;
++ return type;
++ }
++
++ return rcc_type;
++};
++
++TagLib::String::Type TagLib::String::ID3RealType(Type type)
++{
++ if((type == Latin1ID3) || (type == Latin1ID3V2))
++ return Latin1;
++ return type;
++}
+diff -dPNur taglib-1.9.1/taglib/toolkit/tstring.h taglib-1.9.1-ds/taglib/toolkit/tstring.h
+--- taglib-1.9.1/taglib/toolkit/tstring.h 2013-10-08 17:50:01.000000000 +0200
++++ taglib-1.9.1-ds/taglib/toolkit/tstring.h 2013-11-11 13:42:53.047126771 +0100
+@@ -90,6 +90,18 @@
+ */
+ enum Type {
+ /*!
++ * Determine using current locale settings
++ */
++ Locale = -1,
++ /*!
++ * Latin1 for ID3 tags.
++ */
++ Latin1ID3 = 65,
++ /*!
++ * Latin1 for ID3v2 tags.
++ */
++ Latin1ID3V2 = 66,
++ /*!
+ * IS08859-1, or <i>Latin1</i> encoding. 8 bit characters.
+ */
+ Latin1 = 0,
+@@ -112,6 +124,10 @@
+ UTF16LE = 4
+ };
+
++ static Type ID3Type(int i);
++ static Type ID3WType(Type type);
++ static Type ID3RealType(Type type);
++
+ /*!
+ * Constructs an empty String.
+ */
+@@ -479,7 +495,7 @@
+ * Converts a \e Latin-1 string into \e UTF-16(without BOM/CPU byte order)
+ * and copies it to the internal buffer.
+ */
+- void copyFromLatin1(const char *s, size_t length);
++ void copyFromLatin1(const char *s, size_t length, bool prepare = false, Type t = Latin1);
+
+ /*!
+ * Converts a \e UTF-8 string into \e UTF-16(without BOM/CPU byte order)
diff --git a/media-libs/taglib/files/taglib-1.9.1-missing-deletes.patch b/media-libs/taglib/files/taglib-1.9.1-missing-deletes.patch
new file mode 100644
index 0000000..9cdbdcf
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.9.1-missing-deletes.patch
@@ -0,0 +1,48 @@
+From c14a3b5c3d0831f7c113d0cf95840c4671d9ebd4 Mon Sep 17 00:00:00 2001
+From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
+Date: Tue, 13 May 2014 20:07:02 +0900
+Subject: [PATCH] Added some missing deletes to test_flac.cpp.
+
+---
+ tests/test_flac.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tests/test_flac.cpp b/tests/test_flac.cpp
+index caec715..364fb11 100644
+--- a/tests/test_flac.cpp
++++ b/tests/test_flac.cpp
+@@ -91,6 +91,7 @@ public:
+ newpic->setData("JPEG data");
+ f->addPicture(newpic);
+ f->save();
++ delete f;
+
+ f = new FLAC::File(newname.c_str());
+ lst = f->pictureList();
+@@ -138,6 +139,7 @@ public:
+ f->removePictures();
+ f->addPicture(newpic);
+ f->save();
++ delete f;
+
+ f = new FLAC::File(newname.c_str());
+ lst = f->pictureList();
+@@ -165,6 +167,7 @@ public:
+
+ f->removePictures();
+ f->save();
++ delete f;
+
+ f = new FLAC::File(newname.c_str());
+ lst = f->pictureList();
+@@ -185,6 +188,7 @@ public:
+ tag->setTitle("NEW TITLE 2");
+ f->save();
+ CPPUNIT_ASSERT_EQUAL(String("NEW TITLE 2"), tag->title());
++ delete f;
+
+ f = new FLAC::File(newname.c_str());
+ tag = f->tag();
+--
+1.9.0
+
diff --git a/media-libs/taglib/files/taglib-1.9.1-order-big-endian.patch b/media-libs/taglib/files/taglib-1.9.1-order-big-endian.patch
new file mode 100644
index 0000000..86d5201
--- /dev/null
+++ b/media-libs/taglib/files/taglib-1.9.1-order-big-endian.patch
@@ -0,0 +1,33 @@
+From db3e961d1098d5efe57364f540f68a5996dc83c2 Mon Sep 17 00:00:00 2001
+From: Tsuda Kageyu <tsuda.kageyu@gmail.com>
+Date: Tue, 13 May 2014 18:22:16 +0900
+Subject: [PATCH] Fixed a wrong byte order handling on big-endian machines.
+
+---
+ taglib/toolkit/tstring.cpp | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp
+index 603455a..1ec083b 100644
+--- a/taglib/toolkit/tstring.cpp
++++ b/taglib/toolkit/tstring.cpp
+@@ -47,10 +47,14 @@
+
+ namespace
+ {
+-
+ inline unsigned short combine(unsigned char c1, unsigned char c2)
+ {
+- return (c1 << 8) | c2;
++ using namespace TagLib::Utils;
++
++ if(SystemByteOrder == LittleEndian)
++ return (c1 << 8) | c2;
++ else
++ return (c2 << 8) | c1;
+ }
+
+ void UTF16toUTF8(const wchar_t *src, size_t srcLength, char *dst, size_t dstLength)
+--
+1.9.0
+
diff --git a/media-libs/taglib/taglib-1.9.1-r4.ebuild b/media-libs/taglib/taglib-1.9.1-r4.ebuild
new file mode 100644
index 0000000..c41e0ad
--- /dev/null
+++ b/media-libs/taglib/taglib-1.9.1-r4.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/taglib/taglib-1.9.1-r2.ebuild,v 1.11 2014/08/27 09:05:26 ssuominen Exp $
+
+EAPI=6
+
+inherit cmake-multilib
+
+DESCRIPTION="A library for reading and editing audio meta data"
+HOMEPAGE="http://developer.kde.org/~wheeler/taglib.html"
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1 MPL-1.1"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris"
+SLOT="0"
+
+#SDS
+IUSE="+asf debug examples +mp4 test rcc"
+
+RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]"
+DEPEND="${RDEPEND}
+ >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+ test? ( >=dev-util/cppunit-1.13.2[${MULTILIB_USEDEP}] )
+ rcc? ( app-i18n/librcc )
+"
+#EDS
+
+RDEPEND="${RDEPEND}
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-medialibs-20140508-r2
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)] )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.6.1-install-examples.patch
+ "${FILESDIR}"/${P}-missing-deletes.patch
+ "${FILESDIR}"/${P}-order-big-endian.patch
+ "${FILESDIR}"/${P}-abi-breakage.patch
+ "${FILESDIR}"/${P}-bytevector-simpler.patch
+)
+
+
+DOCS=( AUTHORS NEWS )
+
+MULTILIB_CHOST_TOOLS=(
+ /usr/bin/taglib-config
+)
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ use rcc && (
+ epatch "${FILESDIR}"/taglib-1.9.1-ds-rusxmms.patch || die
+ epatch "${FILESDIR}"/taglib-1.9.1-ds-rusxmms-enforce.patch || die
+ )
+}
+
+
+multilib_src_configure() {
+ mycmakeargs=(
+ $(multilib_is_native_abi && cmake-utils_use_build examples)
+ $(cmake-utils_use_build test TESTS)
+ $(cmake-utils_use_with asf)
+ $(cmake-utils_use_with mp4)
+ )
+
+ cmake-utils_src_configure
+}
+
+multilib_src_test() {
+ # ctest does not work
+ emake -C "${BUILD_DIR}" check
+}
+
+pkg_postinst() {
+ if ! use asf; then
+ elog "You've chosen to disable the asf use flag, thus taglib won't include"
+ elog "support for Microsoft's 'advanced systems format' media container"
+ fi
+ if ! use mp4; then
+ elog "You've chosen to disable the mp4 use flag, thus taglib won't include"
+ elog "support for the MPEG-4 part 14 / MP4 media container"
+ fi
+}
diff --git a/media-libs/win32codecs/Manifest b/media-libs/win32codecs/Manifest
new file mode 100644
index 0000000..e178399
--- /dev/null
+++ b/media-libs/win32codecs/Manifest
@@ -0,0 +1,2 @@
+DIST all-20071007.tar.bz2 13864479 SHA256 7aae7fc658d7a9a1766002435fd75436fead9c2d45eac3d67588c313cde0d8da SHA512 b2ca67a8c7d87a9a62a78fce2c4bcba2a33604afdecf68275035107caea5421c03853dfbd642c915c3374fcfdb477fcb41fab051158e2aaaf61f091ada9229a2 WHIRLPOOL 50b4e2a08f6630d72ae684fd69c45929fcc37df0c442cef431ce09e7220f074f2d86b94ee6c675b0d3b8c6c15bd4983264c2c3063544cf466a3cc96239c44b07
+EBUILD win32codecs-20071007-r5.ebuild 1574 SHA256 b004ef71fba5009c6af0b9e3805172caa2c16ccd59314f410471dd374c9a36ac SHA512 9b7bcc5a3306341d748b47d6ef45c2533243834a7d8c83a2de387cb3bafd7f1c17170bea1a6f2c036c925fff5d179191cddcf453df7d4dd48b5016b6bc5593c4 WHIRLPOOL 693c7cc6656162afe9e1f46ef94dcf8e1880f956ddd31615f8c8447c75820a52343babdce8dae3a36922cdea359b0ab6fde8c17f85163264fde9629100fead82
diff --git a/media-libs/win32codecs/win32codecs-20071007-r5.ebuild b/media-libs/win32codecs/win32codecs-20071007-r5.ebuild
new file mode 100644
index 0000000..b00d51a
--- /dev/null
+++ b/media-libs/win32codecs/win32codecs-20071007-r5.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-libs/win32codecs/win32codecs-20071007-r4.ebuild,v 1.6 2013/05/03 15:35:03 ulm Exp $
+
+inherit multilib
+
+DESCRIPTION="Windows 32-bit binary codecs for video and audio playback support"
+SRC_URI="mirror://mplayer/releases/codecs/all-${PV}.tar.bz2"
+HOMEPAGE="http://www.mplayerhq.hu/"
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~x86-linux"
+IUSE="real"
+
+RDEPEND="real? ( =virtual/libstdc++-3.3* )"
+
+S="${WORKDIR}/all-${PV}"
+
+RESTRICT="mirror strip binchecks"
+
+pkg_setup() {
+ # This is a binary x86 package => ABI=x86
+ # Please keep this in future versions
+ # Daniel Gryniewicz <dang@gentoo.org>
+ has_multilib_profile && ABI="x86"
+}
+
+src_install() {
+ use prefix || EPREFIX=
+
+ insinto /usr/$(get_libdir)/win32
+ doins *.dll *.ax *.xa *.acm *.vwp *.drv *.DLL || die "Failed to install win32 codecs"
+
+ if use real
+ then
+ insinto /usr/$(get_libdir)/real
+ doins *so.6.0 || die "Failed to install realplayer codecs"
+
+ # copy newly introduced codecs from realplayer10
+ # see the ChangeLog online
+ doins *.so || die "Failed to install realplayer10 codecs"
+
+ # fix bug #80321
+ local x
+ for x in *so.6.0 *.so; do
+ dosym ../real/$x /usr/$(get_libdir)/win32 || die "Failed to make symlink to $x"
+ done
+ fi
+
+ dodoc README
+
+ cat > "${T}/50${PN}" <<EOF
+SEARCH_DIRS_MASK="${EPREFIX}/usr/$(get_libdir)/real ${EPREFIX}/usr/$(get_libdir)/win32"
+EOF
+ insinto /etc/revdep-rebuild
+ doins "${T}/50${PN}"
+}