mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-09-01 03:54:15 -04:00
Depend on TagLib unconditionally
- Removes effectively untested code paths - Removes libvorbisfile dependency
This commit is contained in:
parent
9eff442169
commit
0f6de67977
@ -7,9 +7,8 @@ dist_doc_DATA = COPYING NEWS README
|
||||
|
||||
EXTRA_DIST = \
|
||||
autogen.sh \
|
||||
m4/attribute.m4 m4/ccflags.m4 m4/libshout.m4 m4/libvorbis.m4 \
|
||||
m4/libxml2.m4 m4/progname.m4 m4/taglib.m4 m4/tree.m4 m4/vacopy.m4 \
|
||||
m4/vars.m4
|
||||
m4/attribute.m4 m4/ccflags.m4 m4/libshout.m4 m4/libxml2.m4 \
|
||||
m4/progname.m4 m4/taglib.m4 m4/tree.m4 m4/vacopy.m4 m4/vars.m4
|
||||
|
||||
CLEANFILES = core *.core *~ .*~
|
||||
|
||||
|
1
NEWS
1
NEWS
@ -10,6 +10,7 @@ Changes in X.X.X, released on XXXX-XX-XX:
|
||||
* The real-time status information is now enabled explicitly with the new
|
||||
command line option -r.
|
||||
* The configuration file structure has changed.
|
||||
* TagLib (its C wrapper library) is now a mandatory dependency
|
||||
|
||||
|
||||
Changes in 0.6.0, released on 2015-01-18:
|
||||
|
10
README
10
README
@ -35,17 +35,11 @@ Ezstream depends on:
|
||||
(http://www.icecast.org/)
|
||||
* libxml 2.x
|
||||
(http://xmlsoft.org/)
|
||||
|
||||
Ezstream optionally uses:
|
||||
- For reading metadata from Ogg Vorbis files:
|
||||
* TagLib 1.x (1.4 or newer recommended, will be used via the libtag_c
|
||||
wrapper)
|
||||
(https://taglib.github.io/)
|
||||
OR:
|
||||
* libvorbis 1.x
|
||||
(http://www.vorbis.com)
|
||||
Using TagLib is recommended, as it allows ezstream to read metadata from
|
||||
many additional media file types.
|
||||
|
||||
Ezstream optionally uses:
|
||||
- For basic non-ASCII charset support in metadata and filenames:
|
||||
* Libiconv, if iconv() is not available in the system libc.
|
||||
(https://www.gnu.org/software/libiconv/)
|
||||
|
28
configure.ac
28
configure.ac
@ -159,27 +159,12 @@ AX_UNIQVAR_APPEND([EZ_CFLAGS], [${LIBXML2_CFLAGS}])
|
||||
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${LIBXML2_LDFLAGS}])
|
||||
AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBXML2_LIBS}])
|
||||
|
||||
use_metadata="No"
|
||||
AX_CHECK_TAGLIB_C([], [
|
||||
AC_DEFINE([HAVE_TAGLIB], [1],
|
||||
[Define to 1 if you have the libtag_c library.]
|
||||
)
|
||||
AX_UNIQVAR_APPEND([EZ_CFLAGS], [${TAGLIB_CFLAGS}])
|
||||
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${TAGLIB_CPPFLAGS}])
|
||||
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${TAGLIB_LDFLAGS}])
|
||||
AX_UNIQVAR_PREPEND([EZ_LIBS], [${TAGLIB_C_LIBS}])
|
||||
use_metadata="TagLib"
|
||||
], [
|
||||
AX_CHECK_LIBVORBISFILE([], [
|
||||
AC_DEFINE([HAVE_VORBISFILE], [1],
|
||||
[Define to 1 if you have the libvorbisfile library.])
|
||||
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${VORBIS_CPPFLAGS}])
|
||||
AX_UNIQVAR_APPEND([EZ_CFLAGS], [${VORBIS_CFLAGS}])
|
||||
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${VORBIS_LDFLAGS}])
|
||||
AX_UNIQVAR_PREPEND([EZ_LIBS], [${LIBVORBISFILE_LIBS}])
|
||||
use_metadata="libvorbis"
|
||||
], [])
|
||||
])
|
||||
AX_CHECK_TAGLIB_C([], [],
|
||||
[AC_MSG_ERROR([libtag_c is required.], [1])])
|
||||
AX_UNIQVAR_APPEND([EZ_CFLAGS], [${TAGLIB_CFLAGS}])
|
||||
AX_UNIQVAR_APPEND([EZ_CPPFLAGS], [${TAGLIB_CPPFLAGS}])
|
||||
AX_UNIQVAR_APPEND([EZ_LDFLAGS], [${TAGLIB_LDFLAGS}])
|
||||
AX_UNIQVAR_PREPEND([EZ_LIBS], [${TAGLIB_C_LIBS}])
|
||||
|
||||
# Not using AM_ICONV to check for iconv(), with or without libiconv(),
|
||||
# is not a viable option. Something in the past went horribly wrong;
|
||||
@ -306,7 +291,6 @@ cat << __EOT
|
||||
${PACKAGE_STRING} has been configured successfully.
|
||||
|
||||
Configuration:
|
||||
Ogg Vorbis metadata support ... : ${use_metadata}
|
||||
Charset conversion support .... : ${use_iconv}
|
||||
Prefix ........................ : ${prefix}
|
||||
|
||||
|
403
m4/libvorbis.m4
403
m4/libvorbis.m4
@ -1,403 +0,0 @@
|
||||
dnl # Check for working installations of libvorbis, libvorbisfile and
|
||||
dnl # libvorbisenc.
|
||||
dnl # Provides appropriate --with configuration options, fills the
|
||||
dnl # VORBIS_CFLAGS, VORBIS_CPPFLAGS, VORBIS_LDFLAGS, LIBVORBIS_LIBS,
|
||||
dnl # LIBVORBISENC_LIBS and LIBVORBISFILE_LIBS variables accordingly.
|
||||
|
||||
|
||||
dnl # Copyright (c) 2008, 2009 Moritz Grimm <mgrimm@mrsserver.net>
|
||||
dnl #
|
||||
dnl # Permission to use, copy, modify, and distribute this software for any
|
||||
dnl # purpose with or without fee is hereby granted, provided that the above
|
||||
dnl # copyright notice and this permission notice appear in all copies.
|
||||
dnl #
|
||||
dnl # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
dnl # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
dnl # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
dnl # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
dnl # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
dnl # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
dnl # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
dnl # Each of these macros supply VORBIS_CFLAGS, VORBIS_CPPFLAGS and
|
||||
dnl # VORBIS_LDFLAGS.
|
||||
|
||||
dnl # For LIBVORBIS_LIBS:
|
||||
dnl # AX_CHECK_LIBVORBIS([VORBISLIBS-VERSION], [ACTION-IF-FOUND],
|
||||
dnl # [ACTION-IF-NOT-FOUND])
|
||||
|
||||
dnl # For LIBVORBISENC_LIBS:
|
||||
dnl # AX_CHECK_LIBVORBISENC([VORBISLIBS-VERSION], [ACTION-IF-FOUND],
|
||||
dnl # [ACTION-IF-NOT-FOUND])
|
||||
|
||||
dnl # For LIBVORBISFILE_LIBS:
|
||||
dnl # AX_CHECK_LIBVORBISFILE([VORBISLIBS-VERSION], [ACTION-IF-FOUND],
|
||||
dnl # [ACTION-IF-NOT-FOUND])
|
||||
|
||||
|
||||
AC_DEFUN([_AX_CHECK_VORBIS_OPTS],
|
||||
[
|
||||
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
if test -z "${PKG_CONFIG}"; then
|
||||
AC_MSG_ERROR([The pkg-config utility is required.], [1])
|
||||
fi
|
||||
AC_ARG_VAR([VORBIS_CFLAGS],
|
||||
[C compiler flags for the Vorbis libraries])
|
||||
AC_ARG_VAR([VORBIS_CPPFLAGS],
|
||||
[C preprocessor flags for the Vorbis libraries])
|
||||
AC_ARG_VAR([VORBIS_LDFLAGS],
|
||||
[linker flags for the Vorbis libraries])
|
||||
have_libvorbis_includes=""
|
||||
have_libvorbis_libs=""
|
||||
want_libvorbis="auto"
|
||||
AC_ARG_WITH([libvorbis],
|
||||
[AS_HELP_STRING([--with-libvorbis=PFX],
|
||||
[prefix where the Vorbis library header files and library are installed (default: autodetect)])],
|
||||
[
|
||||
case "${withval}" in
|
||||
yes)
|
||||
want_libvorbis="yes"
|
||||
;;
|
||||
no)
|
||||
want_libvorbis="no"
|
||||
;;
|
||||
*)
|
||||
have_libvorbis_prefix="${withval}"
|
||||
want_libvorbis="yes"
|
||||
;;
|
||||
esac
|
||||
]
|
||||
)
|
||||
AC_ARG_WITH([libvorbis-includes],
|
||||
[AS_HELP_STRING([--with-libvorbis-includes=DIR],
|
||||
[directory where Vorbis library header files are installed (optional)]) ],
|
||||
[
|
||||
case "${withval}" in
|
||||
yes|no) ;;
|
||||
*)
|
||||
have_libvorbis_includes="${withval}"
|
||||
;;
|
||||
esac
|
||||
]
|
||||
)
|
||||
AC_ARG_WITH([libvorbis-libs],
|
||||
[AS_HELP_STRING([--with-libvorbis-libs=DIR],
|
||||
[directory where the Vorbis libraries are installed (optional)]) ],
|
||||
[
|
||||
case "${withval}" in
|
||||
yes|no) ;;
|
||||
*)
|
||||
have_libvorbis_libs="${withval}"
|
||||
;;
|
||||
esac
|
||||
]
|
||||
)
|
||||
AC_CACHE_VAL([local_cv_have_lib_libvorbis_opts],
|
||||
[
|
||||
ax_check_libvorbis_vorbis_pc="no"
|
||||
PKG_CHECK_EXISTS([vorbis], [ax_check_libvorbis_vorbis_pc=yes])
|
||||
if test -z "${VORBIS_CFLAGS}" \
|
||||
-a x"${ax_check_libvorbis_vorbis_pc}" = "xyes"; then
|
||||
VORBIS_CFLAGS="`${PKG_CONFIG} --cflags-only-other vorbis`"
|
||||
fi
|
||||
if test -n "${VORBIS_CPPFLAGS}"; then
|
||||
if test -n "${have_libvorbis_includes}"; then
|
||||
VORBIS_CPPFLAGS="${VORBIS_CPPFLAGS} -I${have_libvorbis_includes}"
|
||||
fi
|
||||
else
|
||||
if test -n "${have_libvorbis_includes}"; then
|
||||
VORBIS_CPPFLAGS="-I${have_libvorbis_includes}"
|
||||
else
|
||||
if test x"${want_libvorbis}" = "xauto" \
|
||||
-a x"${ax_check_libvorbis_vorbis_pc}" = "xyes"; then
|
||||
VORBIS_CPPFLAGS="`${PKG_CONFIG} --cflags-only-I vorbis`"
|
||||
elif test -n "${have_libvorbis_prefix}"; then
|
||||
VORBIS_CPPFLAGS="-I${have_libvorbis_prefix}/include"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test -n "${VORBIS_LDFLAGS}"; then
|
||||
if test -n "${have_libvorbis_libs}"; then
|
||||
VORBIS_LDFLAGS="-L${have_libvorbis_libs} ${VORBIS_LDFLAGS}"
|
||||
fi
|
||||
else
|
||||
if test -n "${have_libvorbis_libs}"; then
|
||||
VORBIS_LDFLAGS="-L${have_libvorbis_libs}"
|
||||
else
|
||||
if test x"${want_libvorbis}" = "xauto" \
|
||||
-a x"${ax_check_libvorbis_vorbis_pc}" = "xyes"; then
|
||||
VORBIS_LDFLAGS=" \
|
||||
`${PKG_CONFIG} --libs-only-L vorbis` \
|
||||
`${PKG_CONFIG} --libs-only-other vorbis` \
|
||||
"
|
||||
elif test -n "${have_libvorbis_prefix}"; then
|
||||
VORBIS_LDFLAGS="-L${have_libvorbis_prefix}/lib"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
local_cv_have_lib_libvorbis_opts=yes
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_CHECK_LIBVORBIS],
|
||||
[
|
||||
AC_REQUIRE([_AX_CHECK_VORBIS_OPTS])
|
||||
AC_ARG_VAR([LIBVORBIS_LIBS],
|
||||
[libraries to use for libvorbis])
|
||||
AC_CACHE_VAL([local_cv_have_lib_libvorbis],
|
||||
[
|
||||
local_cv_have_lib_libvorbis=no
|
||||
|
||||
if test x"${want_libvorbis}" != "xno"; then # want_libvorbis != no
|
||||
|
||||
if test -z "${PKG_CONFIG}"; then
|
||||
AC_MSG_ERROR([The pkg-config utility is required.], [1])
|
||||
fi
|
||||
|
||||
dnl ####### BEGIN CHECK ######
|
||||
PKG_CHECK_EXISTS([vorbis $1], [
|
||||
dnl ##########################
|
||||
|
||||
libvorbis_libs_autodetect=no
|
||||
if test -z "${LIBVORBIS_LIBS}"; then
|
||||
LIBVORBIS_LIBS="`${PKG_CONFIG} --libs-only-l vorbis`"
|
||||
libvorbis_libs_autodetect=yes
|
||||
fi
|
||||
ax_check_libvorbis_save_CFLAGS="${CFLAGS}"
|
||||
ax_check_libvorbis_save_CPPFLAGS="${CPPFLAGS}"
|
||||
ax_check_libvorbis_save_LDFLAGS="${LDFLAGS}"
|
||||
ax_check_libvorbis_save_LIBS="${LIBS}"
|
||||
AC_LANG_PUSH([C])
|
||||
CFLAGS="${CFLAGS} ${VORBIS_CFLAGS}"
|
||||
CPPFLAGS="${CPPFLAGS} ${VORBIS_CPPFLAGS}"
|
||||
LDFLAGS="${LDFLAGS} ${VORBIS_LDFLAGS}"
|
||||
LIBS="${LIBVORBIS_LIBS} ${LIBS}"
|
||||
AC_CHECK_HEADER([vorbis/codec.h],
|
||||
[
|
||||
AC_MSG_CHECKING([if libvorbis works])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <stdlib.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include <vorbis/codec.h>
|
||||
]],
|
||||
[[
|
||||
vorbis_info_init(NULL);
|
||||
]]
|
||||
)],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
local_cv_have_lib_libvorbis=yes
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
]
|
||||
)
|
||||
AC_CHECK_TYPE([struct ovectl_ratemanage_arg],
|
||||
[],
|
||||
[AC_MSG_ERROR([These Vorbis libraries are too old, please upgrade.], [1])],
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include <vorbis/codec.h>
|
||||
#include <vorbis/vorbisenc.h>
|
||||
]
|
||||
)
|
||||
])
|
||||
CFLAGS="${ax_check_libvorbis_save_CFLAGS}"
|
||||
CPPFLAGS="${ax_check_libvorbis_save_CPPFLAGS}"
|
||||
LDFLAGS="${ax_check_libvorbis_save_LDFLAGS}"
|
||||
LIBS="${ax_check_libvorbis_save_LIBS}"
|
||||
AC_LANG_POP([C])
|
||||
|
||||
dnl ####### END CHECK ########
|
||||
], [])
|
||||
dnl ##########################
|
||||
|
||||
fi # want_libvorbis != no
|
||||
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for libvorbis $1])
|
||||
if test x"${local_cv_have_lib_libvorbis}" = "xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
:
|
||||
$2
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
:
|
||||
$3
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_CHECK_LIBVORBISFILE],
|
||||
[
|
||||
AC_REQUIRE([_AX_CHECK_VORBIS_OPTS])
|
||||
AC_ARG_VAR([LIBVORBISFILE_LIBS],
|
||||
[libraries to use for libvorbisfile])
|
||||
AC_CACHE_VAL([local_cv_have_lib_libvorbisfile],
|
||||
[
|
||||
local_cv_have_lib_libvorbisfile=no
|
||||
|
||||
if test x"${want_libvorbis}" != "xno"; then # want_libvorbis != no
|
||||
|
||||
if test -z "${PKG_CONFIG}"; then
|
||||
AC_MSG_ERROR([The pkg-config utility is required.], [1])
|
||||
fi
|
||||
|
||||
dnl ####### BEGIN CHECK ######
|
||||
PKG_CHECK_EXISTS([vorbisfile $1], [
|
||||
dnl ##########################
|
||||
|
||||
libvorbisfile_libs_autodetect=no
|
||||
if test -z "${LIBVORBISFILE_LIBS}"; then
|
||||
LIBVORBISFILE_LIBS="`${PKG_CONFIG} --libs-only-l vorbisfile`"
|
||||
libvorbisfile_libs_autodetect=yes
|
||||
fi
|
||||
ax_check_libvorbisfile_save_CFLAGS="${CFLAGS}"
|
||||
ax_check_libvorbisfile_save_CPPFLAGS="${CPPFLAGS}"
|
||||
ax_check_libvorbisfile_save_LDFLAGS="${LDFLAGS}"
|
||||
ax_check_libvorbisfile_save_LIBS="${LIBS}"
|
||||
AC_LANG_PUSH([C])
|
||||
CFLAGS="${CFLAGS} ${VORBIS_CFLAGS}"
|
||||
CPPFLAGS="${CPPFLAGS} ${VORBIS_CPPFLAGS}"
|
||||
LDFLAGS="${LDFLAGS} ${VORBIS_LDFLAGS}"
|
||||
LIBS="${LIBVORBISFILE_LIBS} ${LIBS}"
|
||||
AC_CHECK_HEADER([vorbis/vorbisfile.h],
|
||||
[
|
||||
AC_MSG_CHECKING([if libvorbisfile works])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <stdlib.h>
|
||||
#include <vorbis/vorbisfile.h>
|
||||
]],
|
||||
[[
|
||||
ov_open(NULL, NULL, NULL, 0);
|
||||
]]
|
||||
)],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
local_cv_have_lib_libvorbisfile=yes
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
]
|
||||
)
|
||||
])
|
||||
CFLAGS="${ax_check_libvorbisfile_save_CFLAGS}"
|
||||
CPPFLAGS="${ax_check_libvorbisfile_save_CPPFLAGS}"
|
||||
LDFLAGS="${ax_check_libvorbisfile_save_LDFLAGS}"
|
||||
LIBS="${ax_check_libvorbisfile_save_LIBS}"
|
||||
AC_LANG_POP([C])
|
||||
|
||||
dnl ####### END CHECK ########
|
||||
], [])
|
||||
dnl ##########################
|
||||
|
||||
fi # want_libvorbis != no
|
||||
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for libvorbisfile $1])
|
||||
if test x"${local_cv_have_lib_libvorbisfile}" = "xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
:
|
||||
$2
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
:
|
||||
$3
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_CHECK_LIBVORBISENC],
|
||||
[
|
||||
AC_REQUIRE([_AX_CHECK_VORBIS_OPTS])
|
||||
AC_ARG_VAR([LIBVORBISENC_LIBS],
|
||||
[libraries to use for libvorbisenc])
|
||||
AC_CACHE_VAL([local_cv_have_lib_libvorbisenc],
|
||||
[
|
||||
local_cv_have_lib_libvorbisenc=no
|
||||
|
||||
if test x"${want_libvorbis}" != "xno"; then # want_libvorbis != no
|
||||
|
||||
if test -z "${PKG_CONFIG}"; then
|
||||
AC_MSG_ERROR([The pkg-config utility is required.], [1])
|
||||
fi
|
||||
|
||||
dnl ####### BEGIN CHECK ######
|
||||
PKG_CHECK_EXISTS([vorbisenc $1], [
|
||||
dnl ##########################
|
||||
|
||||
libvorbisenc_libs_autodetect=no
|
||||
if test -z "${LIBVORBISENC_LIBS}"; then
|
||||
LIBVORBISENC_LIBS="`${PKG_CONFIG} --libs-only-l vorbisenc`"
|
||||
libvorbisenc_libs_autodetect=yes
|
||||
fi
|
||||
ax_check_libvorbisenc_save_CFLAGS="${CFLAGS}"
|
||||
ax_check_libvorbisenc_save_CPPFLAGS="${CPPFLAGS}"
|
||||
ax_check_libvorbisenc_save_LDFLAGS="${LDFLAGS}"
|
||||
ax_check_libvorbisenc_save_LIBS="${LIBS}"
|
||||
AC_LANG_PUSH([C])
|
||||
CFLAGS="${CFLAGS} ${VORBIS_CFLAGS}"
|
||||
CPPFLAGS="${CPPFLAGS} ${VORBIS_CPPFLAGS}"
|
||||
LDFLAGS="${LDFLAGS} ${VORBIS_LDFLAGS}"
|
||||
LIBS="${LIBVORBISENC_LIBS} ${LIBS}"
|
||||
AC_CHECK_HEADER([vorbis/vorbisenc.h],
|
||||
[
|
||||
AC_MSG_CHECKING([if libvorbisenc works])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <stdlib.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include <vorbis/codec.h>
|
||||
#include <vorbis/vorbisenc.h>
|
||||
]],
|
||||
[[
|
||||
vorbis_encode_init(NULL, 0, 0, 0, 0, 0);
|
||||
]]
|
||||
)],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
local_cv_have_lib_libvorbisenc=yes
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
]
|
||||
)
|
||||
])
|
||||
CFLAGS="${ax_check_libvorbisenc_save_CFLAGS}"
|
||||
CPPFLAGS="${ax_check_libvorbisenc_save_CPPFLAGS}"
|
||||
LDFLAGS="${ax_check_libvorbisenc_save_LDFLAGS}"
|
||||
LIBS="${ax_check_libvorbisenc_save_LIBS}"
|
||||
AC_LANG_POP([C])
|
||||
|
||||
dnl ####### END CHECK ########
|
||||
], [])
|
||||
dnl ##########################
|
||||
|
||||
fi # want_libvorbis != no
|
||||
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([for libvorbisenc $1])
|
||||
if test x"${local_cv_have_lib_libvorbisenc}" = "xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
:
|
||||
$2
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
:
|
||||
$3
|
||||
fi
|
||||
|
||||
])
|
132
src/metadata.c
132
src/metadata.c
@ -33,12 +33,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_TAGLIB
|
||||
# include <taglib/tag_c.h>
|
||||
#endif /* HAVE_TAGLIB */
|
||||
#ifdef HAVE_VORBISFILE
|
||||
# include <vorbis/vorbisfile.h>
|
||||
#endif /* HAVE_VORBISFILE */
|
||||
#include <taglib/tag_c.h>
|
||||
#include <shout/shout.h>
|
||||
|
||||
#include "log.h"
|
||||
@ -75,10 +70,8 @@ struct ID3Tag {
|
||||
|
||||
static struct metadata *
|
||||
metadata_create(const char *);
|
||||
static void metadata_use_taglib(struct metadata *, FILE **);
|
||||
static void metadata_use_self(struct metadata *, FILE **);
|
||||
static void metadata_get(struct metadata *, FILE **);
|
||||
static void metadata_clean_md(struct metadata *);
|
||||
static void metadata_get_extension(char *, size_t, const char *);
|
||||
static char * metadata_get_name(const char *);
|
||||
static void metadata_process_md(struct metadata *);
|
||||
static void metadata_normalize_string(char **);
|
||||
@ -96,8 +89,7 @@ metadata_create(const char *filename)
|
||||
}
|
||||
|
||||
static void
|
||||
metadata_use_taglib(struct metadata *md, FILE **filep)
|
||||
#ifdef HAVE_TAGLIB
|
||||
metadata_get(struct metadata *md, FILE **filep)
|
||||
{
|
||||
TagLib_File *tf;
|
||||
TagLib_Tag *tt;
|
||||
@ -146,104 +138,6 @@ metadata_use_taglib(struct metadata *md, FILE **filep)
|
||||
|
||||
taglib_file_free(tf);
|
||||
}
|
||||
#else
|
||||
{
|
||||
(void)md;
|
||||
(void)filep;
|
||||
|
||||
log_alert("metadata_use_taglib() called without TagLib support");
|
||||
abort();
|
||||
}
|
||||
#endif /* HAVE_TAGLIB */
|
||||
|
||||
static void
|
||||
metadata_use_self(struct metadata *md, FILE **filep)
|
||||
#ifdef HAVE_TAGLIB
|
||||
{
|
||||
(void)md;
|
||||
(void)filep;
|
||||
|
||||
log_alert("metadata_use_self() called with TagLib support");
|
||||
abort();
|
||||
}
|
||||
#else
|
||||
{
|
||||
char extension[25];
|
||||
struct ID3Tag id3tag;
|
||||
|
||||
metadata_clean_md(md);
|
||||
metadata_get_extension(extension, sizeof(extension), md->filename);
|
||||
|
||||
if (strcmp(extension, ".mp3") == 0) {
|
||||
memset(&id3tag, 0, sizeof(id3tag));
|
||||
fseek(*filep, -128L, SEEK_END);
|
||||
fread(&id3tag, 1UL, sizeof(struct ID3Tag), *filep);
|
||||
if (memcmp(id3tag.tag, "TAG", 3UL) == 0) {
|
||||
if (strlen(id3tag.artistName) > 0)
|
||||
md->artist = CHARtoUTF8(id3tag.artistName, ICONV_REPLACE);
|
||||
if (strlen(id3tag.trackName) > 0)
|
||||
md->title = CHARtoUTF8(id3tag.trackName, ICONV_REPLACE);
|
||||
}
|
||||
#ifdef HAVE_VORBISFILE
|
||||
} else if (strcmp(extension, ".ogg") == 0) {
|
||||
OggVorbis_File vf;
|
||||
int ret;
|
||||
|
||||
if ((ret = ov_open(*filep, &vf, NULL, 0L)) != 0) {
|
||||
switch (ret) {
|
||||
case OV_EREAD:
|
||||
log_error("%s: media read error",
|
||||
md->filename);
|
||||
break;
|
||||
case OV_ENOTVORBIS:
|
||||
log_error("%s: invalid Vorbis bitstream",
|
||||
md->filename);
|
||||
break;
|
||||
case OV_EVERSION:
|
||||
log_error("%s: Vorbis version mismatch",
|
||||
md->filename);
|
||||
break;
|
||||
case OV_EBADHEADER:
|
||||
log_error("%s: invalid Vorbis bitstream header",
|
||||
md->filename);
|
||||
break;
|
||||
case OV_EFAULT:
|
||||
log_alert("libvorbisfile fault");
|
||||
abort();
|
||||
default:
|
||||
log_error("%s: unknown error",
|
||||
md->filename);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
char **ptr;
|
||||
|
||||
for (ptr = ov_comment(&vf, -1)->user_comments; *ptr != NULL; ptr++) {
|
||||
if (md->artist == NULL &&
|
||||
strncasecmp(*ptr, "ARTIST", strlen("ARTIST")) == 0) {
|
||||
if (strlen(*ptr + strlen("ARTIST=")) > 0)
|
||||
md->artist = xstrdup(*ptr + strlen("ARTIST="));
|
||||
}
|
||||
if (md->title == NULL &&
|
||||
strncasecmp(*ptr, "TITLE", strlen("TITLE")) == 0) {
|
||||
if (strlen(*ptr + strlen("TITLE=")) > 0)
|
||||
md->title = xstrdup(*ptr + strlen("TITLE="));
|
||||
}
|
||||
}
|
||||
|
||||
ov_clear(&vf);
|
||||
*filep = NULL;
|
||||
}
|
||||
#endif /* HAVE_VORBISFILE */
|
||||
}
|
||||
|
||||
if (*filep != NULL)
|
||||
fclose(*filep);
|
||||
|
||||
if (md->artist == NULL && md->title == NULL)
|
||||
md->string = metadata_get_name(md->filename);
|
||||
}
|
||||
#endif /* HAVE_TAGLIB */
|
||||
|
||||
static void
|
||||
metadata_clean_md(struct metadata *md)
|
||||
@ -262,19 +156,6 @@ metadata_clean_md(struct metadata *md)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
metadata_get_extension(char *buf, size_t siz, const char *filename)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if ((p = strrchr(filename, '.')) != NULL)
|
||||
strlcpy(buf, p, siz);
|
||||
else
|
||||
buf[0] = '\0';
|
||||
for (p = buf; *p != '\0'; p++)
|
||||
*p = tolower((int)*p);
|
||||
}
|
||||
|
||||
static char *
|
||||
metadata_get_name(const char *file)
|
||||
{
|
||||
@ -416,12 +297,7 @@ metadata_file_update(struct metadata *md)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_TAGLIB
|
||||
metadata_use_taglib(md, &filep);
|
||||
#else
|
||||
metadata_use_self(md, &filep);
|
||||
#endif /* HAVE_TAGLIB */
|
||||
|
||||
metadata_get(md, &filep);
|
||||
metadata_process_md(md);
|
||||
|
||||
return (1);
|
||||
|
Loading…
Reference in New Issue
Block a user