[xiph-commits] r12684 - in trunk/ezstream: . src

moritz at svn.xiph.org moritz at svn.xiph.org
Thu Mar 8 12:24:14 PST 2007


Author: moritz
Date: 2007-03-08 12:24:09 -0800 (Thu, 08 Mar 2007)
New Revision: 12684

Modified:
   trunk/ezstream/NEWS
   trunk/ezstream/README
   trunk/ezstream/configure.in
   trunk/ezstream/src/Makefile.am
   trunk/ezstream/src/metadata.c
Log:
Working TagLib support (optional.)


Modified: trunk/ezstream/NEWS
===================================================================
--- trunk/ezstream/NEWS	2007-03-08 19:46:23 UTC (rev 12683)
+++ trunk/ezstream/NEWS	2007-03-08 20:24:09 UTC (rev 12684)
@@ -8,8 +8,12 @@
    - [ADD]   Implement a basename() function for Windows that behaves like the
              ones used on Windows.
 
+ * various:
+   - [ADD]   Allow ezstream to use TagLib for reading metadata from media
+             files. TagLib (libtag_c) is now an optional dependency.
 
 
+
 Changes in 0.3.0, released on 2007-03-05:
 
  * The original author, Ed Zaleski, hands over ezstream maintainership to

Modified: trunk/ezstream/README
===================================================================
--- trunk/ezstream/README	2007-03-08 19:46:23 UTC (rev 12683)
+++ trunk/ezstream/README	2007-03-08 20:24:09 UTC (rev 12684)
@@ -18,7 +18,8 @@
 enabled, ezstream is a very flexible source client.
 
 Supported media formats for streaming are MP3, Ogg Vorbis and Ogg Theora.
-Metadata support is available for MP3 (ID3v1 only) and Ogg Vorbis.
+Ezstream natively supports metadata in MP3 (ID3v1 only) and Ogg Vorbis, or many
+more formats when it is built with the TagLib option.
 
 Ezstream is free software and licensed under the GNU General Public License.
 See the COPYING file for details.
@@ -35,8 +36,12 @@
    (http://www.vorbis.com/ and http://www.theora.org/)
  * libxml 2.x (http://xmlsoft.org/)
 
+Ezstream optionally uses:
+ * TagLib 1.x (1.4 or newer recommended, will be used via the libtag_c wrapper)
+   (http://developer.kde.org/~wheeler/taglib.html)
 
 
+
 INSTALLATION
 ::::::::::::::
 
@@ -47,9 +52,11 @@
 
   --enable-examplesdir=DIR  example configuration files installation directory
                           (default: DATADIR/examples/ezstream)
-  --with-xml-config=PATH  use xml-config in PATH to find libxml
+  --with-taglib=PREFIX    Prefix where TagLib is installed (default:
+                          autodetect)
   --with-ogg=PREFIX       Prefix where libogg is installed (optional)
   --with-vorbis=PREFIX    Prefix where libvorbis is installed (optional)
+  --with-xml-config=PATH  use xml-config in PATH to find libxml
 
 The compilation and installation process boils down to the usual
 

Modified: trunk/ezstream/configure.in
===================================================================
--- trunk/ezstream/configure.in	2007-03-08 19:46:23 UTC (rev 12683)
+++ trunk/ezstream/configure.in	2007-03-08 20:24:09 UTC (rev 12684)
@@ -43,7 +43,7 @@
 
 dnl MISC SYSTEM CHARACTERISTICS
 
-dnl __progname check adapted from OpenNTPd-portable's configure.ac
+dnl __progname check adapted from OpenNTPd-portable configure.ac
 AC_MSG_CHECKING([whether libc defines __progname])
 AC_LINK_IFELSE(
 	[AC_LANG_PROGRAM([[#include <stdio.h>]],
@@ -81,6 +81,99 @@
 
 dnl CONFIGURE OPTIONS
 
+dnl Optional: TagLib support
+AC_ARG_VAR([TAGLIB_PREFIX], [path to TagLib installation])
+if test -n "${TAGLIB_PREFIX}"; then
+	taglib_prefix="${TAGLIB_PREFIX}"
+else
+	taglib_prefix=""
+fi
+use_taglib=yes
+require_taglib=no
+AC_ARG_WITH(taglib,
+	[AS_HELP_STRING([--with-taglib=PREFIX],
+		[Prefix where TagLib is installed (default: autodetect)])],
+[case "$withval" in
+	yes) require_taglib=yes
+	     if test -z "$taglib_prefix"; then
+		taglib_prefix=/usr/local
+	     fi
+	     ;;
+	no)  use_taglib=no ;;
+	*)   require_taglib=yes
+	     taglib_prefix="$withval"
+	     ;;
+esac], [])
+
+have_taglib=no
+AC_MSG_CHECKING([for TagLib option])
+if test x"$use_taglib" != "xno"; then
+	if test x"$require_taglib" = "xyes"; then
+		AC_MSG_RESULT([enabled])
+	else
+		AC_MSG_RESULT([autodetect])
+	fi
+
+	TAGLIB_CFLAGS=""
+	TAGLIB_CPPFLAGS=""
+	TAGLIB_LIBS="-ltag_c"
+	if test -n "$taglib_prefix"; then
+		TAGLIB_CPPFLAGS="-I${taglib_prefix}/include"
+		TAGLIB_LIBS="-L${taglib_prefix}/lib ${TAGLIB_LIBS}"
+	fi
+
+	ac_taglib_save_CFLAGS="$CFLAGS"
+	ac_taglib_save_CPPFLAGS="$CPPFLAGS"
+	ac_taglib_save_LIBS="$LIBS"
+
+	CFLAGS="${TAGLIB_CFLAGS}"
+	CPPFLAGS="${TAGLIB_CPPFLAGS}"
+	LIBS="${TAGLIB_LIBS}"
+
+	AC_CHECK_HEADERS([taglib/tag_c.h], [
+			AC_MSG_CHECKING([whether TagLib works])
+			AC_LINK_IFELSE(
+				[AC_LANG_PROGRAM([[#include <taglib/tag_c.h>]],
+					[[ taglib_set_string_management_enabled(0); ]])],
+				[
+				AC_MSG_RESULT([yes])
+				have_taglib=yes
+				], [
+				if test x"$require_taglib" = "xyes"; then
+					AC_MSG_RESULT([no])
+					AC_MSG_ERROR([Cannot link against libtag_c in ${taglib_prefix}/lib])
+				else
+					AC_MSG_RESULT([no])
+					AC_MSG_WARN([Error while linking against libtag_c in ${taglib_prefix}/lib, disabling support])
+				fi
+				]
+			)
+		], [
+			if test x"$require_taglib" = "xyes"; then
+				AC_MSG_ERROR([Cannot find taglib/tag_c.h in ${taglib_prefix}/include])
+			else
+				AC_MSG_NOTICE([No TagLib C header found on this system])
+			fi
+		])
+
+	CFLAGS="$ac_taglib_save_CFLAGS"
+	CPPFLAGS="$ac_taglib_save_CPPFLAGS"
+	LIBS="$ac_taglib_save_LIBS"
+else
+	AC_MSG_RESULT([disabled])
+fi
+
+if test x"$have_taglib" = "xyes"; then
+	AC_DEFINE(HAVE_TAGLIB, 1, [Define whether we're using TagLib])
+else
+	TAGLIB_CFLAGS=""
+	TAGLIB_CPPFLAGS=""
+	TAGLIB_LIBS=""
+fi
+AC_SUBST(TAGLIB_CFLAGS)
+AC_SUBST(TAGLIB_CPPFLAGS)
+AC_SUBST(TAGLIB_LIBS)
+
 dnl Check for Ogg Vorbis
 XIPH_PATH_OGG(, AC_MSG_ERROR([Must have libogg 1.x installed.]))
 XIPH_PATH_VORBIS(, AC_MSG_ERROR([Must have libvorbis 1.x installed.]))

Modified: trunk/ezstream/src/Makefile.am
===================================================================
--- trunk/ezstream/src/Makefile.am	2007-03-08 19:46:23 UTC (rev 12683)
+++ trunk/ezstream/src/Makefile.am	2007-03-08 20:24:09 UTC (rev 12684)
@@ -4,10 +4,10 @@
 
 ezstream_SOURCES = compat.c configfile.c ezstream.c metadata.c playlist.c \
 		util.c
-ezstream_LDADD = @LIBOBJS@ @XIPH_LIBS@
+ezstream_LDADD = @LIBOBJS@ @XIPH_LIBS@ @TAGLIB_LIBS@
     
-AM_CFLAGS =	@XIPH_CFLAGS@
-AM_CPPFLAGS =	@XIPH_CPPFLAGS@
+AM_CFLAGS =	@XIPH_CFLAGS@ @TAGLIB_CFLAGS@
+AM_CPPFLAGS =	@XIPH_CPPFLAGS@ @TAGLIB_CPPFLAGS@
 
 EXTRA_DIST =	compat.h configfile.h getopt.h metadata.h playlist.h \
 		strfctns.h util.h

Modified: trunk/ezstream/src/metadata.c
===================================================================
--- trunk/ezstream/src/metadata.c	2007-03-08 19:46:23 UTC (rev 12683)
+++ trunk/ezstream/src/metadata.c	2007-03-08 20:24:09 UTC (rev 12684)
@@ -33,6 +33,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef HAVE_TAGLIB
+# include <taglib/tag_c.h>
+#endif
 #include <vorbis/vorbisfile.h>
 
 #include "compat.h"
@@ -81,7 +84,7 @@
 
 void
 metadata_use_taglib(metadata_t *md, FILE **filep)
-#ifdef HAVE_TAG_C
+#ifdef HAVE_TAGLIB
 {
 	TagLib_File	*tf;
 	TagLib_Tag	*tt;
@@ -98,6 +101,7 @@
 
 	metadata_clean_md(md);
 	taglib_set_string_management_enabled(0);
+	taglib_set_strings_unicode(0);
 
 	if (md->string != NULL)
 		xfree(md->string);
@@ -130,11 +134,11 @@
 	       __progname);
 	abort();
 }
-#endif /* HAVE_TAG_C */
+#endif /* HAVE_TAGLIB */
 
 void
 metadata_use_self(metadata_t *md, FILE **filep)
-#ifdef HAVE_TAG_C
+#ifdef HAVE_TAGLIB
 {
 	printf("%s: Internal error: metadata_use_self() called with TagLib support\n",
 	       __progname);
@@ -223,7 +227,7 @@
 	if (md->artist == NULL && md->title == NULL)
 		md->string = metadata_get_name(md->filename);
 }
-#endif /* HAVE_TAG_C */
+#endif /* HAVE_TAGLIB */
 
 void
 metadata_clean_md(metadata_t *md)
@@ -400,11 +404,11 @@
 		return (0);
 	}
 
-#ifdef HAVE_TAG_C
+#ifdef HAVE_TAGLIB
 	metadata_use_taglib(md, &filep);
 #else
 	metadata_use_self(md, &filep);
-#endif /* HAVE_TAG_C */
+#endif /* HAVE_TAGLIB */
 
 	metadata_process_md(md);
 



More information about the commits mailing list