diff options
Diffstat (limited to 'abs')
48 files changed, 4575 insertions, 91 deletions
diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index c25ee7e..a3c00c1 100755 --- a/abs/core-testing/LinHES-config/PKGBUILD +++ b/abs/core-testing/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=1.0 -pkgrel=191 +pkgrel=193 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan ) diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh index fd84d6c..e9d2461 100755 --- a/abs/core-testing/LinHES-config/install_functions.sh +++ b/abs/core-testing/LinHES-config/install_functions.sh @@ -470,9 +470,13 @@ case $1 in then if [ -f /tmp/etc/fstab ] then - grep /dev/vg /tmp/etc/fstab >> /$mountpoint/etc/fstab - grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs mkdir - grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs chown -R mythtv:users + grep -q /dev/vg /tmp/etc/fstab + if [ $? = 0 ] + then + grep /dev/vg /tmp/etc/fstab >> /$mountpoint/etc/fstab + grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs mkdir + grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs chown -R mythtv:users + fi fi fi ;; diff --git a/abs/core-testing/LinHES-config/systemconfig.sh b/abs/core-testing/LinHES-config/systemconfig.sh index 948137a..66ef9cd 100755 --- a/abs/core-testing/LinHES-config/systemconfig.sh +++ b/abs/core-testing/LinHES-config/systemconfig.sh @@ -673,7 +673,7 @@ then else ser_remove="$ser_remove" - ser_daemon_remove="nfsd nfslock $ser_daemon_remove" + ser_daemon_remove="nfsd $ser_daemon_remove" fi if [ x$Runncidd = x1 ] @@ -856,7 +856,7 @@ function setupcnfs () { #if no central nfs found, then use the mbe. if [ $SystemType = "Frontend_only" ] then - setupfstab ${dbhost}:/data/media /data/media + setupfstab ${dbhost}:/myth /myth fi fi @@ -1130,12 +1130,12 @@ case $SystemType in sudo sv restart avahi fi - install="mysql mythdb-initial avahli portmap local-website $ser_install" + install="mysql mythdb-initial avahli portmap nfslock local-website $ser_install" remove="none $ser_remove" - daemon_add="mysql mythbackend avahi portmap lighttpd $ser_daemon_add" + daemon_add="mysql mythbackend avahi portmap nfslock netfs lighttpd $ser_daemon_add" daemon_remove="none $ser_daemon_remove" ;; @@ -1150,10 +1150,10 @@ case $SystemType in sudo sv restart avahi fi - install="mysql mythdb-initial avahi portmap local-website myth2ipod mythtv-status $ser_install " + install="mysql mythdb-initial avahi portmap nfslock local-website myth2ipod mythtv-status $ser_install " remove="$ser_remove" - daemon_add="mysql mythbackend avahi portmap lighttpd $ser_daemon_add" + daemon_add="mysql mythbackend avahi portmap nfslock netfs lighttpd $ser_daemon_add" daemon_remove="$ser_daemon_remove" ;; Slave_backend) @@ -1170,10 +1170,10 @@ case $SystemType in fi #cp $TEMPLATES/mysql.service ${BASE}/etc/avahi/services/mysql.service - install="mysql avahi local-website $ser_install " + install="mysql avahi local-website portmap nfslock $ser_install " remove=" $ser_remove" - daemon_add="mythbackend avahi portmap lighttpd $ser_daemon_add" + daemon_add="mythbackend avahi portmap nfslock netfs lighttpd $ser_daemon_add" daemon_remove="$ser_daemon_remove" ;; Frontend_only) @@ -1186,10 +1186,10 @@ case $SystemType in sudo sv restart avahi fi - install="libmysqlclient mysql-clients portmap avahi local-website $ser_install" + install="libmysqlclient mysql-clients portmap nfslock avahi local-website $ser_install" remove="mysql mythweb$postfix $ser_remove" - daemon_add="avahi portmap lighttpd $ser_daemon_add " + daemon_add="avahi portmap nfslock netfs lighttpd $ser_daemon_add " daemon_remove="mysql mythbackend $ser_daemon_remove" ;; diff --git a/abs/core-testing/LinHES-config/templates/exports.template b/abs/core-testing/LinHES-config/templates/exports.template index b946287..b883932 100644 --- a/abs/core-testing/LinHES-config/templates/exports.template +++ b/abs/core-testing/LinHES-config/templates/exports.template @@ -3,6 +3,6 @@ # See exports(5) for a description. # use exportfs -arv to reread -/data/media REPLACEME(rw,all_squash,anonuid=1000,anongid=1000) +/myth REPLACEME(rw,all_squash,anonuid=1000,anongid=1000) /data/var/cache REPLACEME(rw,all_squash,anonuid=1000,anongid=1000) diff --git a/abs/core-testing/LinHES-config/templates/fstab.conf.template b/abs/core-testing/LinHES-config/templates/fstab.conf.template index d27bcd9..f8544cf 100755 --- a/abs/core-testing/LinHES-config/templates/fstab.conf.template +++ b/abs/core-testing/LinHES-config/templates/fstab.conf.template @@ -12,5 +12,5 @@ none /dev/shm tmpfs defaults 0 0 /dev/sda1 / reiserfs defaults 0 1 /dev/sda2 swap swap defaults 0 0 /dev/sda3 /data reiserfs defaults 0 0 -192.168.1.6:/media /data/media nfs +192.168.1.6:/myth /myth nfs diff --git a/abs/extra-testing/atk/PKGBUILD b/abs/core-testing/atk/PKGBUILD index bca7854..bca7854 100644 --- a/abs/extra-testing/atk/PKGBUILD +++ b/abs/core-testing/atk/PKGBUILD diff --git a/abs/core-testing/cairo/PKGBUILD b/abs/core-testing/cairo/PKGBUILD index 16f38b3..4bdb085 100644 --- a/abs/core-testing/cairo/PKGBUILD +++ b/abs/core-testing/cairo/PKGBUILD @@ -1,23 +1,24 @@ -# $Id: PKGBUILD 491 2008-04-20 11:39:47Z jgc $ +# $Id: PKGBUILD 22041 2008-12-21 12:11:48Z jgc $ # Maintainer: Jan de Groot <jgc@archlinux.org> # Contributor: Brice Carpentier <brice@daknet.org> pkgname=cairo -pkgver=1.6.4 +pkgver=1.8.6 pkgrel=1 pkgdesc="Cairo vector graphics library" arch=(i686 x86_64) license=('LGPL' 'MPL') url="http://cairographics.org/" -depends=('libpng>=1.2.25' 'libxrender' 'fontconfig>=2.5.0' 'pixman>=0.10.0') +depends=('libpng>=1.2.33' 'libxrender' 'fontconfig>=2.6.0' 'pixman>=0.12.0' 'xcb-util>=0.3.2') makedepends=('pkgconfig') options=('!libtool') source=(http://cairographics.org/releases/${pkgname}-${pkgver}.tar.gz) -md5sums=('a198d509f9e3a35b78de8bb02174ebb9') +md5sums=('4e64139ef6f668df24450f3b81dd0771') build() { - cd ${startdir}/src/${pkgname}-${pkgver} - ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var || return 1 + cd "${srcdir}/${pkgname}-${pkgver}" + ./configure --prefix=/usr --sysconfdir=/etc \ + --localstatedir=/var --enable-xcb --disable-static || return 1 make || return 1 - make DESTDIR=${startdir}/pkg install || return 1 + make DESTDIR="${pkgdir}" install || return 1 } diff --git a/abs/core-testing/libxcb/PKGBUILD b/abs/core-testing/libxcb/PKGBUILD index b1eadee..c61df23 100644 --- a/abs/core-testing/libxcb/PKGBUILD +++ b/abs/core-testing/libxcb/PKGBUILD @@ -1,29 +1,34 @@ -# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $ +# $Id: PKGBUILD 8004 2008-08-05 18:11:40Z jgc $ # Maintainer: Alexander Baldeck <alexander@archlinux.org> # Contributor: Jan de Groot <jgc@archlinux.org> pkgname=libxcb -pkgver=1.1 +pkgver=1.1.90.1 pkgrel=1 pkgdesc="X11 client-side library" arch=(i686 x86_64) url="http://xcb.freedesktop.org/" -depends=('xcb-proto>=1.1' 'libxdmcp' 'libxau') -makedepends=('pkgconfig' 'libxslt' 'libpthread-stubs') +depends=('xcb-proto>=1.2' 'libxdmcp' 'libxau') +makedepends=('pkgconfig' 'libxslt' 'python') options=('!libtool') license=('custom') -source=(${url}/dist/${pkgname}-${pkgver}.tar.bz2) +source=(${url}/dist/${pkgname}-${pkgver}.tar.bz2 + libxcb-1.1-no-pthread-stubs.patch + libxcb-1.1-sloppy-lock.patch) +md5sums=('c4b67c5576ed58e2fd4a2855c0b21aa6' + 'a53f09ab3ec5cbfc1b0848bd137c535a' + '4b3fbedc471d7ab336a18f1d0f853ddd') build() { - cd ${startdir}/src/${pkgname}-${pkgver} - ./configure --prefix=/usr \ - --build=${CHOST} --host=${CHOST} + cd ${srcdir}/${pkgname}-${pkgver} + patch -Np1 -i ${srcdir}/libxcb-1.1-no-pthread-stubs.patch || return 1 + patch -Np1 -i ${srcdir}/libxcb-1.1-sloppy-lock.patch || return 1 + libtoolize --force --copy || return 1 + aclocal || return 1 + autoconf || return 1 + automake --add-missing || return 1 + ./configure --prefix=/usr --enable-xinput || return 1 make || return 1 - make DESTDIR=${startdir}/pkg install || return 1 - # Remove pthread-stubs dependency from pc files, - # the stubs package doesn't provide any libs since our libc is complete. - sed -i -e 's/pthread-stubs//' ${startdir}/pkg/usr/lib/pkgconfig/*.pc - - install -m644 -D ${startdir}/src/${pkgname}-${pkgver}/COPYING \ - ${startdir}/pkg/usr/share/licenses/${pkgname}/COPYING + make DESTDIR=${pkgdir} install || return 1 + install -m755 -d ${pkgdir}/usr/share/licenses/${pkgname} + install -m644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/ || return 1 } -md5sums=('9310b02433273d75d42f10da3c7455aa') diff --git a/abs/core-testing/libxcb/libxcb-1.1-no-pthread-stubs.patch b/abs/core-testing/libxcb/libxcb-1.1-no-pthread-stubs.patch new file mode 100644 index 0000000..67a09f2 --- /dev/null +++ b/abs/core-testing/libxcb/libxcb-1.1-no-pthread-stubs.patch @@ -0,0 +1,12 @@ +diff -up libxcb-1.1/configure.ac.pthread-stubs libxcb-1.1/configure.ac +--- libxcb-1.1/configure.ac.pthread-stubs 2007-11-04 18:17:11.000000000 -0500 ++++ libxcb-1.1/configure.ac 2007-11-12 10:27:06.000000000 -0500 +@@ -31,7 +31,7 @@ AC_SUBST(HTML_CHECK_RESULT) + + # Checks for pkg-config packages + PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.1) +-NEEDED="pthread-stubs xau >= 0.99.2" ++NEEDED="xau >= 0.99.2" + PKG_CHECK_MODULES(NEEDED, $NEEDED) + + have_xdmcp="no" diff --git a/abs/core-testing/libxcb/libxcb-1.1-sloppy-lock.patch b/abs/core-testing/libxcb/libxcb-1.1-sloppy-lock.patch new file mode 100644 index 0000000..130890e --- /dev/null +++ b/abs/core-testing/libxcb/libxcb-1.1-sloppy-lock.patch @@ -0,0 +1,12 @@ +diff -up libxcb-1.1/src/xcb_conn.c.jx libxcb-1.1/src/xcb_conn.c +--- libxcb-1.1/src/xcb_conn.c.jx 2007-10-28 16:11:18.000000000 -0400 ++++ libxcb-1.1/src/xcb_conn.c 2008-04-22 11:58:05.000000000 -0400 +@@ -63,7 +63,7 @@ static int _xcb_xlib_init(_xcb_xlib *xli + { + xlib->lock = 0; + #ifndef NDEBUG +- xlib->sloppy_lock = (getenv("LIBXCB_ALLOW_SLOPPY_LOCK") != 0); ++ xlib->sloppy_lock = 1; + #endif + pthread_cond_init(&xlib->cond, 0); + return 1; diff --git a/abs/core-testing/mythtv/stable/mythdb-initial/PKGBUILD b/abs/core-testing/mythtv/stable/mythdb-initial/PKGBUILD index 2b9ab76..06c0aae 100755 --- a/abs/core-testing/mythtv/stable/mythdb-initial/PKGBUILD +++ b/abs/core-testing/mythtv/stable/mythdb-initial/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythdb-initial pkgver=1 -pkgrel=9 +pkgrel=10 pkgdesc="setup the initial mythtv database for linhes" url="" license="" diff --git a/abs/core-testing/pixman/PKGBUILD b/abs/core-testing/pixman/PKGBUILD index a3fcb97..306acd9 100644 --- a/abs/core-testing/pixman/PKGBUILD +++ b/abs/core-testing/pixman/PKGBUILD @@ -1,7 +1,8 @@ -# $Id: PKGBUILD 490 2008-04-20 11:35:45Z jgc $ -# Maintainer: Alexander Baldeck <alexander@archlinux.org> +# $Id: PKGBUILD 12786 2008-09-20 08:34:14Z jgc $ +# Maintainer: Jan de Groot <jgc@archlinux.org> +# Contributor: Alexander Baldeck <alexander@archlinux.org> pkgname=pixman -pkgver=0.10.0 +pkgver=0.12.0 pkgrel=1 pkgdesc="Pixman library" arch=(i686 x86_64) @@ -10,11 +11,11 @@ license=() depends=('glibc') options=('!libtool') source=(http://xorg.freedesktop.org/releases/individual/lib/${pkgname}-${pkgver}.tar.bz2) -md5sums=('fb23e17a8a0308e8fad6dc153753ba9a') +md5sums=('494af78c1c7d825c9ad6815d7b91f17d') build() { - cd "${startdir}/src/${pkgname}-${pkgver}" - ./configure --prefix=/usr || return 1 + cd "${srcdir}/${pkgname}-${pkgver}" + ./configure --prefix=/usr --disable-static || return 1 make || return 1 - make DESTDIR="${startdir}/pkg" install || return 1 + make DESTDIR="${pkgdir}" install || return 1 } diff --git a/abs/core-testing/pycairo/PKGBUILD b/abs/core-testing/pycairo/PKGBUILD index 283ed43..51fa905 100644 --- a/abs/core-testing/pycairo/PKGBUILD +++ b/abs/core-testing/pycairo/PKGBUILD @@ -1,21 +1,24 @@ -# $Id: PKGBUILD 1020 2008-04-27 18:50:59Z jgc $ +# $Id: PKGBUILD 23420 2009-01-10 05:29:10Z allan $ # Maintainer: Jan de Groot <jgc@archlinux.org> pkgname=pycairo -pkgver=1.4.12 -pkgrel=1 +pkgver=1.8.0 +pkgrel=2 pkgdesc="Python bindings for the cairo graphics library" arch=(i686 x86_64) license=('LGPL' 'MPL') -depends=('python>=2.5' 'cairo>=1.6.4') +depends=('python' 'cairo>=1.8.6') options=('!libtool') -source=(http://cairographics.org/releases/${pkgname}-${pkgver}.tar.gz) +source=(http://cairographics.org/releases/${pkgname}-${pkgver}.tar.gz + pycairo-1.8.0-threading.diff) url="http://www.cairographics.org/" -md5sums=('c63199d35b1e1d3c5133509f315f70d7') +md5sums=('847f5377c32228a656819f5bd18eb6b4' + '5259928a3d58750d5c54af60d71f2493') build() { - cd ${startdir}/src/${pkgname}-${pkgver} + cd "${srcdir}/${pkgname}-${pkgver}" + patch -Np1 -i "${srcdir}"/pycairo-1.8.0-threading.diff || return 1 ./configure --prefix=/usr || return 1 make || return 1 - make DESTDIR=${startdir}/pkg install || return 1 + make DESTDIR="${pkgdir}" install || return 1 } diff --git a/abs/core-testing/pycairo/pycairo-1.8.0-threading.diff b/abs/core-testing/pycairo/pycairo-1.8.0-threading.diff new file mode 100644 index 0000000..ce1a80f --- /dev/null +++ b/abs/core-testing/pycairo/pycairo-1.8.0-threading.diff @@ -0,0 +1,67 @@ +diff -Naur pycairo-1.8.0-old/cairo/pycairo-surface.c pycairo-1.8.0/cairo/pycairo-surface.c +--- pycairo-1.8.0-old/cairo/pycairo-surface.c 2008-12-10 17:41:16.000000000 +1000 ++++ pycairo-1.8.0/cairo/pycairo-surface.c 2009-01-10 15:08:36.000000000 +1000 +@@ -310,10 +310,10 @@ + return NULL; + } + Py_DECREF(writer); +- Py_BEGIN_ALLOW_THREADS ++ /*Py_BEGIN_ALLOW_THREADS*/ /*seg faults reported*/ + status = cairo_surface_write_to_png_stream (o->surface, _write_func, + file); +- Py_END_ALLOW_THREADS ++ /*Py_END_ALLOW_THREADS*/ + } + RETURN_NULL_IF_CAIRO_ERROR(status); + Py_RETURN_NONE; +@@ -505,9 +505,9 @@ + } + Py_DECREF(reader); + +- Py_BEGIN_ALLOW_THREADS ++ /*Py_BEGIN_ALLOW_THREADS*/ /*seg faults reported*/ + is = cairo_image_surface_create_from_png_stream (_read_func, file); +- Py_END_ALLOW_THREADS ++ /*Py_END_ALLOW_THREADS*/ + return PycairoSurface_FromSurface (is, NULL); + } + #endif /* CAIRO_HAS_PNG_FUNCTIONS */ +@@ -712,10 +712,10 @@ + } + Py_DECREF(writer); + +- Py_BEGIN_ALLOW_THREADS ++ /*Py_BEGIN_ALLOW_THREADS*/ /*seg faults reported*/ + sfc = cairo_pdf_surface_create_for_stream (_write_func, file, + width_in_points, height_in_points); +- Py_END_ALLOW_THREADS ++ /*Py_END_ALLOW_THREADS*/ + return PycairoSurface_FromSurface (sfc, file); + } + +@@ -818,10 +818,10 @@ + } + Py_DECREF(writer); + +- Py_BEGIN_ALLOW_THREADS ++ /*Py_BEGIN_ALLOW_THREADS*/ /*seg faults reported*/ + sfc = cairo_ps_surface_create_for_stream (_write_func, file, + width_in_points, height_in_points); +- Py_END_ALLOW_THREADS ++ /*Py_END_ALLOW_THREADS*/ + return PycairoSurface_FromSurface (sfc, file); + } + +@@ -1010,10 +1010,10 @@ + } + Py_DECREF(writer); + +- Py_BEGIN_ALLOW_THREADS ++ /*Py_BEGIN_ALLOW_THREADS*/ /*seg faults reported*/ + sfc = cairo_svg_surface_create_for_stream (_write_func, file, + width_in_points, height_in_points); +- Py_END_ALLOW_THREADS ++ /*Py_END_ALLOW_THREADS*/ + return PycairoSurface_FromSurface (sfc, file); + } + diff --git a/abs/core-testing/runit-scripts/PKGBUILD b/abs/core-testing/runit-scripts/PKGBUILD index 6391972..d74ab16 100755 --- a/abs/core-testing/runit-scripts/PKGBUILD +++ b/abs/core-testing/runit-scripts/PKGBUILD @@ -1,6 +1,6 @@ pkgname=runit-scripts pkgver=1.8.0 -pkgrel=22 +pkgrel=23 pkgdesc="collection of startup scripts for runit" url="http://smarden.org/runit/" license="BSD" diff --git a/abs/core-testing/runit-scripts/runitscripts/services/netfs/run b/abs/core-testing/runit-scripts/runitscripts/services/netfs/run index f2c0813..28388b9 100755 --- a/abs/core-testing/runit-scripts/runitscripts/services/netfs/run +++ b/abs/core-testing/runit-scripts/runitscripts/services/netfs/run @@ -1,5 +1,6 @@ #!/bin/sh exec 2>&1 sv start portmap +sv start nfslock /etc/rc.d/netfs start diff --git a/abs/core-testing/xcb-proto/PKGBUILD b/abs/core-testing/xcb-proto/PKGBUILD index b17aa2d..e59e26b 100644 --- a/abs/core-testing/xcb-proto/PKGBUILD +++ b/abs/core-testing/xcb-proto/PKGBUILD @@ -1,21 +1,23 @@ -# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $ +# $Id: PKGBUILD 17316 2008-10-28 12:25:37Z douglas $ # Maintainer: Alexander Baldeck <alexander@archlinux.org> # Contributor: Jan de Groot <jgc@archlinux.org> + pkgname=xcb-proto -pkgver=1.1 -pkgrel=1 +pkgver=1.2 +pkgrel=2 pkgdesc="XML-XCB protocol descriptions" arch=(i686 x86_64) url="http://xcb.freedesktop.org/" license=('custom') +makedepends=('python' 'libxml2') source=(${url}/dist/${pkgname}-${pkgver}.tar.bz2) +md5sums=('09f912486d8a2353bb4b99ddc28ba3c7') build() { - cd ${startdir}/src/${pkgname}-${pkgver} - ./configure --prefix=/usr + cd ${srcdir}/${pkgname}-${pkgver} + ./configure --prefix=/usr || return 1 make || return 1 - make DESTDIR=${startdir}/pkg install || return 1 - install -m644 -D ${startdir}/src/${pkgname}-${pkgver}/COPYING \ - ${startdir}/pkg/usr/share/licenses/${pkgname}/COPYING + make DESTDIR=${pkgdir} install || return 1 + install -m755 -d ${pkgdir}/usr/share/licenses/${pkgname} + install -m644 COPYING ${pkgdir}/usr/share/licenses/${pkgname}/ || return 1 } -md5sums=('dd34acc58c0a438e812f72a9afe7b2a0') diff --git a/abs/extra-testing/xcb-util/PKGBUILD b/abs/core-testing/xcb-util/PKGBUILD index 734f57d..734f57d 100644 --- a/abs/extra-testing/xcb-util/PKGBUILD +++ b/abs/core-testing/xcb-util/PKGBUILD diff --git a/abs/extra-testing/atomicparsley/PKGBUILD b/abs/extra-testing/atomicparsley/PKGBUILD index a8d41ab..4108fa9 100644 --- a/abs/extra-testing/atomicparsley/PKGBUILD +++ b/abs/extra-testing/atomicparsley/PKGBUILD @@ -6,10 +6,12 @@ pkgdesc="command line program for reading, parsing and setting iTunes-style meta arch=(i686 x86_64) url="http://atomicparsley.sourceforge.net/" license=('GPL') -source=(http://downloads.sourceforge.net/$pkgname/AtomicParsley-source-$pkgver.zip) -md5sums=('681e6ecec2921c98e07a9262bdcd6cf2') +source=(http://ftp.knoppmyth.net/R6/sources/$pkgname/AtomicParsley-source-$pkgver.tar.bz2) +md5sums=('dfe6700089ca20c87f7f5293dee5df6c') build() { + cd $startdir/src/ + unzip AtomicParsley-source-$pkgver cd $startdir/src/AtomicParsley-source-$pkgver ./build install -D -m 755 AtomicParsley $startdir/pkg/usr/bin/AtomicParsley diff --git a/abs/extra-testing/autoconf/PKGBUILD b/abs/extra-testing/autoconf/PKGBUILD new file mode 100644 index 0000000..75bd7ef --- /dev/null +++ b/abs/extra-testing/autoconf/PKGBUILD @@ -0,0 +1,25 @@ +# $Id: PKGBUILD 12545 2008-09-15 12:33:36Z andyrtr $ +# Maintainer: Andreas Radke <adyrtr@archlinux.org> + +pkgname=autoconf +pkgver=2.63 +pkgrel=1 +pkgdesc="A GNU tool for automatically configuring source code" +arch=(i686 x86_64) +license=('GPL2' 'GPL3') +url="http://www.gnu.org/software/autoconf" +groups=('base-devel') +depends=('awk' 'm4' 'diffutils' 'bash') +install=autoconf.install +source=(ftp://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz) +md5sums=('43d76649fb86cd21d64f68c48d5abdcf') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + ./configure --prefix=/usr + make || return 1 + make DESTDIR=${pkgdir} install || return 1 + rm -f ${pkgdir}/usr/share/info/dir + # conflict with bintuils + rm -f ${pkgdir}/usr/share/info/standards.info +} diff --git a/abs/extra-testing/autoconf/autoconf.install b/abs/extra-testing/autoconf/autoconf.install new file mode 100644 index 0000000..6440ec6 --- /dev/null +++ b/abs/extra-testing/autoconf/autoconf.install @@ -0,0 +1,20 @@ +infodir=/usr/share/info +filelist=(autoconf.info) + +post_install() { + for file in ${filelist[@]}; do + install-info $infodir/$file $infodir/dir 2> /dev/null + done +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + for file in ${filelist[@]}; do + install-info --delete $infodir/$file $infodir/dir 2> /dev/null + done +} + +# vim:set ts=2 sw=2 et: diff --git a/abs/extra-testing/automake/PKGBUILD b/abs/extra-testing/automake/PKGBUILD new file mode 100644 index 0000000..2943f44 --- /dev/null +++ b/abs/extra-testing/automake/PKGBUILD @@ -0,0 +1,25 @@ +# $Id: PKGBUILD 19545 2008-11-26 18:00:03Z andyrtr $ +# Contributor: judd <jvinet@zeroflux.org> +# Maintainer: Andreas Radke <andyrtr@archlinux.org> + +pkgname=automake +pkgver=1.10.2 +pkgrel=1 +pkgdesc="A GNU tool for automatically creating Makefiles" +arch=(i686 x86_64) +license=('GPL') +url="http://www.gnu.org/software/automake" +groups=('base-devel') +depends=('perl' 'bash' 'texinfo') +install=automake.install +source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz) +md5sums=('ede3e08c696861a01f4d2c6a2e822053') + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + ./configure --prefix=/usr + make || return 1 + make DESTDIR=${pkgdir} install || return 1 + + rm -f ${pkgdir}/usr/share/info/dir +} diff --git a/abs/extra-testing/automake/automake.install b/abs/extra-testing/automake/automake.install new file mode 100644 index 0000000..a1030e5 --- /dev/null +++ b/abs/extra-testing/automake/automake.install @@ -0,0 +1,20 @@ +infodir=/usr/share/info +filelist=(automake.info automake.info-1 automake.info-2) + +post_install() { + for file in ${filelist[@]}; do + install-info $infodir/$file $infodir/dir 2> /dev/null + done +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + for file in ${filelist[@]}; do + install-info --delete $infodir/$file $infodir/dir 2> /dev/null + done +} + +# vim:set ts=2 sw=2 et: diff --git a/abs/extra-testing/bmp/0.9.7-visualization.patch b/abs/extra-testing/bmp/0.9.7-visualization.patch new file mode 100644 index 0000000..ac03323 --- /dev/null +++ b/abs/extra-testing/bmp/0.9.7-visualization.patch @@ -0,0 +1,12 @@ +--- beep/vis.c 2004-12-04 10:04:29.000000000 +0100 ++++ beep/vis.c 2005-02-17 12:02:25.391044008 +0100 +@@ -223,7 +223,8 @@ vis_draw(Widget * w) + /* FIXME: The check "shouldn't" be neccessary? */ + /* if (GTK_IS_WINDOW(vis->vs_window)) { */ + GDK_THREADS_ENTER(); +- gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, ++ if (GDK_IS_DRAWABLE(vis->vs_window)) ++ gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, + vis->vs_widget.x, vis->vs_widget.y, + vis->vs_widget.width, vis->vs_widget.height, + GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, diff --git a/abs/extra-testing/bmp/0.9.7.1-visualization.patch b/abs/extra-testing/bmp/0.9.7.1-visualization.patch new file mode 100644 index 0000000..ac03323 --- /dev/null +++ b/abs/extra-testing/bmp/0.9.7.1-visualization.patch @@ -0,0 +1,12 @@ +--- beep/vis.c 2004-12-04 10:04:29.000000000 +0100 ++++ beep/vis.c 2005-02-17 12:02:25.391044008 +0100 +@@ -223,7 +223,8 @@ vis_draw(Widget * w) + /* FIXME: The check "shouldn't" be neccessary? */ + /* if (GTK_IS_WINDOW(vis->vs_window)) { */ + GDK_THREADS_ENTER(); +- gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, ++ if (GDK_IS_DRAWABLE(vis->vs_window)) ++ gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, + vis->vs_widget.x, vis->vs_widget.y, + vis->vs_widget.width, vis->vs_widget.height, + GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, diff --git a/abs/extra-testing/bmp/PKGBUILD b/abs/extra-testing/bmp/PKGBUILD new file mode 100644 index 0000000..ffcc1bf --- /dev/null +++ b/abs/extra-testing/bmp/PKGBUILD @@ -0,0 +1,25 @@ +# $Id: PKGBUILD 9914 2008-08-21 00:36:16Z eric $ +# Maintainer: Kevin Piche <kevin@archlinux.org> +# Contributor: Ben <contrasutra@myrealbox.com> + +pkgname=bmp +pkgver=0.9.7.1 +pkgrel=4 +pkgdesc="gtk2 port of xmms" +arch=(i686 x86_64) +url="http://bmp.beep-media-player.org/" +depends=('esd' 'id3lib' 'libglade' 'libsm' 'libvorbis' 'unzip') +source=(http://voxel.dl.sourceforge.net/sourceforge/beepmp/bmp-$pkgver.tar.gz $pkgver-visualization.patch bmp-${pkgver}-crossfade-0.3.9.patch) +md5sums=('c25d5a8d49cc5851d13d525a20023c4c' 'fa1bdf5a8d03e8539a6bed5caa471176'\ + '42ad4109ddb66024d4c6d1f3e572ab86') + +build() { + cd $startdir/src/$pkgname-$pkgver + patch -p0 -i ../${pkgver}-visualization.patch + patch -p1 -i ../${pkgname}-${pkgver}-crossfade-0.3.9.patch + ./configure --prefix=/usr + /usr/bin/make || return 1 + /usr/bin/make DESTDIR=$startdir/pkg install + find $startdir/pkg -name '*.la' -exec rm {} \; +} +# vim: ts=2 sw=2 et ft=sh diff --git a/abs/extra-testing/bmp/bmp-0.9.7.1-crossfade-0.3.9.patch b/abs/extra-testing/bmp/bmp-0.9.7.1-crossfade-0.3.9.patch new file mode 100644 index 0000000..4c1e46d --- /dev/null +++ b/abs/extra-testing/bmp/bmp-0.9.7.1-crossfade-0.3.9.patch @@ -0,0 +1,108 @@ +Patch taken from xmms-crossfade 3.10 tarball. Required for crossfade to +work. http://www.eisenlohr.org/xmms-crossfade/ + +diff -ur bmp-0.9.7.1/beep/mainwin.c bmp-0.9.7.1.patched/beep/mainwin.c +--- bmp-0.9.7.1/beep/mainwin.c 2005-05-09 10:45:39.000000000 +0200 ++++ bmp-0.9.7.1.patched/beep/mainwin.c 2005-11-25 00:03:59.000000000 +0100 +@@ -655,9 +655,11 @@ + mainwin_set_shade(!cfg.player_shaded); + } + ++gboolean is_quitting = FALSE; + void + mainwin_quit_cb(void) + { ++ is_quitting = TRUE; + gtk_widget_hide(equalizerwin); + gtk_widget_hide(playlistwin); + gtk_widget_hide(mainwin); +@@ -1318,7 +1320,7 @@ + change_song(guint pos) + { + if (bmp_playback_get_playing()) +- bmp_playback_stop(); ++ bmp_playback_stop_for_restart(); + + playlist_set_position(pos); + bmp_playback_initiate(); +diff -ur bmp-0.9.7.1/beep/playback.c bmp-0.9.7.1.patched/beep/playback.c +--- bmp-0.9.7.1/beep/playback.c 2005-01-26 06:56:15.000000000 +0100 ++++ bmp-0.9.7.1.patched/beep/playback.c 2005-11-25 00:03:59.000000000 +0100 +@@ -89,7 +89,7 @@ + return; + + if (bmp_playback_get_playing()) +- bmp_playback_stop(); ++ bmp_playback_stop_for_restart(); + + vis_clear_data(mainwin_vis); + vis_clear_data(playlistwin_vis); +@@ -135,6 +135,15 @@ + get_current_input_plugin()->pause(ip_data.paused); + } + ++gboolean input_stopped_for_restart = FALSE; ++void ++bmp_playback_stop_for_restart(void) ++{ ++ input_stopped_for_restart = TRUE; ++ bmp_playback_stop(); ++ input_stopped_for_restart = FALSE; ++} ++ + void + bmp_playback_stop(void) + { +diff -ur bmp-0.9.7.1/beep/playback.h bmp-0.9.7.1.patched/beep/playback.h +--- bmp-0.9.7.1/beep/playback.h 2004-12-04 10:04:26.000000000 +0100 ++++ bmp-0.9.7.1.patched/beep/playback.h 2005-11-25 00:03:59.000000000 +0100 +@@ -26,6 +26,7 @@ + void bmp_playback_initiate(void); + void bmp_playback_pause(void); + void bmp_playback_stop(void); ++void bmp_playback_stop_for_restart(void); + gboolean bmp_playback_play_file(const gchar * filename); + gboolean bmp_playback_get_playing(void); + gboolean bmp_playback_get_paused(void); +diff -ur bmp-0.9.7.1/beep/playlist.c bmp-0.9.7.1.patched/beep/playlist.c +--- bmp-0.9.7.1/beep/playlist.c 2005-08-11 09:25:51.000000000 +0200 ++++ bmp-0.9.7.1.patched/beep/playlist.c 2005-11-25 00:03:59.000000000 +0100 +@@ -817,7 +817,7 @@ + if (bmp_playback_get_playing()) { + /* We need to stop before changing playlist_position */ + PLAYLIST_UNLOCK(); +- bmp_playback_stop(); ++ bmp_playback_stop_for_restart(); + PLAYLIST_LOCK(); + restart_playing = TRUE; + } +@@ -868,7 +868,7 @@ + if (bmp_playback_get_playing()) { + /* We need to stop before changing playlist_position */ + PLAYLIST_UNLOCK(); +- bmp_playback_stop(); ++ bmp_playback_stop_for_restart(); + PLAYLIST_LOCK(); + restart_playing = TRUE; + } +@@ -1018,7 +1018,7 @@ + if (bmp_playback_get_playing()) { + /* We need to stop before changing playlist_position */ + PLAYLIST_UNLOCK(); +- bmp_playback_stop(); ++ bmp_playback_stop_for_restart(); + PLAYLIST_LOCK(); + restart_playing = TRUE; + } +@@ -1047,7 +1047,10 @@ + { + GList *plist_pos_list; + +- bmp_playback_stop(); ++ if (cfg.repeat) ++ bmp_playback_stop_for_restart(); ++ else ++ bmp_playback_stop(); + + PLAYLIST_LOCK(); + plist_pos_list = find_playlist_position_list(); diff --git a/abs/extra-testing/cairo/PKGBUILD b/abs/extra-testing/cairo/PKGBUILD deleted file mode 100644 index 4bdb085..0000000 --- a/abs/extra-testing/cairo/PKGBUILD +++ /dev/null @@ -1,24 +0,0 @@ -# $Id: PKGBUILD 22041 2008-12-21 12:11:48Z jgc $ -# Maintainer: Jan de Groot <jgc@archlinux.org> -# Contributor: Brice Carpentier <brice@daknet.org> - -pkgname=cairo -pkgver=1.8.6 -pkgrel=1 -pkgdesc="Cairo vector graphics library" -arch=(i686 x86_64) -license=('LGPL' 'MPL') -url="http://cairographics.org/" -depends=('libpng>=1.2.33' 'libxrender' 'fontconfig>=2.6.0' 'pixman>=0.12.0' 'xcb-util>=0.3.2') -makedepends=('pkgconfig') -options=('!libtool') -source=(http://cairographics.org/releases/${pkgname}-${pkgver}.tar.gz) -md5sums=('4e64139ef6f668df24450f3b81dd0771') - -build() { - cd "${srcdir}/${pkgname}-${pkgver}" - ./configure --prefix=/usr --sysconfdir=/etc \ - --localstatedir=/var --enable-xcb --disable-static || return 1 - make || return 1 - make DESTDIR="${pkgdir}" install || return 1 -} diff --git a/abs/extra-testing/gd/PKGBUILD b/abs/extra-testing/gd/PKGBUILD new file mode 100644 index 0000000..11e2929 --- /dev/null +++ b/abs/extra-testing/gd/PKGBUILD @@ -0,0 +1,23 @@ +# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $ +# Maintainer: Eric Belanger <eric@archlinux.org> + +pkgname=gd +pkgver=2.0.35 +pkgrel=1 +pkgdesc="Library for the dynamic creation of images by programmers" +arch=('i686' 'x86_64') +url="http://www.libgd.org/" +license=('custom') +depends=('libpng>=1.2.16' 'fontconfig>=2.4.2' 'libjpeg') +options=('!libtool') +source=(http://www.libgd.org/releases/${pkgname}-${pkgver}.tar.bz2) +md5sums=('6c6c3dbb7bf079e0bb5fbbfd3bb8a71c') +sha1sums=('ccf34a610abff2dbf133a20c4d2a4aa94939018a') + +build() { + cd ${startdir}/src/${pkgname}-${pkgver} + ./configure --prefix=/usr --without-xpm + make || return 1 + make DESTDIR=${startdir}/pkg install + install -D -m644 COPYING $startdir/pkg/usr/share/licenses/$pkgname/COPYING +} diff --git a/abs/extra-testing/gdk-pixbuf/PKGBUILD b/abs/extra-testing/gdk-pixbuf/PKGBUILD new file mode 100644 index 0000000..64b8b9a --- /dev/null +++ b/abs/extra-testing/gdk-pixbuf/PKGBUILD @@ -0,0 +1,33 @@ +# $Id: PKGBUILD 20860 2008-12-07 04:28:44Z eric $ +# Maintainer: dorphell <dorphell@archlinux.org> +# Committer: Judd Vinet <jvinet@zeroflux.org> + +pkgname=gdk-pixbuf +pkgver=0.22.0 +pkgrel=4 +pkgdesc="Image loading and manipulation library" +depends=(gtk libtiff libpng) +options=(!libtool) +arch=(i686 x86_64) +source=(ftp://ftp.gnome.org/pub/gnome/sources/${pkgname}/0.22/${pkgname}-${pkgver}.tar.bz2 + gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch + gdk-pixbuf-0.22.0-bmp_secure.patch + gdk-pixbuf-0.22.0-loaders.patch + gdk-pixbuf-0.22.0-m4.patch) +md5sums=(05fcb68ceaa338614ab650c775efc2f2 d1fb93f1ae994875158a7e0c108c36f8 + 5f59d5772b1482d885a180dbc581cf84 3cf31ae0509747f72ac27a9fd96109c2 + 3edfa9fe9382fd8206d6238ec121a5af) + +build() { + cd ${startdir}/src/${pkgname}-${pkgver} + export SED=/bin/sed + patch -Np1 -i ${startdir}/src/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch || return 1 + patch -Np0 -i ${startdir}/src/gdk-pixbuf-0.22.0-bmp_secure.patch || return 1 + patch -Np1 -i ${startdir}/src/gdk-pixbuf-0.22.0-loaders.patch || return 1 + patch -Np1 -i ${startdir}/src/gdk-pixbuf-0.22.0-m4.patch || return 1 + libtoolize --force --copy --automake + ./configure --prefix=/usr --disable-gtk-doc + make || return 1 + make DESTDIR=${startdir}/pkg install + rm -rf ${startdir}/pkg/usr/share/gnome +} diff --git a/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch b/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_reject_corrupt.patch new file mode 100644 index 0000000..ffb4378 --- /dev/null +++ b/abs/extra-testing/gdk-pixbuf/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/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_secure.patch b/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-bmp_secure.patch new file mode 100644 index 0000000..29471f1 --- /dev/null +++ b/abs/extra-testing/gdk-pixbuf/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/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-loaders.patch b/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-loaders.patch new file mode 100644 index 0000000..0686538 --- /dev/null +++ b/abs/extra-testing/gdk-pixbuf/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/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-m4.patch b/abs/extra-testing/gdk-pixbuf/gdk-pixbuf-0.22.0-m4.patch new file mode 100644 index 0000000..032976d --- /dev/null +++ b/abs/extra-testing/gdk-pixbuf/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/abs/extra-testing/id3lib/PKGBUILD b/abs/extra-testing/id3lib/PKGBUILD new file mode 100644 index 0000000..ba0328a --- /dev/null +++ b/abs/extra-testing/id3lib/PKGBUILD @@ -0,0 +1,29 @@ +# $Id: PKGBUILD 2134 2008-05-26 00:30:40Z eric $ +# Maintainer: +# Contributor: Jochem Kossen <j.kossen@home.nl> +pkgname=id3lib +pkgver=3.8.3 +pkgrel=10 +pkgdesc="An open-source, cross-platform software development library for reading, writing, and manipulating ID3v1 and ID3v2 tags" +arch=(i686 x86_64) +license=('LGPL') +url="http://id3lib.sourceforge.net/" +depends=('zlib' 'gcc-libs') +options=('!libtool') +source=(http://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${pkgver}.tar.gz + patch_id3lib_3.8.3_UTF16_writing_bug.diff + id3lib-3.8.3-CVE-2007-4460.patch + id3lib-3.8.3-gcc-4.3.patch) +md5sums=('19f27ddd2dda4b2d26a559a4f0f402a7' '196c65adee1ba511ddacef2de0dfd102'\ + '78e90e15ddd1122b66da352b6c3b00ff' 'fdbffd2d9d289ed0d730950c78d4ebc4') + +build() { + cd ${startdir}/src/${pkgname}-${pkgver} + patch -Np1 -i ${startdir}/src/patch_id3lib_3.8.3_UTF16_writing_bug.diff || return 1 + patch -Np0 -i ${startdir}/src/id3lib-3.8.3-CVE-2007-4460.patch || return 1 + patch -Np1 -i ${startdir}/src/id3lib-3.8.3-gcc-4.3.patch || return 1 + ./configure --prefix=/usr + sed -i -e 's/^LIBS =/LIBS = -lz -lstdc++/' src/Makefile || return 1 + make || return 1 + make DESTDIR=${startdir}/pkg install +} diff --git a/abs/extra-testing/id3lib/id3lib-3.8.3-CVE-2007-4460.patch b/abs/extra-testing/id3lib/id3lib-3.8.3-CVE-2007-4460.patch new file mode 100644 index 0000000..daa0866 --- /dev/null +++ b/abs/extra-testing/id3lib/id3lib-3.8.3-CVE-2007-4460.patch @@ -0,0 +1,49 @@ +--- src/tag_file.cpp ++++ src/tag_file.cpp +@@ -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/abs/extra-testing/id3lib/id3lib-3.8.3-gcc-4.3.patch b/abs/extra-testing/id3lib/id3lib-3.8.3-gcc-4.3.patch new file mode 100644 index 0000000..f5ec498 --- /dev/null +++ b/abs/extra-testing/id3lib/id3lib-3.8.3-gcc-4.3.patch @@ -0,0 +1,83 @@ +diff -Naur id3lib-3.8.3-orig/configure id3lib-3.8.3/configure +--- id3lib-3.8.3-orig/configure 2008-05-24 23:39:36.000000000 -0400 ++++ id3lib-3.8.3/configure 2008-05-24 23:39:57.000000000 -0400 +@@ -10296,8 +10296,7 @@ + + for ac_header in \ + string \ +- iomanip.h \ + + do + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` + +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/abs/extra-testing/id3lib/patch_id3lib_3.8.3_UTF16_writing_bug.diff b/abs/extra-testing/id3lib/patch_id3lib_3.8.3_UTF16_writing_bug.diff new file mode 100644 index 0000000..b05d2cf --- /dev/null +++ b/abs/extra-testing/id3lib/patch_id3lib_3.8.3_UTF16_writing_bug.diff @@ -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/abs/extra-testing/libftdi/PKGBUILD b/abs/extra-testing/libftdi/PKGBUILD new file mode 100644 index 0000000..b435b9a --- /dev/null +++ b/abs/extra-testing/libftdi/PKGBUILD @@ -0,0 +1,19 @@ +# Contributor: Bernhard Walle <bernhard.walle@gmx.de> +pkgname=libftdi +pkgver=0.13 +pkgrel=0 +pkgdesc="Library to program and control the FTDI USB controller" +url="http://www.intra2net.com/de/produkte/opensource/ftdi/" +license="GPL" +depends=(libusb) +arch=(i686 x86_64) +source=(http://www.intra2net.com/de/produkte/opensource/ftdi/TGZ/$pkgname-$pkgver.tar.gz) +md5sums=('7b4a660fd644980f3d45873d156d021a') + +build() { + cd $startdir/src/$pkgname-$pkgver + ./configure --prefix=/usr --sysconfdir=/etc + make + make DESTDIR=$startdir/pkg install +} +# :mode=shellscript: diff --git a/abs/extra-testing/libmrss/PKGBUILD b/abs/extra-testing/libmrss/PKGBUILD new file mode 100644 index 0000000..7d23508 --- /dev/null +++ b/abs/extra-testing/libmrss/PKGBUILD @@ -0,0 +1,20 @@ +# Contributor: Bernhard Walle <bernhard.walle@gmx.de> +pkgname=libmrss +pkgver=0.19.2 +pkgrel=1 +pkgdesc="C library for parsing, writing and creating RSS/ATOM files or streams" +url="http://www2.autistici.org/bakunin/libmrss/" +license="LGPL" +depends=(curl libnxml) +arch=('i686' 'x86_64') +options=('!libtool') +source=(http://www2.autistici.org/bakunin/libmrss/$pkgname-$pkgver.tar.gz) +md5sums=('a6f66b72898d27270e3a68007f90d62b') + +build() { + cd $startdir/src/$pkgname-$pkgver + ./configure --prefix=/usr + make || return 1 + make DESTDIR=$startdir/pkg install +} +# :mode=shellscript: diff --git a/abs/extra-testing/libnxml/PKGBUILD b/abs/extra-testing/libnxml/PKGBUILD new file mode 100644 index 0000000..0c4f9cb --- /dev/null +++ b/abs/extra-testing/libnxml/PKGBUILD @@ -0,0 +1,22 @@ +# $Id: PKGBUILD,v 1.1 2008/09/27 07:05:31 allan Exp $ +# Maintainer: Allan McRae <allan@archlinux.org> +# Contributor: Bernhard Walle <bernhard.walle@gmx.de> + +pkgname=libnxml +pkgver=0.18.3 +pkgrel=1 +pkgdesc="C library for parsing, writing and creating XML 1.0 and 1.1 files or streams" +url="http://www2.autistici.org/bakunin//libnxml/" +license=('LGPL') +depends=('curl') +arch=('i686' 'x86_64') +options=('!libtool') +source=(http://www2.autistici.org/bakunin//libnxml/$pkgname-$pkgver.tar.gz) +md5sums=('857f43970e7f0724d28f4ddc87085daf') + +build() { + cd $srcdir/$pkgname-$pkgver + ./configure --prefix=/usr + make || return 1 + make DESTDIR=$pkgdir install +} diff --git a/abs/extra-testing/serdisplib/PKGBUILD b/abs/extra-testing/serdisplib/PKGBUILD new file mode 100644 index 0000000..454769b --- /dev/null +++ b/abs/extra-testing/serdisplib/PKGBUILD @@ -0,0 +1,22 @@ +# Contributor: Bernhard Walle <bernhard.walle@gmx.de> +pkgname=serdisplib +pkgver=1.97.8 +pkgrel=1 +pkgdesc="Library for Certain Serial and Parallel LC Displays" +url="http://serdisplib.sourceforge.net/" +license="GPL" +depends=(libusb gd) +backup=(etc/LCDd.conf) +arch=(i686 x86_64) +source=(http://switch.dl.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz) +md5sums=('2aa91c43d01d2dfc9fbc1116e3063ae1') + +build() { + cd $startdir/src/$pkgname-$pkgver + ./configure --prefix=/usr --sysconfdir=/etc --enable-libusb + make + make DESTDIR=$startdir/pkg includedir=$startdir/pkg/usr/include \ + libdir=$startdir/pkg/usr/lib bindir=$startdir/pkg/usr/bin \ + install +} +# :mode=shellscript: diff --git a/abs/extra-testing/xmms/PKGBUILD b/abs/extra-testing/xmms/PKGBUILD new file mode 100644 index 0000000..533c227 --- /dev/null +++ b/abs/extra-testing/xmms/PKGBUILD @@ -0,0 +1,50 @@ +# $Id: PKGBUILD,v 1.3 2007/12/06 01:18:06 Snowman Exp $ +# Maintainer: Eric Belanger <belanger@astro.umontreal.ca> + +pkgname=xmms +pkgver=1.2.11 +pkgrel=1 +pkgdesc="The X MultiMedia System" +arch=('i686' 'x86_64') +url="http://www.xmms.org" +license=('GPL') +depends=('libsm' 'libxxf86vm' 'zlib' 'gtk' 'libvorbis' 'esd' 'alsa-lib' 'libgl') +makedepends=('mesa') +options=('!libtool') +source=(http://www.xmms.org/files/1.2.x/$pkgname-$pkgver.tar.bz2 \ + xmms-menu.patch \ + xmms-1.2.10-crossfade-0.3.9.patch \ + xmms-fix.diff) +md5sums=('f3e6dbaf0b3f571a532ab575656be506' 'b7b6f1811bad8d14e4c4534240e45980'\ + '4eb222111a82a2e1ebe63b5f6109133d' 'd7f9dc3712c486658149c4504f7478a7') +sha1sums=('9d1eae4baab25fd35c9ddfb49321ca60222f672d' + '27fb6e21bd6db923a425a8df8bd07a2a93867ddb' + 'ff5c172752c8bee708d9a9ecd53864cc95a4bcc5' + 'c227284955f2cc16f027dade670155c0f0fbc4ff') + +build() { + cd $startdir/src/$pkgname-$pkgver + +# Add id3v2 editing feature (doesn't apply atm, needs to be redone) +# patch -Np1 -i ../id3v2.patch || return 1 +# Fix xmms.desktop + patch -Np0 -i ../xmms-menu.patch || return 1 +# Patch for hang with xmms-crossfade + patch -Np1 -i ../xmms-1.2.10-crossfade-0.3.9.patch || return 1 +# fix xmms not able to be shown double size,at least needed for x86_64 + patch -Np1 -i ../xmms-fix.diff || return 1 + + if [ "$CARCH" == "x86_64" ]; then + ./configure --prefix=/usr --disable-mikmod --disable-simd # for x86_64 + else + ./configure --prefix=/usr --disable-mikmod --enable-simd # for i686 + fi + make || return 1 + make DESTDIR=$startdir/pkg install + mkdir -p ${startdir}/pkg/usr/share/{applications,pixmaps} + install -m 644 xmms/xmms.desktop ${startdir}/pkg/usr/share/applications + install -m 644 xmms/xmms_mini.xpm ${startdir}/pkg/usr/share/pixmaps/xmms.xpm + # don't want wmxmms + rm -rf $startdir/pkg/usr/bin/wmxmms $startdir/pkg/usr/share/xmms + rm -f $startdir/pkg/usr/man/man1/{gnomexmms.1,wmxmms.1} +} diff --git a/abs/extra-testing/xmms/id3v2.patch b/abs/extra-testing/xmms/id3v2.patch new file mode 100644 index 0000000..c8f8ba2 --- /dev/null +++ b/abs/extra-testing/xmms/id3v2.patch @@ -0,0 +1,3379 @@ +diff -Naur xmms-1.2.9-orig/Input/mpg123/charset.h xmms-1.2.9/Input/mpg123/charset.h +--- xmms-1.2.9-orig/Input/mpg123/charset.h Wed Dec 31 19:00:00 1969 ++++ xmms-1.2.9/Input/mpg123/charset.h Thu Jan 29 05:20:31 2004 +@@ -0,0 +1,420 @@ ++/* charset.h - 2001/12/04 */ ++/* ++ * EasyTAG - Tag editor for MP3 and OGG files ++ * Copyright (C) 2000-2002 Jerome Couderc <j.couderc@ifrance.com> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#ifndef FALSE ++#define FALSE 0 ++#endif ++#ifndef TRUE ++#define TRUE 1 ++#endif ++ ++/* ++ * Standard gettext macros. ++ */ ++#ifdef ENABLE_NLS ++# include <libintl.h> ++# define _(String) gettext (String) ++# ifdef gettext_noop ++# define N_(String) gettext_noop (String) ++# else ++# define N_(String) (String) ++# endif ++#else ++# define textdomain(String) (String) ++# define gettext(String) (String) ++# define dgettext(Domain,Message) (Message) ++# define dcgettext(Domain,Message,Type) (Message) ++# define bindtextdomain(Domain,Directory) (Domain) ++# define _(String) (String) ++# define N_(String) (String) ++#endif ++ ++#ifndef DLL_H ++#define DLL_H ++typedef struct DLL_s ++{ ++ void *prev; ++ void *data; ++ void *next; ++} DLL; ++#endif ++ ++#ifndef __CHARSET_H__ ++#define __CHARSET_H__ ++ ++ ++/*************** ++ * Declaration * ++ ***************/ ++ ++typedef struct { ++ char *charset_title; ++ char *charset_name; ++} CharsetInfo; ++ ++ ++/************** ++ * Prototypes * ++ **************/ ++ ++//static gchar* get_current_charset (void); ++ ++/* Used for ogg tags */ ++char* convert_to_utf8 (const char *string); ++char* convert_from_utf8 (const char *string); ++ ++char* convert_from_file_to_user (const char *string); ++char* convert_from_user_to_file (const char *string); ++ ++DLL *Charset_Create_List (void); ++char *Charset_Get_Name_From_Title (char *charset_title); ++char *Charset_Get_Title_From_Name (char *charset_name); ++ ++short int test_conversion_charset (char *from, char *to); ++ ++ ++#endif /* __CHARSET_H__ */ ++ ++/* ++ * Main part of code, written by: ++ * ++ * Copyright (C) 1999-2001 H�vard Kv�len <havardk@xmms.org> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++ * 02111-1307, USA. ++ * ++ */ ++ ++#include <stdlib.h> ++#include <string.h> ++#include <errno.h> ++ ++#ifdef HAVE_ICONV_OPEN ++#include <iconv.h> ++#endif ++ ++#ifdef HAVE_LANGINFO_CODESET ++#include <langinfo.h> ++#endif ++ ++/**************** ++ * Declarations * ++ ****************/ ++ ++#define CHARSET_TRANS_ARRAY_LEN ( sizeof(charset_trans_array) / sizeof((charset_trans_array)[0]) ) ++const CharsetInfo charset_trans_array[] = { ++ {N_("Arabic (IBM-864)"), "IBM864" }, ++ {N_("Arabic (ISO-8859-6)"), "ISO-8859-6" }, ++ {N_("Arabic (Windows-1256)"), "windows-1256" }, ++ {N_("Baltic (ISO-8859-13)"), "ISO-8859-13" }, ++ {N_("Baltic (ISO-8859-4)"), "ISO-8859-4" }, ++ {N_("Baltic (Windows-1257)"), "windows-1257" }, ++ {N_("Celtic (ISO-8859-14)"), "ISO-8859-14" }, ++ {N_("Central European (IBM-852)"), "IBM852" }, ++ {N_("Central European (ISO-8859-2)"), "ISO-8859-2" }, ++ {N_("Central European (Windows-1250)"), "windows-1250" }, ++ {N_("Chinese Simplified (GB18030)"), "gb18030" }, ++ {N_("Chinese Simplified (GB2312)"), "GB2312" }, ++ {N_("Chinese Traditional (Big5)"), "Big5" }, ++ {N_("Chinese Traditional (Big5-HKSCS)"), "Big5-HKSCS" }, ++ {N_("Cyrillic (IBM-855)"), "IBM855" }, ++ {N_("Cyrillic (ISO-8859-5)"), "ISO-8859-5" }, ++ {N_("Cyrillic (ISO-IR-111)"), "ISO-IR-111" }, ++ {N_("Cyrillic (KOI8-R)"), "KOI8-R" }, ++ {N_("Cyrillic (Windows-1251)"), "windows-1251" }, ++ {N_("Cyrillic/Russian (CP-866)"), "IBM866" }, ++ {N_("Cyrillic/Ukrainian (KOI8-U)"), "KOI8-U" }, ++ {N_("English (US-ASCII)"), "us-ascii" }, ++ {N_("Greek (ISO-8859-7)"), "ISO-8859-7" }, ++ {N_("Greek (Windows-1253)"), "windows-1253" }, ++ {N_("Hebrew (IBM-862)"), "IBM862" }, ++ {N_("Hebrew (Windows-1255)"), "windows-1255" }, ++ {N_("Japanese (EUC-JP)"), "EUC-JP" }, ++ {N_("Japanese (ISO-2022-JP)"), "ISO-2022-JP" }, ++ {N_("Japanese (Shift_JIS)"), "Shift_JIS" }, ++ {N_("Korean (EUC-KR)"), "EUC-KR" }, ++ {N_("Nordic (ISO-8859-10)"), "ISO-8859-10" }, ++ {N_("South European (ISO-8859-3)"), "ISO-8859-3" }, ++ {N_("Thai (TIS-620)"), "TIS-620" }, ++ {N_("Turkish (IBM-857)"), "IBM857" }, ++ {N_("Turkish (ISO-8859-9)"), "ISO-8859-9" }, ++ {N_("Turkish (Windows-1254)"), "windows-1254" }, ++ {N_("Unicode (UTF-7)"), "UTF-7" }, ++ {N_("Unicode (UTF-8)"), "UTF-8" }, ++ {N_("Unicode (UTF-16BE)"), "UTF-16BE" }, ++ {N_("Unicode (UTF-16LE)"), "UTF-16LE" }, ++ {N_("Unicode (UTF-32BE)"), "UTF-32BE" }, ++ {N_("Unicode (UTF-32LE)"), "UTF-32LE" }, ++ {N_("Vietnamese (VISCII)"), "VISCII" }, ++ {N_("Vietnamese (Windows-1258)"), "windows-1258" }, ++ {N_("Visual Hebrew (ISO-8859-8)"), "ISO-8859-8" }, ++ {N_("Western (IBM-850)"), "IBM850" }, ++ {N_("Western (ISO-8859-1)"), "ISO-8859-1" }, ++ {N_("Western (ISO-8859-15)"), "ISO-8859-15" }, ++ {N_("Western (Windows-1252)"), "windows-1252" } ++ ++ /* ++ * From this point, character sets aren't supported by iconv ++ */ ++/* {N_("Arabic (IBM-864-I)"), "IBM864i" }, ++ {N_("Arabic (ISO-8859-6-E)"), "ISO-8859-6-E" }, ++ {N_("Arabic (ISO-8859-6-I)"), "ISO-8859-6-I" }, ++ {N_("Arabic (MacArabic)"), "x-mac-arabic" }, ++ {N_("Armenian (ARMSCII-8)"), "armscii-8" }, ++ {N_("Central European (MacCE)"), "x-mac-ce" }, ++ {N_("Chinese Simplified (GBK)"), "x-gbk" }, ++ {N_("Chinese Simplified (HZ)"), "HZ-GB-2312" }, ++ {N_("Chinese Traditional (EUC-TW)"), "x-euc-tw" }, ++ {N_("Croatian (MacCroatian)"), "x-mac-croatian" }, ++ {N_("Cyrillic (MacCyrillic)"), "x-mac-cyrillic" }, ++ {N_("Cyrillic/Ukrainian (MacUkrainian)"), "x-mac-ukrainian" }, ++ {N_("Farsi (MacFarsi)"), "x-mac-farsi"}, ++ {N_("Greek (MacGreek)"), "x-mac-greek" }, ++ {N_("Gujarati (MacGujarati)"), "x-mac-gujarati" }, ++ {N_("Gurmukhi (MacGurmukhi)"), "x-mac-gurmukhi" }, ++ {N_("Hebrew (ISO-8859-8-E)"), "ISO-8859-8-E" }, ++ {N_("Hebrew (ISO-8859-8-I)"), "ISO-8859-8-I" }, ++ {N_("Hebrew (MacHebrew)"), "x-mac-hebrew" }, ++ {N_("Hindi (MacDevanagari)"), "x-mac-devanagari" }, ++ {N_("Icelandic (MacIcelandic)"), "x-mac-icelandic" }, ++ {N_("Korean (JOHAB)"), "x-johab" }, ++ {N_("Korean (UHC)"), "x-windows-949" }, ++ {N_("Romanian (MacRomanian)"), "x-mac-romanian" }, ++ {N_("Turkish (MacTurkish)"), "x-mac-turkish" }, ++ {N_("User Defined"), "x-user-defined" }, ++ {N_("Vietnamese (TCVN)"), "x-viet-tcvn5712" }, ++ {N_("Vietnamese (VPS)"), "x-viet-vps" }, ++ {N_("Western (MacRoman)"), "x-mac-roman" }, ++ // charsets whithout posibly translatable names ++ {"T61.8bit", "T61.8bit" }, ++ {"x-imap4-modified-utf7", "x-imap4-modified-utf7"}, ++ {"x-u-escaped", "x-u-escaped" }, ++ {"windows-936", "windows-936" } ++*/ ++}; ++ ++ ++ ++ ++/************* ++ * Functions * ++ *************/ ++// Return the last item of an doubly linked list ++static DLL * ++dll_last_c (DLL *list) ++{ ++ DLL *item = list; ++ ++ while ( item->next ) ++ item = item->next; ++ ++ return item; ++} ++ ++// Append an item to the doubly linked list ++static DLL * ++dll_append_c (DLL *list, void *data) ++{ ++ DLL *item = malloc (sizeof(DLL)); ++ ++ item->data = data; ++ item->prev = dll_last_c(list); ++ item->next = NULL; ++ ++ return item; ++} ++ ++static char* get_current_charset (void) ++{ ++ char *charset = getenv("CHARSET"); ++ ++#ifdef HAVE_LANGINFO_CODESET ++ if (!charset) ++ charset = nl_langinfo(CODESET); ++#endif ++ if (!charset) ++ charset = "ISO-8859-1"; ++ ++ return charset; ++} ++ ++ ++#ifdef HAVE_ICONV_OPEN ++static char* convert_string (const char *string, char *from, char *to) ++{ ++ size_t outleft, outsize, length; ++ iconv_t cd; ++ char *out, *outptr; ++ const char *input = string; ++ ++ if (!string) ++ return NULL; ++ ++ length = strlen(string); ++ ++ /* g_message("converting %s from %s to %s", string, from, to); */ ++ if ((cd = iconv_open(to, from)) == (iconv_t)-1) ++ { ++ fprintf (stderr, "convert_string(): Conversion not supported. Charsets: %s -> %s", from, to); ++ return strdup(string); ++ } ++ ++ /* Due to a GLIBC bug, round outbuf_size up to a multiple of 4 */ ++ /* + 1 for nul in case len == 1 */ ++ outsize = ((length + 3) & ~3) + 1; ++ out = g_malloc(outsize); ++ outleft = outsize - 1; ++ outptr = out; ++ ++ retry: ++ if (iconv(cd, (char **)&input, &length, &outptr, &outleft) == -1) ++ { ++ int used; ++ switch (errno) ++ { ++ case E2BIG: ++ used = outptr - out; ++ outsize = (outsize - 1) * 2 + 1; ++ out = g_realloc(out, outsize); ++ outptr = out + used; ++ outleft = outsize - 1 - used; ++ goto retry; ++ case EINVAL: ++ break; ++ case EILSEQ: ++ /* Invalid sequence, try to get the ++ rest of the string */ ++ input++; ++ length = strlen(input); ++ goto retry; ++ default: ++ fprintf (stderr, "convert_string(): Conversion failed. Inputstring: %s; Error: %s", string, strerror(errno)); ++ break; ++ } ++ } ++ *outptr = '\0'; ++ ++ iconv_close(cd); ++ return out; ++} ++#else ++static char* convert_string (const char *string, char *from, char *to) ++{ ++ if (!string) ++ return NULL; ++ return strdup(string); ++} ++#endif ++ ++ ++/* ++ * Conversion with UTF-8 for ogg tags ++ */ ++char* convert_to_utf8 (const char *string) ++{ ++ char *charset = get_current_charset(); ++ ++ return convert_string(string, charset, "UTF-8"); ++} ++ ++char* convert_from_utf8 (const char *string) ++{ ++ char *charset = get_current_charset(); ++ ++ return convert_string(string, "UTF-8", charset); ++} ++ ++ ++DLL *Charset_Create_List (void) ++{ ++ DLL *list = NULL; ++ int i; ++ ++ for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++) ++ list = dll_append_c (list,_(charset_trans_array[i].charset_title)); ++ return list; ++} ++ ++ ++/* ++ * Return charset_name from charset_title ++ */ ++char *Charset_Get_Name_From_Title (char *charset_title) ++{ ++ int i; ++ ++ if (charset_title) ++ for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++) ++ if ( strcasecmp(_(charset_title),_(charset_trans_array[i].charset_title)) == 0 ) ++ return charset_trans_array[i].charset_name; ++ return ""; ++} ++ ++ ++/* ++ * Return charset_title from charset_name ++ */ ++char *Charset_Get_Title_From_Name (char *charset_name) ++{ ++ int i; ++ ++ if (charset_name) ++ for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++) ++ if ( strcasecmp(charset_name,charset_trans_array[i].charset_name) == 0 ) ++ return _(charset_trans_array[i].charset_title); ++ return ""; ++} ++ ++ ++ ++/* ++ * Test if the conversion is supported between two character sets ('from' and 'to) ++ */ ++#ifdef HAVE_ICONV_OPEN ++short int test_conversion_charset (char *from, char *to) ++{ ++ iconv_t cd; ++ ++ if ((cd=iconv_open(to,from)) == (iconv_t)-1) ++ { ++ /* Conversion not supported */ ++ return FALSE; ++ } ++ iconv_close(cd); ++ return TRUE; ++} ++#else ++short int test_conversion_charset (char *from, char *to) ++{ ++ return TRUE; ++} ++#endif +diff -Naur xmms-1.2.9-orig/Input/mpg123/fileinfo.c xmms-1.2.9/Input/mpg123/fileinfo.c +--- xmms-1.2.9-orig/Input/mpg123/fileinfo.c Thu Jan 29 06:43:24 2004 ++++ xmms-1.2.9/Input/mpg123/fileinfo.c Thu Jan 29 06:39:47 2004 +@@ -25,28 +25,36 @@ + #include <errno.h> + #include <libxmms/xentry.h> + #include "mpg123.h" ++#include "lib_id3v2.h" ++ ++#define MAX_STR_LEN 100 ++#define MAX_ENTRY_LEN2 1023 + + static GtkWidget *window = NULL; +-static GtkWidget *filename_entry, *id3_frame; +-static GtkWidget *title_entry, *artist_entry, *album_entry, *year_entry; +-static GtkWidget *tracknum_entry, *comment_entry, *genre_combo; ++static GtkWidget *notebook = NULL; ++static GtkWidget *filename_entry, *id3v1_frame, *id3v2_frame; ++static GtkWidget *v1_checkbox, *v2_checkbox; ++static GtkWidget *v1_title_entry, *v1_artist_entry, *v1_album_entry, *v1_year_entry, *v1_tracknum_entry, *v1_comment_entry; ++static GtkWidget *v2_title_entry, *v2_artist_entry, *v2_album_entry, *v2_year_entry, *v2_tracknum_entry, *v2_comment_entry, ++ *v2_composer_entry, *v2_orig_artist_entry, *v2_url_entry, *v2_encoded_by_entry; ++static GtkWidget *v1_genre_combo, *v2_genre_combo; + static GtkWidget *mpeg_level, *mpeg_bitrate, *mpeg_samplerate, *mpeg_flags; + static GtkWidget *mpeg_fileinfo; + ++static GPtrArray *v1_labels_list = NULL, *v2_labels_list = NULL; // TODO: Where will these be freed? + static GList *genre_list; + struct genre_item { + const char *name; + int id; + }; +-static int current_genre; ++static int v1_current_genre; ++static int v2_current_genre; + static char *current_filename; + + extern char *mpg123_filename; + extern int mpg123_bitrate, mpg123_frequency, mpg123_layer, mpg123_lsf, mpg123_mode; + extern gboolean mpg123_stereo, mpg123_mpeg25; + +-#define MAX_STR_LEN 100 +- + static void label_set_text(GtkWidget * label, char *str, ...) + G_GNUC_PRINTF(2, 3); + +@@ -66,6 +74,12 @@ + strncpy(tag, gtk_entry_get_text(entry), length); + } + ++void copy_entry_tag(GtkEntry * src, GtkEntry * dest, int length) ++{ ++ set_entry_tag(dest, gtk_entry_get_text(src), length); ++ return; ++} ++ + static int genre_find_index(GList *genre_list, int id) + { + int idx = 0; +@@ -80,15 +94,29 @@ + return idx; + } + ++static int genre_find_index_str(GList *genre_list, const char* str) ++{ ++ int idx = 0; ++ while (genre_list) ++ { ++ struct genre_item *item = genre_list->data; ++ if (strcmp(item->name, str) == 0) ++ break; ++ idx++; ++ genre_list = genre_list->next; ++ } ++ return idx; ++} ++ + static int genre_comp_func(gconstpointer a, gconstpointer b) + { + const struct genre_item *ga = a, *gb = b; + return strcasecmp(ga->name, gb->name); + } + +-static void save_cb(GtkWidget * w, gpointer data) ++static void remove_id3v1(void) + { +- int fd; ++ int fd, len; + struct id3v1tag_t tag; + char *msg = NULL; + +@@ -97,71 +125,36 @@ + + if ((fd = open(current_filename, O_RDWR)) != -1) + { +- int tracknum; +- +- lseek(fd, -128, SEEK_END); ++ len = lseek(fd, -128, SEEK_END); + read(fd, &tag, sizeof (struct id3v1tag_t)); + + if (!strncmp(tag.tag, "TAG", 3)) +- lseek(fd, -128, SEEK_END); +- else +- lseek(fd, 0, SEEK_END); +- tag.tag[0] = 'T'; +- tag.tag[1] = 'A'; +- tag.tag[2] = 'G'; +- get_entry_tag(GTK_ENTRY(title_entry), tag.title, 30); +- get_entry_tag(GTK_ENTRY(artist_entry), tag.artist, 30); +- get_entry_tag(GTK_ENTRY(album_entry), tag.album, 30); +- get_entry_tag(GTK_ENTRY(year_entry), tag.year, 4); +- tracknum = atoi(gtk_entry_get_text(GTK_ENTRY(tracknum_entry))); +- if (tracknum > 0) + { +- get_entry_tag(GTK_ENTRY(comment_entry), +- tag.u.v1_1.comment, 28); +- tag.u.v1_1.__zero = 0; +- tag.u.v1_1.track_number = MIN(tracknum, 255); ++ if (ftruncate(fd, len)) ++ msg = g_strdup_printf(_("%s\n" ++ "Unable to truncate file: %s"), ++ _("Couldn't remove tag!"), ++ strerror(errno)); + } +- else +- get_entry_tag(GTK_ENTRY(comment_entry), +- tag.u.v1_0.comment, 30); +- tag.genre = current_genre; +- if (write(fd, &tag, sizeof (tag)) != sizeof (tag)) +- msg = g_strdup_printf(_("%s\nUnable to write to file: %s"), +- _("Couldn't write tag!"), +- strerror(errno)); + close(fd); + } + else + msg = g_strdup_printf(_("%s\nUnable to open file: %s"), +- _("Couldn't write tag!"), ++ _("Couldn't remove tag!"), + strerror(errno)); + if (msg) + { +- GtkWidget *mwin = xmms_show_message(_("File Info"), msg, +- _("Ok"), FALSE, NULL, NULL); ++ GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"), ++ FALSE, NULL, NULL); + gtk_window_set_transient_for(GTK_WINDOW(mwin), + GTK_WINDOW(window)); + g_free(msg); + } +- else +- gtk_widget_destroy(window); +-} +- +-static void label_set_text(GtkWidget * label, char *str, ...) +-{ +- va_list args; +- char tempstr[MAX_STR_LEN]; +- +- va_start(args, str); +- g_vsnprintf(tempstr, MAX_STR_LEN, str, args); +- va_end(args); +- +- gtk_label_set_text(GTK_LABEL(label), tempstr); + } + +-static void remove_id3_cb(GtkWidget * w, gpointer data) ++static void save_cb(GtkWidget * w, gpointer data) + { +- int fd, len; ++ int fd; + struct id3v1tag_t tag; + char *msg = NULL; + +@@ -170,36 +163,95 @@ + + if ((fd = open(current_filename, O_RDWR)) != -1) + { +- len = lseek(fd, -128, SEEK_END); +- read(fd, &tag, sizeof (struct id3v1tag_t)); ++ if (!GTK_TOGGLE_BUTTON(v1_checkbox)->active) { ++ // Try to save id3v1 tag ++ int tracknum; + +- if (!strncmp(tag.tag, "TAG", 3)) +- { +- if (ftruncate(fd, len)) +- msg = g_strdup_printf( +- _("%s\n" +- "Unable to truncate file: %s"), +- _("Couldn't remove tag!"), +- strerror(errno)); ++ lseek(fd, -128, SEEK_END); ++ read(fd, &tag, sizeof (struct id3v1tag_t)); ++ ++ if (!strncmp(tag.tag, "TAG", 3)) ++ lseek(fd, -128, SEEK_END); ++ else ++ lseek(fd, 0, SEEK_END); ++ tag.tag[0] = 'T'; ++ tag.tag[1] = 'A'; ++ tag.tag[2] = 'G'; ++ get_entry_tag(GTK_ENTRY(v1_title_entry), tag.title, 30); ++ get_entry_tag(GTK_ENTRY(v1_artist_entry), tag.artist, 30); ++ get_entry_tag(GTK_ENTRY(v1_album_entry), tag.album, 30); ++ get_entry_tag(GTK_ENTRY(v1_year_entry), tag.year, 4); ++ tracknum = atoi(gtk_entry_get_text(GTK_ENTRY(v1_tracknum_entry))); ++ if (tracknum > 0) ++ { ++ get_entry_tag(GTK_ENTRY(v1_comment_entry), ++ tag.u.v1_1.comment, 28); ++ tag.u.v1_1.__zero = 0; ++ tag.u.v1_1.track_number = MIN(tracknum, 255); ++ } ++ else ++ get_entry_tag(GTK_ENTRY(v1_comment_entry), ++ tag.u.v1_0.comment, 30); ++ tag.genre = v1_current_genre; ++ if (write(fd, &tag, sizeof (tag)) != sizeof (tag)) ++ msg = g_strdup_printf(_("%s\nUnable to write to file: %s"), ++ _("Couldn't write tag!"), ++ strerror(errno)); ++ } else { ++ // Remove the id3v1 tag from the file ++ remove_id3v1(); + } +- else +- msg = strdup(_("No tag to remove!")); +- close(fd); ++ ++ if (!GTK_TOGGLE_BUTTON(v2_checkbox)->active) { ++ ++ id3Tag v2_tag; ++ strncpy(v2_tag.title, gtk_entry_get_text(GTK_ENTRY(v2_title_entry)), MAX_ENTRY_LEN2); ++ strncpy(v2_tag.artist, gtk_entry_get_text(GTK_ENTRY(v2_artist_entry)), MAX_ENTRY_LEN2); ++ strncpy(v2_tag.album, gtk_entry_get_text(GTK_ENTRY(v2_album_entry)), MAX_ENTRY_LEN2); ++ strncpy(v2_tag.year, gtk_entry_get_text(GTK_ENTRY(v2_year_entry)), 4); ++ strncpy(v2_tag.comment, gtk_entry_get_text(GTK_ENTRY(v2_comment_entry)), MAX_ENTRY_LEN2); ++ strncpy(v2_tag.track, gtk_entry_get_text(GTK_ENTRY(v2_tracknum_entry)), 3); ++ snprintf(v2_tag.genre, 6, "(%d)", v2_current_genre); ++ ++ strncpy(v2_tag.composer, gtk_entry_get_text(GTK_ENTRY(v2_composer_entry)), MAX_ENTRY_LEN2); ++ strncpy(v2_tag.url, gtk_entry_get_text(GTK_ENTRY(v2_url_entry)), MAX_ENTRY_LEN2); ++ strncpy(v2_tag.orig_artist, gtk_entry_get_text(GTK_ENTRY(v2_orig_artist_entry)), MAX_ENTRY_LEN2); ++ strncpy(v2_tag.enc_by, gtk_entry_get_text(GTK_ENTRY(v2_encoded_by_entry)), MAX_ENTRY_LEN2); ++ ++ set_id3v2_tag(&v2_tag, current_filename); ++ ++ } else { ++ // remove the id3v2 tag from the file ++ del_id3v2_tag(current_filename); ++ } ++ ++ if (fd) ++ close(fd); + } + else + msg = g_strdup_printf(_("%s\nUnable to open file: %s"), +- _("Couldn't remove tag!"), ++ _("Couldn't write tag!"), + strerror(errno)); + if (msg) + { +- GtkWidget *mwin = xmms_show_message(_("File Info"), msg, +- _("Ok"), FALSE, NULL, NULL); ++ GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"), ++ FALSE, NULL, NULL); + gtk_window_set_transient_for(GTK_WINDOW(mwin), + GTK_WINDOW(window)); + g_free(msg); + } +- else +- gtk_widget_destroy(window); ++} ++ ++static void label_set_text(GtkWidget * label, char *str, ...) ++{ ++ va_list args; ++ char tempstr[MAX_STR_LEN]; ++ ++ va_start(args, str); ++ g_vsnprintf(tempstr, MAX_STR_LEN, str, args); ++ va_end(args); ++ ++ gtk_label_set_text(GTK_LABEL(label), tempstr); + } + + static void set_mpeg_level_label(gboolean mpeg25, int lsf, int layer) +@@ -222,28 +274,144 @@ + + static void file_info_http(char *filename) + { +- gtk_widget_set_sensitive(id3_frame, FALSE); ++ gtk_widget_set_sensitive(id3v1_frame, FALSE); ++ gtk_widget_set_sensitive(id3v2_frame, FALSE); + if (mpg123_filename && !strcmp(filename, mpg123_filename) && + mpg123_bitrate != 0) + { +- set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, mpg123_layer); ++ set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, ++ mpg123_layer); + label_set_text(mpeg_bitrate, _("Bitrate: %d kb/s"), +- mpg123_bitrate); ++ mpg123_bitrate); + label_set_text(mpeg_samplerate, _("Samplerate: %d Hz"), +- mpg123_frequency); ++ mpg123_frequency); + label_set_text(mpeg_flags, "%s", +- channel_mode_name(mpg123_mode)); ++ channel_mode_name(mpg123_mode)); + } + } + +-static void genre_selected(GtkList *list, GtkWidget *w, gpointer data) ++void copy_v2_to_v1_cb(GtkButton *button, gpointer user_data) ++{ ++ copy_entry_tag(GTK_ENTRY(v2_title_entry), GTK_ENTRY(v1_title_entry), 30); ++ copy_entry_tag(GTK_ENTRY(v2_artist_entry), GTK_ENTRY(v1_artist_entry), 30); ++ copy_entry_tag(GTK_ENTRY(v2_album_entry), GTK_ENTRY(v1_album_entry), 30); ++ copy_entry_tag(GTK_ENTRY(v2_year_entry), GTK_ENTRY(v1_year_entry), 4); ++ copy_entry_tag(GTK_ENTRY(v2_comment_entry), GTK_ENTRY(v1_comment_entry), 30); ++ copy_entry_tag(GTK_ENTRY(v2_tracknum_entry), GTK_ENTRY(v1_tracknum_entry), 3); ++ ++ gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), genre_find_index(genre_list, v2_current_genre)); ++ return; ++} ++ ++void copy_v1_to_v2_cb(GtkButton *button, gpointer user_data) ++{ ++ copy_entry_tag(GTK_ENTRY(v1_title_entry), GTK_ENTRY(v2_title_entry), MAX_ENTRY_LEN2); ++ copy_entry_tag(GTK_ENTRY(v1_artist_entry), GTK_ENTRY(v2_artist_entry), MAX_ENTRY_LEN2); ++ copy_entry_tag(GTK_ENTRY(v1_album_entry), GTK_ENTRY(v2_album_entry), MAX_ENTRY_LEN2); ++ copy_entry_tag(GTK_ENTRY(v1_year_entry), GTK_ENTRY(v2_year_entry), 4); ++ copy_entry_tag(GTK_ENTRY(v1_comment_entry), GTK_ENTRY(v2_comment_entry), MAX_ENTRY_LEN2); ++ copy_entry_tag(GTK_ENTRY(v1_tracknum_entry), GTK_ENTRY(v2_tracknum_entry), 3); ++ ++ gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), genre_find_index(genre_list, v1_current_genre)); ++ //int genreID = find_genre_id(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(v1_genre_combo)->entry))); ++ //gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), ++ // g_list_index(genre_list, (char *) mpg123_id3_genres[genreID])); ++ return; ++} ++ ++void v1_toggle_cb (GtkWidget *widget, gpointer data) ++{ ++ int i = 0; ++ if (GTK_TOGGLE_BUTTON (widget)->active) ++ { ++ // If control reaches here, the toggle button is down ++ // Gray out labels ++ for (i = 0; i < v1_labels_list->len; i++) { ++ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v1_labels_list, i) ), FALSE); ++ } ++ gtk_widget_set_sensitive(v1_title_entry, FALSE); ++ gtk_widget_set_sensitive(v1_artist_entry, FALSE); ++ gtk_widget_set_sensitive(v1_album_entry, FALSE); ++ gtk_widget_set_sensitive(v1_year_entry, FALSE); ++ gtk_widget_set_sensitive(v1_tracknum_entry, FALSE); ++ gtk_widget_set_sensitive(v1_comment_entry, FALSE); ++ gtk_widget_set_sensitive(v1_genre_combo, FALSE); ++ } else { ++ ++ // If control reaches here, the toggle button is up ++ // Enable labels ++ for (i = 0; i < v1_labels_list->len; i++) { ++ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v1_labels_list, i) ), TRUE); ++ } ++ gtk_widget_set_sensitive(v1_title_entry, TRUE); ++ gtk_widget_set_sensitive(v1_artist_entry, TRUE); ++ gtk_widget_set_sensitive(v1_album_entry, TRUE); ++ gtk_widget_set_sensitive(v1_year_entry, TRUE); ++ gtk_widget_set_sensitive(v1_tracknum_entry, TRUE); ++ gtk_widget_set_sensitive(v1_comment_entry, TRUE); ++ gtk_widget_set_sensitive(v1_genre_combo, TRUE); ++ } ++} ++ ++void v2_toggle_cb (GtkWidget *widget, gpointer data) ++{ ++ int i = 0; ++ if (GTK_TOGGLE_BUTTON (widget)->active) ++ { ++ // If control reaches here, the toggle button is down ++ // Gray out labels ++ for (i = 0; i < v2_labels_list->len; i++) { ++ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v2_labels_list, i) ), FALSE); ++ } ++ gtk_widget_set_sensitive(v2_title_entry, FALSE); ++ gtk_widget_set_sensitive(v2_artist_entry, FALSE); ++ gtk_widget_set_sensitive(v2_album_entry, FALSE); ++ gtk_widget_set_sensitive(v2_year_entry, FALSE); ++ gtk_widget_set_sensitive(v2_tracknum_entry, FALSE); ++ gtk_widget_set_sensitive(v2_comment_entry, FALSE); ++ gtk_widget_set_sensitive(v2_composer_entry, FALSE); ++ gtk_widget_set_sensitive(v2_orig_artist_entry, FALSE); ++ gtk_widget_set_sensitive(v2_url_entry, FALSE); ++ gtk_widget_set_sensitive(v2_encoded_by_entry, FALSE); ++ gtk_widget_set_sensitive(v2_genre_combo, FALSE); ++ } else { ++ ++ // If control reaches here, the toggle button is up ++ // Enable labels ++ for (i = 0; i < v2_labels_list->len; i++) { ++ gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v2_labels_list, i) ), TRUE); ++ } ++ gtk_widget_set_sensitive(v2_title_entry, TRUE); ++ gtk_widget_set_sensitive(v2_artist_entry, TRUE); ++ gtk_widget_set_sensitive(v2_album_entry, TRUE); ++ gtk_widget_set_sensitive(v2_year_entry, TRUE); ++ gtk_widget_set_sensitive(v2_tracknum_entry, TRUE); ++ gtk_widget_set_sensitive(v2_comment_entry, TRUE); ++ gtk_widget_set_sensitive(v2_composer_entry, TRUE); ++ gtk_widget_set_sensitive(v2_orig_artist_entry, TRUE); ++ gtk_widget_set_sensitive(v2_url_entry, TRUE); ++ gtk_widget_set_sensitive(v2_encoded_by_entry, TRUE); ++ gtk_widget_set_sensitive(v2_genre_combo, TRUE); ++ } ++} ++static void v1_genre_selected(GtkList *list, GtkWidget *w, gpointer data) ++{ ++ void * p; ++ p = gtk_object_get_data(GTK_OBJECT(w), "genre_id"); ++ if (p != NULL) ++ v1_current_genre = GPOINTER_TO_INT(p); ++ else ++ v1_current_genre = 0; ++} ++ ++static void v2_genre_selected(GtkList *list, GtkWidget *w, gpointer data) + { + void * p; + p = gtk_object_get_data(GTK_OBJECT(w), "genre_id"); + if (p != NULL) +- current_genre = GPOINTER_TO_INT(p); ++ v2_current_genre = GPOINTER_TO_INT(p); + else +- current_genre = 0; ++ v2_current_genre = 0; + } + + static void genre_set_popdown(GtkWidget *combo, GList *genres) +@@ -266,11 +434,12 @@ + void mpg123_file_info_box(char *filename) + { + int i; +- struct id3v1tag_t tag; ++ struct id3v1tag_t id3v1tag; + FILE *fh; + char *tmp, *title; + const char *emphasis[4]; + const char *bool_label[2]; ++ struct id3tag_t id3v2tag; + + emphasis[0] = _("None"); + emphasis[1] = _("50/15 ms"); +@@ -281,116 +450,123 @@ + + if (!window) + { +- GtkWidget *vbox, *hbox, *left_vbox, *table; +- GtkWidget *mpeg_frame, *mpeg_box; +- GtkWidget *label, *filename_hbox; +- GtkWidget *bbox, *save, *remove_id3, *cancel; +- +- window = gtk_window_new(GTK_WINDOW_DIALOG); +- gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); +- gtk_signal_connect(GTK_OBJECT(window), "destroy", +- gtk_widget_destroyed, &window); +- gtk_container_set_border_width(GTK_CONTAINER(window), 10); +- +- vbox = gtk_vbox_new(FALSE, 10); +- gtk_container_add(GTK_CONTAINER(window), vbox); ++ GtkWidget *window_vbox, ++ *id3v1_vbox, *id3v2_vbox, *id3v1_frame_vbox, *id3v2_frame_vbox, ++ *mpeg_lvbox, *mpeg_rvbox, *mpeg_hbox, *mpeg_box, *mpeg_frame, ++ *bbox, *save, *close, *copy_to, *copy_from, ++ *table, *label, *filename_hbox; ++ ++ v1_labels_list = g_ptr_array_new(); ++ v2_labels_list = g_ptr_array_new(); ++ ++ window = gtk_window_new(GTK_WINDOW_DIALOG); ++ //gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); ++ gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window); ++ gtk_container_set_border_width(GTK_CONTAINER(window), 10); + ++ window_vbox = gtk_vbox_new(FALSE,10); + filename_hbox = gtk_hbox_new(FALSE, 5); +- gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, +- FALSE, TRUE, 0); ++ gtk_box_pack_start(GTK_BOX(window_vbox), filename_hbox, FALSE, TRUE, 0); + + label = gtk_label_new(_("Filename:")); +- gtk_box_pack_start(GTK_BOX(filename_hbox), label, +- FALSE, TRUE, 0); ++ gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); + filename_entry = xmms_entry_new(); + gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); +- gtk_box_pack_start(GTK_BOX(filename_hbox), +- filename_entry, TRUE, TRUE, 0); +- +- hbox = gtk_hbox_new(FALSE, 10); +- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); +- +- left_vbox = gtk_vbox_new(FALSE, 10); +- gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); +- +- id3_frame = gtk_frame_new(_("ID3 Tag:")); +- gtk_box_pack_start(GTK_BOX(left_vbox), id3_frame, +- FALSE, FALSE, 0); +- +- table = gtk_table_new(5, 5, FALSE); +- gtk_container_set_border_width(GTK_CONTAINER(table), 5); +- gtk_container_add(GTK_CONTAINER(id3_frame), table); +- +- label = gtk_label_new(_("Title:")); +- gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); +- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, +- GTK_FILL, GTK_FILL, 5, 5); +- +- title_entry = gtk_entry_new_with_max_length(30); +- gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); +- +- label = gtk_label_new(_("Artist:")); +- gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); +- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, +- GTK_FILL, GTK_FILL, 5, 5); +- +- artist_entry = gtk_entry_new_with_max_length(30); +- gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 4, 1, 2, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); +- +- label = gtk_label_new(_("Album:")); +- gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); +- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, +- GTK_FILL, GTK_FILL, 5, 5); +- +- album_entry = gtk_entry_new_with_max_length(30); +- gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); +- +- label = gtk_label_new(_("Comment:")); +- gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); +- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, +- GTK_FILL, GTK_FILL, 5, 5); +- +- comment_entry = gtk_entry_new_with_max_length(30); +- gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 4, 3, 4, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); +- +- label = gtk_label_new(_("Year:")); +- gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); +- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, +- GTK_FILL, GTK_FILL, 5, 5); +- +- year_entry = gtk_entry_new_with_max_length(4); +- gtk_widget_set_usize(year_entry, 40, -1); +- gtk_table_attach(GTK_TABLE(table), year_entry, 1, 2, 4, 5, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); +- +- label = gtk_label_new(_("Track number:")); +- gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); +- gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, +- GTK_FILL, GTK_FILL, 5, 5); +- +- tracknum_entry = gtk_entry_new_with_max_length(3); +- gtk_widget_set_usize(tracknum_entry, 40, -1); +- gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); +- +- label = gtk_label_new(_("Genre:")); +- gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); +- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, +- GTK_FILL, GTK_FILL, 5, 5); +- +- genre_combo = gtk_combo_new(); +- gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), +- FALSE); ++ gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); ++ ++ id3v1_vbox = gtk_vbox_new(FALSE, 10); ++ id3v1_frame = gtk_frame_new("ID3v1 Information"); ++ gtk_box_pack_start(GTK_BOX(id3v1_vbox), id3v1_frame, TRUE, TRUE, 0); ++ ++ id3v1_frame_vbox = gtk_vbox_new(FALSE,10); ++ gtk_container_add(GTK_CONTAINER(id3v1_frame), id3v1_frame_vbox); ++ ++ table = gtk_table_new(6, 6, FALSE); ++ gtk_container_set_border_width(GTK_CONTAINER(table), 5); ++ //gtk_widget_set_usize(GTK_WIDGET(table), 325, -1); ++ //gtk_container_add(GTK_CONTAINER(id3v1_frame), table); ++ gtk_box_pack_start(GTK_BOX(id3v1_frame_vbox), table, FALSE, FALSE, 0); ++ ++ v1_checkbox = gtk_check_button_new_with_label ("Disable ID3v1 Tag"); ++ gtk_signal_connect(GTK_OBJECT(v1_checkbox), "toggled", GTK_SIGNAL_FUNC(v1_toggle_cb), NULL); ++ gtk_table_attach(GTK_TABLE(table), v1_checkbox, 1, 3, 0, 1, ++ GTK_FILL, GTK_FILL, 0, 2); ++ ++ label = gtk_label_new("Track number:"); ++ g_ptr_array_add(v1_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, ++ GTK_FILL, GTK_FILL, 5,5); ++ ++ v1_tracknum_entry = gtk_entry_new_with_max_length(3); ++ gtk_widget_set_usize(v1_tracknum_entry, 20, -1); ++ gtk_table_attach(GTK_TABLE(table), v1_tracknum_entry, 4, 5, 0, 1, ++ GTK_FILL, GTK_FILL, 0, 2); ++ ++ label = gtk_label_new("Title:"); ++ g_ptr_array_add(v1_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v1_title_entry = gtk_entry_new_with_max_length(30); ++ gtk_table_attach(GTK_TABLE(table), v1_title_entry, 1, 5, 1, 2, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Artist:"); ++ g_ptr_array_add(v1_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v1_artist_entry = gtk_entry_new_with_max_length(30); ++ gtk_table_attach(GTK_TABLE(table), v1_artist_entry, 1, 5, 2, 3, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Album:"); ++ g_ptr_array_add(v1_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v1_album_entry = gtk_entry_new_with_max_length(30); ++ gtk_table_attach(GTK_TABLE(table), v1_album_entry, 1, 5, 3, 4, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Comment:"); ++ g_ptr_array_add(v1_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v1_comment_entry = gtk_entry_new_with_max_length(30); ++ gtk_table_attach(GTK_TABLE(table), v1_comment_entry, 1, 5, 4, 5, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Year:"); ++ g_ptr_array_add(v1_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v1_year_entry = gtk_entry_new_with_max_length(4); ++ gtk_widget_set_usize(v1_year_entry, 45, -1); ++ gtk_table_attach(GTK_TABLE(table), v1_year_entry, 1, 2, 5, 6, ++ GTK_FILL, GTK_FILL, 0, 2); ++ ++ label = gtk_label_new("Genre:"); ++ g_ptr_array_add(v1_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 2, 3, 5, 6, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v1_genre_combo = gtk_combo_new(); ++ gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(v1_genre_combo)->entry), ++ FALSE); + if (!genre_list) + { + struct genre_item *item; +@@ -408,77 +584,278 @@ + genre_list = g_list_prepend(genre_list, item); + genre_list = g_list_sort(genre_list, genre_comp_func); + } +- genre_set_popdown(genre_combo, genre_list); +- gtk_signal_connect(GTK_OBJECT(GTK_COMBO(genre_combo)->list), +- "select-child", genre_selected, NULL); +- +- gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 4, 5, 6, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, +- GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); +- +- bbox = gtk_hbutton_box_new(); +- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), +- GTK_BUTTONBOX_END); +- gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); +- gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0); +- +- save = gtk_button_new_with_label(_("Save")); +- gtk_signal_connect(GTK_OBJECT(save), "clicked", save_cb, NULL); +- GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT); +- gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 0); +- gtk_widget_grab_default(save); +- +- remove_id3 = gtk_button_new_with_label(_("Remove ID3")); +- gtk_signal_connect(GTK_OBJECT(remove_id3), "clicked", +- remove_id3_cb, NULL); +- GTK_WIDGET_SET_FLAGS(remove_id3, GTK_CAN_DEFAULT); +- gtk_box_pack_start(GTK_BOX(bbox), remove_id3, TRUE, TRUE, 0); +- +- cancel = gtk_button_new_with_label(_("Cancel")); +- gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", +- gtk_widget_destroy, GTK_OBJECT(window)); +- GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); +- gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); +- +- mpeg_frame = gtk_frame_new(_("MPEG Info:")); +- gtk_box_pack_start(GTK_BOX(hbox), mpeg_frame, FALSE, FALSE, 0); +- +- mpeg_box = gtk_vbox_new(FALSE, 5); +- gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_box); +- gtk_container_set_border_width(GTK_CONTAINER(mpeg_box), 10); +- gtk_box_set_spacing(GTK_BOX(mpeg_box), 0); +- +- mpeg_level = gtk_label_new(""); +- gtk_widget_set_usize(mpeg_level, 120, -2); +- gtk_misc_set_alignment(GTK_MISC(mpeg_level), 0, 0); +- gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_level, FALSE, FALSE, 0); +- +- mpeg_bitrate = gtk_label_new(""); +- gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 0, 0); +- gtk_label_set_justify(GTK_LABEL(mpeg_bitrate), +- GTK_JUSTIFY_LEFT); +- gtk_box_pack_start(GTK_BOX(mpeg_box), +- mpeg_bitrate, FALSE, FALSE, 0); +- +- mpeg_samplerate = gtk_label_new(""); +- gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 0, 0); +- gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_samplerate, +- FALSE, FALSE, 0); +- +- mpeg_flags = gtk_label_new(""); +- gtk_misc_set_alignment(GTK_MISC(mpeg_flags), 0, 0); +- gtk_label_set_justify(GTK_LABEL(mpeg_flags), GTK_JUSTIFY_LEFT); +- gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_flags, +- FALSE, FALSE, 0); +- +- mpeg_fileinfo = gtk_label_new(""); +- gtk_misc_set_alignment(GTK_MISC(mpeg_fileinfo), 0, 0); +- gtk_label_set_justify(GTK_LABEL(mpeg_fileinfo), +- GTK_JUSTIFY_LEFT); +- gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_fileinfo, +- FALSE, FALSE, 0); ++ genre_set_popdown(v1_genre_combo, genre_list); ++ gtk_signal_connect(GTK_OBJECT(GTK_COMBO(v1_genre_combo)->list), ++ "select-child", v1_genre_selected, NULL); ++ ++ gtk_table_attach(GTK_TABLE(table), v1_genre_combo, 3, 5, 5, 6, ++ GTK_FILL | GTK_SHRINK, GTK_FILL | ++ GTK_SHRINK, 0, 2); ++ ++ bbox = gtk_hbutton_box_new(); ++ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); ++ gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0); ++ gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); ++ gtk_box_pack_start(GTK_BOX(id3v1_frame_vbox), bbox, FALSE, FALSE, 0); ++ ++ copy_from = gtk_button_new_with_label("ID3v1 to ID3v2"); ++ gtk_signal_connect(GTK_OBJECT(copy_from), "clicked", GTK_SIGNAL_FUNC(copy_v1_to_v2_cb), NULL); ++ // remove the next line to thicken the button width ++ GTK_WIDGET_SET_FLAGS(copy_from, GTK_CAN_DEFAULT); ++ gtk_box_pack_start(GTK_BOX(bbox), copy_from, FALSE, TRUE, 0); ++ ++ ++ notebook = gtk_notebook_new (); ++ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP); ++ ++ label = gtk_label_new ("ID3v1"); ++ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), id3v1_vbox, label); ++ ++ ++ //////////////////////////////////////////////////////////////////////////////////////////////////// ++ //////////////////////////////////////////////////////////////////////////////////////////////////// ++ ++ id3v2_vbox = gtk_vbox_new(FALSE, 0); ++ ++ id3v2_frame = gtk_frame_new("ID3v2 Information"); ++ gtk_box_pack_start(GTK_BOX(id3v2_vbox), id3v2_frame, FALSE, FALSE, 0); ++ ++ id3v2_frame_vbox = gtk_vbox_new(FALSE, 0); ++ gtk_container_add(GTK_CONTAINER(id3v2_frame), id3v2_frame_vbox); ++ ++ table = gtk_table_new(6, 6, FALSE); ++ gtk_container_set_border_width(GTK_CONTAINER(table), 5); ++ gtk_widget_set_usize(GTK_WIDGET(table), 400, -1); ++ //gtk_container_add(GTK_CONTAINER(id3v2_frame), table); ++ gtk_box_pack_start(GTK_BOX(id3v2_frame_vbox), table, FALSE, FALSE, 0); ++ ++ v2_checkbox = gtk_check_button_new_with_label ("Disable ID3v2 Tag"); ++ gtk_signal_connect(GTK_OBJECT(v2_checkbox), "toggled", GTK_SIGNAL_FUNC(v2_toggle_cb), NULL); ++ gtk_table_attach(GTK_TABLE(table), v2_checkbox, 1, 3, 0, 1, ++ GTK_FILL, GTK_FILL, 0, 2); ++ ++ label = gtk_label_new("Track number:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, ++ GTK_FILL, GTK_FILL, 5,5); ++ ++ v2_tracknum_entry = gtk_entry_new_with_max_length(3); ++ gtk_widget_set_usize(v2_tracknum_entry, 20, -1); ++ gtk_table_attach(GTK_TABLE(table), v2_tracknum_entry, 4, 5, 0, 1, ++ GTK_FILL, GTK_FILL, 0, 2); ++ ++ label = gtk_label_new("Title:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_title_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_title_entry, 1, 5, 1, 2, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Artist:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_artist_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_artist_entry, 1, 5, 2, 3, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Album:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_album_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_album_entry, 1, 5, 3, 4, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Comment:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_comment_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_comment_entry, 1, 5, 4, 5, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Year:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_year_entry = gtk_entry_new_with_max_length(4); ++ gtk_widget_set_usize(v2_year_entry, 45, -1); ++ gtk_table_attach(GTK_TABLE(table), v2_year_entry, 1, 2, 5, 6, ++ GTK_FILL, GTK_FILL, 0, 2); ++ ++ label = gtk_label_new("Genre:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 2, 3, 5, 6, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_genre_combo = gtk_combo_new(); ++ gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(v2_genre_combo)->entry), FALSE); ++ genre_set_popdown(v2_genre_combo, genre_list); ++ gtk_signal_connect(GTK_OBJECT(GTK_COMBO(v2_genre_combo)->list), ++ "select-child", v2_genre_selected, NULL); ++ ++ gtk_table_attach(GTK_TABLE(table), v2_genre_combo, 3, 5, 5, 6, ++ GTK_FILL | GTK_SHRINK, GTK_FILL | ++ GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Composer:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_composer_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_composer_entry, 1, 5, 6, 7, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("Orig. Artist:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 7, 8, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_orig_artist_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_orig_artist_entry, 1, 5, 7, 8, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ label = gtk_label_new("URL:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 8, 9, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_url_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_url_entry, 1, 5, 8, 9, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ label = gtk_label_new("Encoded By:"); ++ g_ptr_array_add(v2_labels_list, (gpointer)label); ++ gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); ++ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 9, 10, ++ GTK_FILL, GTK_FILL, 5, 5); ++ ++ v2_encoded_by_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); ++ gtk_table_attach(GTK_TABLE(table), v2_encoded_by_entry, 1, 5, 9, 10, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, ++ GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); ++ ++ bbox = gtk_hbutton_box_new(); ++ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); ++ gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0); ++ gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); ++ gtk_box_pack_start(GTK_BOX(id3v2_frame_vbox), bbox, FALSE, FALSE, 0); ++ ++ copy_to = gtk_button_new_with_label("ID3v2 to ID3v1"); ++ gtk_signal_connect(GTK_OBJECT(copy_to), "clicked", GTK_SIGNAL_FUNC(copy_v2_to_v1_cb), NULL); ++ // remove the next line to thicken the button width ++ GTK_WIDGET_SET_FLAGS(copy_to, GTK_CAN_DEFAULT); ++ gtk_box_pack_start(GTK_BOX(bbox), copy_to, FALSE, TRUE, 0); ++ ++ label = gtk_label_new ("ID3v2"); ++ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), id3v2_vbox, label); ++ ++ ++ //////////////////////////////////////////////////////////////////////////////////////////////////// ++ //////////////////////////////////////////////////////////////////////////////////////////////////// ++ ++ mpeg_frame = gtk_frame_new("MPEG Information"); ++ mpeg_hbox = gtk_hbox_new(FALSE,50); ++ gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_hbox); ++ ++ mpeg_lvbox = gtk_vbox_new(FALSE, 5); ++ gtk_container_set_border_width(GTK_CONTAINER(mpeg_lvbox), 10); ++ gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_lvbox, FALSE, FALSE, 0); ++ ++ //gtk_container_set_border_width(GTK_CONTAINER(table), 5); ++ //gtk_widget_set_usize(GTK_WIDGET(table), 325, -1); ++ //gtk_container_add(GTK_CONTAINER(mpeg_frame), table); ++ ++ mpeg_box = gtk_vbox_new(FALSE, 5); ++ gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_box, FALSE, FALSE, 0); ++ gtk_container_set_border_width(GTK_CONTAINER(mpeg_box), 10); ++ gtk_box_set_spacing(GTK_BOX(mpeg_box), 0); ++ ++ mpeg_level = gtk_label_new(""); ++ //gtk_widget_set_usize(mpeg_level, 120, -2); ++ gtk_label_set_justify (GTK_LABEL(mpeg_level), GTK_JUSTIFY_LEFT); ++ gtk_misc_set_alignment(GTK_MISC(mpeg_level), 0, 0.5); ++ gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_level, FALSE, FALSE, 0); ++ ++ mpeg_samplerate = gtk_label_new(""); ++ gtk_label_set_justify (GTK_LABEL(mpeg_samplerate), GTK_JUSTIFY_LEFT); ++ gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 0, 0.5); ++ gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_samplerate, FALSE, FALSE, 0); ++ ++ mpeg_fileinfo = gtk_label_new(""); ++ gtk_label_set_justify (GTK_LABEL(mpeg_fileinfo), GTK_JUSTIFY_LEFT); ++ gtk_misc_set_alignment(GTK_MISC(mpeg_fileinfo), 0, 0.5); ++ gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_fileinfo, FALSE, FALSE, 0); ++ ++ mpeg_rvbox = gtk_vbox_new(FALSE, 5); ++ gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_rvbox, FALSE, FALSE, 0); ++ gtk_container_set_border_width(GTK_CONTAINER(mpeg_rvbox), 10); ++ ++ mpeg_bitrate = gtk_label_new(""); ++ gtk_label_set_justify (GTK_LABEL(mpeg_bitrate), GTK_JUSTIFY_LEFT); ++ gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 0, 0.5); ++ gtk_box_pack_start(GTK_BOX(mpeg_rvbox), mpeg_bitrate, FALSE, FALSE, 0); ++ ++ mpeg_flags = gtk_label_new(""); ++ gtk_label_set_justify (GTK_LABEL(mpeg_flags), GTK_JUSTIFY_LEFT); ++ gtk_misc_set_alignment(GTK_MISC(mpeg_flags), 0, 0.5); ++ gtk_box_pack_start(GTK_BOX(mpeg_rvbox), mpeg_flags, FALSE, FALSE, 0); ++ ++ label = gtk_label_new ("MPEG"); ++ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), mpeg_frame, label); ++ ++ ////////////////////////////////////////////////////////////////// ++ ////////////////////////////////////////////////////////////////// ++ ++ // add notebook to window vbox ++ gtk_box_pack_start(GTK_BOX(window_vbox), notebook, FALSE, FALSE, 0); ++ ++ // add button box to window vbox ++ bbox = gtk_hbutton_box_new(); ++ gtk_box_pack_start(GTK_BOX(window_vbox), bbox, FALSE, FALSE, 0); ++ ++ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END); ++ gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 5); ++ //gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h); ++ ++ save = gtk_button_new_with_label("Save"); ++ gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_cb), NULL); ++ //GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT); ++ gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 5); ++ //gtk_widget_grab_default(save); ++ ++ close = gtk_button_new_with_label("Close"); ++ gtk_signal_connect_object(GTK_OBJECT(close), "clicked", ++ GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); ++ //GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT); ++ gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5); + +- gtk_widget_show_all(window); ++ gtk_container_add(GTK_CONTAINER(window), window_vbox); ++ gtk_widget_show_all(window); + } + + if (current_filename) +@@ -495,29 +872,43 @@ + title = g_strdup(g_basename(filename)); + if ((tmp = strrchr(title, '.')) != NULL) + *tmp = '\0'; +- gtk_entry_set_text(GTK_ENTRY(title_entry), title); ++ gtk_entry_set_text(GTK_ENTRY(v1_title_entry), title); ++ gtk_entry_set_text(GTK_ENTRY(v2_title_entry), title); + g_free(title); + +- gtk_entry_set_text(GTK_ENTRY(artist_entry), ""); +- gtk_entry_set_text(GTK_ENTRY(album_entry), ""); +- gtk_entry_set_text(GTK_ENTRY(year_entry), ""); +- gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ""); +- gtk_entry_set_text(GTK_ENTRY(comment_entry), ""); +- gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list), ++ gtk_entry_set_text(GTK_ENTRY(v1_artist_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v1_album_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v1_year_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v1_comment_entry), ""); ++ gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), ++ genre_find_index(genre_list, 0xff)); ++ ++ gtk_entry_set_text(GTK_ENTRY(v2_artist_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_album_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_year_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_tracknum_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_comment_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_composer_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_orig_artist_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_url_entry), ""); ++ gtk_entry_set_text(GTK_ENTRY(v2_encoded_by_entry), ""); ++ gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), + genre_find_index(genre_list, 0xff)); ++ + gtk_label_set_text(GTK_LABEL(mpeg_level), "MPEG ?, layer ?"); + gtk_label_set_text(GTK_LABEL(mpeg_bitrate), ""); + gtk_label_set_text(GTK_LABEL(mpeg_samplerate), ""); + gtk_label_set_text(GTK_LABEL(mpeg_flags), ""); + gtk_label_set_text(GTK_LABEL(mpeg_fileinfo), ""); +- + if (!strncasecmp(filename, "http://", 7)) + { + file_info_http(filename); + return; + } + +- gtk_widget_set_sensitive(id3_frame, TRUE); ++ gtk_widget_set_sensitive(id3v1_frame, TRUE); ++ gtk_widget_set_sensitive(id3v2_frame, TRUE); + + if ((fh = fopen(current_filename, "rb")) != NULL) + { +@@ -525,40 +916,95 @@ + unsigned char tmp[4]; + struct frame frm; + gboolean id3_found = FALSE; ++ char *temp = NULL; ++ struct id3_tag *id3 = NULL; + +- fseek(fh, -sizeof (tag), SEEK_END); +- if (fread(&tag, 1, sizeof (tag), fh) == sizeof (tag)) ++ /* ++ * Try reading ID3v2 tag. ++ */ ++ if (!mpg123_cfg.disable_id3v2) + { +- if (!strncmp(tag.tag, "TAG", 3)) ++ fseek(fh, 0, SEEK_SET); ++ id3 = id3_open_fp(fh, 0); ++ if (id3) + { +- id3_found = TRUE; +- set_entry_tag(GTK_ENTRY(title_entry), +- tag.title, 30); +- set_entry_tag(GTK_ENTRY(artist_entry), +- tag.artist, 30); +- set_entry_tag(GTK_ENTRY(album_entry), +- tag.album, 30); +- set_entry_tag(GTK_ENTRY(year_entry), +- tag.year, 4); +- /* Check for v1.1 tags */ +- if (tag.u.v1_1.__zero == 0) +- { +- char *temp = g_strdup_printf("%d", tag.u.v1_1.track_number); +- set_entry_tag(GTK_ENTRY(comment_entry), +- tag.u.v1_1.comment, 28); +- gtk_entry_set_text(GTK_ENTRY(tracknum_entry), temp); +- g_free(temp); +- } +- else +- { +- set_entry_tag(GTK_ENTRY(comment_entry), +- tag.u.v1_0.comment, 30); +- gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ""); +- } ++ mpg123_get_id3v2(id3, &id3v2tag); ++ set_entry_tag(GTK_ENTRY(v2_title_entry), ++ id3v2tag.title, 128); ++ set_entry_tag(GTK_ENTRY(v2_artist_entry), ++ id3v2tag.artist, 128); ++ set_entry_tag(GTK_ENTRY(v2_album_entry), ++ id3v2tag.album, 128); ++ set_entry_tag(GTK_ENTRY(v2_comment_entry), ++ id3v2tag.comment, 256); ++ set_entry_tag(GTK_ENTRY(v2_composer_entry), ++ id3v2tag.composer, MAX_ENTRY_LEN2); ++ set_entry_tag(GTK_ENTRY(v2_orig_artist_entry), ++ id3v2tag.orig_artist, MAX_ENTRY_LEN2); ++ set_entry_tag(GTK_ENTRY(v2_url_entry), ++ id3v2tag.url, MAX_ENTRY_LEN2); ++ set_entry_tag(GTK_ENTRY(v2_encoded_by_entry), ++ id3v2tag.encoded_by, MAX_ENTRY_LEN2); + +- gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list), genre_find_index(genre_list, tag.genre)); ++ temp = g_strdup_printf("%d", id3v2tag.track_number); ++ gtk_entry_set_text(GTK_ENTRY(v2_tracknum_entry), temp); ++ g_free(temp); ++ ++ temp = g_strdup_printf("%d", id3v2tag.year); ++ gtk_entry_set_text(GTK_ENTRY(v2_year_entry), temp); ++ g_free(temp); ++ ++ printf("Loading genre: %s", id3v2tag.genre); ++ gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), genre_find_index_str(genre_list, id3v2tag.genre)); ++ id3_close(id3); + } ++ else ++ { ++ // Grey out the id3v2 tab ++ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(v2_checkbox), TRUE); ++ } ++ } ++ ++ /* ++ * Try reading ID3v1 tag. ++ */ ++ fseek(fh, -sizeof (id3v1tag), SEEK_END); ++ if ( (fread(&id3v1tag, 1, sizeof (id3v1tag), fh) == sizeof (id3v1tag)) && ++ !strncmp(id3v1tag.tag, "TAG", 3)) ++ { ++ id3_found = TRUE; ++ set_entry_tag(GTK_ENTRY(v1_title_entry), ++ id3v1tag.title, 30); ++ set_entry_tag(GTK_ENTRY(v1_artist_entry), ++ id3v1tag.artist, 30); ++ set_entry_tag(GTK_ENTRY(v1_album_entry), ++ id3v1tag.album, 30); ++ set_entry_tag(GTK_ENTRY(v1_year_entry), ++ id3v1tag.year, 4); ++ /* Check for v1.1 tags */ ++ if (id3v1tag.u.v1_1.__zero == 0) ++ { ++ char *temp = g_strdup_printf("%d", id3v1tag.u.v1_1.track_number); ++ set_entry_tag(GTK_ENTRY(v1_comment_entry), ++ id3v1tag.u.v1_1.comment, 28); ++ gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), temp); ++ g_free(temp); ++ } ++ else ++ { ++ set_entry_tag(GTK_ENTRY(v1_comment_entry), ++ id3v1tag.u.v1_0.comment, 30); ++ gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), ""); ++ } ++ ++ gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), genre_find_index(genre_list, id3v1tag.genre)); + } ++ else ++ { ++ // Grey out id3v1 tab ++ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(v1_checkbox), TRUE); ++ } ++ + rewind(fh); + if (fread(tmp, 1, 4, fh) != 4) + { +diff -Naur xmms-1.2.9-orig/Input/mpg123/id3.h xmms-1.2.9/Input/mpg123/id3.h +--- xmms-1.2.9-orig/Input/mpg123/id3.h Thu Jan 29 06:43:24 2004 ++++ xmms-1.2.9/Input/mpg123/id3.h Thu Jan 29 05:20:31 2004 +@@ -351,6 +351,7 @@ + int id3_set_text(struct id3_frame *, char *); + int id3_set_text_number(struct id3_frame *, int); + gboolean id3_frame_is_text(struct id3_frame *frame); ++char* id3_get_comm(struct id3_frame *frame); + + /* From id3_frame_content.c */ + char *id3_get_content(struct id3_frame *); +diff -Naur xmms-1.2.9-orig/Input/mpg123/id3_frame_text.c xmms-1.2.9/Input/mpg123/id3_frame_text.c +--- xmms-1.2.9-orig/Input/mpg123/id3_frame_text.c Thu Jan 29 06:43:24 2004 ++++ xmms-1.2.9/Input/mpg123/id3_frame_text.c Thu Jan 29 05:18:54 2004 +@@ -38,15 +38,15 @@ + + char *id3_utf16_to_ascii(void *utf16) + { +- char ascii[256]; +- char *uc = (char *) utf16 + 2; +- int i; +- +- for (i = 0; *uc != 0 && i < sizeof(ascii); i++, uc += 2) +- ascii[i] = *uc; +- +- ascii[i] = 0; +- return g_strdup(ascii); ++ char ascii[256]; ++ char *uc = (char *) utf16 + 2; ++ int i; ++ ++ for (i = 0; *uc != 0 && i < sizeof(ascii); i++, uc += 2) ++ ascii[i] = *uc; ++ ++ ascii[i] = 0; ++ return g_strdup(ascii); + } + + +@@ -59,25 +59,25 @@ + */ + gint8 id3_get_encoding(struct id3_frame *frame) + { +- /* Type check */ +- if (!id3_frame_is_text(frame) && +- frame->fr_desc->fd_id != ID3_WXXX && +- frame->fr_desc->fd_id != ID3_IPLS && +- frame->fr_desc->fd_id != ID3_USLT && +- frame->fr_desc->fd_id != ID3_SYLT && +- frame->fr_desc->fd_id != ID3_COMM && +- frame->fr_desc->fd_id != ID3_APIC && +- frame->fr_desc->fd_id != ID3_GEOB && +- frame->fr_desc->fd_id != ID3_USER && +- frame->fr_desc->fd_id != ID3_OWNE && +- frame->fr_desc->fd_id != ID3_COMR) +- return -1; +- +- /* Check if frame is compressed */ +- if (id3_decompress_frame(frame) == -1) +- return -1; ++ /* Type check */ ++ if (!id3_frame_is_text(frame) && ++ frame->fr_desc->fd_id != ID3_WXXX && ++ frame->fr_desc->fd_id != ID3_IPLS && ++ frame->fr_desc->fd_id != ID3_USLT && ++ frame->fr_desc->fd_id != ID3_SYLT && ++ frame->fr_desc->fd_id != ID3_COMM && ++ frame->fr_desc->fd_id != ID3_APIC && ++ frame->fr_desc->fd_id != ID3_GEOB && ++ frame->fr_desc->fd_id != ID3_USER && ++ frame->fr_desc->fd_id != ID3_OWNE && ++ frame->fr_desc->fd_id != ID3_COMR) ++ return -1; ++ ++ /* Check if frame is compressed */ ++ if (id3_decompress_frame(frame) == -1) ++ return -1; + +- return *(gint8 *) frame->fr_data; ++ return *(gint8 *) frame->fr_data; + } + + +@@ -92,25 +92,25 @@ + { + /* Type check */ + if ( frame->fr_desc->fd_idstr[0] != 'T' && +- frame->fr_desc->fd_id != ID3_WXXX && +- frame->fr_desc->fd_id != ID3_IPLS && +- frame->fr_desc->fd_id != ID3_USLT && +- frame->fr_desc->fd_id != ID3_SYLT && +- frame->fr_desc->fd_id != ID3_COMM && +- frame->fr_desc->fd_id != ID3_APIC && +- frame->fr_desc->fd_id != ID3_GEOB && +- frame->fr_desc->fd_id != ID3_USER && +- frame->fr_desc->fd_id != ID3_OWNE && +- frame->fr_desc->fd_id != ID3_COMR ) +- return -1; ++ frame->fr_desc->fd_id != ID3_WXXX && ++ frame->fr_desc->fd_id != ID3_IPLS && ++ frame->fr_desc->fd_id != ID3_USLT && ++ frame->fr_desc->fd_id != ID3_SYLT && ++ frame->fr_desc->fd_id != ID3_COMM && ++ frame->fr_desc->fd_id != ID3_APIC && ++ frame->fr_desc->fd_id != ID3_GEOB && ++ frame->fr_desc->fd_id != ID3_USER && ++ frame->fr_desc->fd_id != ID3_OWNE && ++ frame->fr_desc->fd_id != ID3_COMR ) ++ return -1; + + /* Check if frame is compressed */ + if (id3_decompress_frame(frame) == -1) +- return -1; ++ return -1; + + /* Changing the encoding of frames is not supported yet */ + if ( *(gint8 *) frame->fr_data != encoding ) +- return -1; ++ return -1; + + /* Set encoding */ + *(gint8 *) frame->fr_data = encoding; +@@ -128,44 +128,44 @@ + { + /* Type check */ + if ( frame->fr_desc->fd_idstr[0] != 'T' ) +- return NULL; ++ return NULL; + + /* Check if frame is compressed */ + if (id3_decompress_frame(frame) == -1) +- return NULL; ++ return NULL; + + if ( frame->fr_desc->fd_id == ID3_TXXX ) { +- /* +- * This is a user defined text frame. Skip the description. +- */ +- switch ( *(guint8 *) frame->fr_data ) { +- case ID3_ENCODING_ISO_8859_1: +- { +- char *text = (char *) frame->fr_data + 1; +- +- while ( *text != 0 ) +- text++; +- +- return g_strdup(++text); +- } +- case ID3_ENCODING_UTF16: +- { +- char *text16 = (char *) frame->fr_data + 1; +- +- while (*text16 != 0 || *(text16 + 1) != 0) +- text16 += 2; +- +- return id3_utf16_to_ascii(text16 + 2); +- } +- default: +- return NULL; +- } ++ /* ++ * This is a user defined text frame. Skip the description. ++ */ ++ switch ( *(guint8 *) frame->fr_data ) { ++ case ID3_ENCODING_ISO_8859_1: ++ { ++ char *text = (char *) frame->fr_data + 1; ++ ++ while ( *text != 0 ) ++ text++; ++ ++ return g_strdup(++text); ++ } ++ case ID3_ENCODING_UTF16: ++ { ++ char *text16 = (char *) frame->fr_data + 1; ++ ++ while (*text16 != 0 || *(text16 + 1) != 0) ++ text16 += 2; ++ ++ return id3_utf16_to_ascii(text16 + 2); ++ } ++ default: ++ return NULL; ++ } + } + + if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1) +- return g_strdup((char *) frame->fr_data + 1); ++ return g_strdup((char *) frame->fr_data + 1); + else +- return id3_utf16_to_ascii(((char *) frame->fr_data + 1)); ++ return id3_utf16_to_ascii(((char *) frame->fr_data + 1)); + } + + +@@ -179,20 +179,20 @@ + { + /* Type check */ + if ( frame->fr_desc->fd_idstr[0] != 'T' ) +- return NULL; ++ return NULL; + + /* If predefined text frame, return description. */ + if ( frame->fr_desc->fd_id != ID3_TXXX ) +- return frame->fr_desc->fd_description; ++ return frame->fr_desc->fd_description; + + /* Check if frame is compressed */ + if (id3_decompress_frame(frame) == -1) +- return NULL; ++ return NULL; + + if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1) +- return g_strdup((char *) frame->fr_data + 1); ++ return g_strdup((char *) frame->fr_data + 1); + else +- return id3_utf16_to_ascii((char *) frame->fr_data + 1); ++ return id3_utf16_to_ascii((char *) frame->fr_data + 1); + } + + +@@ -209,42 +209,42 @@ + + /* Check if frame is compressed */ + if (id3_decompress_frame(frame) == -1) +- return -1; ++ return -1; + + /* + * Generate integer according to encoding. + */ + switch ( *(guint8 *) frame->fr_data ) { +- case ID3_ENCODING_ISO_8859_1: +- { +- char *text = ((char *) frame->fr_data) + 1; +- +- while ( *text >= '0' && *text <= '9' ) { +- number *= 10; +- number += *text - '0'; +- text++; +- } ++ case ID3_ENCODING_ISO_8859_1: ++ { ++ char *text = ((char *) frame->fr_data) + 1; ++ ++ while ( *text >= '0' && *text <= '9' ) { ++ number *= 10; ++ number += *text - '0'; ++ text++; ++ } ++ ++ return number; ++ } ++ case ID3_ENCODING_UTF16: ++ { ++ char *text = ((char *) frame->fr_data) + 3; ++ ++/* if (*(gint16 *) frame->fr_data == 0xfeff) */ ++/* text++; */ ++ ++ while ( *text >= '0' && *text <= '9' ) { ++ number *= 10; ++ number += *text - '0'; ++ text++; ++ } + +- return number; +- } +- case ID3_ENCODING_UTF16: +- { +- char *text = ((char *) frame->fr_data) + 3; +- +-/* if (*(gint16 *) frame->fr_data == 0xfeff) */ +-/* text++; */ +- +- while ( *text >= '0' && *text <= '9' ) { +- number *= 10; +- number += *text - '0'; +- text++; +- } ++ return number; ++ } + +- return number; +- } +- +- default: +- return -1; ++ default: ++ return -1; + } + } + +@@ -260,7 +260,7 @@ + { + /* Type check */ + if ( frame->fr_desc->fd_idstr[0] != 'T' ) +- return -1; ++ return -1; + + /* + * Release memory occupied by previous data. +@@ -289,6 +289,58 @@ + } + + ++ ++ ++char* id3_get_comm(struct id3_frame *frame) ++{ ++ ++ /* Type check */ ++ if ( frame->fr_desc->fd_id != ID3_COMM ) ++ return NULL; ++ ++ /* Check if frame is compressed */ ++ if (id3_decompress_frame(frame) == -1) ++ return NULL; ++ ++ /* ++ * <Header for 'Comment', ID: "COMM"> ++ * Text encoding $xx ++ * Language $xx xx xx ++ * Short content descrip. <text string according to encoding> $00 (00) ++ * The actual text <full text string according to encoding> ++ * ++ * Skip language and short description. ++ */ ++ switch ( *(guint8 *) frame->fr_data ) { ++ case ID3_ENCODING_ISO_8859_1: ++ { ++ char *text = (char *) frame->fr_data + 4; ++ ++ while ( *text != 0 ) ++ text++; ++ ++ return g_strdup(++text); ++ } ++ case ID3_ENCODING_UTF16: ++ { ++ char *text16 = (char *) frame->fr_data + 4; ++ ++ while (*text16 != 0 || *(text16 + 1) != 0) ++ text16 += 2; ++ ++ return id3_utf16_to_ascii(text16 + 2); ++ } ++ default: ++ return NULL; ++ } ++ ++ if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1) ++ return g_strdup((char *) frame->fr_data + 1); ++ else ++ return id3_utf16_to_ascii(((char *) frame->fr_data + 1)); ++} ++ ++ + /* + * Function id3_set_text_number (frame, number) + * +@@ -304,25 +356,25 @@ + + /* Type check */ + if ( frame->fr_desc->fd_idstr[0] != 'T' ) +- return -1; ++ return -1; + + /* + * Release memory occupied by previous data. + */ + id3_frame_clear_data(frame); +- ++ + /* + * Create a string with a reversed number. + */ + pos = 0; + while ( number > 0 && pos < 64 ) { +- buf[pos++] = (number % 10) + '0'; +- number /= 10; ++ buf[pos++] = (number % 10) + '0'; ++ number /= 10; + } + if ( pos == 64 ) +- return -1; ++ return -1; + if ( pos == 0 ) +- buf[pos++] = '0'; ++ buf[pos++] = '0'; + + /* + * Allocate memory for new data. +@@ -336,7 +388,7 @@ + *(gint8 *) frame->fr_raw_data = ID3_ENCODING_ISO_8859_1; + text = (char *) frame->fr_raw_data + 1; + while ( --pos >= 0 ) +- *text++ = buf[pos]; ++ *text++ = buf[pos]; + *text = '\0'; + + frame->fr_altered = 1; +@@ -350,9 +402,9 @@ + + gboolean id3_frame_is_text(struct id3_frame *frame) + { +- if (frame && frame->fr_desc && +- (frame->fr_desc->fd_idstr[0] == 'T' || +- frame->fr_desc->fd_idstr[0] == 'W' )) +- return TRUE; +- return FALSE; ++ if (frame && frame->fr_desc && ++ (frame->fr_desc->fd_idstr[0] == 'T' || ++ frame->fr_desc->fd_idstr[0] == 'W' )) ++ return TRUE; ++ return FALSE; + } +diff -Naur xmms-1.2.9-orig/Input/mpg123/lib_id3v2.h xmms-1.2.9/Input/mpg123/lib_id3v2.h +--- xmms-1.2.9-orig/Input/mpg123/lib_id3v2.h Wed Dec 31 19:00:00 1969 ++++ xmms-1.2.9/Input/mpg123/lib_id3v2.h Thu Jan 29 05:20:31 2004 +@@ -0,0 +1,1280 @@ ++/* the id3v2.3 library. ++ * (c)2002 by Samuel Abels (sam@manicsadness.com) ++ * This project's homepage is: http://software.manicsadness.com/cantus ++ * ++ * This library is designed for easyest possible access to id3 V2 tags. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#ifndef DLL_H ++#define DLL_H ++typedef struct DLL_s ++{ ++ void *prev; ++ void *data; ++ void *next; ++} DLL; ++#endif ++ ++#ifndef FALSE ++#define FALSE 0 ++#endif ++#ifndef TRUE ++#define TRUE 1 ++#endif ++ ++#ifndef id3Tag_def ++#define id3Tag_def ++ ++typedef struct id3Tag_s ++{ ++ char title[1024]; ++ char artist[1024]; ++ char album[1024]; ++ char year[5]; ++ char comment[1024]; ++ char track[3]; ++ char genre[512]; ++ char composer[1024]; ++ char url[1024]; ++ char orig_artist[1024]; ++ char enc_by[1024]; ++ unsigned int size; ++ short int has_footer; ++} id3Tag; ++ ++typedef struct id3v2Tag_s ++{ ++// header ++ int tag_size; ++ short int unsync; ++ short int has_extheader; ++ short int is_experimental; ++//extheader ++ int extheader_size; ++ int padding_size; ++ short int crc_data_present; ++ char crc_data[4]; ++// frames ++ DLL *frames; ++} id3v2Tag; ++ ++typedef struct id3v2Frame_s ++{ ++ unsigned char id[4]; ++ int datasize; ++ short int tagalter; ++ short int filealter; ++ short int readonly; ++ short int compression; ++ short int encryption; ++ short int grouping; ++ char *data; ++} id3v2Frame; ++ ++#endif ++ ++/* the id3v2.3 library. ++ * (c)2002 by Samuel Abels (sam@manicsadness.com) ++ * This project's homepage is: http://software.manicsadness.com/cantus ++ * ++ * This library is designed for easyest possible access to id3 V2 tags. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include <stdio.h> ++#include <string.h> ++#include <stdlib.h> ++#include <ctype.h> ++#include "charset.h" ++ ++ ++ ++/*************************************************************************************** ++ * BELOW FOLLOW THE STATICS ++ ***************************************************************************************/ ++// Return the last item of an doubly linked list ++static DLL * ++dll_last (DLL *list) ++{ ++ if( list == NULL ) ++ return (NULL); ++ ++ while ( list->next != NULL ) ++ list = list->next; ++ ++ return (list); ++} ++ ++// Append an item to the doubly linked list ++static DLL * ++dll_append (DLL *list, void *data) ++{ ++ DLL *item = malloc (sizeof(DLL)); ++ DLL *lastitem = dll_last(list); ++ ++ item->data = data; ++ item->next = NULL; ++ ++ if ( lastitem == NULL ) ++ { ++ item->prev = NULL; ++ return (item); ++ } ++ else ++ { ++ item->prev = lastitem; ++ lastitem->next = item; ++ } ++ ++ return list; ++} ++ ++static DLL * ++dll_remove (DLL *list, void *data) ++{ ++ DLL *item = list; ++ ++ while ( item ) ++ { ++ if ( item->data == data ) ++ { ++ if ( item->prev == NULL ++ && item->next == NULL ) ++ { ++// No other items there? Then return a zero pointer. ++ free (item); ++ return (NULL); ++ } ++ if ( item->prev == NULL ) ++ { ++// remove the first item of the list here... ++ list = item->next; ++ list->prev = NULL; ++ free (item); ++ ++ break; ++ } ++ if ( item->next == NULL ) ++ { ++// ...remove the last item of the list here... ++ ((DLL*)(item->prev))->next = NULL; ++ free (item); ++ ++ break; ++ } ++// ...or other items here ++ ((DLL*)(item->prev))->next = item->next; ++ ((DLL*)(item->next))->prev = item->prev; ++ free (item); ++ ++ break; ++ } ++ item = item->next; ++ } ++ ++ return list; ++} ++ ++// Free a doubly linked list ++static DLL * ++dll_free (DLL *list) ++{ ++ DLL *item = list; ++ DLL *current = NULL; ++ ++ while (item) ++ { ++ current = item; ++ item = item->next; ++ ++ free (current); ++ } ++ ++ return NULL; ++} ++ ++/* ++ * Converts all occurences of a CR/LF to LF ++ */ ++static void ++crlf2cr (char *source) ++{ ++ char *psource = source; ++ char destination[2048]; ++ ++ if(source != NULL) ++ { ++ memset (destination, 0, 2048); ++ for (psource = source; *psource != '\0'; psource++) ++ { ++ if(*psource == 13 ++ && *(psource+1) == 10 ) ++ { ++ psource++; ++ } ++ destination[strlen(destination)] = *psource; ++ } ++ } ++ ++ strncpy (source, destination, strlen(destination)+1); ++} ++ ++ ++/* ++ * Converts all occurences of a LF to CR/LF ++ */ ++static void ++cr2crlf (char *source) ++{ ++ char *psource = source; ++ char destination[2048]; ++ ++ if( source != NULL ) ++ { ++ memset (destination, 0, 2048); ++ for (psource = source; *psource != '\0'; psource++) ++ { ++ if (*psource == 10) ++ destination[strlen(destination)] = 13; ++ destination[strlen(destination)] = *psource; ++ } ++ } ++ ++ strncpy (source, destination, strlen(destination)+1); ++} ++ ++ ++ ++ ++/* ++ * Reads the first ten bytes of an file and checks, if it's a valid ID3 V2.3 file ++ * If it is, the header flags are stored in the tag struct. ++ * Returns TRUE on a valid header, otherwise FALSE. ++ */ ++static short int ++check_header (FILE *mp3file, id3v2Tag *v2) ++{ ++ unsigned char buf[10]; ++ ++// get header (=first ten bytes of the file) ++ fseek (mp3file, 0, SEEK_SET); ++ if ( fread (buf, 1, 10, mp3file) < 10 ) ++ return (FALSE); ++ ++// a valid tag must begin with "ID3" followed by the version (checked below) ++// followed by a flag byte, where the last five bytes are unused and must be FALSE ++ if ( memcmp(buf, "ID3", 3) != 0 ++ || (buf[5] & 31) != 0 ) ++ return (FALSE); ++ ++// check if version is supported ++ if ( buf[3] != 3 ++ || buf[4] != 0 ) ++ return (FALSE); ++ ++// The next thing to come is the tag size. These are 4 bytes, the MSB should always be set to zero. check! ++ if ( (buf[6] & 128) != 0 ++ || (buf[7] & 128) != 0 ++ || (buf[8] & 128) != 0 ++ || (buf[9] & 128) != 0 ) ++ return (FALSE); ++ ++// The tag size is encoded to be syncsave, so I got to decode it. ++// The tag size is the size of the complete tag EXCLUDING the 10-byte header. ++ v2->tag_size = buf[9] + (buf[8] << 7) + (buf[7] << 14) + (buf[6] << 21); ++ ++// ok, so were save. put the flags in the nicer struct. ++ v2->unsync = (buf[5] & 128) >> 7; ++ v2->has_extheader = (buf[5] & 64) >> 6; ++ v2->is_experimental = (buf[5] & 32) >> 5; ++ ++ return (TRUE); ++} ++ ++ ++ ++ ++ ++/* ++ * Reads the extheader of a valid ID3V2.3 file and checks, if it's a valid. ++ * If it is, the extheader flags are stored in the tag struct. ++ * Returns TRUE on a valid extheader, otherwise FALSE. ++ */ ++static short int ++check_extheader (FILE *mp3file, id3v2Tag *v2) ++{ ++ unsigned char buf[10]; ++ ++// Read id3 extheader intro (5 bytes) ++ fseek (mp3file, 10, SEEK_SET); ++ if ( fread(buf, 1, 5, mp3file) < 5 ) ++ return (FALSE); ++ ++// First comes the extheader size. These are 4 bytes, the MSB should always be set to zero. check! ++ if( (buf[0] & 128) != 0 ++ || (buf[1] & 128) != 0 ++ || (buf[2] & 128) != 0 ++ || (buf[3] & 128) != 0 ) ++ return (FALSE); ++ ++// OK. In ID3V2.3 only six byte or ten byte extheaders are allowed. ++ if( v2->extheader_size != 6 ++ && v2->extheader_size != 10 ) ++ return (FALSE); ++ ++// The first four bytes specify the extheader size. ++ v2->extheader_size = buf[3] + (buf[2] << 7) + (buf[1] << 14) + (buf[0] << 21); ++ ++// The fifth byte specifies extendened flags. (in fact, only one flag is used for ID3V2.3 ++// The MSB of the byte 5 specifies, if there is CRC data to come, appended to the extheader. ++ if( (buf[4] & 127) != 0 ++ || buf[5] != 0 ) ++ return (FALSE); ++ ++ v2->crc_data_present = (buf[4] & 128) >> 7; ++ ++// if crc data is present, the extheader size must be ten bytes, otherwise 6. ++ if ( (v2->extheader_size == 6 && v2->crc_data_present == TRUE) ++ || (v2->extheader_size == 10 && v2->crc_data_present == FALSE) ) ++ return (FALSE); ++ ++// now come four bytes specifying the padding size ++ if ( (buf[6] & 128) != 0 ++ || (buf[7] & 128) != 0 ++ || (buf[8] & 128) != 0 ++ || (buf[9] & 128) != 0 ) ++ return (FALSE); ++ ++ v2->padding_size = buf[9] + (buf[8] << 7) + (buf[7] << 14) + (buf[6] << 21); ++ ++// Now to the optional crc data. ++ if( v2->crc_data_present ) ++ { ++ if( fread (buf, 1, 4, mp3file) < 4 ) ++ return (FALSE); ++ ++ memcpy (v2->crc_data, buf, 4); ++ } ++ ++ return (TRUE); ++} ++ ++ ++ ++ ++ ++/* ++ * Reads the complete frames of a valid ID3V2.3 file and checks, if they are valid. ++ * If they are, the flags are stored in a DLL and appended to the tag struct. ++ * Returns TRUE on success, otherwise FALSE. ++ */ ++static short int ++read_frames (FILE *mp3file, id3v2Tag *v2) ++{ ++ unsigned char buf[10]; ++ int numframes = 0; ++ unsigned int totalframesize = 0; ++ id3v2Frame *frame = NULL; ++ ++// set the position to the first frame header (header = 10 bytes + extheadersize + 4 bytes "extheaderheader") ++ if (v2->has_extheader) ++ fseek (mp3file, 10 + v2->extheader_size + 4, SEEK_SET); ++ else ++ fseek (mp3file, 10, SEEK_SET); ++ ++// If the tag size is too small for frames, return with an error. ++ if ( ((v2->tag_size + 10) - v2->padding_size) <= ftell(mp3file) ) ++ return FALSE; ++ ++// now read all the frames ++ numframes = 0; ++ v2->frames = NULL; ++ while ( ftell (mp3file) < ((v2->tag_size + 10) - v2->padding_size) ) ++ { ++ frame = calloc (1, sizeof(id3v2Frame)); ++ ++// the frame header is ten bytes long ++ if ( fread (buf, 1, 10, mp3file) < 10 ) ++ goto error; ++ ++// if we are already in the padding, we must no longer look for frames... ++ if ( buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0 ) ++ { ++ if (numframes == 0) ++ goto error; ++ ++ free (frame); ++ break; ++ } ++ ++// first come four characters identifying the frame. It must be alphanumeric. ++ if ( !isalnum(buf[0]) || !isalnum(buf[1]) || !isalnum(buf[2]) || !isalnum(buf[3]) ) ++ goto error; ++ ++ *(frame->id) = buf[0]; ++ *(frame->id + 1) = buf[1]; ++ *(frame->id + 2) = buf[2]; ++ *(frame->id + 3) = buf[3]; ++ ++// then, the frame size is to come. Again, the four MSBs must be zero. ++ if ( (buf[4] & 128) != 0 ++ || (buf[5] & 128) != 0 ++ || (buf[6] & 128) != 0 ++ || (buf[7] & 128) != 0 ) ++ goto error; ++ ++ frame->datasize = buf[7] + (buf[6] << 7) + (buf[5] << 14) + (buf[4] << 21); ++ ++// A minimum size must be present! ++ if ( frame->datasize <= 0 ) ++ goto error; ++ ++// The two following frame header flags have the 5 LSBs not set. ++ if ( (buf[8] & 31) != 0 ++ || (buf[9] & 31) != 0 ) ++ goto error; ++ ++// now, put the flags in the struct. ++ frame->tagalter = (buf[8] & 128) >> 7; ++ frame->filealter = (buf[8] & 64) >> 6; ++ frame->readonly = (buf[8] & 32) >> 5; ++ ++ frame->compression = (buf[9] & 128) >> 7; ++ frame->encryption = (buf[8] & 64) >> 6; ++ frame->grouping = (buf[8] & 32) >> 5; ++ ++// ok, we are done with the frame header, so now we read the frame data. ++ frame->data = calloc (1, frame->datasize + 1); ++ if( fread (frame->data, 1, frame->datasize, mp3file) < frame->datasize ) ++ goto error; ++ ++ numframes++; ++ totalframesize += 10 + frame->datasize; ++ ++// we append it to a glist, which is appended to the v2 struct. ++ v2->frames = dll_append (v2->frames, frame); ++ } ++ ++// if we have no extheader, that means, we don't know how much padding we have! ++// thus, i calculate it here. ++ if ( !v2->has_extheader ) ++ v2->padding_size = v2->tag_size - totalframesize; ++ ++// A minimum of one frame is mandatory. ++ if( numframes > 0 ) ++ return (TRUE); ++ ++error: ++// cleanups in case of an error. ++ if( frame && frame->data ) ++ free (frame->data); ++ if( frame ) ++ free (frame); ++ return (FALSE); ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++/* ++ * Reads all tag information of a valid ID3V2.3 file. ++ * When successful, the info is stored in the tag struct. ++ * Returns: ++ * 0 = success ++ * 1 = Cannot open file. ++ * 2 = No header or wrong version. ++ * 3 = broken extheader. ++ * 4 = broken frames. ++ */ ++static int ++get_id3v2tag_raw (id3v2Tag *v2, char *filename) ++{ ++ FILE *mp3file = NULL; ++ int error = 0; ++ ++// open file ++ error = 1; ++ mp3file = fopen (filename, "rb"); ++ if (!mp3file) ++ goto done; ++ ++// check/get header ++ error = 2; ++ if( !check_header (mp3file, v2) ) ++ goto done; ++ ++// check/get extheader ++ error = 3; ++ if( v2->has_extheader ++ && !check_extheader (mp3file, v2) ) ++ goto done; ++ ++// get the content frames ++ error = 4; ++ if( !read_frames (mp3file, v2) ) ++ goto done; ++ ++ error = 0; ++done: ++ fclose (mp3file); ++ return (error); ++} ++ ++ ++ ++ ++ ++/* ++ * Find one frames data and give back its data in the correct format. ++ * Returns TRUE on success, otherwise FALSE; ++ */ ++static short int ++frame_find (id3v2Tag *v2, char *name, char *value) ++{ ++ DLL *curframe = NULL; ++ id3v2Frame *frame = NULL; ++ ++ // we parse through the whole list of frames, giving back the correct frame value. ++ curframe = v2->frames; ++ while ( curframe ) ++ { ++ frame = (id3v2Frame *)curframe->data; ++ ++ // Just to be sure... ++ if( frame->datasize <= 0 ) ++ goto nextframe; ++ ++ // Matches the users request? Otherwise try the next frame. ++ if( memcmp (frame->id, name, 4) != 0 ) ++ goto nextframe; ++ ++ // These types don't need much change, just give the whole data back to the user according to the encoding. ++ // The first byte is the encoding. ++ // TPE1: Artist ++ // TIT2: Song Title ++ // TALB: Album Title ++ // TYER: Year ++ // TRCK: Track ++ // TCON: Genre ++ // COMM: Comment ++ // TCOM: Composer ++ // TOPE: TOPE Original artist(s)/performer(s) ++ // TENC: Encoded by ++ if ( memcmp (frame->id, "TPE1", 4) == 0 ++ || memcmp (frame->id, "TIT2", 4) == 0 ++ || memcmp (frame->id, "TALB", 4) == 0 ++ || memcmp (frame->id, "TYER", 4) == 0 ++ || memcmp (frame->id, "TRCK", 4) == 0 ++ || memcmp (frame->id, "TCON", 4) == 0 ++ || memcmp (frame->id, "TCOM", 4) == 0 ++ || memcmp (frame->id, "TOPE", 4) == 0 ++ || memcmp (frame->id, "TENC", 4) == 0) ++ //|| memcmp (frame->id, "WXXX", 4) == 0) ++ { ++ if ( *frame->data == 0 ) ++ memcpy(value, frame->data + 1, frame->datasize - 1); ++ if ( *frame->data == 1 ) ++ { ++ char nulltermvalue[frame->datasize]; ++ char *isovalue = NULL; ++ ++ // the tag is not null terminated, so i have to create a null terminated string first. ++ memset (nulltermvalue, 0, frame->datasize); ++ memcpy (nulltermvalue, frame->data + 1, frame->datasize - 1); ++ ++ // Convert from UTF to ISO and copy to the users variable. ++ isovalue = convert_from_utf8 (nulltermvalue); ++ strncpy (value, isovalue, sizeof(value) - 1); ++ free (isovalue); ++ } ++ ++ // change linefeeds to a single "return" key. ++ crlf2cr (value); ++ return (TRUE); ++ } ++ if ( memcmp (frame->id, "WCOM", 4) == 0 ++ || memcmp (frame->id, "WCOP", 4) == 0 ++ || memcmp (frame->id, "WOAF", 4) == 0 ++ || memcmp (frame->id, "WOAR", 4) == 0 ++ || memcmp (frame->id, "WOAS", 4) == 0 ++ || memcmp (frame->id, "WPAY", 4) == 0 ++ || memcmp (frame->id, "WPUB", 4) == 0) ++ { ++ memcpy(value, frame->data, frame->datasize - 1); ++ ++ // change linefeeds to a single "return" key. ++ crlf2cr (value); ++ return (TRUE); ++ } ++ ++ // The comment requires special handling. ++ // Its data has: One byte "encoding" (0 = ISO-8859-1, 1 = UNICODE) ++ // followed by the language (three bytes, e.g. "eng"), ++ // followed by a short description, ++ // then a NULL, ++ // and the full description ++ // For now, i simply drop the short description ++ if( memcmp(frame->id, "COMM", 4) == 0 ) ++ { ++ // check for the right format. (minsize 5, must contain a "\0" after the language) ++ if ( frame->datasize < 5 ) ++ goto nextframe; ++ if ( !memchr (frame->data + 4, '\0', frame->datasize - 4) ) ++ goto nextframe; ++ ++ // now, give the data back to the user, according to the encoding. ++ if ( *frame->data == 0 ) ++ memcpy (value, frame->data + 5, frame->datasize - 5); ++ if ( *frame->data == 1 ) ++ { ++ char nulltermvalue[frame->datasize]; ++ char *isovalue = NULL; ++ ++ // the tag is not null terminated, so i have to create a null terminated string first. ++ memset (nulltermvalue, 0, frame->datasize); ++ memcpy (nulltermvalue, frame->data + 5, frame->datasize - 5); ++ ++ // Convert from UTF to ISO and copy to the users variable. ++ isovalue = convert_from_utf8 (nulltermvalue); ++ strncpy (value, isovalue, sizeof(value) - 1); ++ free (isovalue); ++ } ++ ++ // change linefeeds to a single "return" key. ++ crlf2cr (value); ++ return TRUE; ++ } ++ ++nextframe: ++ curframe = curframe->next; ++ } ++ ++ return FALSE; ++} ++ ++ ++ ++ ++/* ++ * Remove one frame out of the id3v2Tag struct ++ * Returns TRUE on success, otherwise FALSE; ++ */ ++static short int ++frame_remove (id3v2Tag *v2, char *name) ++{ ++ id3v2Frame *frame = NULL; ++ DLL *curframe = NULL; ++ DLL *tempframe = NULL; ++ ++// Parse through the list of frames. ++ curframe = v2->frames; ++ while ( curframe ) ++ { ++ frame = (id3v2Frame *)curframe->data; ++ tempframe = curframe; ++ curframe = curframe->next; ++ ++ if ( memcmp (frame->id, name, 4) == 0 ) ++ { ++// we have found the item! removing will NOT shrink the tag, but increase the padding. ++ v2->padding_size += (frame->datasize + 10); ++// and free memory. ++ v2->frames = dll_remove (v2->frames, tempframe->data); ++ free (frame->data); ++ free (frame); ++ ++ return TRUE; ++ } ++ } ++ ++ return FALSE; ++} ++ ++ ++ ++/* ++ * Add a frame to the framelist. If the frame name is already in the list, it will be replaced. ++ * Returns: ++ * TRUE: The tag size HAS BEEN increased. ++ * FALSE: The tag size has NOT been increased. ++ */ ++static short int ++frame_set (id3v2Tag *v2, char *name, char *value) ++{ ++ id3v2Frame *frame = NULL; ++ short int sizechange = FALSE; ++ ++// prevent the user to send CR/LF, which is forbidden. ++ cr2crlf (value); ++// eventually remove an existing item! ++ frame_remove (v2, name); ++ ++// alloc space for the new frame. ++ frame = malloc (sizeof(id3v2Frame)); ++ ++ memcpy (frame->id, name, 4); ++ frame->datasize = strlen (value); ++ frame->tagalter = 0; ++ frame->filealter = 0; ++ frame->readonly = 0; ++ frame->compression = 0; ++ frame->encryption = 0; ++ frame->grouping = 0; ++ ++// The comment requires special handling. If you need to know why, look at the documentation ++// of the "frame_find" function above. ++ if( memcmp (frame->id, "COMM", 4) == 0 ) ++ { ++ char fullvalue[frame->datasize + 6]; ++ ++ sprintf(fullvalue, "%ceng%c%s", 0, 0, value); ++ ++ frame->datasize += 5; ++ frame->data = malloc (frame->datasize); ++ memcpy (frame->data, fullvalue, frame->datasize); ++ } ++ else if ((memcmp(frame->id, "WCOM", 4) == 0) ++ || memcmp (frame->id, "WCOP", 4) == 0 ++ || memcmp (frame->id, "WOAF", 4) == 0 ++ || memcmp (frame->id, "WOAR", 4) == 0 ++ || memcmp (frame->id, "WOAS", 4) == 0 ++ || memcmp (frame->id, "WPAY", 4) == 0 ++ || memcmp (frame->id, "WPUB", 4) == 0) ++ { ++ frame->data = malloc (frame->datasize); ++ memcpy (frame->data, value, frame->datasize); ++ } ++ else ++ { ++ char fullvalue[frame->datasize + 2]; ++ ++ // Put encoding type just before the value ++ sprintf (fullvalue, "%c%s", 0, value); ++ ++ frame->datasize += 1; ++ frame->data = malloc (frame->datasize); ++ memcpy (frame->data, fullvalue, frame->datasize); ++ } ++ ++// Ok. This decreases the available padding. If we have no padding left, we must increase the padding (and thus, the tag). ++ if( v2->padding_size - (frame->datasize + 10) <= 0 ) ++ { ++// add: framesize + frameheadersize + padding. ++ v2->padding_size += frame->datasize + 10 + 1024; ++ v2->tag_size += frame->datasize + 10 + 1024; ++ ++ sizechange = TRUE; ++ } ++ ++// In every case, we must subtract the new allocated space from the padding. ++ v2->padding_size -= frame->datasize + 10; ++ ++ v2->frames = dll_append (v2->frames, frame); ++ ++ return sizechange; ++} ++ ++ ++ ++/* ++ * Create raw header. ++ * Returns: ++ * TRUE: successful. ++ * FALSE: unsuccessful. ++ */ ++static int ++create_header_raw (char *raw, id3v2Tag *v2) ++{ ++// now we are going to write the tags raw data into the raw string ++ memset (raw, 0, v2->tag_size + 10); ++// ID3 identifier bytes ++ memcpy (raw, "ID3", 3); ++ raw += 3; ++// major version byte ++ *raw++ = 3; ++// minor version byte ++ *raw++ = 0; ++// Flags byte ++ *raw++ = ((v2->unsync & 1) << 7) ++ | ((v2->has_extheader & 1) << 6) ++ | ((v2->is_experimental & 1) << 5); ++// Tag size. It must be syncsafe! ++ *raw++ = ((v2->tag_size & 0x800000) >> 23) | (((v2->tag_size & 0x7f000000) >> 24) << 1); ++ *raw++ = ((v2->tag_size & 0x8000) >> 15) | (((v2->tag_size & 0x7f0000) >> 16) << 1); ++ *raw++ = ((v2->tag_size & 0x80) >> 7) | (((v2->tag_size & 0x7f00) >> 8) << 1); ++ *raw++ = (v2->tag_size & 0x7f); ++ ++ return TRUE; ++} ++ ++ ++ ++ ++/* ++ * Generates the frames. btw.: ID3 sucks! ++ * Returns: TRUE if succesful, otherwise FALSE. ++ */ ++static short int ++create_frames_raw (char *raw, id3v2Tag *v2) ++{ ++ id3v2Frame *frame = NULL; ++ DLL *curframe = NULL; ++ ++// if we have no frames, just quit. ++ if ( v2->frames == NULL ) ++ return FALSE; ++ ++// the header and extheader have already been written. ++ raw += 10; ++ if ( v2->has_extheader ) ++ raw += 4 + v2->extheader_size; ++ ++ curframe = v2->frames; ++ while ( curframe ) ++ { ++ frame = (id3v2Frame *)curframe->data; ++ ++// secure is secure ++ if ( frame->datasize <= 0 ) ++ goto nextframe; ++ ++// add the frame id ++ memcpy(raw, frame->id, 4); ++ raw += 4; ++// add the frame size (syncsafe) ++ *raw++ = ((frame->datasize & 0x800000) >> 23) | (((frame->datasize & 0x7f000000) >> 24) << 1); ++ *raw++ = ((frame->datasize & 0x8000) >> 15) | (((frame->datasize & 0x7f0000) >> 16) << 1); ++ *raw++ = ((frame->datasize & 0x80) >> 7) | (((frame->datasize & 0x7f00) >> 8) << 1); ++ *raw++ = (frame->datasize & 0x7f); ++ ++// The two flagbytes ++ *raw++ = ((frame->tagalter & 1) << 7) ++ | ((frame->filealter & 1) << 6) ++ | ((frame->readonly & 1) << 5); ++ ++ *raw++ = ((frame->compression & 1) << 7) ++ | ((frame->encryption & 1) << 6) ++ | ((frame->grouping & 1) << 5); ++ ++// now the frame data. ++ memcpy(raw, frame->data, frame->datasize); ++ raw += frame->datasize; ++ ++nextframe: ++ curframe = curframe->next; ++ } ++ ++ return TRUE; ++} ++ ++/*************************************************************************************** ++ * END OF STATICS ++ ***************************************************************************************/ ++ ++ ++ ++ ++ ++ ++ ++/* ++ * Purpose: Reads the ID3 tag from a file. ++ * Parameters: tag - The structure to store the tag in, filename - The name of the file to operate on. ++ * Returns: ++ * 0 if successful, ++ * 1 if an error occured when opening the file ++ * 2 if error while reading tag. ++ * 3 if no TAG found. ++ */ ++int ++get_id3v2_tag (id3Tag *tag, char *filename) ++{ ++ id3v2Tag *v2 = calloc (1, sizeof(id3v2Tag)); ++ DLL *curframe = NULL; ++ int error = 0; ++ ++// Read the tag. ++ error = get_id3v2tag_raw (v2, filename); ++ ++// Init the users tag ++ memset (tag, 0, sizeof (id3Tag)); ++ ++ if( error == 0 ) ++ { ++// if we have a valid tag we copy the raw data to the users struct ++ tag->size = v2->tag_size; ++ ++ frame_find (v2, "TPE1", tag->artist); ++ frame_find (v2, "TIT2", tag->title); ++ frame_find (v2, "TALB", tag->album); ++ frame_find (v2, "TYER", tag->year); ++ frame_find (v2, "COMM", tag->comment); ++ frame_find (v2, "TRCK", tag->track); ++ frame_find (v2, "TCON", tag->genre); ++ frame_find (v2, "TCOM", tag->composer); // Composer ++ frame_find (v2, "TOPE", tag->orig_artist); // Original artist(s)/performer(s) ++ frame_find (v2, "WCOM", tag->url); // URL ++ frame_find (v2, "TENC", tag->enc_by); // Encoded by ++ } ++ ++// Free all the stuff ++ if (v2->frames) ++ { ++ id3v2Frame *frame = NULL; ++ ++ curframe = v2->frames; ++ while ( curframe ) ++ { ++ frame = (id3v2Frame *)curframe->data; ++ ++ free (frame->data); ++ free (frame); ++ ++ curframe = curframe->next; ++ } ++ v2->frames = dll_free (v2->frames); ++ } ++ ++ free (v2); ++ return (error); ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++/* ++ * Purpose: Clear the ID3 tag of a file. ++ * Parameters: a filename. ++ * Returns: ++ * 0 if successful, ++ * 1 if an error occured when opening the file ++ * 2 if an error while reading/writing the tag. ++ */ ++int ++del_id3v2_tag (char *filename) ++{ ++ id3v2Tag *v2 = calloc (1, sizeof(id3v2Tag)); ++ long file_len; ++ FILE *file; ++ void *ptr; ++ ++// check if an valid old id3v2 tag is present ++// In these two error-cases we don't know how big the tag is. ++ if( get_id3v2tag_raw (v2, filename) == 1 ++ || get_id3v2tag_raw (v2, filename) == 2 ) ++ return(0); ++ ++ ptr = malloc (4096); ++ ++// open file read/write ++ file = fopen (filename, "r+b"); ++ if (!file) ++ return (1); ++ ++ fseek (file, 0, SEEK_END); ++ file_len = ftell (file); ++ if ( file_len < 11 ++ || v2->tag_size < 11 ) ++ return (2); ++ ++// set anything but the header in tag to zero. I'll not really remove the tag, ++// because this would be much slower and if we write a new tag, this would mean we�d have to ++// rewrite the complete tag. ++/* ++ fseek (file, 10, SEEK_SET); ++ for (read = 0; read < v2->tag_size - 10; read++) ++ fputc (0, file); ++ ++*/ ++ { ++ FILE *file = NULL; ++ FILE *tempfile = NULL; ++ char *tempfilename = NULL; ++ int read = 0; ++ char buf[4096]; ++ int error = 0; ++ ++ // Open a tempfile ++ error = 2; ++ tempfilename = malloc (strlen (filename) + 11); ++ sprintf (tempfilename, "%s%s", filename, ".tempXXXXX"); ++ if( !(tempfile = fopen(tempfilename, "wb")) ) ++ { ++ remove (tempfilename); ++ free (tempfilename); ++ goto done; ++ } ++ ++ // Write the tag to the tempfile. ++ ++ // Open the mp3file. ++ error = 4; ++ if( !(file = fopen(filename, "r+b")) ) ++ { ++ fclose (file); ++ remove (tempfilename); ++ free (tempfilename); ++ goto done; ++ } ++ // skip the old tag (if one existed) ++ fseek (file, v2->tag_size + 10, SEEK_SET); ++ ++ // copy the rest of the file to the tempfile. ++ while ( !feof(file) ) ++ { ++ error = 5; ++ read = fread (buf, 1, 4096, file); ++ if( fwrite (buf, 1, read, tempfile) != read ++ && !feof (file) ) ++ { ++ remove (tempfilename); ++ free (tempfilename); ++ fflush (tempfile); ++ fclose (tempfile); ++ fflush (file); ++ fclose (file); ++ goto done; ++ } ++ } ++ ++ fflush (file); ++ fclose (file); ++ fflush (tempfile); ++ fclose (tempfile); ++ ++ // rename the tempfile, so it is the mp3file. ++ rename (tempfilename, filename); ++ free (tempfilename); ++ } ++ ++done: ++ if (v2) free (v2); ++ if (ptr) free (ptr); ++ ++ return(0); ++} ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++int ++set_id3v2_tag (id3Tag *tag, char *filename) ++{ ++ id3v2Tag *v2 = malloc (sizeof(id3v2Tag)); ++ id3v2Frame *frame = NULL; ++ unsigned char *rawdata = NULL; ++ DLL *curframe = NULL; ++ int oldsize = 0; ++ char track[3]; ++ int error = 0; ++ ++// Try to get the content of an old tag ++ error = 1; ++ memset (v2, 0, sizeof(id3v2Tag)); ++ get_id3v2tag_raw (v2, filename); ++ ++ oldsize = v2->tag_size; ++ ++// If the old tag had an extheader, I'll add its size to my tag, because i don't plan to add it again. ++ if ( v2->has_extheader ) ++ { ++ v2->padding_size += v2->extheader_size; ++ v2->has_extheader = FALSE; ++ v2->extheader_size = 0; ++ } ++ ++// first of all I'll generate a valid id3v2 tag struct out of the tag struct we got by the user. ++// Set the flags... ++ v2->unsync = FALSE; ++ v2->is_experimental = FALSE; ++ v2->crc_data_present = FALSE; ++ ++// Set the contentframes ++ frame_set (v2, "TIT2", tag->title); ++ frame_set (v2, "TPE1", tag->artist); ++ frame_set (v2, "TALB", tag->album); ++ frame_set (v2, "TYER", tag->year); ++ frame_set (v2, "COMM", tag->comment); ++ frame_set (v2, "TCON", tag->genre); ++ frame_set (v2, "TCOM", tag->composer); // Composer ++ frame_set (v2, "TOPE", tag->orig_artist); // TOPE Original artist(s)/performer(s) ++ frame_set (v2, "WCOM", tag->url); // URL ++ frame_set (v2, "TENC", tag->enc_by); // Encoded by ++ if ( atoi (tag->track) < 10 ) ++ snprintf (track, 3, "0%i", atoi(tag->track)); ++ else ++ snprintf (track, 3, "%i", atoi(tag->track)); ++ frame_set (v2, "TRCK", track); ++ ++// Create a header in the raw data string ++ rawdata = calloc (1, v2->tag_size + 10); ++ create_header_raw (rawdata, v2); ++ ++// Create frames raw data. ++ create_frames_raw (rawdata, v2); ++ ++// is the new tag bigger than the old one? Then we'll have to completely rewrite the file... ++ if ( v2->tag_size > oldsize ) ++ { ++ FILE *file = NULL; ++ FILE *tempfile = NULL; ++ char *tempfilename = NULL; ++ int read = 0; ++ char buf[4096]; ++ ++// Open a tempfile ++ error = 2; ++ tempfilename = malloc (strlen (filename) + 11); ++ sprintf (tempfilename, "%s%s", filename, ".tempXXXXX"); ++ if( !(tempfile = fopen(tempfilename, "wb")) ) ++ { ++ remove (tempfilename); ++ free (tempfilename); ++ goto done; ++ } ++ ++// Write the tag to the tempfile. ++ error = 3; ++ fseek (tempfile, 0, SEEK_SET); ++ if( fwrite (rawdata, 1, v2->tag_size + 10, tempfile) < v2->tag_size ) ++ { ++ fclose (tempfile); ++ remove (tempfilename); ++ free (tempfilename); ++ goto done; ++ } ++ ++// Open the mp3file. ++ error = 4; ++ if( !(file = fopen(filename, "r+b")) ) ++ { ++ fclose (file); ++ remove (tempfilename); ++ free (tempfilename); ++ goto done; ++ } ++// skip the old tag (if one existed) ++ fseek (file, oldsize? oldsize + 10 : oldsize, SEEK_SET); ++ ++// copy the rest of the file to the tempfile. ++ while ( !feof(file) ) ++ { ++ error = 5; ++ read = fread (buf, 1, 4096, file); ++ if( fwrite (buf, 1, read, tempfile) != read ++ && !feof (file) ) ++ { ++ remove (tempfilename); ++ free (tempfilename); ++ fflush (tempfile); ++ fclose (tempfile); ++ fflush (file); ++ fclose (file); ++ goto done; ++ } ++ } ++ ++ fflush (file); ++ fclose (file); ++ fflush (tempfile); ++ fclose (tempfile); ++ ++// rename the tempfile, so it is the mp3file. ++ rename (tempfilename, filename); ++ free (tempfilename); ++ } ++ else ++ { ++ FILE *file = NULL; ++ ++// If the old tag was bigger than the new one, we can simply overwrite it! ++// open. ++ error = 10; ++ if( !(file = fopen(filename, "r+b")) ) ++ goto done; ++ ++// write. ++ error = 11; ++ fseek (file, 0, SEEK_SET); ++ if( fwrite (rawdata, 1, v2->tag_size + 10, file) < v2->tag_size ) ++ { ++ fflush (file); ++ fclose (file); ++ goto done; ++ } ++ ++ fflush (file); ++ fclose (file); ++ } ++ ++ error = 0; ++ ++done: ++// Free all the stuff ++ curframe = v2->frames; ++ while ( curframe ) ++ { ++ frame = (id3v2Frame *)curframe->data; ++ ++ free (frame->data); ++ free (frame); ++ ++ curframe = curframe->next; ++ } ++ dll_free (v2->frames); ++ ++ if ( rawdata != NULL ) ++ free (rawdata); ++ free (v2); ++ return (error); ++} +diff -Naur xmms-1.2.9-orig/Input/mpg123/mpg123.c xmms-1.2.9/Input/mpg123/mpg123.c +--- xmms-1.2.9-orig/Input/mpg123/mpg123.c Thu Jan 29 06:43:24 2004 ++++ xmms-1.2.9/Input/mpg123/mpg123.c Thu Jan 29 05:18:54 2004 +@@ -607,8 +607,13 @@ + { \ + id3frm = id3_get_frame( id3d, _tid, 1 ); \ + if (id3frm) { \ +- txt = _tid == ID3_TCON ? id3_get_content(id3frm) \ +- : id3_get_text(id3frm); \ ++ if (_tid == ID3_COMM) \ ++ txt = id3_get_comm(id3frm); \ ++ else if (id3frm->fr_desc->fd_idstr[0] == 'W') \ ++ txt = id3_get_url(id3frm); \ ++ else \ ++ txt = _tid == ID3_TCON ? id3_get_content(id3frm) \ ++ : id3_get_text(id3frm); \ + if(txt) \ + { \ + tlen = strlen(txt); \ +@@ -644,6 +649,10 @@ + ID3_SET_NUM (ID3_TRCK, track_number); + ID3_SET (ID3_COMM, comment); + ID3_SET (ID3_TCON, genre); ++ ID3_SET (ID3_TCOM, composer); ++ ID3_SET (ID3_TOPE, orig_artist); ++ ID3_SET (ID3_WCOM, url); ++ ID3_SET (ID3_TENC, encoded_by); + } + + /* +diff -Naur xmms-1.2.9-orig/Input/mpg123/mpg123.h xmms-1.2.9/Input/mpg123/mpg123.h +--- xmms-1.2.9-orig/Input/mpg123/mpg123.h Thu Jan 29 06:43:24 2004 ++++ xmms-1.2.9/Input/mpg123/mpg123.h Thu Jan 29 05:20:31 2004 +@@ -78,6 +78,10 @@ + char genre[256]; + int year; + int track_number; ++ char composer[1024]; ++ char orig_artist[1024]; ++ char url[1024]; ++ char encoded_by[1024]; + }; + + typedef struct diff --git a/abs/extra-testing/xmms/xmms-1.2.10-crossfade-0.3.9.patch b/abs/extra-testing/xmms/xmms-1.2.10-crossfade-0.3.9.patch new file mode 100644 index 0000000..51c5167 --- /dev/null +++ b/abs/extra-testing/xmms/xmms-1.2.10-crossfade-0.3.9.patch @@ -0,0 +1,101 @@ +diff -ur xmms-1.2.10/xmms/input.c xmms-1.2.10.patched/xmms/input.c +--- xmms-1.2.10/xmms/input.c 2003-08-08 19:10:44.000000000 +0200 ++++ xmms-1.2.10.patched/xmms/input.c 2005-11-25 00:12:36.000000000 +0100 +@@ -285,6 +285,14 @@ + } + } + ++gboolean input_stopped_for_restart = FALSE; /* crossfade */ ++void input_stop_for_restart() /* crossfade */ ++{ ++ input_stopped_for_restart = TRUE; ++ input_stop(); ++ input_stopped_for_restart = FALSE; ++} ++ + void input_stop(void) + { + if (ip_data->playing && get_current_input_plugin()) +diff -ur xmms-1.2.10/xmms/input.h xmms-1.2.10.patched/xmms/input.h +--- xmms-1.2.10/xmms/input.h 2000-02-16 22:05:57.000000000 +0100 ++++ xmms-1.2.10.patched/xmms/input.h 2005-11-25 00:12:36.000000000 +0100 +@@ -34,6 +34,7 @@ + gboolean input_check_file(gchar * filename); + void input_play(char *filename); + void input_stop(void); ++void input_stop_for_restart(void); + void input_pause(void); + int input_get_time(void); + void input_set_eq(int on, float preamp, float *bands); +diff -ur xmms-1.2.10/xmms/main.c xmms-1.2.10.patched/xmms/main.c +--- xmms-1.2.10/xmms/main.c 2004-02-23 21:31:43.000000000 +0100 ++++ xmms-1.2.10.patched/xmms/main.c 2005-11-25 00:12:36.000000000 +0100 +@@ -881,8 +881,10 @@ + mainwin_set_shade(!cfg.player_shaded); + } + ++gboolean is_quitting = FALSE; /* crossfade */ + void mainwin_quit_cb(void) + { ++ is_quitting = TRUE; /* crossfade */ + input_stop(); + gtk_widget_hide(equalizerwin); + gtk_widget_hide(playlistwin); +@@ -1523,7 +1525,8 @@ + int *pos; + + if (get_input_playing()) +- input_stop(); ++ input_stop_for_restart(); ++ + pos = gtk_clist_get_row_data(clist, GPOINTER_TO_INT(clist->selection->data)); + playlist_set_position(*pos); + playlist_play(); +diff -ur xmms-1.2.10/xmms/playlist.c xmms-1.2.10.patched/xmms/playlist.c +--- xmms-1.2.10/xmms/playlist.c 2004-02-23 21:31:43.000000000 +0100 ++++ xmms-1.2.10.patched/xmms/playlist.c 2005-11-25 00:12:36.000000000 +0100 +@@ -124,7 +124,7 @@ + if (get_input_playing()) + { + PL_UNLOCK(); +- input_stop(); ++ input_stop_for_restart(); + PL_LOCK(); + *restart_playing = TRUE; + } +@@ -570,7 +570,7 @@ + } + + if (get_input_playing()) +- input_stop(); ++ input_stop_for_restart(); + + vis_clear_data(mainwin_vis); + vis_clear_data(playlistwin_vis); +@@ -668,7 +668,7 @@ + { + /* We need to stop before changing playlist_position */ + PL_UNLOCK(); +- input_stop(); ++ input_stop_for_restart(); + PL_LOCK(); + restart_playing = TRUE; + } +@@ -723,7 +723,7 @@ + { + /* We need to stop before changing playlist_position */ + PL_UNLOCK(); +- input_stop(); ++ input_stop_for_restart(); + PL_LOCK(); + restart_playing = TRUE; + } +@@ -852,7 +852,7 @@ + { + /* We need to stop before changing playlist_position */ + PL_UNLOCK(); +- input_stop(); ++ input_stop_for_restart(); + PL_LOCK(); + restart_playing = TRUE; + } diff --git a/abs/extra-testing/xmms/xmms-fix.diff b/abs/extra-testing/xmms/xmms-fix.diff new file mode 100644 index 0000000..a810aa2 --- /dev/null +++ b/abs/extra-testing/xmms/xmms-fix.diff @@ -0,0 +1,11 @@ +--- xmms-1.2.10+cvs20060429/xmms/util.c.orig 2006-11-05 12:29:59.000000000 +0800 ++++ xmms-1.2.10+cvs20060429/xmms/util.c 2006-11-05 12:30:01.000000000 +0800 +@@ -175,7 +175,7 @@ GdkImage *create_dblsize_image(GdkImage + * This needs to be optimized + */ + +- dblimg = gdk_image_new(GDK_IMAGE_NORMAL, gdk_visual_get_best(), img->width << 1, img->height << 1); ++ dblimg = gdk_image_new(GDK_IMAGE_NORMAL, gdk_visual_get_best_with_depth(img->depth), img->width << 1, img->height << 1); + if (dblimg->bpp == 1) + { + register guint8 *srcptr, *ptr, *ptr2, pix; diff --git a/abs/extra-testing/xmms/xmms-menu.patch b/abs/extra-testing/xmms/xmms-menu.patch new file mode 100644 index 0000000..39304f9 --- /dev/null +++ b/abs/extra-testing/xmms/xmms-menu.patch @@ -0,0 +1,35 @@ +--- xmms/xmms.desktop 2002-02-11 23:15:56.000000000 +0000 ++++ xmms.desktop 2006-02-25 14:21:03.000000000 +0000 +@@ -1,21 +1,16 @@ + [Desktop Entry] + Name=XMMS + Comment=X Multimedia System +-comment[az]=X Multimedya Sistemi +-comment[ca]=Sistema Multim�dia per a X +-comment[cs]=Multimedi�ln� p�ehr�va� +-comment[es]=Sistema Multimedia para X +-comment[gl]=Sistema Multimedia para X +-comment[hr]=X Multimedijski Sustav +-comment[nn]=X Multimedia-system +-comment[pt_BR]=X Multimedia System +-comment[ro]=X MultiMedia Sistem +-comment[th]=�к���ŵ�����º� X +-comment[tr]=X Multimedya Sistem +-comment[zh_TW]=X �h�C��t�� +-Encoding=Legacy-Mixed ++Comment[es]=Sistema Multimedia para X ++Comment[gl]=Sistema Multimedia para X ++Comment[hr]=X Multimedijski Sustav ++Comment[pt_BR]=X Multimedia System ++Comment[ro]=X MultiMedia Sistem ++Comment[tr]=X Multimedya Sistem ++Encoding=UTF-8 + Exec=xmms +-Icon=xmms_mini.xpm +-MimeType=audio/x-scpls;audio/x-mpegurl;audio/mpegurl;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/x-wav;application/x-ogg +-Terminal=0 ++Icon=xmms + Type=Application ++Categories=Application;AudioVideo; ++MimeType=audio/x-scpls;audio/x-mpegurl;audio/mpegurl;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/x-wav;application/x-ogg ++Terminal=false diff --git a/abs/extra-testing/xosd/PKGBUILD b/abs/extra-testing/xosd/PKGBUILD new file mode 100644 index 0000000..e4a87ba --- /dev/null +++ b/abs/extra-testing/xosd/PKGBUILD @@ -0,0 +1,26 @@ +# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $ +# Maintainer: damir <damir@archlinux.org> +# Contributor: Damir Perisa <damir.perisa@bluewin.ch> + +pkgname=xosd +pkgver=2.2.14 +pkgrel=1 +pkgdesc="XOSD displays text on your screen. On-Screen-Display-libs for some tools." +arch=("i686" "x86_64") +license=('GPL2') +url="http://www.ignavus.net/software.html" +depends=('libxt' 'libxinerama' 'gdk-pixbuf') +makedepends=('xmms' 'bmp') +options=(!libtool) +#source=("http://www.ignavus.net/xosd-$pkgver.tar.bz2") +source=("http://ftp.de.debian.org/debian/pool/main/x/xosd/xosd_$pkgver.orig.tar.gz") + +build() { + cd $startdir/src/xosd-$pkgver + ./configure --prefix=/usr + make || return 1 + make DESTDIR=$startdir/pkg/ install +} + + +md5sums=('4b349fe930e4eee2f504d6c02673e24d') |