Commit 887593ce authored by Led's avatar Led

0.11.0-pre1

parent 70d6e3ee
......@@ -4,6 +4,7 @@ wave File Support -> normalperson
setuid patch -> Nagilum
'next' and 'previous' patch -> Niklas Hofer
command.c cleanup -> mackstann
replayGain -> AliasMrJones
libid3tag and libmad copyrighted by Robert Leslie, http://www.underbit.com/products/mad
mp4ff copyrighted by M. Bakker, Ahead Software AG, http://www.nero.com
ver 0.10.4 (2004/5/26)
1) Fix configure problems on OpenBSD with langinfo and iconv
2) Fix an infinte loop when writing to an interface and it has expired
3) Fix a segfault in decoding flac's
4) Ingore CRC stuff in mp3's since some encoders did not compute the CRC correctly
5) Fix a segfault in processing faulty mp4 metadata
ver 0.10.3 (2004/4/2)
1) Fix a segfault when a blanck line is sent from a client
2) Fix for loading playlists on platforms where char is unsigned
......
......@@ -76,7 +76,7 @@ Run
$ mpd <port> <mp3 directory> <playlist directory> <mpd log> <mpd err>
example where mpd executable is in mpd-x.x.x directory:
$ mpd-x.x.x/mpd 2100 mp3 playlists mpd.log mpd.err
$ mpd-x.x.x/mpd 6600 mp3 playlists mpd.log mpd.err
Note: The first time you run mpd, it will "explore" your mp3 directory for
mp3's.
......
......@@ -84,6 +84,10 @@ ID3_SUBDIR = @ID3_SUBDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBMIKMOD_CFLAGS = @LIBMIKMOD_CFLAGS@
LIBMIKMOD_CONFIG = @LIBMIKMOD_CONFIG@
LIBMIKMOD_LDADD = @LIBMIKMOD_LDADD@
LIBMIKMOD_LIBS = @LIBMIKMOD_LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAD_LIB = @MAD_LIB@
......
1) put some sort of error reporting for streaming/inputStream!
2) Fix charset errors so they don't goto stderr/out
Post-1.0
--------
1) crosslink "list" stuff, for example, artists are crosslinked to alubms and
vice versa, this way you can do list album artists or list artist albums, this
will make life easier when we add genre and other metadata
2) rewrite linked list impelmentation to be more flexible
a) remove "key" stuff
b) allow assigning a compare function for a list
......@@ -836,6 +836,20 @@ case $host in
rm -rf conftest*
;;
*-*-linux*)
# Test if the compiler is 64bit
echo 'int i;' > conftest.$ac_ext
lt_cv_cc_64bit_output=no
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
*"ELF 64"*)
lt_cv_cc_64bit_output=yes
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
......@@ -2113,6 +2127,30 @@ EOF
hardcode_shlibpath_var=no
;;
linux*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
*\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
if test $supports_anon_versioning = yes; then
archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
$archive_expsym_cmds="$archive_cmds"
fi
else
ld_shlibs=no
fi
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
......@@ -2646,8 +2684,8 @@ shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib"
case $host_os in
aix3*)
......@@ -2881,6 +2919,13 @@ linux-gnu*)
# before this can be enabled.
hardcode_into_libs=yes
case $host_cpu:$lt_cv_cc_64bit_output in
powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64"
sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64"
;;
esac
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
......@@ -2892,7 +2937,7 @@ linux-gnu*)
# Find out which ABI we are using (multilib Linux x86_64 hack).
libsuff=
case "$host_cpu" in
x86_64*|s390x*)
x86_64*)
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
......@@ -5123,3 +5168,211 @@ END
rm -f conf.audiofiletest
])
# Configure paths for libmikmod
#
# Derived from glib.m4 (Owen Taylor 97-11-3)
# Improved by Chris Butler
#
dnl AM_PATH_LIBMIKMOD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libmikmod, and define LIBMIKMOD_CFLAGS, LIBMIKMOD_LIBS and
dnl LIBMIKMOD_LDADD
dnl
AC_DEFUN(AM_PATH_LIBMIKMOD,
[dnl
dnl Get the cflags and libraries from the libmikmod-config script
dnl
AC_ARG_WITH(libmikmod-prefix,[ --with-libmikmod-prefix=PFX Prefix where libmikmod is installed (optional)],
libmikmod_config_prefix="$withval", libmikmod_config_prefix="")
AC_ARG_WITH(libmikmod-exec-prefix,[ --with-libmikmod-exec-prefix=PFX Exec prefix where libmikmod is installed (optional)],
libmikmod_config_exec_prefix="$withval", libmikmod_config_exec_prefix="")
AC_ARG_ENABLE(libmikmodtest, [ --disable-libmikmodtest Do not try to compile and run a test libmikmod program],
, enable_libmikmodtest=yes)
if test x$libmikmod_config_exec_prefix != x ; then
libmikmod_config_args="$libmikmod_config_args --exec-prefix=$libmikmod_config_exec_prefix"
if test x${LIBMIKMOD_CONFIG+set} != xset ; then
LIBMIKMOD_CONFIG=$libmikmod_config_exec_prefix/bin/libmikmod-config
fi
fi
if test x$libmikmod_config_prefix != x ; then
libmikmod_config_args="$libmikmod_config_args --prefix=$libmikmod_config_prefix"
if test x${LIBMIKMOD_CONFIG+set} != xset ; then
LIBMIKMOD_CONFIG=$libmikmod_config_prefix/bin/libmikmod-config
fi
fi
AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no)
min_libmikmod_version=ifelse([$1], ,3.1.5,$1)
AC_MSG_CHECKING(for libmikmod - version >= $min_libmikmod_version)
no_libmikmod=""
if test "$LIBMIKMOD_CONFIG" = "no" ; then
no_libmikmod=yes
else
LIBMIKMOD_CFLAGS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --cflags`
LIBMIKMOD_LIBS=`$LIBMIKMOD_CONFIG $libmikmod_config_args --libs`
LIBMIKMOD_LDADD=`$LIBMIKMOD_CONFIG $libmikmod_config_args --ldadd`
libmikmod_config_major_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
libmikmod_config_minor_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
libmikmod_config_micro_version=`$LIBMIKMOD_CONFIG $libmikmod_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\).*/\3/'`
if test "x$enable_libmikmodtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
AC_LANG_SAVE
AC_LANG_C
CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS $LIBMIKMOD_LDADD"
LIBS="$LIBMIKMOD_LIBS $LIBS"
dnl
dnl Now check if the installed libmikmod is sufficiently new. (Also sanity
dnl checks the results of libmikmod-config to some extent
dnl
rm -f conf.mikmodtest
AC_TRY_RUN([
#include <mikmod.h>
#include <stdio.h>
#include <stdlib.h>
char* my_strdup (char *str)
{
char *new_str;
if (str) {
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
} else
new_str = NULL;
return new_str;
}
int main()
{
int major,minor,micro;
int libmikmod_major_version,libmikmod_minor_version,libmikmod_micro_version;
char *tmp_version;
system("touch conf.mikmodtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_libmikmod_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_libmikmod_version");
exit(1);
}
libmikmod_major_version=(MikMod_GetVersion() >> 16) & 255;
libmikmod_minor_version=(MikMod_GetVersion() >> 8) & 255;
libmikmod_micro_version=(MikMod_GetVersion() ) & 255;
if ((libmikmod_major_version != $libmikmod_config_major_version) ||
(libmikmod_minor_version != $libmikmod_config_minor_version) ||
(libmikmod_micro_version != $libmikmod_config_micro_version))
{
printf("\n*** 'libmikmod-config --version' returned %d.%d.%d, but libmikmod (%d.%d.%d)\n",
$libmikmod_config_major_version, $libmikmod_config_minor_version, $libmikmod_config_micro_version,
libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
printf ("*** was found! If libmikmod-config was correct, then it is best\n");
printf ("*** to remove the old version of libmikmod. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If libmikmod-config was wrong, set the environment variable LIBMIKMOD_CONFIG\n");
printf("*** to point to the correct copy of libmikmod-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
else if ((libmikmod_major_version != LIBMIKMOD_VERSION_MAJOR) ||
(libmikmod_minor_version != LIBMIKMOD_VERSION_MINOR) ||
(libmikmod_micro_version != LIBMIKMOD_REVISION))
{
printf("*** libmikmod header files (version %d.%d.%d) do not match\n",
LIBMIKMOD_VERSION_MAJOR, LIBMIKMOD_VERSION_MINOR, LIBMIKMOD_REVISION);
printf("*** library (version %d.%d.%d)\n",
libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
}
else
{
if ((libmikmod_major_version > major) ||
((libmikmod_major_version == major) && (libmikmod_minor_version > minor)) ||
((libmikmod_major_version == major) && (libmikmod_minor_version == minor) && (libmikmod_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of libmikmod (%d.%d.%d) was found.\n",
libmikmod_major_version, libmikmod_minor_version, libmikmod_micro_version);
printf("*** You need a version of libmikmod newer than %d.%d.%d.\n",
major, minor, micro);
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the libmikmod-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of libmikmod, but you can also set the LIBMIKMOD_CONFIG environment to point to the\n");
printf("*** correct copy of libmikmod-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_libmikmod=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
fi
fi
if test "x$no_libmikmod" = x ; then
AC_MSG_RESULT([yes, `$LIBMIKMOD_CONFIG --version`])
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$LIBMIKMOD_CONFIG" = "no" ; then
echo "*** The libmikmod-config script installed by libmikmod could not be found"
echo "*** If libmikmod was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the LIBMIKMOD_CONFIG environment variable to the"
echo "*** full path to libmikmod-config."
else
if test -f conf.mikmodtest ; then
:
else
echo "*** Could not run libmikmod test program, checking why..."
CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS"
LIBS="$LIBS $LIBMIKMOD_LIBS"
AC_LANG_SAVE
AC_LANG_C
AC_TRY_LINK([
#include <mikmod.h>
#include <stdio.h>
], [ return (MikMod_GetVersion()!=0); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding libmikmod or finding the wrong"
echo "*** version of libmikmod. If it is not finding libmikmod, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location. Also, make sure you have run ldconfig if that"
echo "*** is required on your system."
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means libmikmod was incorrectly installed"
echo "*** or that you have moved libmikmod since it was installed. In the latter case, you"
echo "*** may want to edit the libmikmod-config script: $LIBMIKMOD_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
AC_LANG_RESTORE
fi
fi
LIBMIKMOD_CFLAGS=""
LIBMIKMOD_LIBS=""
LIBMIKMOD_LDADD=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBMIKMOD_CFLAGS)
AC_SUBST(LIBMIKMOD_LIBS)
AC_SUBST(LIBMIKMOD_LDADD)
rm -f conf.mikmodtest
])
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2003-01-10'
timestamp='2002-10-21'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
......@@ -98,17 +98,14 @@ trap 'exit 1' 1 2 15
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
# This shell variable is my proudest work .. or something. --bje
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
|| (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
dummy=$tmpdir/dummy ;
files="$dummy.c $dummy.o $dummy.rel $dummy" ;
trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
......@@ -116,13 +113,15 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
rm -f $files ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ;'
esac ;
unset files'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
......@@ -179,18 +178,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
......@@ -235,9 +223,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:MicroBSD:*:*)
echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
......@@ -301,6 +286,7 @@ EOF
;;
esac
fi
rm -f $dummy.s $dummy && rmdir $tmpdir
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
......@@ -453,7 +439,8 @@ EOF
EOF
$CC_FOR_BUILD -o $dummy $dummy.c \
&& $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& exit 0
&& rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Motorola:PowerMAX_OS:*:*)
......@@ -462,7 +449,7 @@ EOF
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
Night_Hawk:*:*:PowerMAX_OS)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
......@@ -537,7 +524,8 @@ EOF
exit(0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
......@@ -636,20 +624,10 @@ EOF
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
rm -f $dummy.c $dummy && rmdir $tmpdir
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
# avoid double evaluation of $set_cc_for_build
test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
ia64:HP-UX:*:*)
......@@ -683,7 +661,8 @@ EOF
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
......@@ -741,15 +720,15 @@ EOF
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3D:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
*:UNICOS/mp:*:*)
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
......@@ -777,6 +756,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c && rmdir $tmpdir
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
exit 0 ;;
i*:CYGWIN*:*)
......@@ -789,16 +769,13 @@ EOF
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:3*)
echo i586-pc-interix3
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
echo i386-pc-interix3
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
......@@ -841,26 +818,8 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
rm -f $dummy.c && rmdir $tmpdir
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
......@@ -955,6 +914,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c && rmdir $tmpdir
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
......@@ -972,23 +932,6 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
......@@ -1023,6 +966,9 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
......@@ -1049,12 +995,9 @@ EOF
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit 0 ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
......@@ -1071,6 +1014,9 @@ EOF
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
......@@ -1152,11 +1098,7 @@ EOF
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
case `uname -p` in
*86) UNAME_PROCESSOR=i686 ;;
powerpc) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
......@@ -1192,6 +1134,11 @@ EOF
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit 0 ;;
......@@ -1210,6 +1157,12 @@ EOF
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
......@@ -1330,7 +1283,8 @@ main ()
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
# Apollos put the system type in the environment.
......
......@@ -3,6 +3,9 @@
/* Define if alsa support is present */
#undef HAVE_ALSA
/* Define to play audio */
#undef HAVE_AUDIO
/* Define for audiofile support */
#undef HAVE_AUDIOFILE
......@@ -64,6 +67,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define for mikmod support */
#undef HAVE_MIKMOD
/* Define to 1 if the system has the type `mp4AudioSpecificConfig'. */
#undef HAVE_MP4AUDIOSPECIFICCONFIG
......
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2003-01-03'
timestamp='2002-09-05'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
......@@ -118,7 +118,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
......@@ -245,19 +245,16 @@ case $basic_machine in
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| msp430 \
| ns16k | ns32k \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| s390 | s390x \
| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
......@@ -318,19 +315,16 @@ case $basic_machine in
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| mipstx39 | mipstx39el \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| s390-* | s390x-* \
| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
......@@ -373,6 +367,9 @@ case $basic_machine in
basic_machine=a29k-none
os=-bsd
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
......@@ -722,10 +719,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
......@@ -822,6 +815,12 @@ case $basic_machine in
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
......@@ -905,6 +904,10 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
t3d)
basic_machine=alpha-cray
os=-unicos
;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
......@@ -977,6 +980,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
windows32)
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
......@@ -1109,12 +1116,11 @@ case $os in
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -microbsd*)
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
......@@ -1126,10 +1132,8 @@ case $os in
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
os=-nto-qnx
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,7 +2,7 @@ dnl AC_INIT(src/main.c)
dnl AM_INIT_AUTOMAKE(mpd, 0.10.0)
AC_PREREQ(2.52)
AC_INIT(mpd, 0.10.4, shank@mercury.chem.pitt.edu)
AC_INIT(mpd, 0.11.0, shank@mercury.chem.pitt.edu)
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
dnl MAD wants this stuff
......@@ -21,22 +21,28 @@ AC_SUBST(MPD_CFLAGS)
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AM_CONFIG_HEADER(config.h)
MPD_CFLAGS="-Wall"
MPD_CFLAGS=""
if test x$CC = xgcc; then
MPD_CFLAGS="-Wall"
fi
MPD_LIBS=""
AC_ARG_ENABLE(audio,[ --disable-audio disable support for playing],,enable_ao=yes)
AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support],,enable_iconv=yes)
AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support],,enable_ipv6=yes)
AC_ARG_ENABLE(alsa,[ --disable-alsa disable Alsa Mixer support],,enable_alsa=yes)
AC_ARG_ENABLE(alsa,[ --disable-alsa disable ALSA Mixer support],,enable_alsa=yes)
AC_ARG_ENABLE(ogg,[ --disable-ogg disable ogg support],,enable_ogg=yes)
AC_ARG_ENABLE(flac,[ --disable-flac disable flac support],,enable_flac=yes)
AC_ARG_ENABLE(mp3,[ --disable-mp3 disable mp3 support],,enable_mp3=yes)
AC_ARG_ENABLE(aac,[ --disable-aac disable AAC support],,enable_aac=yes)
AC_ARG_ENABLE(audiofile,[ --disable-audiofile disable audiofile support, disables wave support],,enable_audiofile=yes)
AC_ARG_ENABLE(mpd_mad,[ --enable-mpd-mad use mpd libmad],use_mpd_mad=yes,)
AC_ARG_ENABLE(mod,[ --disable-mod disable MOD support],,enable_mod=yes)
AC_ARG_ENABLE(id3,[ --disable-id3 disable id3 support],,enable_id3=yes)
AC_ARG_ENABLE(mpd_mad,[ --enable-mpd-mad use mpd libmad],use_mpd_mad=yes,)
AC_ARG_ENABLE(mpd_id3tag,[ --enable-mpd-id3tag use mpd libid3tag],use_mpd_id3tag=yes,)
AC_ARG_WITH(iconv,[ --with-iconv=PFX Prefix where iconv is installed (optional)], iconv_prefix="$withval", iconv_prefix="")
......@@ -69,6 +75,8 @@ AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
AC_CHECK_LIB(m,exp,MPD_LIBS="$MPD_LIBS -lm",)
dnl doesn't work for systems that don't have CODESET like OpenBSD
dnl AC_CHECK_HEADER(langinfo.h,[enable_langinfo=yes;AC_DEFINE(HAVE_LANGINFO,1,[Define if nl_langinfo.h is present])],enable_langinfo=no)
AM_LANGINFO_CODESET
AC_CHECK_HEADER(locale.h,[enable_locale=yes;AC_DEFINE(HAVE_LOCALE,1,[Define if locale.h is present])],enable_locale=no)
......@@ -91,7 +99,11 @@ AP_maGiC_VALUE
)
fi
XIPH_PATH_AO(MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS",AC_MSG_ERROR(Must have libao installed!!!))
if test x$enable_ao = xyes; then
XIPH_PATH_AO(MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS",AC_MSG_ERROR(Must have libao installed!!!))
AC_DEFINE(HAVE_AUDIO, 1, [Define to play audio])
fi
AC_CHECK_HEADER(sys/soundcard.h,enable_oss=yes,[AC_MSG_WARN(Soundcard headers not found -- disabling OSS mixer);enable_oss=no;AC_DEFINE(NO_OSS_MIXER,1,[Define to disable OSS mixer support])])
if test x$enable_alsa = xyes; then
......@@ -462,6 +474,14 @@ if test x$enable_audiofile = xyes; then
AC_DEFINE(HAVE_AUDIOFILE,1,[Define for audiofile support])
fi
if test x$enable_mod = xyes; then
AM_PATH_LIBMIKMOD(3.1.7, MPD_CFLAGS="$MPD_CFLAGS $LIBMIKMOD_CFLAGS"
MPD_LIBS="$MPD_LIBS $LIBMIKMOD_LIBS", enable_mod=no)
if test x$enable_mod = xyes; then
AC_DEFINE(HAVE_MIKMOD, 1, [Define for mikmod support])
fi
fi
AC_OUTPUT(src/mp4ff/Makefile doc/Makefile src/Makefile Makefile )
echo ""
......@@ -475,9 +495,9 @@ else
fi
if test x$enable_alsa = xyes; then
echo "Alsa mixer support ............enabled"
echo "ALSA mixer support ............enabled"
else
echo "Alsa mixer support ............disabled"
echo "ALSA mixer support ............disabled"
fi
echo ""
......@@ -502,6 +522,12 @@ fi
echo ""
echo "Audio Format Support:"
if test x$enable_ao = xyes; then
echo "Playing audio .................enabled"
else
echo "Playing audio .................disabled"
fi
if test x$enable_id3 = xyes; then
echo "ID3 tag support ...............enabled"
if test x$use_mpd_id3tag = xyes; then
......@@ -548,6 +574,12 @@ else
echo "MP4/AAC support ...............disabled"
fi
if test x$enable_mod = xyes; then
echo "MOD support ...................enabled"
else
echo "MOD support ...................disabled"
fi
echo ""
echo "##########################################"
echo ""
......
......@@ -106,8 +106,9 @@ playlist
displays the current playlist
NOTE: do not use this, instead use 'playlistinfo'
playlistinfo
displays information about the current playlist
playlistinfo <int song>
displays list of songs in the playlist
_song_ is optional and species a single song to displa info for
previous
plays previous song in playlist
......@@ -125,7 +126,8 @@ save <string name>
saves the current playlist to _name_.m3u in the playlist directory
search <string type> <string what>
same as "find" but searches for any song that contain _what_
searches for any song that contain _what_
_type_ can be "title","artist","album", or "filename"
search is not case sensitive
seek <int song> <int time>
......@@ -162,6 +164,7 @@ status
bitrate: <int bitrate> (instantaneous bitrate in kbps)
xfade: <int seconds> (crossfade in seconds)
audio: <int sampleRate>:<int bits>:<int channels>
updatings_db: <int job id>
error: if there is an error, returns message here
stop
......@@ -171,9 +174,17 @@ swap <int song1> <int song2>
swap positions of _song1_ and _song2_
increments playlist version by 1
update
update <string path>
searches mp3 directory for new music and removes old music from the db
_path_ is an optional argument that maybe a particular directory or
song/file to update.
returned:
updating_db: <int job id>
where job id, is the job id requested for your update, and is displayed
in status, while the requested update is happening
increments playlist version by 1
NOTE: to update a number of paths/songs at once, use command_list,
it will be much more faster/effecient
volume <int change>
change volume by amount _change_
......
......@@ -84,6 +84,10 @@ ID3_SUBDIR = @ID3_SUBDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBMIKMOD_CFLAGS = @LIBMIKMOD_CFLAGS@
LIBMIKMOD_CONFIG = @LIBMIKMOD_CONFIG@
LIBMIKMOD_LDADD = @LIBMIKMOD_LDADD@
LIBMIKMOD_LIBS = @LIBMIKMOD_LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAD_LIB = @MAD_LIB@
......
......@@ -45,7 +45,7 @@ Below are a list of parameters that can be specified in the config file. Each l
parameter "value"
.TP
.B port <port>
This specifies the port that MPD listens on. This parameter is required. This is typically 2100.
This specifies the port that MPD listens on. This parameter is required. This is typically 6600.
.TP
.B music_directory <directory>
This specifies the directory where music is located. This parameter is required. The directory path should be an absolute path.
......@@ -155,7 +155,7 @@ Below is an example config file. (Note: '#' at the beginning of a line denotes a
.br
# required
.br
port "2100"
port "6600"
.br
music_directory "~/mp3"
.br
......
......@@ -4,7 +4,7 @@
########## REQUIRED ###############
port "2100"
port "6600"
music_directory "~/music"
playlist_directory "~/.mpd/playlists"
log_file "~/.mpd/mpd.log"
......@@ -97,7 +97,7 @@ error_file "~/.mpd/mpd.error"
########### MISC OPTIONS #################
#max_playlist_length "4096"
#max_playlist_length "16384"
#connection_timeout "60"
#max_connections "5"
#max_command_list_size "2048"
......
......@@ -1214,6 +1214,11 @@ compiler."
continue
;;
-Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread )
compiler_flags="$compiler_flags $arg"
continue
;;
# Some other compiler flag.
-* | +*)
# Unknown arguments in both finalize_command and compile_command need
......@@ -1393,7 +1398,7 @@ compiler."
;;
esac
for pass in $passes; do
if test $linkmode = prog; then
if test "$linkmode" = prog; then
# Determine which files to process
case $pass in
dlopen)
......@@ -1410,11 +1415,11 @@ compiler."
found=no
case $deplib in
-l*)
if test $linkmode = oldlib && test $linkmode = obj; then
if test "$linkmode" = oldlib && test "$linkmode" = obj; then
$echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
continue
fi
if test $pass = conv; then
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
......@@ -1434,7 +1439,7 @@ compiler."
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
fi
......@@ -1443,16 +1448,16 @@ compiler."
case $linkmode in
lib)
deplibs="$deplib $deplibs"
test $pass = conv && continue
test "$pass" = conv && continue
newdependency_libs="$deplib $newdependency_libs"
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
;;
prog)
if test $pass = conv; then
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
if test $pass = scan; then
if test "$pass" = scan; then
deplibs="$deplib $deplibs"
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
else
......@@ -1467,7 +1472,7 @@ compiler."
continue
;; # -L
-R*)
if test $pass = link; then
if test "$pass" = link; then
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
......@@ -1480,7 +1485,7 @@ compiler."
;;
*.la) lib="$deplib" ;;
*.$libext)
if test $pass = conv; then
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
......@@ -1503,7 +1508,7 @@ compiler."
continue
;;
prog)
if test $pass != link; then
if test "$pass" != link; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
......@@ -1514,7 +1519,7 @@ compiler."
esac # linkmode
;; # *.$libext
*.lo | *.$objext)
if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
# If there is no dlopen support or we're linking statically,
# we need to preload.
newdlprefiles="$newdlprefiles $deplib"
......@@ -1530,7 +1535,7 @@ compiler."
continue
;;
esac # case $deplib
if test $found = yes || test -f "$lib"; then :
if test "$found" = yes || test -f "$lib"; then :
else
$echo "$modename: cannot find the library \`$lib'" 1>&2
exit 1
......@@ -1564,13 +1569,13 @@ compiler."
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test $linkmode = oldlib && test $linkmode = obj; }; then
{ test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
# Add dl[pre]opened files of deplib
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
fi
if test $pass = conv; then
if test "$pass" = conv; then
# Only check for convenience libraries
deplibs="$lib $deplibs"
if test -z "$libdir"; then
......@@ -1591,7 +1596,7 @@ compiler."
fi
tmp_libs="$tmp_libs $deplib"
done
elif test $linkmode != prog && test $linkmode != lib; then
elif test "$linkmode" != prog && test "$linkmode" != lib; then
$echo "$modename: \`$lib' is not a convenience library" 1>&2
exit 1
fi
......@@ -1609,7 +1614,7 @@ compiler."
fi
# This library was specified with -dlopen.
if test $pass = dlopen; then
if test "$pass" = dlopen; then
if test -z "$libdir"; then
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
exit 1
......@@ -1658,7 +1663,7 @@ compiler."
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
# This library was specified with -dlpreopen.
if test $pass = dlpreopen; then
if test "$pass" = dlpreopen; then
if test -z "$libdir"; then
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
exit 1
......@@ -1677,7 +1682,7 @@ compiler."
if test -z "$libdir"; then
# Link the convenience library
if test $linkmode = lib; then
if test "$linkmode" = lib; then
deplibs="$dir/$old_library $deplibs"
elif test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$dir/$old_library $compile_deplibs"
......@@ -1688,7 +1693,7 @@ compiler."
continue
fi
if test $linkmode = prog && test $pass != link; then
if test "$linkmode" = prog && test "$pass" != link; then
newlib_search_path="$newlib_search_path $ladir"
deplibs="$lib $deplibs"
......@@ -1704,7 +1709,7 @@ compiler."
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
esac
# Need to link against all dependency_libs?
if test $linkalldeplibs = yes; then
if test "$linkalldeplibs" = yes; then
deplibs="$deplib $deplibs"
else
# Need to hardcode shared library paths
......@@ -1727,7 +1732,7 @@ compiler."
# Link against this shared library
if test "$linkmode,$pass" = "prog,link" ||
{ test $linkmode = lib && test $hardcode_into_libs = yes; }; then
{ test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
......@@ -1749,7 +1754,7 @@ compiler."
esac
;;
esac
if test $linkmode = prog; then
if test "$linkmode" = prog; then
# We need to hardcode the library path
if test -n "$shlibpath_var"; then
# Make sure the rpath contains only unique directories.
......@@ -1833,7 +1838,7 @@ compiler."
linklib=$newlib
fi # test -n $old_archive_from_expsyms_cmds
if test $linkmode = prog || test "$mode" != relink; then
if test "$linkmode" = prog || test "$mode" != relink; then
add_shlibpath=
add_dir=
add=
......@@ -1882,7 +1887,7 @@ compiler."
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
esac
fi
if test $linkmode = prog; then
if test "$linkmode" = prog; then
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
test -n "$add" && compile_deplibs="$add $compile_deplibs"
else
......@@ -1899,7 +1904,7 @@ compiler."
fi
fi
if test $linkmode = prog || test "$mode" = relink; then
if test "$linkmode" = prog || test "$mode" = relink; then
add_shlibpath=
add_dir=
add=
......@@ -1939,7 +1944,7 @@ compiler."
add="-l$name"
fi
if test $linkmode = prog; then
if test "$linkmode" = prog; then
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
else
......@@ -1947,7 +1952,7 @@ compiler."
test -n "$add" && deplibs="$add $deplibs"
fi
fi
elif test $linkmode = prog; then
elif test "$linkmode" = prog; then
if test "$alldeplibs" = yes &&
{ test "$deplibs_check_method" = pass_all ||
{ test "$build_libtool_libs" = yes &&
......@@ -2007,10 +2012,10 @@ compiler."
fi
fi # link shared/static library?
if test $linkmode = lib; then
if test "$linkmode" = lib; then
if test -n "$dependency_libs" &&
{ test $hardcode_into_libs != yes || test $build_old_libs = yes ||
test $link_static = yes; }; then
{ test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
test "$link_static" = yes; }; then
# Extract -R from dependency_libs
temp_deplibs=
for libdir in $dependency_libs; do
......@@ -2041,7 +2046,7 @@ compiler."
tmp_libs="$tmp_libs $deplib"
done
if test $link_all_deplibs != no; then
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
case $deplib in
......@@ -2084,15 +2089,15 @@ compiler."
fi # link_all_deplibs != no
fi # linkmode = lib
done # for deplib in $libs
if test $pass = dlpreopen; then
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
for deplib in $save_deplibs; do
deplibs="$deplib $deplibs"
done
fi
if test $pass != dlopen; then
test $pass != scan && dependency_libs="$newdependency_libs"
if test $pass != conv; then
if test "$pass" != dlopen; then
test "$pass" != scan && dependency_libs="$newdependency_libs"
if test "$pass" != conv; then
# Make sure lib_search_path contains only unique directories.
lib_search_path=
for dir in $newlib_search_path; do
......@@ -2150,7 +2155,7 @@ compiler."
deplibs=
fi
done # for pass
if test $linkmode = prog; then
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
dlprefiles="$newdlprefiles"
fi
......@@ -2462,7 +2467,7 @@ compiler."
*) finalize_rpath="$finalize_rpath $libdir" ;;
esac
done
if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
dependency_libs="$temp_xrpath $dependency_libs"
fi
fi
......@@ -2505,7 +2510,7 @@ compiler."
;;
*)
# Add libc to deplibs on all other systems if necessary.
if test $build_libtool_need_lc = "yes"; then
if test "$build_libtool_need_lc" = "yes"; then
deplibs="$deplibs -lc"
fi
;;
......@@ -2643,6 +2648,13 @@ EOF
*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
esac
done
# It is ok to link against an archive when
# building a shared library.
if $AR -t $potlib > /dev/null 2>&1; then
newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
fi
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
| ${SED} 10q \
| egrep "$file_magic_regex" > /dev/null; then
......@@ -2770,7 +2782,7 @@ EOF
echo "*** automatically added whenever a program is linked with this library"
echo "*** or is declared to -dlopen it."
if test $allow_undefined = no; then
if test "$allow_undefined" = no; then
echo
echo "*** Since this library must not contain undefined symbols,"
echo "*** because either the platform does not support them or"
......@@ -2797,7 +2809,7 @@ EOF
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
if test $hardcode_into_libs = yes; then
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
dep_rpath=
......@@ -3505,7 +3517,7 @@ static const void *lt_preloaded_setup() {
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
fi
if test $need_relink = no || test "$build_libtool_libs" != yes; then
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
# Replace the output file specification.
compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
link_command="$compile_command$compile_rpath"
......@@ -3982,9 +3994,46 @@ fi\
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
exit 1
fi
newdependency_libs="$newdependency_libs $libdir/$name"
# We do not want portage's install root ($D) present. Check only for
# this if the .la is being installed.
if test "$installed" = yes && test "$D"; then
eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
else
mynewdependency_lib="$libdir/$name"
fi
# Do not add duplicates
if test "$mynewdependency_lib"; then
if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
newdependency_libs="$newdependency_libs $mynewdependency_lib"
fi
fi
;;
*)
if test "$installed" = yes; then
# Rather use S=WORKDIR if our version of portage supports it.
# This is because some ebuild (gcc) do not use $S as buildroot.
if test "$PWORKDIR"; then
S="$PWORKDIR"
fi
# We do not want portage's build root ($S) present.
if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
mynewdependency_lib=""
# We do not want portage's install root ($D) present.
elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
else
mynewdependency_lib="$deplib"
fi
else
mynewdependency_lib="$deplib"
fi
# Do not add duplicates
if test "$mynewdependency_lib"; then
if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
newdependency_libs="$newdependency_libs $mynewdependency_lib"
fi
fi
;;
*) newdependency_libs="$newdependency_libs $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
......@@ -4017,6 +4066,10 @@ fi\
case $host,$output,$installed,$module,$dlname in
*cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
esac
# Do not add duplicates
if test "$installed" = yes && test "$D"; then
install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
fi
$echo > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
......@@ -4050,7 +4103,7 @@ dlpreopen='$dlprefiles'
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
if test "$installed" = no && test $need_relink = yes; then
if test "$installed" = no && test "$need_relink" = yes; then
$echo >> $output "\
relink_command=\"$relink_command\""
fi
......@@ -4447,13 +4500,11 @@ relink_command=\"$relink_command\""
if test "$finalize" = yes && test -z "$run"; then
tmpdir="/tmp"
test -n "$TMPDIR" && tmpdir="$TMPDIR"
tmpdir_mktemp=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
if test $? = 0 ; then
tmpdir="$tmpdir_mktemp"
unset tmpdir_mktemp
else
tmpdir="$tmpdir/libtool-$$"
fi
tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
if test $? = 0 ; then :
else
tmpdir="$tmpdir/libtool-$$"
fi
if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
else
$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
......@@ -4794,10 +4845,10 @@ relink_command=\"$relink_command\""
objdir="$dir/$objdir"
fi
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
test $mode = uninstall && objdir="$dir"
test "$mode" = uninstall && objdir="$dir"
# Remember objdir for removal later, being careful to avoid duplicates
if test $mode = clean; then
if test "$mode" = clean; then
case " $rmdirs " in
*" $objdir "*) ;;
*) rmdirs="$rmdirs $objdir" ;;
......@@ -4829,9 +4880,9 @@ relink_command=\"$relink_command\""
rmfiles="$rmfiles $objdir/$n"
done
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
if test $mode = uninstall; then
if test "$mode" = uninstall; then
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
eval cmds=\"$postuninstall_cmds\"
......@@ -4875,7 +4926,7 @@ relink_command=\"$relink_command\""
*)
# Do a test to see if this is a libtool program.
if test $mode = clean &&
if test "$mode" = clean &&
(${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
relink_command=
. $dir/$file
......
bin_PROGRAMS = mpd
SUBDIRS = $(ID3_SUBDIR) $(MAD_SUBDIR) $(MP4FF_SUBDIR)
mpd_inputPlugins = inputPlugins/mp3_plugin.c inputPlugins/ogg_plugin.c \
inputPlugins/flac_plugin.c inputPlugins/audiofile_plugin.c \
inputPlugins/mp4_plugin.c inputPlugins/aac_plugin.c \
inputPlugins/mod_plugin.c
mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
song.h list.h directory.h tables.h utils.h path.h mp3_decode.h \
tag.h player.h listen.h conf.h ogg_decode.h volume.h flac_decode.h \
song.h list.h directory.h tables.h utils.h path.h \
tag.h player.h listen.h conf.h volume.h \
audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h \
audiofile_decode.h charConv.h permission.h mpd_types.h pcm_utils.h \
mp4_decode.h aac_decode.h
charConv.h permission.h mpd_types.h pcm_utils.h \
signal_check.h utf8.h inputStream.h \
outputBuffer.h replayGain.h inputStream_file.h inputStream_http.h \
inputPlugin.h
mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
song.c list.c directory.c tables.c utils.c path.c mp3_decode.c \
tag.c player.c listen.c conf.c ogg_decode.c volume.c flac_decode.c \
song.c list.c directory.c tables.c utils.c path.c \
tag.c player.c listen.c conf.c volume.c \
audio.c playerData.c stats.c myfprintf.c sig_handlers.c decode.c log.c \
audiofile_decode.c charConv.c permission.c pcm_utils.c mp4_decode.c \
aac_decode.c $(mpd_headers)
charConv.c permission.c pcm_utils.c \
signal_check.c utf8.c inputStream.c outputBuffer.c \
replayGain.c inputStream_file.c inputStream_http.c inputPlugin.c \
$(mpd_headers) $(mpd_inputPlugins)
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_LDADD = $(MPD_LIBS) $(ID3_LIB) $(MAD_LIB) $(MP4FF_LIB)
......
......@@ -84,6 +84,10 @@ ID3_SUBDIR = @ID3_SUBDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBMIKMOD_CFLAGS = @LIBMIKMOD_CFLAGS@
LIBMIKMOD_CONFIG = @LIBMIKMOD_CONFIG@
LIBMIKMOD_LDADD = @LIBMIKMOD_LDADD@
LIBMIKMOD_LIBS = @LIBMIKMOD_LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAD_LIB = @MAD_LIB@
......@@ -108,19 +112,30 @@ am__quote = @am__quote@
install_sh = @install_sh@
bin_PROGRAMS = mpd
SUBDIRS = $(ID3_SUBDIR) $(MAD_SUBDIR) $(MP4FF_SUBDIR)
mpd_inputPlugins = inputPlugins/mp3_plugin.c inputPlugins/ogg_plugin.c \
inputPlugins/flac_plugin.c inputPlugins/audiofile_plugin.c \
inputPlugins/mp4_plugin.c inputPlugins/aac_plugin.c \
inputPlugins/mod_plugin.c
mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
song.h list.h directory.h tables.h utils.h path.h mp3_decode.h \
tag.h player.h listen.h conf.h ogg_decode.h volume.h flac_decode.h \
song.h list.h directory.h tables.h utils.h path.h \
tag.h player.h listen.h conf.h volume.h \
audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h \
audiofile_decode.h charConv.h permission.h mpd_types.h pcm_utils.h \
mp4_decode.h aac_decode.h
charConv.h permission.h mpd_types.h pcm_utils.h \
signal_check.h utf8.h inputStream.h \
outputBuffer.h replayGain.h inputStream_file.h inputStream_http.h \
inputPlugin.h
mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
song.c list.c directory.c tables.c utils.c path.c mp3_decode.c \
tag.c player.c listen.c conf.c ogg_decode.c volume.c flac_decode.c \
song.c list.c directory.c tables.c utils.c path.c \
tag.c player.c listen.c conf.c volume.c \
audio.c playerData.c stats.c myfprintf.c sig_handlers.c decode.c log.c \
audiofile_decode.c charConv.c permission.c pcm_utils.c mp4_decode.c \
aac_decode.c $(mpd_headers)
charConv.c permission.c pcm_utils.c \
signal_check.c utf8.c inputStream.c outputBuffer.c \
replayGain.c inputStream_file.c inputStream_http.c inputPlugin.c \
$(mpd_headers) $(mpd_inputPlugins)
mpd_CFLAGS = $(MPD_CFLAGS)
......@@ -135,21 +150,26 @@ bin_PROGRAMS = mpd$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am__objects_1 =
am__objects_2 = mpd-mp3_plugin.$(OBJEXT) mpd-ogg_plugin.$(OBJEXT) \
mpd-flac_plugin.$(OBJEXT) mpd-audiofile_plugin.$(OBJEXT) \
mpd-mp4_plugin.$(OBJEXT) mpd-aac_plugin.$(OBJEXT) \
mpd-mod_plugin.$(OBJEXT)
am_mpd_OBJECTS = mpd-main.$(OBJEXT) mpd-buffer2array.$(OBJEXT) \
mpd-interface.$(OBJEXT) mpd-command.$(OBJEXT) \
mpd-playlist.$(OBJEXT) mpd-ls.$(OBJEXT) mpd-song.$(OBJEXT) \
mpd-list.$(OBJEXT) mpd-directory.$(OBJEXT) mpd-tables.$(OBJEXT) \
mpd-utils.$(OBJEXT) mpd-path.$(OBJEXT) mpd-mp3_decode.$(OBJEXT) \
mpd-tag.$(OBJEXT) mpd-player.$(OBJEXT) mpd-listen.$(OBJEXT) \
mpd-conf.$(OBJEXT) mpd-ogg_decode.$(OBJEXT) \
mpd-volume.$(OBJEXT) mpd-flac_decode.$(OBJEXT) \
mpd-audio.$(OBJEXT) mpd-playerData.$(OBJEXT) \
mpd-stats.$(OBJEXT) mpd-myfprintf.$(OBJEXT) \
mpd-sig_handlers.$(OBJEXT) mpd-decode.$(OBJEXT) \
mpd-log.$(OBJEXT) mpd-audiofile_decode.$(OBJEXT) \
mpd-charConv.$(OBJEXT) mpd-permission.$(OBJEXT) \
mpd-pcm_utils.$(OBJEXT) mpd-mp4_decode.$(OBJEXT) \
mpd-aac_decode.$(OBJEXT) $(am__objects_1)
mpd-utils.$(OBJEXT) mpd-path.$(OBJEXT) mpd-tag.$(OBJEXT) \
mpd-player.$(OBJEXT) mpd-listen.$(OBJEXT) mpd-conf.$(OBJEXT) \
mpd-volume.$(OBJEXT) mpd-audio.$(OBJEXT) \
mpd-playerData.$(OBJEXT) mpd-stats.$(OBJEXT) \
mpd-myfprintf.$(OBJEXT) mpd-sig_handlers.$(OBJEXT) \
mpd-decode.$(OBJEXT) mpd-log.$(OBJEXT) mpd-charConv.$(OBJEXT) \
mpd-permission.$(OBJEXT) mpd-pcm_utils.$(OBJEXT) \
mpd-signal_check.$(OBJEXT) mpd-utf8.$(OBJEXT) \
mpd-inputStream.$(OBJEXT) mpd-outputBuffer.$(OBJEXT) \
mpd-replayGain.$(OBJEXT) mpd-inputStream_file.$(OBJEXT) \
mpd-inputStream_http.$(OBJEXT) mpd-inputPlugin.$(OBJEXT) \
$(am__objects_1) $(am__objects_2)
mpd_OBJECTS = $(am_mpd_OBJECTS)
mpd_DEPENDENCIES =
mpd_LDFLAGS =
......@@ -161,33 +181,42 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mpd-aac_decode.Po \
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mpd-aac_plugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-audio.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-audiofile_decode.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-audiofile_plugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-buffer2array.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-charConv.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-command.Po ./$(DEPDIR)/mpd-conf.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-decode.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-directory.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-flac_decode.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-flac_plugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-inputPlugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-inputStream.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-inputStream_file.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-inputStream_http.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-interface.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-list.Po ./$(DEPDIR)/mpd-listen.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-log.Po ./$(DEPDIR)/mpd-ls.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-main.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-mp3_decode.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-mp4_decode.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-mod_plugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-mp3_plugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-mp4_plugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-myfprintf.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-ogg_decode.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-ogg_plugin.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-outputBuffer.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-path.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-pcm_utils.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-permission.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-player.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-playerData.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-playlist.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-replayGain.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-sig_handlers.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-signal_check.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-song.Po ./$(DEPDIR)/mpd-stats.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-tables.Po ./$(DEPDIR)/mpd-tag.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-utils.Po ./$(DEPDIR)/mpd-volume.Po
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-utf8.Po ./$(DEPDIR)/mpd-utils.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/mpd-volume.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
......@@ -255,14 +284,11 @@ mpd-directory.$(OBJEXT): directory.c
mpd-tables.$(OBJEXT): tables.c
mpd-utils.$(OBJEXT): utils.c
mpd-path.$(OBJEXT): path.c
mpd-mp3_decode.$(OBJEXT): mp3_decode.c
mpd-tag.$(OBJEXT): tag.c
mpd-player.$(OBJEXT): player.c
mpd-listen.$(OBJEXT): listen.c
mpd-conf.$(OBJEXT): conf.c
mpd-ogg_decode.$(OBJEXT): ogg_decode.c
mpd-volume.$(OBJEXT): volume.c
mpd-flac_decode.$(OBJEXT): flac_decode.c
mpd-audio.$(OBJEXT): audio.c
mpd-playerData.$(OBJEXT): playerData.c
mpd-stats.$(OBJEXT): stats.c
......@@ -270,12 +296,24 @@ mpd-myfprintf.$(OBJEXT): myfprintf.c
mpd-sig_handlers.$(OBJEXT): sig_handlers.c
mpd-decode.$(OBJEXT): decode.c
mpd-log.$(OBJEXT): log.c
mpd-audiofile_decode.$(OBJEXT): audiofile_decode.c
mpd-charConv.$(OBJEXT): charConv.c
mpd-permission.$(OBJEXT): permission.c
mpd-pcm_utils.$(OBJEXT): pcm_utils.c
mpd-mp4_decode.$(OBJEXT): mp4_decode.c
mpd-aac_decode.$(OBJEXT): aac_decode.c
mpd-signal_check.$(OBJEXT): signal_check.c
mpd-utf8.$(OBJEXT): utf8.c
mpd-inputStream.$(OBJEXT): inputStream.c
mpd-outputBuffer.$(OBJEXT): outputBuffer.c
mpd-replayGain.$(OBJEXT): replayGain.c
mpd-inputStream_file.$(OBJEXT): inputStream_file.c
mpd-inputStream_http.$(OBJEXT): inputStream_http.c
mpd-inputPlugin.$(OBJEXT): inputPlugin.c
mpd-mp3_plugin.$(OBJEXT): inputPlugins/mp3_plugin.c
mpd-ogg_plugin.$(OBJEXT): inputPlugins/ogg_plugin.c
mpd-flac_plugin.$(OBJEXT): inputPlugins/flac_plugin.c
mpd-audiofile_plugin.$(OBJEXT): inputPlugins/audiofile_plugin.c
mpd-mp4_plugin.$(OBJEXT): inputPlugins/mp4_plugin.c
mpd-aac_plugin.$(OBJEXT): inputPlugins/aac_plugin.c
mpd-mod_plugin.$(OBJEXT): inputPlugins/mod_plugin.c
mpd$(EXEEXT): $(mpd_OBJECTS) $(mpd_DEPENDENCIES)
@rm -f mpd$(EXEEXT)
$(LINK) $(mpd_LDFLAGS) $(mpd_OBJECTS) $(mpd_LDADD) $(LIBS)
......@@ -286,37 +324,46 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-aac_decode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-aac_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-audio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-audiofile_decode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-audiofile_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-buffer2array.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-charConv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-command.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-conf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-decode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-directory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-flac_decode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-flac_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-inputPlugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-inputStream.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-inputStream_file.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-inputStream_http.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-interface.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-list.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-listen.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-ls.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-mp3_decode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-mp4_decode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-mod_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-mp3_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-mp4_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-myfprintf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-ogg_decode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-ogg_plugin.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-outputBuffer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-path.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-pcm_utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-permission.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-player.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-playerData.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-playlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-replayGain.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-sig_handlers.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-signal_check.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-song.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-stats.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-tables.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-tag.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-utf8.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-volume.Po@am__quote@
......@@ -557,24 +604,6 @@ mpd-path.lo: path.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-path.lo `test -f 'path.c' || echo '$(srcdir)/'`path.c
mpd-mp3_decode.o: mp3_decode.c
@AMDEP_TRUE@ source='mp3_decode.c' object='mpd-mp3_decode.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp3_decode.Po' tmpdepfile='$(DEPDIR)/mpd-mp3_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_decode.o `test -f 'mp3_decode.c' || echo '$(srcdir)/'`mp3_decode.c
mpd-mp3_decode.obj: mp3_decode.c
@AMDEP_TRUE@ source='mp3_decode.c' object='mpd-mp3_decode.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp3_decode.Po' tmpdepfile='$(DEPDIR)/mpd-mp3_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_decode.obj `cygpath -w mp3_decode.c`
mpd-mp3_decode.lo: mp3_decode.c
@AMDEP_TRUE@ source='mp3_decode.c' object='mpd-mp3_decode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp3_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-mp3_decode.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_decode.lo `test -f 'mp3_decode.c' || echo '$(srcdir)/'`mp3_decode.c
mpd-tag.o: tag.c
@AMDEP_TRUE@ source='tag.c' object='mpd-tag.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-tag.Po' tmpdepfile='$(DEPDIR)/mpd-tag.TPo' @AMDEPBACKSLASH@
......@@ -647,24 +676,6 @@ mpd-conf.lo: conf.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-conf.lo `test -f 'conf.c' || echo '$(srcdir)/'`conf.c
mpd-ogg_decode.o: ogg_decode.c
@AMDEP_TRUE@ source='ogg_decode.c' object='mpd-ogg_decode.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-ogg_decode.Po' tmpdepfile='$(DEPDIR)/mpd-ogg_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_decode.o `test -f 'ogg_decode.c' || echo '$(srcdir)/'`ogg_decode.c
mpd-ogg_decode.obj: ogg_decode.c
@AMDEP_TRUE@ source='ogg_decode.c' object='mpd-ogg_decode.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-ogg_decode.Po' tmpdepfile='$(DEPDIR)/mpd-ogg_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_decode.obj `cygpath -w ogg_decode.c`
mpd-ogg_decode.lo: ogg_decode.c
@AMDEP_TRUE@ source='ogg_decode.c' object='mpd-ogg_decode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-ogg_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-ogg_decode.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_decode.lo `test -f 'ogg_decode.c' || echo '$(srcdir)/'`ogg_decode.c
mpd-volume.o: volume.c
@AMDEP_TRUE@ source='volume.c' object='mpd-volume.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-volume.Po' tmpdepfile='$(DEPDIR)/mpd-volume.TPo' @AMDEPBACKSLASH@
......@@ -683,24 +694,6 @@ mpd-volume.lo: volume.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-volume.lo `test -f 'volume.c' || echo '$(srcdir)/'`volume.c
mpd-flac_decode.o: flac_decode.c
@AMDEP_TRUE@ source='flac_decode.c' object='mpd-flac_decode.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-flac_decode.Po' tmpdepfile='$(DEPDIR)/mpd-flac_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_decode.o `test -f 'flac_decode.c' || echo '$(srcdir)/'`flac_decode.c
mpd-flac_decode.obj: flac_decode.c
@AMDEP_TRUE@ source='flac_decode.c' object='mpd-flac_decode.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-flac_decode.Po' tmpdepfile='$(DEPDIR)/mpd-flac_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_decode.obj `cygpath -w flac_decode.c`
mpd-flac_decode.lo: flac_decode.c
@AMDEP_TRUE@ source='flac_decode.c' object='mpd-flac_decode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-flac_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-flac_decode.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_decode.lo `test -f 'flac_decode.c' || echo '$(srcdir)/'`flac_decode.c
mpd-audio.o: audio.c
@AMDEP_TRUE@ source='audio.c' object='mpd-audio.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-audio.Po' tmpdepfile='$(DEPDIR)/mpd-audio.TPo' @AMDEPBACKSLASH@
......@@ -827,24 +820,6 @@ mpd-log.lo: log.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-log.lo `test -f 'log.c' || echo '$(srcdir)/'`log.c
mpd-audiofile_decode.o: audiofile_decode.c
@AMDEP_TRUE@ source='audiofile_decode.c' object='mpd-audiofile_decode.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-audiofile_decode.Po' tmpdepfile='$(DEPDIR)/mpd-audiofile_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_decode.o `test -f 'audiofile_decode.c' || echo '$(srcdir)/'`audiofile_decode.c
mpd-audiofile_decode.obj: audiofile_decode.c
@AMDEP_TRUE@ source='audiofile_decode.c' object='mpd-audiofile_decode.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-audiofile_decode.Po' tmpdepfile='$(DEPDIR)/mpd-audiofile_decode.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_decode.obj `cygpath -w audiofile_decode.c`
mpd-audiofile_decode.lo: audiofile_decode.c
@AMDEP_TRUE@ source='audiofile_decode.c' object='mpd-audiofile_decode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-audiofile_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-audiofile_decode.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_decode.lo `test -f 'audiofile_decode.c' || echo '$(srcdir)/'`audiofile_decode.c
mpd-charConv.o: charConv.c
@AMDEP_TRUE@ source='charConv.c' object='mpd-charConv.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-charConv.Po' tmpdepfile='$(DEPDIR)/mpd-charConv.TPo' @AMDEPBACKSLASH@
......@@ -899,41 +874,275 @@ mpd-pcm_utils.lo: pcm_utils.c
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-pcm_utils.lo `test -f 'pcm_utils.c' || echo '$(srcdir)/'`pcm_utils.c
mpd-mp4_decode.o: mp4_decode.c
@AMDEP_TRUE@ source='mp4_decode.c' object='mpd-mp4_decode.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp4_decode.Po' tmpdepfile='$(DEPDIR)/mpd-mp4_decode.TPo' @AMDEPBACKSLASH@
mpd-signal_check.o: signal_check.c
@AMDEP_TRUE@ source='signal_check.c' object='mpd-signal_check.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-signal_check.Po' tmpdepfile='$(DEPDIR)/mpd-signal_check.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-signal_check.o `test -f 'signal_check.c' || echo '$(srcdir)/'`signal_check.c
mpd-signal_check.obj: signal_check.c
@AMDEP_TRUE@ source='signal_check.c' object='mpd-signal_check.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-signal_check.Po' tmpdepfile='$(DEPDIR)/mpd-signal_check.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-signal_check.obj `cygpath -w signal_check.c`
mpd-signal_check.lo: signal_check.c
@AMDEP_TRUE@ source='signal_check.c' object='mpd-signal_check.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-signal_check.Plo' tmpdepfile='$(DEPDIR)/mpd-signal_check.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-signal_check.lo `test -f 'signal_check.c' || echo '$(srcdir)/'`signal_check.c
mpd-utf8.o: utf8.c
@AMDEP_TRUE@ source='utf8.c' object='mpd-utf8.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-utf8.Po' tmpdepfile='$(DEPDIR)/mpd-utf8.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-utf8.o `test -f 'utf8.c' || echo '$(srcdir)/'`utf8.c
mpd-utf8.obj: utf8.c
@AMDEP_TRUE@ source='utf8.c' object='mpd-utf8.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-utf8.Po' tmpdepfile='$(DEPDIR)/mpd-utf8.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-utf8.obj `cygpath -w utf8.c`
mpd-utf8.lo: utf8.c
@AMDEP_TRUE@ source='utf8.c' object='mpd-utf8.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-utf8.Plo' tmpdepfile='$(DEPDIR)/mpd-utf8.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-utf8.lo `test -f 'utf8.c' || echo '$(srcdir)/'`utf8.c
mpd-inputStream.o: inputStream.c
@AMDEP_TRUE@ source='inputStream.c' object='mpd-inputStream.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream.Po' tmpdepfile='$(DEPDIR)/mpd-inputStream.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream.o `test -f 'inputStream.c' || echo '$(srcdir)/'`inputStream.c
mpd-inputStream.obj: inputStream.c
@AMDEP_TRUE@ source='inputStream.c' object='mpd-inputStream.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream.Po' tmpdepfile='$(DEPDIR)/mpd-inputStream.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream.obj `cygpath -w inputStream.c`
mpd-inputStream.lo: inputStream.c
@AMDEP_TRUE@ source='inputStream.c' object='mpd-inputStream.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream.Plo' tmpdepfile='$(DEPDIR)/mpd-inputStream.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream.lo `test -f 'inputStream.c' || echo '$(srcdir)/'`inputStream.c
mpd-outputBuffer.o: outputBuffer.c
@AMDEP_TRUE@ source='outputBuffer.c' object='mpd-outputBuffer.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-outputBuffer.Po' tmpdepfile='$(DEPDIR)/mpd-outputBuffer.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-outputBuffer.o `test -f 'outputBuffer.c' || echo '$(srcdir)/'`outputBuffer.c
mpd-outputBuffer.obj: outputBuffer.c
@AMDEP_TRUE@ source='outputBuffer.c' object='mpd-outputBuffer.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-outputBuffer.Po' tmpdepfile='$(DEPDIR)/mpd-outputBuffer.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-outputBuffer.obj `cygpath -w outputBuffer.c`
mpd-outputBuffer.lo: outputBuffer.c
@AMDEP_TRUE@ source='outputBuffer.c' object='mpd-outputBuffer.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-outputBuffer.Plo' tmpdepfile='$(DEPDIR)/mpd-outputBuffer.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-outputBuffer.lo `test -f 'outputBuffer.c' || echo '$(srcdir)/'`outputBuffer.c
mpd-replayGain.o: replayGain.c
@AMDEP_TRUE@ source='replayGain.c' object='mpd-replayGain.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-replayGain.Po' tmpdepfile='$(DEPDIR)/mpd-replayGain.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-replayGain.o `test -f 'replayGain.c' || echo '$(srcdir)/'`replayGain.c
mpd-replayGain.obj: replayGain.c
@AMDEP_TRUE@ source='replayGain.c' object='mpd-replayGain.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-replayGain.Po' tmpdepfile='$(DEPDIR)/mpd-replayGain.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-replayGain.obj `cygpath -w replayGain.c`
mpd-replayGain.lo: replayGain.c
@AMDEP_TRUE@ source='replayGain.c' object='mpd-replayGain.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-replayGain.Plo' tmpdepfile='$(DEPDIR)/mpd-replayGain.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-replayGain.lo `test -f 'replayGain.c' || echo '$(srcdir)/'`replayGain.c
mpd-inputStream_file.o: inputStream_file.c
@AMDEP_TRUE@ source='inputStream_file.c' object='mpd-inputStream_file.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream_file.Po' tmpdepfile='$(DEPDIR)/mpd-inputStream_file.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream_file.o `test -f 'inputStream_file.c' || echo '$(srcdir)/'`inputStream_file.c
mpd-inputStream_file.obj: inputStream_file.c
@AMDEP_TRUE@ source='inputStream_file.c' object='mpd-inputStream_file.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream_file.Po' tmpdepfile='$(DEPDIR)/mpd-inputStream_file.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream_file.obj `cygpath -w inputStream_file.c`
mpd-inputStream_file.lo: inputStream_file.c
@AMDEP_TRUE@ source='inputStream_file.c' object='mpd-inputStream_file.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream_file.Plo' tmpdepfile='$(DEPDIR)/mpd-inputStream_file.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream_file.lo `test -f 'inputStream_file.c' || echo '$(srcdir)/'`inputStream_file.c
mpd-inputStream_http.o: inputStream_http.c
@AMDEP_TRUE@ source='inputStream_http.c' object='mpd-inputStream_http.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream_http.Po' tmpdepfile='$(DEPDIR)/mpd-inputStream_http.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream_http.o `test -f 'inputStream_http.c' || echo '$(srcdir)/'`inputStream_http.c
mpd-inputStream_http.obj: inputStream_http.c
@AMDEP_TRUE@ source='inputStream_http.c' object='mpd-inputStream_http.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream_http.Po' tmpdepfile='$(DEPDIR)/mpd-inputStream_http.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream_http.obj `cygpath -w inputStream_http.c`
mpd-inputStream_http.lo: inputStream_http.c
@AMDEP_TRUE@ source='inputStream_http.c' object='mpd-inputStream_http.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputStream_http.Plo' tmpdepfile='$(DEPDIR)/mpd-inputStream_http.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputStream_http.lo `test -f 'inputStream_http.c' || echo '$(srcdir)/'`inputStream_http.c
mpd-inputPlugin.o: inputPlugin.c
@AMDEP_TRUE@ source='inputPlugin.c' object='mpd-inputPlugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputPlugin.Po' tmpdepfile='$(DEPDIR)/mpd-inputPlugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputPlugin.o `test -f 'inputPlugin.c' || echo '$(srcdir)/'`inputPlugin.c
mpd-inputPlugin.obj: inputPlugin.c
@AMDEP_TRUE@ source='inputPlugin.c' object='mpd-inputPlugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputPlugin.Po' tmpdepfile='$(DEPDIR)/mpd-inputPlugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputPlugin.obj `cygpath -w inputPlugin.c`
mpd-inputPlugin.lo: inputPlugin.c
@AMDEP_TRUE@ source='inputPlugin.c' object='mpd-inputPlugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-inputPlugin.Plo' tmpdepfile='$(DEPDIR)/mpd-inputPlugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-inputPlugin.lo `test -f 'inputPlugin.c' || echo '$(srcdir)/'`inputPlugin.c
mpd-mp3_plugin.o: inputPlugins/mp3_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mp3_plugin.c' object='mpd-mp3_plugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp3_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-mp3_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_plugin.o `test -f 'inputPlugins/mp3_plugin.c' || echo '$(srcdir)/'`inputPlugins/mp3_plugin.c
mpd-mp3_plugin.obj: inputPlugins/mp3_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mp3_plugin.c' object='mpd-mp3_plugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp3_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-mp3_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_plugin.obj `cygpath -w inputPlugins/mp3_plugin.c`
mpd-mp3_plugin.lo: inputPlugins/mp3_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mp3_plugin.c' object='mpd-mp3_plugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp3_plugin.Plo' tmpdepfile='$(DEPDIR)/mpd-mp3_plugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_plugin.lo `test -f 'inputPlugins/mp3_plugin.c' || echo '$(srcdir)/'`inputPlugins/mp3_plugin.c
mpd-ogg_plugin.o: inputPlugins/ogg_plugin.c
@AMDEP_TRUE@ source='inputPlugins/ogg_plugin.c' object='mpd-ogg_plugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-ogg_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-ogg_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_plugin.o `test -f 'inputPlugins/ogg_plugin.c' || echo '$(srcdir)/'`inputPlugins/ogg_plugin.c
mpd-ogg_plugin.obj: inputPlugins/ogg_plugin.c
@AMDEP_TRUE@ source='inputPlugins/ogg_plugin.c' object='mpd-ogg_plugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-ogg_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-ogg_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_plugin.obj `cygpath -w inputPlugins/ogg_plugin.c`
mpd-ogg_plugin.lo: inputPlugins/ogg_plugin.c
@AMDEP_TRUE@ source='inputPlugins/ogg_plugin.c' object='mpd-ogg_plugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-ogg_plugin.Plo' tmpdepfile='$(DEPDIR)/mpd-ogg_plugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_plugin.lo `test -f 'inputPlugins/ogg_plugin.c' || echo '$(srcdir)/'`inputPlugins/ogg_plugin.c
mpd-flac_plugin.o: inputPlugins/flac_plugin.c
@AMDEP_TRUE@ source='inputPlugins/flac_plugin.c' object='mpd-flac_plugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-flac_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-flac_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_plugin.o `test -f 'inputPlugins/flac_plugin.c' || echo '$(srcdir)/'`inputPlugins/flac_plugin.c
mpd-flac_plugin.obj: inputPlugins/flac_plugin.c
@AMDEP_TRUE@ source='inputPlugins/flac_plugin.c' object='mpd-flac_plugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-flac_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-flac_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_plugin.obj `cygpath -w inputPlugins/flac_plugin.c`
mpd-flac_plugin.lo: inputPlugins/flac_plugin.c
@AMDEP_TRUE@ source='inputPlugins/flac_plugin.c' object='mpd-flac_plugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-flac_plugin.Plo' tmpdepfile='$(DEPDIR)/mpd-flac_plugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_plugin.lo `test -f 'inputPlugins/flac_plugin.c' || echo '$(srcdir)/'`inputPlugins/flac_plugin.c
mpd-audiofile_plugin.o: inputPlugins/audiofile_plugin.c
@AMDEP_TRUE@ source='inputPlugins/audiofile_plugin.c' object='mpd-audiofile_plugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-audiofile_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-audiofile_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_plugin.o `test -f 'inputPlugins/audiofile_plugin.c' || echo '$(srcdir)/'`inputPlugins/audiofile_plugin.c
mpd-audiofile_plugin.obj: inputPlugins/audiofile_plugin.c
@AMDEP_TRUE@ source='inputPlugins/audiofile_plugin.c' object='mpd-audiofile_plugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-audiofile_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-audiofile_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_plugin.obj `cygpath -w inputPlugins/audiofile_plugin.c`
mpd-audiofile_plugin.lo: inputPlugins/audiofile_plugin.c
@AMDEP_TRUE@ source='inputPlugins/audiofile_plugin.c' object='mpd-audiofile_plugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-audiofile_plugin.Plo' tmpdepfile='$(DEPDIR)/mpd-audiofile_plugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_plugin.lo `test -f 'inputPlugins/audiofile_plugin.c' || echo '$(srcdir)/'`inputPlugins/audiofile_plugin.c
mpd-mp4_plugin.o: inputPlugins/mp4_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mp4_plugin.c' object='mpd-mp4_plugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp4_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-mp4_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp4_plugin.o `test -f 'inputPlugins/mp4_plugin.c' || echo '$(srcdir)/'`inputPlugins/mp4_plugin.c
mpd-mp4_plugin.obj: inputPlugins/mp4_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mp4_plugin.c' object='mpd-mp4_plugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp4_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-mp4_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp4_plugin.obj `cygpath -w inputPlugins/mp4_plugin.c`
mpd-mp4_plugin.lo: inputPlugins/mp4_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mp4_plugin.c' object='mpd-mp4_plugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp4_plugin.Plo' tmpdepfile='$(DEPDIR)/mpd-mp4_plugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp4_plugin.lo `test -f 'inputPlugins/mp4_plugin.c' || echo '$(srcdir)/'`inputPlugins/mp4_plugin.c
mpd-aac_plugin.o: inputPlugins/aac_plugin.c
@AMDEP_TRUE@ source='inputPlugins/aac_plugin.c' object='mpd-aac_plugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-aac_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-aac_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp4_decode.o `test -f 'mp4_decode.c' || echo '$(srcdir)/'`mp4_decode.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-aac_plugin.o `test -f 'inputPlugins/aac_plugin.c' || echo '$(srcdir)/'`inputPlugins/aac_plugin.c
mpd-mp4_decode.obj: mp4_decode.c
@AMDEP_TRUE@ source='mp4_decode.c' object='mpd-mp4_decode.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp4_decode.Po' tmpdepfile='$(DEPDIR)/mpd-mp4_decode.TPo' @AMDEPBACKSLASH@
mpd-aac_plugin.obj: inputPlugins/aac_plugin.c
@AMDEP_TRUE@ source='inputPlugins/aac_plugin.c' object='mpd-aac_plugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-aac_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-aac_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp4_decode.obj `cygpath -w mp4_decode.c`
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-aac_plugin.obj `cygpath -w inputPlugins/aac_plugin.c`
mpd-mp4_decode.lo: mp4_decode.c
@AMDEP_TRUE@ source='mp4_decode.c' object='mpd-mp4_decode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mp4_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-mp4_decode.TPlo' @AMDEPBACKSLASH@
mpd-aac_plugin.lo: inputPlugins/aac_plugin.c
@AMDEP_TRUE@ source='inputPlugins/aac_plugin.c' object='mpd-aac_plugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-aac_plugin.Plo' tmpdepfile='$(DEPDIR)/mpd-aac_plugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp4_decode.lo `test -f 'mp4_decode.c' || echo '$(srcdir)/'`mp4_decode.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-aac_plugin.lo `test -f 'inputPlugins/aac_plugin.c' || echo '$(srcdir)/'`inputPlugins/aac_plugin.c
mpd-aac_decode.o: aac_decode.c
@AMDEP_TRUE@ source='aac_decode.c' object='mpd-aac_decode.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-aac_decode.Po' tmpdepfile='$(DEPDIR)/mpd-aac_decode.TPo' @AMDEPBACKSLASH@
mpd-mod_plugin.o: inputPlugins/mod_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mod_plugin.c' object='mpd-mod_plugin.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mod_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-mod_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-aac_decode.o `test -f 'aac_decode.c' || echo '$(srcdir)/'`aac_decode.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mod_plugin.o `test -f 'inputPlugins/mod_plugin.c' || echo '$(srcdir)/'`inputPlugins/mod_plugin.c
mpd-aac_decode.obj: aac_decode.c
@AMDEP_TRUE@ source='aac_decode.c' object='mpd-aac_decode.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-aac_decode.Po' tmpdepfile='$(DEPDIR)/mpd-aac_decode.TPo' @AMDEPBACKSLASH@
mpd-mod_plugin.obj: inputPlugins/mod_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mod_plugin.c' object='mpd-mod_plugin.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mod_plugin.Po' tmpdepfile='$(DEPDIR)/mpd-mod_plugin.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-aac_decode.obj `cygpath -w aac_decode.c`
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mod_plugin.obj `cygpath -w inputPlugins/mod_plugin.c`
mpd-aac_decode.lo: aac_decode.c
@AMDEP_TRUE@ source='aac_decode.c' object='mpd-aac_decode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-aac_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-aac_decode.TPlo' @AMDEPBACKSLASH@
mpd-mod_plugin.lo: inputPlugins/mod_plugin.c
@AMDEP_TRUE@ source='inputPlugins/mod_plugin.c' object='mpd-mod_plugin.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/mpd-mod_plugin.Plo' tmpdepfile='$(DEPDIR)/mpd-mod_plugin.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-aac_decode.lo `test -f 'aac_decode.c' || echo '$(srcdir)/'`aac_decode.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mod_plugin.lo `test -f 'inputPlugins/mod_plugin.c' || echo '$(srcdir)/'`inputPlugins/mod_plugin.c
CCDEPMODE = @CCDEPMODE@
mostlyclean-libtool:
......
......@@ -25,15 +25,28 @@
#include <assert.h>
#include <signal.h>
int audio_write_size;
#ifdef HAVE_AUDIO
#include <ao/ao.h>
int audio_ao_driver_id;
ao_option * audio_ao_options;
static int audio_write_size;
AudioFormat audio_format;
ao_device * audio_device = NULL;
static int audio_ao_driver_id;
static ao_option * audio_ao_options;
static AudioFormat audio_format;
static ao_device * audio_device = NULL;
#endif
static AudioFormat * audio_configFormat = NULL;
static void copyAudioFormat(AudioFormat * dest, AudioFormat * src) {
dest->sampleRate = src->sampleRate;
dest->bits = src->bits;
dest->channels = src->channels;
}
void initAudioDriver() {
#ifdef HAVE_AUDIO
ao_info * ai;
char * dup;
char * stk1;
......@@ -49,7 +62,7 @@ void initAudioDriver() {
if (*test!='\0') {
ERROR("\"%s\" is not a valid write size",
(getConf())[CONF_AUDIO_WRITE_SIZE]);
exit(-1);
exit(EXIT_FAILURE);
}
audio_ao_options = NULL;
......@@ -62,13 +75,13 @@ void initAudioDriver() {
ao_driver_id((getConf())[CONF_AO_DRIVER]))<0) {
ERROR("\"%s\" is not a valid ao driver\n",
(getConf())[CONF_AO_DRIVER]);
exit(-1);
exit(EXIT_FAILURE);
}
if((ai = ao_driver_info(audio_ao_driver_id))==NULL) {
ERROR("problems getting ao_driver_info\n");
ERROR("you may not have permission to the audio device\n");
exit(-1);
exit(EXIT_FAILURE);
}
dup = strdup((getConf())[CONF_AO_DRIVER_OPTIONS]);
......@@ -81,7 +94,7 @@ void initAudioDriver() {
if(!key) {
ERROR("problems parsing "
"ao_driver_options \"%s\"\n", n1);
exit(-1);
exit(EXIT_FAILURE);
}
/*found = 0;
for(i=0;i<ai->option_count;i++) {
......@@ -94,52 +107,131 @@ void initAudioDriver() {
ERROR("\"%s\" is not an option for "
"\"%s\" ao driver\n",key,
ai->short_name);
exit(-1);
exit(EXIT_FAILURE);
}*/
value = strtok_r(NULL,"",&stk2);
if(!value) {
ERROR("problems parsing "
"ao_driver_options \"%s\"\n", n1);
exit(-1);
exit(EXIT_FAILURE);
}
ao_append_option(&audio_ao_options,key,value);
n1 = strtok_r(NULL,";",&stk1);
}
}
free(dup);
#endif
}
void getOutputAudioFormat(AudioFormat * inAudioFormat,
AudioFormat * outAudioFormat)
{
if(audio_configFormat) {
copyAudioFormat(outAudioFormat,audio_configFormat);
}
else copyAudioFormat(outAudioFormat,inAudioFormat);
}
void initAudioConfig() {
char * conf = getConf()[CONF_AUDIO_OUTPUT_FORMAT];
char * test;
if(NULL == conf) return;
audio_configFormat = malloc(sizeof(AudioFormat));
memset(audio_configFormat,0,sizeof(AudioFormat));
audio_configFormat->sampleRate = strtol(conf,&test,10);
if(*test!=':') {
ERROR("error parsing audio output format: %s\n",conf);
exit(EXIT_FAILURE);
}
/*switch(audio_configFormat->sampleRate) {
case 48000:
case 44100:
case 32000:
case 16000:
break;
default:
ERROR("sample rate %i can not be used for audio output\n",
(int)audio_configFormat->sampleRate);
exit(EXIT_FAILURE);
}*/
if(audio_configFormat->sampleRate <= 0) {
ERROR("sample rate %i is not >= 0\n",
(int)audio_configFormat->sampleRate);
exit(EXIT_FAILURE);
}
audio_configFormat->bits = strtol(test+1,&test,10);
if(*test!=':') {
ERROR("error parsing audio output format: %s\n",conf);
exit(EXIT_FAILURE);
}
switch(audio_configFormat->bits) {
case 16:
break;
default:
ERROR("bits %i can not be used for audio output\n",
(int)audio_configFormat->bits);
exit(EXIT_FAILURE);
}
audio_configFormat->channels = strtol(test+1,&test,10);
if(*test!='\0') {
ERROR("error parsing audio output format: %s\n",conf);
exit(EXIT_FAILURE);
}
switch(audio_configFormat->channels) {
case 2:
break;
default:
ERROR("channels %i can not be used for audio output\n",
(int)audio_configFormat->channels);
exit(EXIT_FAILURE);
}
}
void finishAudioConfig() {
if(audio_configFormat) free(audio_configFormat);
}
void finishAudioDriver() {
#ifdef HAVE_AUDIO
ao_free_options(audio_ao_options);
ao_shutdown();
#endif
}
int isCurrentAudioFormat(AudioFormat * audioFormat) {
#ifdef HAVE_AUDIO
if(!audio_device || !audioFormat) return 0;
if(audio_format.bits!=audioFormat->bits ||
audio_format.sampleRate!=audioFormat->sampleRate ||
audio_format.channels!=audioFormat->channels)
{
return 0;
}
if(memcmp(audioFormat,&audio_format,sizeof(AudioFormat)) != 0) return 0;
#endif
return 1;
}
int initAudio(AudioFormat * audioFormat) {
int openAudioDevice(AudioFormat * audioFormat) {
#ifdef HAVE_AUDIO
ao_sample_format format;
if(audio_device && !isCurrentAudioFormat(audioFormat)) {
finishAudio();
closeAudioDevice();
}
if(!audio_device) {
if(audioFormat) {
audio_format.bits = audioFormat->bits;
audio_format.sampleRate = audioFormat->sampleRate;
audio_format.channels = audioFormat->channels;
copyAudioFormat(&audio_format,audioFormat);
}
format.bits = audio_format.bits;
......@@ -154,12 +246,13 @@ int initAudio(AudioFormat * audioFormat) {
if(audio_device==NULL) return -1;
}
#endif
return 0;
}
int playAudio(char * playChunk, int size) {
#ifdef HAVE_AUDIO
int send;
if(audio_device==NULL) {
......@@ -173,7 +266,7 @@ int playAudio(char * playChunk, int size) {
if(ao_play(audio_device,playChunk,send)==0) {
audioError();
ERROR("closing audio device due to write error\n");
finishAudio();
closeAudioDevice();
return -1;
}
......@@ -181,20 +274,23 @@ int playAudio(char * playChunk, int size) {
size-=send;
}
#endif
return 0;
}
void finishAudio() {
void closeAudioDevice() {
#ifdef HAVE_AUDIO
if(audio_device) {
blockSignals();
ao_close(audio_device);
audio_device = NULL;
unblockSignals();
}
#endif
}
void audioError() {
ERROR("Error opening audio device\n");
#ifdef HAVE_AUDIO
if(errno==AO_ENOTLIVE) {
ERROR("not a live ao device\n");
}
......@@ -204,4 +300,6 @@ void audioError() {
else if(errno==AO_EBADOPTION) {
ERROR("bad driver option\n");
}
#endif
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -24,31 +24,34 @@
#include "mpd_types.h"
#include <stdio.h>
#include <ao/ao.h>
#define AUDIO_AO_DRIVER_DEFAULT "default"
typedef struct _AudioFormat {
mpd_sint8 channels;
mpd_uint32 sampleRate;
mpd_sint8 bits;
volatile mpd_sint8 channels;
volatile mpd_uint32 sampleRate;
volatile mpd_sint8 bits;
} AudioFormat;
extern int audio_ao_driver_id;
extern ao_option * audio_ao_options;
void getOutputAudioFormat(AudioFormat * inFormat, AudioFormat * outFormat);
void initAudioConfig();
void finishAudioConfig();
void initAudioDriver();
void finishAudioDriver();
int initAudio(AudioFormat * audioFormat);
int openAudioDevice(AudioFormat * audioFormat);
int playAudio(char * playChunk,int size);
void finishAudio();
void closeAudioDevice();
void audioError();
int isCurrentAudioFormat(AudioFormat * audioFormat);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -120,3 +120,4 @@ void freeArgArray(char ** array, int argArrayLength) {
}
free(array);
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -26,3 +26,4 @@ int buffer2array(char * buffer, char *** array);
void freeArgArray(char ** array, int argArrayLength);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -17,6 +17,8 @@
*/
#include "charConv.h"
#include "mpd_types.h"
#include "utf8.h"
#include <stdlib.h>
#include <errno.h>
......@@ -25,14 +27,21 @@
#ifdef HAVE_ICONV
#include <iconv.h>
iconv_t char_conv_iconv;
#endif
char * char_conv_to = NULL;
char * char_conv_from = NULL;
#endif
mpd_sint8 char_conv_same = 0;
mpd_sint8 char_conv_use_iconv = 0;
/* 1 is to use latin1ToUtf8
0 is not to use latin1/utf8 converter
-1 is to use utf8ToLatin1*/
mpd_sint8 char_conv_latin1ToUtf8 = 0;
#define BUFFER_SIZE 1024
int setCharSetConversion(char * to, char * from) {
#ifdef HAVE_ICONV
if(char_conv_to && strcmp(to,char_conv_to)==0 &&
char_conv_from && strcmp(from,char_conv_from)==0)
{
......@@ -41,60 +50,101 @@ int setCharSetConversion(char * to, char * from) {
closeCharSetConversion();
if(0==strcmp(to,from)) {
char_conv_same = 1;
char_conv_to = strdup(to);
char_conv_from = strdup(from);
return 0;
}
if(strcmp(to,"UTF-8")==0 && strcmp(from,"ISO-8859-1")==0) {
char_conv_latin1ToUtf8 = 1;
}
else if(strcmp(to,"ISO-8859-1")==0 && strcmp(from,"UTF-8")==0) {
char_conv_latin1ToUtf8 = -1;
}
if(char_conv_latin1ToUtf8!=0) {
char_conv_to = strdup(to);
char_conv_from = strdup(from);
return 0;
}
#ifdef HAVE_ICONV
if((char_conv_iconv = iconv_open(to,from))==(iconv_t)(-1)) return -1;
char_conv_to = strdup(to);
char_conv_from = strdup(from);
char_conv_use_iconv = 1;
return 0;
#endif
return -1;
}
char * convStrDup(char * string) {
#ifdef HAVE_ICONV
char buffer[BUFFER_SIZE];
size_t inleft = strlen(string);
char * ret;
size_t outleft;
size_t retlen = 0;
size_t err;
char * bufferPtr;
if(!char_conv_to) return NULL;
ret = malloc(1);
ret[0] = '\0';
if(char_conv_same) return strdup(string);
while(inleft) {
bufferPtr = buffer;
outleft = BUFFER_SIZE;
err = iconv(char_conv_iconv,&string,&inleft,&bufferPtr,
#ifdef HAVE_ICONV
if(char_conv_use_iconv) {
char buffer[BUFFER_SIZE];
size_t inleft = strlen(string);
char * ret;
size_t outleft;
size_t retlen = 0;
size_t err;
char * bufferPtr;
ret = malloc(1);
ret[0] = '\0';
while(inleft) {
bufferPtr = buffer;
outleft = BUFFER_SIZE;
err = iconv(char_conv_iconv,&string,&inleft,&bufferPtr,
&outleft);
if(outleft==BUFFER_SIZE || (err<0 && errno!=E2BIG)) {
free(ret);
return NULL;
if(outleft==BUFFER_SIZE || (err<0 && errno!=E2BIG)) {
free(ret);
return NULL;
}
ret = realloc(ret,retlen+BUFFER_SIZE-outleft+1);
memcpy(ret+retlen,buffer,BUFFER_SIZE-outleft);
retlen+=BUFFER_SIZE-outleft;
ret[retlen] = '\0';
}
ret = realloc(ret,retlen+BUFFER_SIZE-outleft+1);
memcpy(ret+retlen,buffer,BUFFER_SIZE-outleft);
retlen+=BUFFER_SIZE-outleft;
ret[retlen] = '\0';
return ret;
}
return ret;
#endif
switch(char_conv_latin1ToUtf8) {
case 1:
return latin1StrToUtf8Dup(string);
break;
case -1:
return utf8StrToLatin1Dup(string);
break;
}
return NULL;
}
void closeCharSetConversion() {
#ifdef HAVE_ICONV
if(char_conv_to) {
iconv_close(char_conv_iconv);
#ifdef HAVE_ICONV
if(char_conv_use_iconv) iconv_close(char_conv_iconv);
#endif
free(char_conv_to);
free(char_conv_from);
char_conv_to = NULL;
char_conv_from = NULL;
char_conv_same = 0;
char_conv_latin1ToUtf8 = 0;
char_conv_use_iconv = 0;
}
#endif
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -28,3 +28,4 @@ char * convStrDup(char * string);
void closeCharSetConversion();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -30,6 +30,8 @@
#include "conf.h"
#include "permission.h"
#include "audio.h"
#include "buffer2array.h"
#include "log.h"
#include <stdlib.h>
#include <string.h>
......@@ -71,6 +73,7 @@
#define COMMAND_SETVOL "setvol"
#define COMMAND_PASSWORD "password"
#define COMMAND_CROSSFADE "crossfade"
#define COMMAND_URL_HANDLERS "urlhandlers"
#define COMMAND_STATUS_VOLUME "volume"
#define COMMAND_STATUS_STATE "state"
......@@ -84,18 +87,29 @@
#define COMMAND_STATUS_ERROR "error"
#define COMMAND_STATUS_CROSSFADE "xfade"
#define COMMAND_STATUS_AUDIO "audio"
#define COMMAND_STATUS_UPDATING_DB "updating_db"
typedef struct _CommandEntry CommandEntry;
typedef int (* CommandHandlerFunction)(FILE *, unsigned int *, int, char **);
typedef int (* CommandListHandlerFunction)(FILE *, unsigned int *, int, char **,
ListNode *, CommandEntry *);
/* if min: -1 don't check args *
* if max: -1 no max args */
typedef struct _CommandEntry {
struct _CommandEntry {
char * cmd;
int min;
int max;
unsigned int reqPermission;
CommandHandlerFunction handler;
} CommandEntry;
CommandListHandlerFunction listHandler;
};
char * current_command = NULL;
int command_listNum = 0;
CommandEntry * getCommandEntryFromString(char * string, int * permission);
List * commandList;
......@@ -105,23 +119,32 @@ CommandEntry * newCommandEntry() {
cmd->min = 0;
cmd->max = 0;
cmd->handler = NULL;
cmd->listHandler = NULL;
cmd->reqPermission = 0;
return cmd;
}
void addCommand(char * name, unsigned int reqPermission, int minargs,
int maxargs, CommandHandlerFunction handler_func)
int maxargs, CommandHandlerFunction handler_func,
CommandListHandlerFunction listHandler_func)
{
CommandEntry * cmd = newCommandEntry();
cmd->cmd = name;
cmd->min = minargs;
cmd->max = maxargs;
cmd->handler = handler_func;
cmd->listHandler = listHandler_func;
cmd->reqPermission = reqPermission;
insertInList(commandList, cmd->cmd, cmd);
}
int handleUrlHandlers(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return printRemoteUrlHandlers(fp);
}
int handlePlay(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
......@@ -131,11 +154,12 @@ int handlePlay(FILE * fp, unsigned int * permission, int argArrayLength,
if(argArrayLength==2) {
song = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG,
"need a positive integer");
return -1;
}
}
return playPlaylist(fp,song,1);
return playPlaylist(fp,song,0);
}
int handleStop(FILE * fp, unsigned int * permission, int argArrayLength,
......@@ -151,8 +175,7 @@ int handlePause(FILE * fp, unsigned int * permission,
char * test;
int pause = strtol(argArray[1],&test,10);
if(*test!='\0' || (pause!=0 && pause!=1)) {
myfprintf(fp,"%s \%s\" is not 0 or 1\n",
COMMAND_RESPOND_ERROR,pause);
commandError(fp, ACK_ERROR_ARG, "\%s\" is not 0 or 1", argArray[1]);
return -1;
}
return playerSetPause(fp,pause);
......@@ -164,6 +187,8 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
char * state = NULL;
int updateJobId;
int song;
playPlaylistIfPlayerStopped();
switch(getPlayerState()) {
......@@ -183,16 +208,23 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_RANDOM,getPlaylistRandomStatus());
myfprintf(fp,"%s: %li\n",COMMAND_STATUS_PLAYLIST,getPlaylistVersion());
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_PLAYLIST_LENGTH,getPlaylistLength());
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_CROSSFADE,(int)getPlayerCrossFade());
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_CROSSFADE,
(int)(getPlayerCrossFade()+0.5));
myfprintf(fp,"%s: %s\n",COMMAND_STATUS_STATE,state);
song = getPlaylistCurrentSong();
if(song >= 0) myfprintf(fp,"%s: %i\n",COMMAND_STATUS_SONG,song);
if(getPlayerState()!=PLAYER_STATE_STOP) {
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_SONG,getPlaylistCurrentSong());
myfprintf(fp,"%s: %i:%i\n",COMMAND_STATUS_TIME,getPlayerElapsedTime(),getPlayerTotalTime());
myfprintf(fp,"%s: %li\n",COMMAND_STATUS_BITRATE,getPlayerBitRate(),getPlayerTotalTime());
myfprintf(fp,"%s: %u:%i:%i\n",COMMAND_STATUS_AUDIO,getPlayerSampleRate(),getPlayerBits(),getPlayerChannels());
}
if((updateJobId = isUpdatingDB())) {
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_UPDATING_DB,updateJobId);
}
if(getPlayerError()!=PLAYER_ERROR_NOERROR) {
myfprintf(fp,"%s: %s\n",COMMAND_STATUS_ERROR,getPlayerErrorStr());
}
......@@ -217,10 +249,13 @@ int handleClose(FILE * fp, unsigned int * permission, int argArrayLength,
int handleAdd(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
char * directory = NULL;
char * path = NULL;
if(argArrayLength == 2) directory = argArray[1];
return addAllIn(fp,directory);
if(argArrayLength == 2) {
path = argArray[1];
if(isRemoteUrl(path)) return addToPlaylist(fp,path);
}
return addAllIn(fp,path);
}
int handleDelete(FILE * fp, unsigned int * permission, int argArrayLength,
......@@ -231,7 +266,8 @@ int handleDelete(FILE * fp, unsigned int * permission, int argArrayLength,
song = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG,
"need a positive integer");
return -1;
}
return deleteFromPlaylist(fp,song);
......@@ -295,7 +331,8 @@ int handlePlaylistInfo(FILE * fp, unsigned int * permission,
if(argArrayLength == 2) {
song = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG,
"%s need a positive integer");
return -1;
}
}
......@@ -314,11 +351,45 @@ int handleSearch(FILE * fp, unsigned int * permission, int argArrayLength,
return searchForSongsIn(fp,NULL,argArray[1],argArray[2]);
}
int listHandleUpdate(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray, ListNode * commandNode, CommandEntry * cmd)
{
static List * pathList = NULL;
CommandEntry * nextCmd = NULL;
ListNode * nextNode = commandNode->nextNode;;
if(!pathList) pathList = makeList(NULL);
if(argArrayLength==2) insertInList(pathList,argArray[1],NULL);
else insertInList(pathList,"",NULL);
if(nextNode) {
nextCmd = getCommandEntryFromString((void *)nextNode->data,
permission);
}
if(cmd!=nextCmd) {
int ret = updateInit(fp,pathList);
freeList(pathList);
pathList = NULL;
return ret;
}
return 0;
}
int handleUpdate(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
incrPlaylistVersion();
return updateMp3Directory(fp);
if(argArrayLength==2) {
int ret;
List * pathList = makeList(NULL);
insertInList(pathList,argArray[1],NULL);
ret = updateInit(fp,pathList);
freeList(pathList);
return ret;
}
return updateInit(fp,NULL);
}
int handleNext(FILE * fp, unsigned int * permission, int argArrayLength,
......@@ -350,7 +421,7 @@ int handleVolume(FILE * fp, unsigned int * permission, int argArrayLength,
change = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG, "need an integer");
return -1;
}
return changeVolumeLevel(fp,change,1);
......@@ -364,7 +435,7 @@ int handleSetVol(FILE * fp, unsigned int * permission, int argArrayLength,
level = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG, "need an integer");
return -1;
}
return changeVolumeLevel(fp,level,0);
......@@ -378,7 +449,7 @@ int handleRepeat(FILE * fp, unsigned int * permission, int argArrayLength,
status = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG, "need an integer");
return -1;
}
return setPlaylistRepeatStatus(fp,status);
......@@ -392,7 +463,7 @@ int handleRandom(FILE * fp, unsigned int * permission, int argArrayLength,
status = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG, "need an integer");
return -1;
}
return setPlaylistRandomStatus(fp,status);
......@@ -429,14 +500,14 @@ int handleMove(FILE * fp, unsigned int * permission, int argArrayLength,
from = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s \"%s\" is not a integer\n",
COMMAND_RESPOND_ERROR,argArray[1]);
commandError(fp, ACK_ERROR_ARG,
"\"%s\" is not a integer", argArray[1]);
return -1;
}
to = strtol(argArray[2],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s \"%s\" is not a integer\n",
COMMAND_RESPOND_ERROR,argArray[2]);
commandError(fp, ACK_ERROR_ARG,
"\"%s\" is not a integer", argArray[2]);
return -1;
}
return moveSongInPlaylist(fp,from,to);
......@@ -451,14 +522,14 @@ int handleSwap(FILE * fp, unsigned int * permission, int argArrayLength,
song1 = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s \"%s\" is not a integer\n",
COMMAND_RESPOND_ERROR,argArray[1]);
commandError(fp, ACK_ERROR_ARG,
"\"%s\" is not a integer", argArray[1]);
return -1;
}
song2 = strtol(argArray[2],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s \"%s\" is not a integer\n",
COMMAND_RESPOND_ERROR,argArray[2]);
commandError(fp, ACK_ERROR_ARG, "\"%s\" is not a integer",
argArray[2]);
return -1;
}
return swapSongsInPlaylist(fp,song1,song2);
......@@ -473,14 +544,14 @@ int handleSeek(FILE * fp, unsigned int * permission, int argArrayLength,
song = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s \"%s\" is not a integer\n",
COMMAND_RESPOND_ERROR,argArray[1]);
commandError(fp, ACK_ERROR_ARG,
"\"%s\" is not a integer", argArray[1]);
return -1;
}
time = strtol(argArray[2],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s \"%s\" is not a integer\n",
COMMAND_RESPOND_ERROR,argArray[2]);
commandError(fp, ACK_ERROR_ARG,
"\"%s\" is not a integer", argArray[2]);
return -1;
}
return seekSongInPlaylist(fp,song,time);
......@@ -505,7 +576,7 @@ int handlePassword(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
if(getPermissionFromPassword(argArray[1],permission)<0) {
myfprintf(fp,"%s incorrect password\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_PASSWORD, "incorrect password");
return -1;
}
......@@ -520,8 +591,8 @@ int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
time = strtol(argArray[1],&test,10);
if(*test!='\0' || time<0) {
myfprintf(fp,"%s \"%s\" is not a integer >= 0\n",
COMMAND_RESPOND_ERROR,argArray[1]);
commandError(fp, ACK_ERROR_ARG,
"\"%s\" is not a integer >= 0", argArray[1]);
return -1;
}
......@@ -533,42 +604,43 @@ int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
void initCommands() {
commandList = makeList(free);
addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay);
addCommand(COMMAND_STOP ,PERMISSION_CONTROL, 0, 0,handleStop);
addCommand(COMMAND_PAUSE ,PERMISSION_CONTROL, 0, 1,handlePause);
addCommand(COMMAND_STATUS ,PERMISSION_READ, 0, 0,commandStatus);
addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill);
addCommand(COMMAND_CLOSE ,0, -1,-1,handleClose);
addCommand(COMMAND_ADD ,PERMISSION_ADD, 0, 1,handleAdd);
addCommand(COMMAND_DELETE ,PERMISSION_CONTROL, 1, 1,handleDelete);
addCommand(COMMAND_PLAYLIST ,PERMISSION_READ, 0, 0,handlePlaylist);
addCommand(COMMAND_SHUFFLE ,PERMISSION_CONTROL, 0, 0,handleShuffle);
addCommand(COMMAND_CLEAR ,PERMISSION_CONTROL, 0, 0,handleClear);
addCommand(COMMAND_SAVE ,PERMISSION_CONTROL, 1, 1,handleSave);
addCommand(COMMAND_LOAD ,PERMISSION_ADD, 1, 1,handleLoad);
addCommand(COMMAND_LSINFO ,PERMISSION_READ, 0, 1,handleLsInfo);
addCommand(COMMAND_RM ,PERMISSION_CONTROL, 1, 1,handleRm);
addCommand(COMMAND_PLAYLISTINFO,PERMISSION_READ, 0, 1,handlePlaylistInfo);
addCommand(COMMAND_FIND ,PERMISSION_READ, 2, 2,handleFind);
addCommand(COMMAND_SEARCH ,PERMISSION_READ, 2, 2,handleSearch);
addCommand(COMMAND_UPDATE ,PERMISSION_ADMIN, 0, 0,handleUpdate);
addCommand(COMMAND_NEXT ,PERMISSION_CONTROL, 0, 0,handleNext);
addCommand(COMMAND_PREVIOUS ,PERMISSION_CONTROL, 0, 0,handlePrevious);
addCommand(COMMAND_LISTALL ,PERMISSION_READ, 0, 1,handleListAll);
addCommand(COMMAND_VOLUME ,PERMISSION_CONTROL, 1, 1,handleVolume);
addCommand(COMMAND_REPEAT ,PERMISSION_CONTROL, 1, 1,handleRepeat);
addCommand(COMMAND_RANDOM ,PERMISSION_CONTROL, 1, 1,handleRandom);
addCommand(COMMAND_STATS ,PERMISSION_READ, 0, 0,handleStats);
addCommand(COMMAND_CLEAR_ERROR ,PERMISSION_CONTROL, 0, 0,handleClearError);
addCommand(COMMAND_LIST ,PERMISSION_READ, 1, 2,handleList);
addCommand(COMMAND_MOVE ,PERMISSION_CONTROL, 2, 2,handleMove);
addCommand(COMMAND_SWAP ,PERMISSION_CONTROL, 2, 2,handleSwap);
addCommand(COMMAND_SEEK ,PERMISSION_CONTROL, 2, 2,handleSeek);
addCommand(COMMAND_LISTALLINFO ,PERMISSION_READ, 0, 1,handleListAllInfo);
addCommand(COMMAND_PING ,0, 0, 0,handlePing);
addCommand(COMMAND_SETVOL ,PERMISSION_CONTROL, 1, 1,handleSetVol);
addCommand(COMMAND_PASSWORD ,0, 1, 1,handlePassword);
addCommand(COMMAND_CROSSFADE ,PERMISSION_CONTROL, 1, 1,handleCrossfade);
addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay,NULL);
addCommand(COMMAND_STOP ,PERMISSION_CONTROL, 0, 0,handleStop,NULL);
addCommand(COMMAND_PAUSE ,PERMISSION_CONTROL, 0, 1,handlePause,NULL);
addCommand(COMMAND_STATUS ,PERMISSION_READ, 0, 0,commandStatus,NULL);
addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill,NULL);
addCommand(COMMAND_CLOSE ,0, -1,-1,handleClose,NULL);
addCommand(COMMAND_ADD ,PERMISSION_ADD, 0, 1,handleAdd,NULL);
addCommand(COMMAND_DELETE ,PERMISSION_CONTROL, 1, 1,handleDelete,NULL);
addCommand(COMMAND_PLAYLIST ,PERMISSION_READ, 0, 0,handlePlaylist,NULL);
addCommand(COMMAND_SHUFFLE ,PERMISSION_CONTROL, 0, 0,handleShuffle,NULL);
addCommand(COMMAND_CLEAR ,PERMISSION_CONTROL, 0, 0,handleClear,NULL);
addCommand(COMMAND_SAVE ,PERMISSION_CONTROL, 1, 1,handleSave,NULL);
addCommand(COMMAND_LOAD ,PERMISSION_ADD, 1, 1,handleLoad,NULL);
addCommand(COMMAND_LSINFO ,PERMISSION_READ, 0, 1,handleLsInfo,NULL);
addCommand(COMMAND_RM ,PERMISSION_CONTROL, 1, 1,handleRm,NULL);
addCommand(COMMAND_PLAYLISTINFO,PERMISSION_READ, 0, 1,handlePlaylistInfo,NULL);
addCommand(COMMAND_FIND ,PERMISSION_READ, 2, 2,handleFind,NULL);
addCommand(COMMAND_SEARCH ,PERMISSION_READ, 2, 2,handleSearch,NULL);
addCommand(COMMAND_UPDATE ,PERMISSION_ADMIN, 0, 1,handleUpdate,listHandleUpdate);
addCommand(COMMAND_NEXT ,PERMISSION_CONTROL, 0, 0,handleNext,NULL);
addCommand(COMMAND_PREVIOUS ,PERMISSION_CONTROL, 0, 0,handlePrevious,NULL);
addCommand(COMMAND_LISTALL ,PERMISSION_READ, 0, 1,handleListAll,NULL);
addCommand(COMMAND_VOLUME ,PERMISSION_CONTROL, 1, 1,handleVolume,NULL);
addCommand(COMMAND_REPEAT ,PERMISSION_CONTROL, 1, 1,handleRepeat,NULL);
addCommand(COMMAND_RANDOM ,PERMISSION_CONTROL, 1, 1,handleRandom,NULL);
addCommand(COMMAND_STATS ,PERMISSION_READ, 0, 0,handleStats,NULL);
addCommand(COMMAND_CLEAR_ERROR ,PERMISSION_CONTROL, 0, 0,handleClearError,NULL);
addCommand(COMMAND_LIST ,PERMISSION_READ, 1, 2,handleList,NULL);
addCommand(COMMAND_MOVE ,PERMISSION_CONTROL, 2, 2,handleMove,NULL);
addCommand(COMMAND_SWAP ,PERMISSION_CONTROL, 2, 2,handleSwap,NULL);
addCommand(COMMAND_SEEK ,PERMISSION_CONTROL, 2, 2,handleSeek,NULL);
addCommand(COMMAND_LISTALLINFO ,PERMISSION_READ, 0, 1,handleListAllInfo,NULL);
addCommand(COMMAND_PING ,0, 0, 0,handlePing,NULL);
addCommand(COMMAND_SETVOL ,PERMISSION_CONTROL, 1, 1,handleSetVol,NULL);
addCommand(COMMAND_PASSWORD ,0, 1, 1,handlePassword,NULL);
addCommand(COMMAND_CROSSFADE ,PERMISSION_CONTROL, 1, 1,handleCrossfade,NULL);
addCommand(COMMAND_URL_HANDLERS,PERMISSION_READ, 0, 0,handleUrlHandlers,NULL);
sortList(commandList);
}
......@@ -584,45 +656,146 @@ int checkArgcAndPermission(CommandEntry * cmd, FILE *fp,
int max = cmd->max + 1;
if (cmd->reqPermission != (permission & cmd->reqPermission)) {
myfprintf(fp,"%s You don't have permission for \"%s\"\n",COMMAND_RESPOND_ERROR,cmd->cmd);
if(fp) {
commandError(fp, ACK_ERROR_PERMISSION,
"you don't have permission for \"%s\"",
cmd->cmd);
}
return -1;
}
if (min == 0) return 0;
if (min == max && max != argc) {
myfprintf(fp,"%s Wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
if(fp) {
commandError(fp, ACK_ERROR_ARG,
"wrong number of arguments for \"%s\"",
argArray[0]);
}
return -1;
}
else if (argc < min) {
myfprintf(fp,"%s too few arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
if(fp) {
commandError(fp, ACK_ERROR_ARG,
"too few arguments for \"%s\"",
argArray[0]);
}
return -1;
}
else if (argc > max && max /* != 0 */) {
myfprintf(fp,"%s too many arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
if(fp) {
commandError(fp, ACK_ERROR_ARG,
"too many arguments for \"%s\"",
argArray[0]);
}
return -1;
}
else return 0;
}
int processCommand(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
CommandEntry * getCommandEntryAndCheckArgcAndPermission(FILE * fp,
unsigned int * permission, int argArrayLength, char ** argArray)
{
static char unknown[] = "";
CommandEntry * cmd;
if(argArrayLength == 0) return 0;
current_command = unknown;
if(argArrayLength == 0) return NULL;
if(!findInList(commandList, argArray[0],(void *)&cmd)) {
myfprintf(fp,"%s Unknown command \"%s\"\n",COMMAND_RESPOND_ERROR,
argArray[0]);
return -1;
if(fp) {
commandError(fp, ACK_ERROR_UNKNOWN,
"unknown command \"%s\"", argArray[0]);
}
return NULL;
}
current_command = cmd->cmd;
if(checkArgcAndPermission(cmd, fp, *permission, argArrayLength,
argArray) < 0)
{
return -1;
return NULL;
}
return cmd->handler(fp, permission, argArrayLength, argArray);
return cmd;
}
CommandEntry * getCommandEntryFromString(char * string, int * permission) {
CommandEntry * cmd = NULL;
char ** argArray;
int argArrayLength = buffer2array(string,&argArray);
if(0==argArrayLength) return NULL;
cmd = getCommandEntryAndCheckArgcAndPermission(NULL,permission,
argArrayLength,argArray);
freeArgArray(argArray,argArrayLength);
return cmd;
}
int processCommandInternal(FILE * fp, unsigned int * permission,
char * commandString,
ListNode * commandNode)
{
int argArrayLength;
char ** argArray;
CommandEntry * cmd;
int ret = -1;
argArrayLength = buffer2array(commandString,&argArray);
if(argArrayLength == 0) return 0;
if((cmd = getCommandEntryAndCheckArgcAndPermission(fp,permission,
argArrayLength,argArray)))
{
if(NULL==commandNode || NULL==cmd->listHandler) {
ret = cmd->handler(fp, permission, argArrayLength,
argArray);
}
else {
ret = cmd->listHandler(fp, permission, argArrayLength,
argArray, commandNode, cmd);
}
}
freeArgArray(argArray,argArrayLength);
current_command = NULL;
return ret;
}
int proccessListOfCommands(FILE * fp, int * permission, int * expired,
List * list)
{
ListNode * node = list->firstNode;
ListNode * tempNode;
int ret = 0;
command_listNum = 0;
while(node!=NULL) {
DEBUG("proccesListOfCommands: process command \"%s\"\n",
node->data);
ret = processCommandInternal(fp,permission,(char *)node->data,
node);
DEBUG("proccessListOfCommands: command returned %i\n",ret);
tempNode = node->nextNode;
deleteNodeFromList(list,node);
node = tempNode;
if(ret!=0 || (*expired)!=0) node = NULL;
command_listNum++;
}
command_listNum = 0;
return ret;
}
int processCommand(FILE * fp, unsigned int * permission, char * commandString) {
return processCommandInternal(fp,permission,commandString,NULL);
}
......@@ -21,19 +21,43 @@
#include "../config.h"
#include "list.h"
#include "myfprintf.h"
#include "log.h"
#include "ack.h"
#include <stdio.h>
#define COMMAND_RETURN_KILL 10
#define COMMAND_RETURN_CLOSE 20
#define COMMAND_RESPOND_ERROR "ACK"
#define COMMAND_RESPOND_OK "OK"
extern char * current_command;
extern int command_listNum;
int proccessListOfCommands(FILE * fp, int * permission, int * expired,
List * list);
int processCommand(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray);
int processCommand(FILE * fp, unsigned int * permission, char * commandString);
void initCommands();
void finishCommands();
#define commandSuccess(fp) myfprintf(fp, "OK\n")
#define commandError(fp, error, format, ... ) \
{\
if(current_command) { \
myfprintf(fp, "ACK [%i@%i] {%s} " format "\n", \
(int)error, command_listNum, \
current_command, ##__VA_ARGS__); \
current_command = NULL; \
} \
else { \
myfprintf(fp, "ACK [%i@%i] " format "\n", \
(int)error, command_listNum, \
##__VA_ARGS__); \
} \
}
#endif
......@@ -37,14 +37,14 @@
#define CONF_COMMENT '#'
#define CONF_NUMBER_OF_PARAMS 27
#define CONF_NUMBER_OF_PARAMS 29
#define CONF_NUMBER_OF_PATHS 6
#define CONF_NUMBER_OF_REQUIRED 5
#define CONF_NUMBER_OF_ALLOW_CATS 1
#define CONF_CONNECTION_TIMEOUT_DEFAULT "60"
#define CONF_MAX_CONNECTIONS_DEFAULT "5"
#define CONF_MAX_PLAYLIST_LENGTH_DEFAULT "4096"
#define CONF_MAX_PLAYLIST_LENGTH_DEFAULT "16384"
#define CONF_BUFFER_BEFORE_PLAY_DEFAULT "25%"
#define CONF_MAX_COMMAND_LIST_SIZE_DEFAULT "2048"
#define CONF_MAX_OUTPUT_BUFFER_SIZE_DEFAULT "2048"
......@@ -123,7 +123,9 @@ char ** readConf(char * file) {
"filesystem_charset",
"password",
"default_permissions",
"buffer_size"
"buffer_size",
"replaygain",
"audio_output_format"
};
int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = {
......@@ -160,7 +162,7 @@ char ** readConf(char * file) {
if(!(fp=fopen(file,"r"))) {
ERROR("problems opening file %s for reading\n",file);
exit(-1);
exit(EXIT_FAILURE);
}
while(myFgets(string,sizeof(string),fp)) {
......@@ -169,13 +171,13 @@ char ** readConf(char * file) {
if(numberOfArgs==0) continue;
if(2!=numberOfArgs) {
ERROR("improperly formated config line: %s\n",string);
exit(-1);
exit(EXIT_FAILURE);
}
i = 0;
while(i<CONF_NUMBER_OF_PARAMS && 0!=strcmp(conf_strings[i],array[0])) i++;
if(i>=CONF_NUMBER_OF_PARAMS) {
ERROR("unrecognized line in conf: %s\n",string);
exit(-1);
exit(EXIT_FAILURE);
}
if(conf_params[i]!=NULL) {
if(allowCat[i]) {
......@@ -203,7 +205,7 @@ char ** readConf(char * file) {
if(conf_params[conf_required[i]] == NULL) {
ERROR("%s is unassigned in conf file\n",
conf_strings[conf_required[i]]);
exit(-1);
exit(EXIT_FAILURE);
}
}
......@@ -214,7 +216,7 @@ char ** readConf(char * file) {
{
ERROR("\"%s\" is not an absolute path\n",
conf_params[conf_absolutePaths[i]]);
exit(-1);
exit(EXIT_FAILURE);
}
/* Parse ~ in path */
else if(conf_params[conf_absolutePaths[i]] &&
......@@ -230,7 +232,7 @@ char ** readConf(char * file) {
if((pwd = getpwuid(uid)) == NULL) {
ERROR("problems getting passwd entry "
"for current user\n");
exit(-1);
exit(EXIT_FAILURE);
}
}
else {
......@@ -249,7 +251,7 @@ char ** readConf(char * file) {
ERROR("user \"%s\" not found\n",
&(conf_params[
conf_absolutePaths[i]][1]));
exit(-1);
exit(EXIT_FAILURE);
}
if(foundSlash) *ch = '/';
}
......@@ -268,3 +270,4 @@ char ** readConf(char * file) {
char ** getConf() {
return conf_params;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -48,6 +48,8 @@
#define CONF_PASSWORD 24
#define CONF_DEFAULT_PERMISSIONS 25
#define CONF_BUFFER_SIZE 26
#define CONF_REPLAYGAIN 27
#define CONF_AUDIO_OUTPUT_FORMAT 28
#define CONF_CAT_CHAR "\n"
......@@ -61,3 +63,4 @@ void initConf();
void writeConf(char * file);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -25,23 +25,9 @@
#include "audio.h"
#include "path.h"
#include "log.h"
#ifdef HAVE_MAD
#include "mp3_decode.h"
#endif
#ifdef HAVE_OGG
#include "ogg_decode.h"
#endif
#ifdef HAVE_FLAC
#include "flac_decode.h"
#endif
#ifdef HAVE_AUDIOFILE
#include "audiofile_decode.h"
#endif
#ifdef HAVE_FAAD
#include "mp4_decode.h"
#include "aac_decode.h"
#endif
#include "sig_handlers.h"
#include "ls.h"
#include "utf8.h"
#include <signal.h>
#include <sys/types.h>
......@@ -51,15 +37,16 @@
#include <unistd.h>
#include <string.h>
int * decode_pid = NULL;
volatile int * volatile decode_pid = NULL;
void decodeSigHandler(int sig) {
if(sig==SIGCHLD) {
int status;
if(decode_pid && *decode_pid==wait3(&status,WNOHANG,NULL)) {
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR("decode process died from a "
"non-TERM signal: %i\n",
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM &&
WTERMSIG(status)!=SIGINT)
{
ERROR("decode process died from signal: %i\n",
WTERMSIG(status));
}
*decode_pid = 0;
......@@ -70,22 +57,24 @@ void decodeSigHandler(int sig) {
int pid = *decode_pid;
if(pid>0) kill(pid,SIGTERM);
}
exit(0);
exit(EXIT_SUCCESS);
}
}
void stopDecode(DecoderControl * dc) {
if(decode_pid && *decode_pid>0 &&
(dc->start || dc->state==DECODE_STATE_DECODE))
(dc->start || dc->state!=DECODE_STATE_STOP))
{
dc->stop = 1;
while(decode_pid && *decode_pid>0 && dc->stop) my_usleep(1000);
while(decode_pid && *decode_pid>0 && dc->stop) my_usleep(10000);
}
}
void quitDecode(PlayerControl * pc, DecoderControl * dc) {
stopDecode(dc);
pc->metadataState = PLAYER_METADATA_STATE_READ;
pc->state = PLAYER_STATE_STOP;
dc->seek = 0;
pc->play = 0;
pc->stop = 0;
pc->pause = 0;
......@@ -109,44 +98,88 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
return (int)chunks;
}
int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
Buffer * cb)
#define handleDecodeStart() \
if(decodeWaitedOn) { \
if(dc->state!=DECODE_STATE_START && *decode_pid > 0 && \
dc->error==DECODE_ERROR_NOERROR) \
{ \
decodeWaitedOn = 0; \
if(openAudioDevice(&(cb->audioFormat))<0) { \
strncpy(pc->erroredUrl, pc->utf8url, \
MAXPATHLEN); \
pc->erroredUrl[MAXPATHLEN] = '\0'; \
pc->error = PLAYER_ERROR_AUDIO; \
quitDecode(pc,dc); \
return; \
} \
if(pc->metadataState == PLAYER_METADATA_STATE_WRITE && \
dc->metadataSet) \
{ \
memcpy(pc->metadata, dc->metadata, \
DECODE_METADATA_LENGTH); \
pc->metadata[DECODE_METADATA_LENGTH-1] = '\0'; \
pc->title = dc->title; \
pc->artist = dc->artist; \
pc->album = dc->album; \
} \
pc->metadataState = PLAYER_METADATA_STATE_READ; \
pc->totalTime = dc->totalTime; \
pc->sampleRate = dc->audioFormat.sampleRate; \
pc->bits = dc->audioFormat.bits; \
pc->channels = dc->audioFormat.channels; \
sizeToTime = 8.0/cb->audioFormat.bits/ \
cb->audioFormat.channels/ \
cb->audioFormat.sampleRate; \
} \
else if(dc->state!=DECODE_STATE_START || *decode_pid <= 0) { \
strncpy(pc->erroredUrl, pc->utf8url, MAXPATHLEN); \
pc->erroredUrl[MAXPATHLEN] = '\0'; \
pc->error = PLAYER_ERROR_FILE; \
quitDecode(pc,dc); \
return; \
} \
else { \
my_usleep(10000); \
continue; \
} \
}
int waitOnDecode(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
int * decodeWaitedOn)
{
while(decode_pid && *decode_pid>0 && dc->start) my_usleep(1000);
strncpy(pc->currentUrl, pc->utf8url, MAXPATHLEN);
pc->currentUrl[MAXPATHLEN] = '\0';
while(decode_pid && *decode_pid>0 && dc->start) my_usleep(10000);
if(dc->start || dc->error!=DECODE_ERROR_NOERROR) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
strncpy(pc->erroredUrl, pc->utf8url, MAXPATHLEN);
pc->erroredUrl[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_FILE;
quitDecode(pc,dc);
return -1;
}
if(initAudio(af)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_AUDIO;
quitDecode(pc,dc);
return -1;
}
pc->totalTime = cb->totalTime;
pc->elapsedTime = 0;
pc->bitRate = 0;
pc->sampleRate = af->sampleRate;
pc->bits = af->bits;
pc->channels = af->channels;
pc->totalTime = pc->fileTime;
pc->elapsedTime = 0;
pc->bitRate = 0;
pc->sampleRate = 0;
pc->bits = 0;
pc->channels = 0;
*decodeWaitedOn = 1;
return 0;
}
void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
Buffer * cb)
int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
int * decodeWaitedOn)
{
int ret = -1;
if(decode_pid && *decode_pid>0) {
cb->next = -1;
if(dc->state!=DECODE_STATE_DECODE || dc->error ||
strcmp(dc->file,pc->file)!=0)
if(dc->state==DECODE_STATE_STOP || dc->error ||
strcmp(dc->utf8url, pc->utf8url)!=0)
{
stopDecode(dc);
cb->begin = 0;
......@@ -154,24 +187,34 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
cb->wrap = 0;
dc->error = 0;
dc->start = 1;
waitOnDecode(pc,af,dc,cb);
waitOnDecode(pc,dc,cb,decodeWaitedOn);
}
if(*decode_pid>0 && dc->state==DECODE_STATE_DECODE) {
if(*decode_pid>0 && dc->state!=DECODE_STATE_STOP &&
dc->seekable)
{
dc->seekWhere = pc->seekWhere > pc->totalTime-0.1 ?
pc->totalTime-0.1 :
pc->seekWhere;
dc->seekWhere = 0 > dc->seekWhere ? 0 : dc->seekWhere;
dc->seekError = 0;
dc->seekError = 0;
dc->seek = 1;
pc->bitRate = 0;
while(*decode_pid>0 && dc->seek) my_usleep(1000);
if(!dc->seekError) pc->elapsedTime = dc->seekWhere;
while(*decode_pid>0 && dc->seek) my_usleep(10000);
if(!dc->seekError) {
pc->elapsedTime = dc->seekWhere;
ret = 0;
}
}
}
pc->seek = 0;
return ret;
}
#define processDecodeInput() \
if(pc->cycleLogFiles) { \
myfprintfCloseAndOpenLogFile(); \
pc->cycleLogFiles = 0; \
} \
if(pc->lockQueue) { \
pc->queueLockState = PLAYER_QUEUE_LOCKED; \
pc->lockQueue = 0; \
......@@ -184,9 +227,10 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
pause = !pause; \
if(pause) pc->state = PLAYER_STATE_PAUSE; \
else { \
if(initAudio(NULL)<0) { \
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); \
pc->erroredFile[MAXPATHLEN] = '\0'; \
if(openAudioDevice(NULL)<0) { \
strncpy(pc->erroredUrl, pc->utf8url, \
MAXPATHLEN); \
pc->erroredUrl[MAXPATHLEN] = '\0'; \
pc->error = PLAYER_ERROR_AUDIO; \
quitDecode(pc,dc); \
return; \
......@@ -195,303 +239,398 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
} \
pc->pause = 0; \
kill(getppid(),SIGUSR1); \
if(pause) finishAudio(); \
if(pause) closeAudioDevice(); \
} \
if(pc->seek) { \
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
decodeSeek(pc,af,dc,cb); \
pc->beginTime = pc->elapsedTime; \
doCrossFade = 0; \
nextChunk = -1; \
bbp = 0; \
if(decodeSeek(pc,dc,cb,&decodeWaitedOn) == 0) { \
doCrossFade = 0; \
nextChunk = -1; \
bbp = 0; \
} \
} \
if(pc->stop) { \
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
quitDecode(pc,dc); \
return; \
}
int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
DecoderControl * dc) {
void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) {
int ret;
InputStream inStream;
InputPlugin * plugin = NULL;
char * path;
if(isRemoteUrl(pc->utf8url)) {
path = utf8StrToLatin1Dup(pc->utf8url);
}
else path = strdup(rmp2amp(utf8ToFsCharset(pc->utf8url)));
if(!path) {
dc->error = DECODE_ERROR_FILE;
dc->state = DECODE_STATE_STOP;
dc->start = 0;
return;
}
dc->metadataSet = 0;
memset(dc->metadata, 0, DECODE_METADATA_LENGTH);
dc->title = -1;
dc->album = -1;
dc->artist = -1;
strncpy(dc->utf8url, pc->utf8url, MAXPATHLEN);
dc->utf8url[MAXPATHLEN] = '\0';
if(openInputStream(&inStream, path) < 0) {
dc->error = DECODE_ERROR_FILE;
dc->state = DECODE_STATE_STOP;
dc->start = 0;
free(path);
return;
}
dc->seekable = inStream.seekable;
dc->state = DECODE_STATE_START;
dc->start = 0;
while(!inputStreamAtEOF(&inStream) && bufferInputStream(&inStream) < 0
&& !dc->stop);
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
free(path);
return;
}
if(inStream.metaTitle) {
strncpy(dc->metadata, inStream.metaTitle,
DECODE_METADATA_LENGTH-1);
dc->title = 0;
dc->metadataSet = 1;
}
ret = DECODE_ERROR_UNKTYPE;
if(isRemoteUrl(dc->utf8url)) {
plugin = getInputPluginFromMimeType(inStream.mime);
if(plugin == NULL) {
plugin = getInputPluginFromSuffix(
getSuffix(dc->utf8url));
}
/* this is needed for bastard streams that don't have a suffix
or set the mimeType */
if(plugin == NULL) {
plugin = getInputPluginFromName("mp3");
}
if(plugin && (plugin->streamTypes & INPUT_PLUGIN_STREAM_URL) &&
plugin->streamDecodeFunc)
{
ret = plugin->streamDecodeFunc(cb, dc, &inStream);
}
}
else {
plugin = getInputPluginFromSuffix(getSuffix(dc->utf8url));
if(plugin && (plugin->streamTypes && INPUT_PLUGIN_STREAM_FILE))
{
if(plugin->streamDecodeFunc) {
ret = plugin->streamDecodeFunc(cb, dc,
&inStream);
}
else if(plugin->fileDecodeFunc) {
closeInputStream(&inStream);
ret = plugin->fileDecodeFunc(cb, dc, path);
}
}
}
if(ret<0 || ret == DECODE_ERROR_UNKTYPE) {
strncpy(pc->erroredUrl, dc->utf8url, MAXPATHLEN);
pc->erroredUrl[MAXPATHLEN] = '\0';
if(ret != DECODE_ERROR_UNKTYPE) dc->error = DECODE_ERROR_FILE;
else {
dc->error = DECODE_ERROR_UNKTYPE;
closeInputStream(&inStream);
}
dc->stop = 0;
dc->state = DECODE_STATE_STOP;
}
free(path);
}
int decoderInit(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) {
int pid;
int ret;
decode_pid = &(pc->decode_pid);
blockSignals();
pid = fork();
if(pid==0) {
/* CHILD */
unblockSignals();
while(1) {
if(dc->start) {
strncpy(dc->file,pc->file,MAXPATHLEN);
dc->file[MAXPATHLEN] = '\0';
switch(pc->decodeType) {
#ifdef HAVE_MAD
case DECODE_TYPE_MP3:
ret = mp3_decode(cb,af,dc);
break;
#endif
#ifdef HAVE_FAAD
case DECODE_TYPE_AAC:
ret = aac_decode(cb,af,dc);
break;
case DECODE_TYPE_MP4:
ret = mp4_decode(cb,af,dc);
break;
#endif
#ifdef HAVE_OGG
case DECODE_TYPE_OGG:
ret = ogg_decode(cb,af,dc);
break;
#endif
#ifdef HAVE_FLAC
case DECODE_TYPE_FLAC:
ret = flac_decode(cb,af,dc);
break;
#endif
#ifdef HAVE_AUDIOFILE
case DECODE_TYPE_AUDIOFILE:
ret = audiofile_decode(cb,af,dc);
break;
#endif
default:
ret = DECODE_ERROR_UNKTYPE;
strncpy(pc->erroredFile,dc->file,
MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
}
if(ret<0) {
dc->error = DECODE_ERROR_FILE;
dc->start = 0;
dc->stop = 0;
dc->state = DECODE_STATE_STOP;
}
}
if(dc->cycleLogFiles) {
myfprintfCloseAndOpenLogFile();
dc->cycleLogFiles = 0;
}
else if(dc->start || dc->seek) decodeStart(pc, cb, dc);
else if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
else if(dc->seek) dc->start = 1;
else my_usleep(10000);
}
exit(0);
exit(EXIT_SUCCESS);
/* END OF CHILD */
}
else if(pid<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
unblockSignals();
strncpy(pc->erroredUrl, pc->utf8url, MAXPATHLEN);
pc->erroredUrl[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_SYSTEM;
return -1;
}
else *decode_pid = pid;
*decode_pid = pid;
unblockSignals();
return 0;
}
/* decode w/ buffering
* this will fork another process
* child process does decoding
* parent process does playing audio
*/
void decode() {
Buffer * cb;
PlayerControl * pc;
AudioFormat * af;
DecoderControl * dc;
void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
int pause = 0;
int quit = 0;
int bbp = buffered_before_play;
int doCrossFade = 0;
int crossFadeChunks = 0;
int fadePosition;
int nextChunk = -1;
int test;
int decodeWaitedOn = 0;
char silence[CHUNK_SIZE];
double sizeToTime = 0.0;
cb = &(getPlayerData()->buffer);
memset(silence,0,CHUNK_SIZE);
cb->begin = 0;
cb->end = 0;
cb->wrap = 0;
pc = &(getPlayerData()->playerControl);
dc = &(getPlayerData()->decoderControl);
af = &(getPlayerData()->audioFormat);
dc->error = 0;
dc->start = 1;
cb->next = -1;
if(waitOnDecode(pc,dc,cb,&decodeWaitedOn)<0) return;
if(decode_pid==NULL || *decode_pid<=0) {
if(decoderInit(pc,cb,af,dc)<0) return;
}
pc->state = PLAYER_STATE_PLAY;
pc->play = 0;
kill(getppid(),SIGUSR1);
while(*decode_pid>0 && !cb->wrap && cb->end-cb->begin<bbp &&
dc->state!=DECODE_STATE_STOP)
{
/* PARENT */
int pause = 0;
int quit = 0;
int bbp = buffered_before_play;
int doCrossFade = 0;
int crossFadeChunks = 0;
int fadePosition;
int nextChunk = -1;
int test;
if(waitOnDecode(pc,af,dc,cb)<0) return;
pc->state = PLAYER_STATE_PLAY;
pc->play = 0;
pc->beginTime = pc->elapsedTime;
kill(getppid(),SIGUSR1);
while(*decode_pid>0 && !cb->wrap && cb->end-cb->begin<bbp &&
dc->state==DECODE_STATE_DECODE)
processDecodeInput();
if(quit) return;
my_usleep(10000);
}
while(!quit) {
processDecodeInput();
handleDecodeStart();
if(dc->state==DECODE_STATE_STOP &&
pc->queueState==PLAYER_QUEUE_FULL &&
pc->queueLockState==PLAYER_QUEUE_UNLOCKED)
{
processDecodeInput();
if(quit) return;
my_usleep(1000);
cb->next = cb->end;
dc->start = 1;
pc->queueState = PLAYER_QUEUE_DECODE;
kill(getppid(),SIGUSR1);
}
while(!quit) {
processDecodeInput();
if(dc->state==DECODE_STATE_STOP &&
pc->queueState==PLAYER_QUEUE_FULL &&
pc->queueLockState==PLAYER_QUEUE_UNLOCKED)
{
cb->next = cb->end;
dc->start = 1;
pc->queueState = PLAYER_QUEUE_DECODE;
kill(getppid(),SIGUSR1);
}
if(cb->next>=0 && doCrossFade==0 && !dc->start) {
nextChunk = -1;
if(isCurrentAudioFormat(af)) {
doCrossFade = 1;
crossFadeChunks =
calculateCrossFadeChunks(pc,af);
if(!crossFadeChunks ||
pc->crossFade>=cb->totalTime)
{
doCrossFade = -1;
}
if(cb->next>=0 && doCrossFade==0 && !dc->start) {
nextChunk = -1;
if(isCurrentAudioFormat(&(cb->audioFormat))) {
doCrossFade = 1;
crossFadeChunks =
calculateCrossFadeChunks(pc,
&(cb->audioFormat));
if(!crossFadeChunks ||
pc->crossFade>=dc->totalTime)
{
doCrossFade = -1;
}
else doCrossFade = -1;
}
if(pause) my_usleep(10000);
else if((cb->begin!=cb->end || cb->wrap) &&
else doCrossFade = -1;
}
if(pause) my_usleep(10000);
else if((cb->begin!=cb->end || cb->wrap) &&
cb->begin!=cb->next)
{
if(doCrossFade==1 && cb->next>=0 &&
{
if(doCrossFade==1 && cb->next>=0 &&
((cb->next>cb->begin &&
(fadePosition=cb->next-cb->begin)
<=crossFadeChunks) ||
(cb->begin>cb->next &&
(fadePosition=cb->next-cb->begin+
buffered_chunks)<=crossFadeChunks)))
{
if(nextChunk<0) {
crossFadeChunks = fadePosition;
{
if(nextChunk<0) {
crossFadeChunks = fadePosition;
}
test = cb->end;
if(cb->wrap) test+=buffered_chunks;
nextChunk = cb->begin+crossFadeChunks;
if(nextChunk<test) {
if(nextChunk>=buffered_chunks)
{
nextChunk -= buffered_chunks;
}
test = cb->end;
if(cb->wrap) test+=buffered_chunks;
nextChunk = cb->begin+crossFadeChunks;
if(nextChunk<test) {
if(nextChunk>=buffered_chunks)
{
nextChunk-=
buffered_chunks;
}
pcm_mix(cb->chunks+cb->begin*
CHUNK_SIZE,
pcm_mix(cb->chunks+cb->begin*CHUNK_SIZE,
cb->chunks+nextChunk*
CHUNK_SIZE,
cb->chunkSize[
cb->begin],
cb->chunkSize[
nextChunk],
af,
&(cb->audioFormat),
((float)fadePosition)/
crossFadeChunks);
if(cb->chunkSize[nextChunk]>
if(cb->chunkSize[nextChunk]>
cb->chunkSize[cb->begin]
)
{
cb->chunkSize[cb->begin]
{
cb->chunkSize[cb->begin]
= cb->chunkSize
[nextChunk];
}
}
else {
if(dc->state==DECODE_STATE_STOP)
{
doCrossFade = -1;
}
else continue;
}
}
pc->elapsedTime = cb->times[cb->begin];
pc->bitRate = cb->bitRate[cb->begin];
pcm_volumeChange(cb->chunks+cb->begin*
CHUNK_SIZE,
cb->chunkSize[cb->begin],
af,
pc->softwareVolume);
if(playAudio(cb->chunks+cb->begin*CHUNK_SIZE,
cb->chunkSize[cb->begin])<0)
{
quit = 1;
}
cb->begin++;
if(cb->begin>=buffered_chunks) {
cb->begin = 0;
cb->wrap = 0;
else {
if(dc->state==DECODE_STATE_STOP)
{
doCrossFade = -1;
}
else continue;
}
}
else if(cb->next==cb->begin) {
pc->totalPlayTime+= pc->elapsedTime-
pc->beginTime;
if(doCrossFade==1 && nextChunk>=0) {
nextChunk = cb->begin+crossFadeChunks;
test = cb->end;
if(cb->wrap) test+=buffered_chunks;
if(nextChunk<test) {
if(nextChunk>=buffered_chunks)
{
nextChunk-=
buffered_chunks;
}
cb->begin = nextChunk;
}
}
while(pc->queueState==PLAYER_QUEUE_DECODE ||
pc->queueLockState==PLAYER_QUEUE_LOCKED)
{
processDecodeInput();
if(quit) {
quitDecode(pc,dc);
return;
pc->elapsedTime = cb->times[cb->begin];
pc->bitRate = cb->bitRate[cb->begin];
pcm_volumeChange(cb->chunks+cb->begin*
CHUNK_SIZE,
cb->chunkSize[cb->begin],
&(cb->audioFormat),
pc->softwareVolume);
if(playAudio(cb->chunks+cb->begin*CHUNK_SIZE,
cb->chunkSize[cb->begin])<0)
{
quit = 1;
}
pc->totalPlayTime+= sizeToTime*cb->chunkSize[cb->begin];
cb->begin++;
if(cb->begin>=buffered_chunks) {
cb->begin = 0;
cb->wrap = 0;
}
}
else if(cb->next==cb->begin) {
if(doCrossFade==1 && nextChunk>=0) {
nextChunk = cb->begin+crossFadeChunks;
test = cb->end;
if(cb->wrap) test+=buffered_chunks;
if(nextChunk<test) {
if(nextChunk>=buffered_chunks)
{
nextChunk -= buffered_chunks;
}
my_usleep(1000);
}
if(pc->queueState!=PLAYER_QUEUE_PLAY) {
quit = 1;
break;
}
else {
cb->next = -1;
if(waitOnDecode(pc,af,dc,cb)<0) return;
nextChunk = -1;
doCrossFade = 0;
crossFadeChunks = 0;
pc->queueState = PLAYER_QUEUE_EMPTY;
kill(getppid(),SIGUSR1);
}
pc->beginTime = cb->times[cb->begin];
cb->begin = nextChunk;
}
}
else if(*decode_pid<=0 ||
(dc->state==DECODE_STATE_STOP && !dc->start))
while(pc->queueState==PLAYER_QUEUE_DECODE ||
pc->queueLockState==PLAYER_QUEUE_LOCKED)
{
processDecodeInput();
if(quit) {
quitDecode(pc,dc);
return;
}
my_usleep(10000);
}
if(pc->queueState!=PLAYER_QUEUE_PLAY) {
quit = 1;
break;
}
else my_usleep(1000);
else {
cb->next = -1;
if(waitOnDecode(pc,dc,cb,&decodeWaitedOn)<0) {
return;
}
nextChunk = -1;
doCrossFade = 0;
crossFadeChunks = 0;
pc->queueState = PLAYER_QUEUE_EMPTY;
kill(getppid(),SIGUSR1);
}
}
else if(*decode_pid<=0 ||
(dc->state==DECODE_STATE_STOP && !dc->start))
{
quit = 1;
break;
}
else {
if(playAudio(silence, CHUNK_SIZE) < 0) quit = 1;
}
}
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
quitDecode(pc,dc);
quitDecode(pc,dc);
}
/* decode w/ buffering
* this will fork another process
* child process does decoding
* parent process does playing audio
*/
void decode() {
OutputBuffer * cb;
PlayerControl * pc;
DecoderControl * dc;
/* END OF PARENT */
cb = &(getPlayerData()->buffer);
cb->begin = 0;
cb->end = 0;
cb->wrap = 0;
pc = &(getPlayerData()->playerControl);
dc = &(getPlayerData()->decoderControl);
dc->error = 0;
cb->next = -1;
dc->seek = 0;
dc->stop = 0;
dc->start = 1;
if(decode_pid==NULL || *decode_pid<=0) {
if(decoderInit(pc,cb,dc)<0) return;
}
return;
decodeParent(pc, dc, cb);
}
/* this is stuff for inputPlugins to use! */
#define copyStringToMetadata(string, element) { \
if(string && (slen = strlen(string)) && \
pos < DECODE_METADATA_LENGTH-1) \
{ \
strncpy(dc->metadata+pos, string, \
DECODE_METADATA_LENGTH-1-pos); \
element = pos; \
pos += slen+1; \
} \
}
void copyMpdTagToDecoderControlMetadata(DecoderControl * dc, MpdTag * tag) {
int pos = 0;
int slen;
if(dc->metadataSet) return;
if(!tag) return;
memset(dc->metadata, 0, DECODE_METADATA_LENGTH);
copyStringToMetadata(tag->title, dc->title);
copyStringToMetadata(tag->artist, dc->artist);
copyStringToMetadata(tag->album, dc->album);
dc->metadataSet = 1;
}
......@@ -20,39 +20,59 @@
#define DECODE_H
#include "../config.h"
#include "tag.h"
#include "mpd_types.h"
#include "audio.h"
#include <stdio.h>
#include <sys/param.h>
#define DECODE_TYPE_MP3 0
#define DECODE_TYPE_OGG 1
#define DECODE_TYPE_FLAC 2
#define DECODE_TYPE_AUDIOFILE 3
#define DECODE_TYPE_MP4 4
#define DECODE_TYPE_AAC 5
#define DECODE_TYPE_FILE 0
#define DECODE_TYPE_URL 1
#define DECODE_STATE_STOP 0
#define DECODE_STATE_DECODE 1
#define DECODE_STATE_START 1
#define DECODE_STATE_DECODE 2
#define DECODE_ERROR_NOERROR 0
#define DECODE_ERROR_UNKTYPE 1
#define DECODE_ERROR_FILE 2
#define DECODE_ERROR_UNKTYPE 10
#define DECODE_ERROR_FILE 20
#define DECODE_SUFFIX_MP3 1
#define DECODE_SUFFIX_OGG 2
#define DECODE_SUFFIX_FLAC 3
#define DECODE_SUFFIX_AAC 4
#define DECODE_SUFFIX_MP4 5
#define DECODE_SUFFIX_WAVE 6
#define DECODE_METADATA_LENGTH 4096
typedef struct _DecoderControl {
mpd_sint8 state;
mpd_sint8 stop;
mpd_sint8 start;
mpd_uint16 error;
mpd_sint8 seek;
mpd_sint8 seekError;
double seekWhere;
char file[MAXPATHLEN+1];
volatile mpd_sint8 state;
volatile mpd_sint8 stop;
volatile mpd_sint8 start;
volatile mpd_uint16 error;
volatile mpd_sint8 seek;
volatile mpd_sint8 seekError;
volatile mpd_sint8 seekable;
volatile mpd_sint8 cycleLogFiles;
volatile double seekWhere;
AudioFormat audioFormat;
char utf8url[MAXPATHLEN+1];
volatile float totalTime;
volatile mpd_sint8 metadataSet;
char metadata[DECODE_METADATA_LENGTH];
volatile mpd_sint16 title;
volatile mpd_sint16 artist;
volatile mpd_sint16 album;
} DecoderControl;
void decodeSigHandler(int sig);
void decode();
void copyMpdTagToDecoderControlMetadata(DecoderControl * dc, MpdTag * tag);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -26,14 +26,24 @@
#include "conf.h"
#include "stats.h"
#include "playlist.h"
#include "listen.h"
#include "interface.h"
#include "volume.h"
#include "mpd_types.h"
#include "sig_handlers.h"
#include "player.h"
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#define DIRECTORY_DIR "directory: "
#define DIRECTORY_MTIME "mtime: "
......@@ -49,19 +59,33 @@
#define DIRECTORY_SEARCH_TITLE "title"
#define DIRECTORY_SEARCH_FILENAME "filename"
#define DIRECTORY_UPDATE_EXIT_NOUPDATE 0
#define DIRECTORY_UPDATE_EXIT_UPDATE 1
#define DIRECTORY_UPDATE_EXIT_ERROR 2
#define DIRECTORY_RETURN_NOUPDATE 0
#define DIRECTORY_RETURN_UPDATE 1
#define DIRECTORY_RETURN_ERROR -1
typedef List DirectoryList;
typedef struct _Directory {
char * utf8name;
DirectoryList * subDirectories;
struct _Directory * parentDirectory;
SongList * songs;
time_t mtime; /* modification time */
} Directory;
Directory * mp3rootDirectory;
Directory * mp3rootDirectory = NULL;
char * directory_db;
time_t directory_dbModTime = 0;
volatile int directory_updatePid = 0;
char directorydb[MAXPATHLEN+1];
volatile int directory_reReadDB = 0;
volatile mpd_uint16 directory_updateJobId = 0;
DirectoryList * newDirectoryList();
......@@ -77,20 +101,153 @@ int updateDirectory(Directory * directory);
void deleteEmptyDirectoriesInDirectory(Directory * directory);
int addSubDirectoryToDirectory(Directory * directory, char * shortname, char * name);
void removeSongFromDirectory(Directory * directory, char * shortname);
int addSubDirectoryToDirectory(Directory * directory, char * shortname,
char * name);
Directory * getDirectoryDetails(char * name, char ** shortname,
Directory ** parentDirectory);
Directory * getDirectory(char * name);
Song * getSongDetails(char * file, char ** shortnameRet,
Directory ** directoryRet);
int updatePath(char * utf8path);
void sortDirectory(Directory * directory);
void clearUpdatePid() {
directory_updatePid = 0;
}
int isUpdatingDB() {
if(directory_updatePid>0 || directory_reReadDB) {
return directory_updateJobId;
}
return 0;
}
void directory_sigChldHandler(int pid, int status) {
if(directory_updatePid==pid) {
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR("update process died from a "
"non-TERM signal: %i\n",
WTERMSIG(status));
}
else if(!WIFSIGNALED(status)) {
switch(WEXITSTATUS(status))
{
case DIRECTORY_UPDATE_EXIT_UPDATE:
directory_reReadDB = 1;
DEBUG("direcotry_sigChldHandler: "
"updated db\n");
case DIRECTORY_UPDATE_EXIT_NOUPDATE:
DEBUG("direcotry_sigChldHandler: "
"update exitted succesffully\n");
break;
default:
ERROR("error updating db\n");
}
}
clearUpdatePid();
}
}
void readDirectoryDBIfUpdateIsFinished() {
if(directory_reReadDB && 0==directory_updatePid) {
DEBUG("readDirectoryDB since update finished successfully\n");
readDirectoryDB();
incrPlaylistVersion();
directory_reReadDB = 0;
}
}
int updateInit(FILE * fp, List * pathList) {
if(directory_updatePid > 0) {
commandError(fp, ACK_ERROR_UPDATE_ALREADY, "already updating");
return -1;
}
/* need to block CHLD signal, cause it can exit before we
even get a chance to assign directory_updatePID */
blockSignals();
directory_updatePid = fork();
if(directory_updatePid==0) {
/* child */
int dbUpdated = 0;
clearPlayerPid();
unblockSignals();
finishSigHandlers();
close(listenSocket);
freeAllInterfaces();
finishPlaylist();
finishVolume();
if(pathList) {
ListNode * node = pathList->firstNode;
while(node) {
switch(updatePath(node->key)) {
case 1:
dbUpdated = 1;
break;
case 0:
break;
default:
exit(DIRECTORY_UPDATE_EXIT_ERROR);
}
node = node->nextNode;
}
}
else {
if((dbUpdated = updateDirectory(mp3rootDirectory))<0) {
exit(DIRECTORY_UPDATE_EXIT_ERROR);
}
}
if(!dbUpdated) exit(DIRECTORY_UPDATE_EXIT_NOUPDATE);
Directory * newDirectory(Directory * parentDirectory, char * dirname, time_t mtime) {
/* ignore signals since we don't want them to corrupt the db*/
ignoreSignals();
if(writeDirectoryDB()<0) {
ERROR("problems writing music db file, \"%s\"\n",
directory_db);
exit(DIRECTORY_UPDATE_EXIT_ERROR);
}
exit(DIRECTORY_UPDATE_EXIT_UPDATE);
}
else if(directory_updatePid < 0) {
unblockSignals();
ERROR("updateInit: Problems forking()'ing\n");
commandError(fp, ACK_ERROR_SYSTEM,
"problems trying to update");
directory_updatePid = 0;
return -1;
}
unblockSignals();
directory_updateJobId++;
if(directory_updateJobId > 1<<15) directory_updateJobId = 1;
DEBUG("updateInit: fork()'d update child for update job id %i\n",
(int)directory_updateJobId);
myfprintf(fp,"updating_db: %i\n",(int)directory_updateJobId);
return 0;
}
Directory * newDirectory(char * dirname) {
Directory * directory;
directory = malloc(sizeof(Directory));
if(dirname!=NULL) directory->utf8name = strdup(dirname);
else directory->utf8name = NULL;
directory->parentDirectory = parentDirectory;
directory->subDirectories = newDirectoryList();
directory->songs = newSongList();
if(mtime<0) isDir(dirname,&(directory->mtime));
else directory->mtime = mtime;
return directory;
}
......@@ -114,7 +271,7 @@ void removeSongFromDirectory(Directory * directory, char * shortname) {
void * song;
if(findInList(directory->songs,shortname,&song)) {
LOG("removing: %s\n",((Song *)song)->utf8file);
LOG("removing: %s\n",((Song *)song)->utf8url);
deleteFromList(directory->songs,shortname);
}
}
......@@ -137,6 +294,11 @@ void deleteEmptyDirectoriesInDirectory(Directory * directory) {
}
}
/* return values:
-1 -> error
0 -> no error, but nothing updated
1 -> no error, and stuff updated
*/
int updateInDirectory(Directory * directory, char * shortname, char * name) {
time_t mtime;
void * song;
......@@ -145,24 +307,34 @@ int updateInDirectory(Directory * directory, char * shortname, char * name) {
if(isMusic(name,&mtime)) {
if(0==findInList(directory->songs,shortname,&song)) {
addToDirectory(directory,shortname,name);
return DIRECTORY_RETURN_UPDATE;
}
else if(mtime!=((Song *)song)->mtime) {
LOG("updating %s\n",name);
if(updateSongInfo((Song *)song)<0) {
removeSongFromDirectory(directory,shortname);
}
return 1;
}
}
else if(isDir(name,&mtime)) {
else if(isDir(name)) {
if(findInList(directory->subDirectories,shortname,(void **)&subDir)) {
updateDirectory((Directory *)subDir);
if(updateDirectory((Directory *)subDir)>0) return 1;
}
else addSubDirectoryToDirectory(directory,shortname,name);
else {
return addSubDirectoryToDirectory(directory,shortname,
name);
}
}
return 0;
}
/* return values:
-1 -> error
0 -> no error, but nothing removed
1 -> no error, and stuff removed
*/
int removeDeletedFromDirectory(Directory * directory) {
DIR * dir;
char cwd[2];
......@@ -174,6 +346,7 @@ int removeDeletedFromDirectory(Directory * directory) {
char * utf8;
ListNode * node;
ListNode * tmpNode;
int ret = 0;
cwd[0] = '.';
cwd[1] = '\0';
......@@ -183,16 +356,18 @@ int removeDeletedFromDirectory(Directory * directory) {
while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
if(strchr(ent->d_name, '\n')) continue;
utf8 = fsCharsetToUtf8(ent->d_name);
utf8 = strdup(fsCharsetToUtf8(ent->d_name));
if(!utf8) continue;
if(directory->utf8name) {
s = malloc(strlen(directory->utf8name)+strlen(utf8)+2);
sprintf(s,"%s/%s",directory->utf8name,utf8);
}
else s= strdup(utf8);
insertInList(entList,fsCharsetToUtf8(ent->d_name),s);
free(utf8);
insertInList(entList,utf8,s);
}
closedir(dir);
......@@ -201,14 +376,19 @@ int removeDeletedFromDirectory(Directory * directory) {
while(node) {
tmpNode = node->nextNode;
if(findInList(entList,node->key,&name)) {
if(!isDir((char *)name,NULL)) {
if(!isDir((char *)name)) {
LOG("removing directory: %s\n",(char*)name);
deleteFromList(directory->subDirectories,node->key);
deleteFromList(directory->subDirectories,
node->key);
ret = 1;
}
}
else {
LOG("removing directory: %s\n",(char*)name);
LOG("removing directory: ");
if(directory->utf8name) LOG("%s/",directory->utf8name);
LOG("%s\n",node->key);
deleteFromList(directory->subDirectories,node->key);
ret = 1;
}
node = tmpNode;
}
......@@ -219,19 +399,147 @@ int removeDeletedFromDirectory(Directory * directory) {
if(findInList(entList,node->key,(void **)&name)) {
if(!isMusic(name,NULL)) {
removeSongFromDirectory(directory,node->key);
ret = 1;
}
}
else {
removeSongFromDirectory(directory,node->key);
ret = 1;
}
node = tmpNode;
}
freeList(entList);
return 0;
return ret;
}
Directory * addDirectoryPathToDB(char * utf8path, char ** shortname) {
char * parent;
Directory * parentDirectory;
void * directory;
parent = strdup(parentPath(utf8path));
if(strlen(parent)==0) parentDirectory = (void *)mp3rootDirectory;
else parentDirectory = addDirectoryPathToDB(parent,shortname);
*shortname = utf8path+strlen(parent);
while(*(*shortname) && *(*shortname)=='/') (*shortname)++;
if(!findInList(parentDirectory->subDirectories,*shortname, &directory))
{
directory = newDirectory(utf8path);
insertInList(parentDirectory->subDirectories,*shortname,
directory);
}
/* if we're adding directory paths, make sure to delete filenames
with potentially the same name*/
removeSongFromDirectory(parentDirectory,*shortname);
free(parent);
return (Directory *)parentDirectory;
}
Directory * addParentPathToDB(char * utf8path, char ** shortname) {
char * parent;
Directory * parentDirectory;
parent = strdup(parentPath(utf8path));
if(strlen(parent)==0) parentDirectory = (void *)mp3rootDirectory;
else parentDirectory = addDirectoryPathToDB(parent,shortname);
*shortname = utf8path+strlen(parent);
while(*(*shortname) && *(*shortname)=='/') (*shortname)++;
free(parent);
return (Directory *)parentDirectory;
}
/* return values:
-1 -> error
0 -> no error, but nothing updated
1 -> no error, and stuff updated
*/
int updatePath(char * utf8path) {
Directory * directory;
Directory * parentDirectory;
Song * song;
char * shortname;
char * path = sanitizePathDup(utf8path);
time_t mtime;
int ret = 0;
if(NULL==path) return -1;
/* if path is in the DB try to update it, or else delete it */
if((directory = getDirectoryDetails(path,&shortname,
&parentDirectory)))
{
/* if this update directory is successfull, we are done */
if((ret = updateDirectory(directory))>=0)
{
free(path);
sortDirectory(directory);
return ret;
}
/* we don't want to delete the root directory */
else if(directory == mp3rootDirectory) {
free(path);
return 0;
}
/* if updateDirectory fials, means we should delete it */
else {
LOG("removing directory: %s\n",path);
deleteFromList(parentDirectory->subDirectories,
shortname);
ret = 1;
/* don't return, path maybe a song now*/
}
}
else if((song = getSongDetails(path,&shortname,&parentDirectory))) {
/* if this song update is successfull, we are done */
if(song && isMusic(song->utf8url,&mtime)) {
free(path);
if(song->mtime==mtime) return 0;
else if(updateSongInfo(song)==0) return 1;
else {
removeSongFromDirectory(parentDirectory,
shortname);
return 1;
}
}
/* if updateDirectory fials, means we should delete it */
else {
removeSongFromDirectory(parentDirectory,shortname);
ret = 1;
/* don't return, path maybe a directory now*/
}
}
/* path not found in the db, see if it actually exists on the fs.
* Also, if by chance a directory was replaced by a file of the same
* name or vice versa, we need to add it to the db
*/
if(isDir(path) || isMusic(path,NULL)) {
parentDirectory = addParentPathToDB(path,&shortname);
if(addToDirectory(parentDirectory,shortname,path)>0) ret = 1;
}
free(path);
return ret;
}
/* return values:
-1 -> error
0 -> no error, but nothing updated
1 -> no error, and stuff updated
*/
int updateDirectory(Directory * directory) {
DIR * dir;
char cwd[2];
......@@ -239,37 +547,46 @@ int updateDirectory(Directory * directory) {
char * s;
char * utf8;
char * dirname = directory->utf8name;
int ret = 0;
cwd[0] = '.';
cwd[1] = '\0';
if(dirname==NULL) dirname=cwd;
removeDeletedFromDirectory(directory);
if(removeDeletedFromDirectory(directory)>0) ret = 1;
if((dir = opendir(rmp2amp(utf8ToFsCharset(dirname))))==NULL) return -1;
while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
if(strchr(ent->d_name, '\n')) continue;
utf8 = strdup(fsCharsetToUtf8(ent->d_name));
utf8 = fsCharsetToUtf8(ent->d_name);
if(!utf8) continue;
utf8 = strdup(utf8);
if(directory->utf8name) {
s = malloc(strlen(directory->utf8name)+strlen(utf8)+2);
sprintf(s,"%s/%s",directory->utf8name,utf8);
}
else s = strdup(utf8);
updateInDirectory(directory,utf8,s);
if(updateInDirectory(directory,utf8,s)>0) ret = 1;
free(utf8);
free(s);
}
closedir(dir);
if(directory->utf8name) isDir(directory->utf8name,&(directory->mtime));
return 0;
return ret;
}
/* return values:
-1 -> error
0 -> no error, but nothing found
1 -> no error, and stuff found
*/
int exploreDirectory(Directory * directory) {
DIR * dir;
char cwd[2];
......@@ -277,6 +594,7 @@ int exploreDirectory(Directory * directory) {
char * s;
char * utf8;
char * dirname = directory->utf8name;
int ret = 0;
cwd[0] = '.';
cwd[1] = '\0';
......@@ -288,8 +606,13 @@ int exploreDirectory(Directory * directory) {
DEBUG("explore: %s\n",dirname);
while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
if(strchr(ent->d_name, '\n')) continue;
utf8 = fsCharsetToUtf8(ent->d_name);
utf8 = strdup(fsCharsetToUtf8(ent->d_name));
if(!utf8) continue;
utf8 = strdup(utf8);
DEBUG("explore: found: %s (%s)\n",ent->d_name,utf8);
......@@ -298,37 +621,42 @@ int exploreDirectory(Directory * directory) {
sprintf(s,"%s/%s",directory->utf8name,utf8);
}
else s = strdup(utf8);
addToDirectory(directory,utf8,s);
if(addToDirectory(directory,utf8,s)>0) ret = 1;
free(utf8);
free(s);
}
closedir(dir);
return 0;
return ret;
}
int addSubDirectoryToDirectory(Directory * directory, char * shortname,
char * name)
{
Directory * subDirectory = newDirectory(directory,name,-1);
Directory * subDirectory = newDirectory(name);
if(exploreDirectory(subDirectory)<1) {
freeDirectory(subDirectory);
return 0;
}
insertInList(directory->subDirectories,shortname,subDirectory);
exploreDirectory(subDirectory);
return 0;
return 1;
}
int addToDirectory(Directory * directory, char * shortname, char * name) {
if(isDir(name,NULL)) {
if(isDir(name)) {
return addSubDirectoryToDirectory(directory,shortname,name);
}
else if(isMusic(name,NULL)) {
Song * song;
song = addSongToList(directory->songs,shortname,name);
song = addSongToList(directory->songs,shortname,name,
SONG_TYPE_FILE);
if(!song) return -1;
LOG("added %s\n",name);
return 0;
return 1;
}
DEBUG("addToDirectory: %s is not a directory or music\n",name);
......@@ -360,7 +688,9 @@ Directory * findSubDirectory(Directory * directory,char * name) {
return NULL;
}
Directory * getSubDirectory(Directory * directory,char * name) {
Directory * getSubDirectory(Directory * directory, char * name,
char ** shortname, Directory ** parentDirectory)
{
Directory * subDirectory;
int len;
......@@ -370,15 +700,32 @@ Directory * getSubDirectory(Directory * directory,char * name) {
if((subDirectory = findSubDirectory(directory,name))==NULL) return NULL;
*shortname = name;
*parentDirectory = directory;
len = 0;
while(name[len]!='/' && name[len]!='\0') len++;
while(name[len]=='/') len++;
return getSubDirectory(subDirectory,&(name[len]));
return getSubDirectory(subDirectory,&(name[len]),shortname,
parentDirectory);
}
Directory * getDirectoryDetails(char * name, char ** shortname,
Directory ** parentDirectory)
{
*shortname = NULL;
*parentDirectory = NULL;
return getSubDirectory(mp3rootDirectory,name,shortname,parentDirectory);
}
Directory * getDirectory(char * name) {
return getSubDirectory(mp3rootDirectory,name);
char * shortname;
Directory * parentDirectory;
return getSubDirectory(mp3rootDirectory,name,&shortname,
&parentDirectory);
}
int printDirectoryList(FILE * fp, DirectoryList * directoryList) {
......@@ -398,7 +745,7 @@ int printDirectoryInfo(FILE * fp, char * name) {
Directory * directory;
if((directory = getDirectory(name))==NULL) {
myfprintf(fp,"%s: directory not found\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_NO_EXIST, "directory not found");
return -1;
}
......@@ -419,7 +766,6 @@ void writeDirectoryInfo(FILE * fp, Directory * directory) {
while(node!=NULL) {
subDirectory = (Directory *)node->data;
myfprintf(fp,"%s%s\n",DIRECTORY_DIR,node->key);
myfprintf(fp,"%s%li\n",DIRECTORY_MTIME,(long)subDirectory->mtime);
writeDirectoryInfo(fp,subDirectory);
node = node->nextNode;
}
......@@ -437,32 +783,58 @@ void readDirectoryInfo(FILE * fp,Directory * directory) {
char * key;
Directory * subDirectory;
char * name;
time_t mtime;
int strcmpRet;
ListNode * nextDirNode = directory->subDirectories->firstNode;
ListNode * nodeTemp;
while(myFgets(buffer,bufferSize,fp) && 0!=strncmp(DIRECTORY_END,buffer,strlen(DIRECTORY_END))) {
if(0==strncmp(DIRECTORY_DIR,buffer,strlen(DIRECTORY_DIR))) {
key = strdup(&(buffer[strlen(DIRECTORY_DIR)]));
if(myFgets(buffer,bufferSize,fp)<0) {
ERROR("Error reading db\n");
exit(-1);
}
if(strncmp(DIRECTORY_MTIME,buffer,strlen(DIRECTORY_MTIME))) {
ERROR("Error reading db\n");
ERROR("%s\n",buffer);
exit(-1);
}
mtime = atoi(&(buffer[strlen(DIRECTORY_BEGIN)]));
if(myFgets(buffer,bufferSize,fp)<0) {
ERROR("Error reading db\n");
exit(-1);
ERROR("Error reading db, fgets\n");
exit(EXIT_FAILURE);
}
/* for compatibility with db's prior to 0.11 */
if(0==strncmp(DIRECTORY_MTIME,buffer,
strlen(DIRECTORY_MTIME)))
{
if(myFgets(buffer,bufferSize,fp)<0) {
ERROR("Error reading db, fgets\n");
exit(EXIT_FAILURE);
}
}
if(strncmp(DIRECTORY_BEGIN,buffer,strlen(DIRECTORY_BEGIN))) {
ERROR("Error reading db\n");
exit(-1);
ERROR("Error reading db at line: %s\n",buffer);
exit(EXIT_FAILURE);
}
name = strdup(&(buffer[strlen(DIRECTORY_BEGIN)]));
subDirectory = newDirectory(directory,name,mtime);
insertInList(directory->subDirectories,key,(void *)subDirectory);
while(nextDirNode && (strcmpRet =
strcmp(key,nextDirNode->key)) > 0) {
nodeTemp = nextDirNode->nextNode;
deleteNodeFromList(directory->subDirectories,
nextDirNode);
nextDirNode = nodeTemp;
}
if(NULL==nextDirNode) {
subDirectory = newDirectory(name);
insertInList(directory->subDirectories,key,
(void *)subDirectory);
}
else if(strcmpRet == 0) {
subDirectory = (Directory *)nextDirNode->data;
nextDirNode = nextDirNode->nextNode;
}
else {
subDirectory = newDirectory(name);
insertInListBeforeNode(
directory->subDirectories,
nextDirNode,
key,
(void *)subDirectory);
}
free(key);
free(name);
readDirectoryInfo(fp,subDirectory);
......@@ -472,9 +844,15 @@ void readDirectoryInfo(FILE * fp,Directory * directory) {
}
else {
ERROR("Unknown line in db: %s\n",buffer);
exit(-1);
exit(EXIT_FAILURE);
}
}
while(nextDirNode) {
nodeTemp = nextDirNode->nextNode;
deleteNodeFromList(directory->subDirectories,nextDirNode);
nextDirNode = nodeTemp;
}
}
void sortDirectory(Directory * directory) {
......@@ -496,18 +874,18 @@ int writeDirectoryDB() {
deleteEmptyDirectoriesInDirectory(mp3rootDirectory);
sortDirectory(mp3rootDirectory);
stats.numberOfSongs = countSongsIn(stderr,NULL);
stats.dbPlayTime = sumSongTimesIn(stderr,NULL);
while(!(fp=fopen(directorydb,"w")) && errno==EINTR);
while(!(fp=fopen(directory_db,"w")) && errno==EINTR);
if(!fp) return -1;
/* block signals when writing the db so we don't get a corrupted db*/
myfprintf(fp,"%s\n",DIRECTORY_INFO_BEGIN);
myfprintf(fp,"%s%s\n",DIRECTORY_MPD_VERSION,VERSION);
myfprintf(fp,"%s%s\n",DIRECTORY_FS_CHARSET,getFsCharset());
myfprintf(fp,"%s\n",DIRECTORY_INFO_END);
writeDirectoryInfo(fp,mp3rootDirectory);
while(fclose(fp) && errno==EINTR);
return 0;
......@@ -515,9 +893,10 @@ int writeDirectoryDB() {
int readDirectoryDB() {
FILE * fp;
struct stat st;
mp3rootDirectory = newDirectory(NULL,NULL,0);
while(!(fp=fopen(directorydb,"r")) && errno==EINTR);
if(!mp3rootDirectory) mp3rootDirectory = newDirectory(NULL);
while(!(fp=fopen(directory_db,"r")) && errno==EINTR);
if(!fp) return -1;
/* get initial info */
......@@ -528,8 +907,8 @@ int readDirectoryDB() {
int foundVersion = 0;
if(myFgets(buffer,bufferSize,fp)<0) {
ERROR("Error reading db\n");
exit(-1);
ERROR("Error reading db, fgets\n");
exit(EXIT_FAILURE);
}
if(0==strcmp(DIRECTORY_INFO_BEGIN,buffer)) {
while(myFgets(buffer,bufferSize,fp) &&
......@@ -541,7 +920,7 @@ int readDirectoryDB() {
if(foundVersion) {
ERROR("already found "
"version in db\n");
exit(-1);
exit(EXIT_FAILURE);
}
foundVersion = 1;
}
......@@ -554,7 +933,7 @@ int readDirectoryDB() {
if(foundFsCharset) {
ERROR("already found "
"fs charset in db\n");
exit(-1);
exit(EXIT_FAILURE);
}
foundFsCharset = 1;
......@@ -577,7 +956,7 @@ int readDirectoryDB() {
else {
ERROR("directory: unknown line in db info: %s\n",
buffer);
exit(-1);
exit(EXIT_FAILURE);
}
}
}
......@@ -594,23 +973,30 @@ int readDirectoryDB() {
stats.numberOfSongs = countSongsIn(stderr,NULL);
stats.dbPlayTime = sumSongTimesIn(stderr,NULL);
if(stat(directory_db,&st)==0) directory_dbModTime = st.st_mtime;
return 0;
}
int updateMp3Directory(FILE * fp) {
if(updateDirectory(mp3rootDirectory)<0) {
void updateMp3Directory() {
switch(updateDirectory(mp3rootDirectory)) {
case 0:
/* nothing updated */
return;
case 1:
if(writeDirectoryDB()<0) {
ERROR("problems writing music db file, \"%s\"\n",
directory_db);
exit(EXIT_FAILURE);
}
/* something was updated and db should be written */
break;
default:
ERROR("problems updating music db\n");
myfprintf(fp,"%s problems updating music db\n",COMMAND_RESPOND_ERROR);
return -1;
exit(EXIT_FAILURE);
}
if(writeDirectoryDB()<0) {
ERROR("problems writing music db file, \"%s\"\n",directorydb);
myfprintf(fp,"%s problems writing music db\n",COMMAND_RESPOND_ERROR);
return -1;
}
return 0;
return;
}
int traverseAllInSubDirectory(FILE * fp, Directory * directory,
......@@ -657,10 +1043,11 @@ int traverseAllIn(FILE * fp, char * name,
if((directory = getDirectory(name))==NULL) {
Song * song;
if((song = getSong(name)) && forEachSong) {
if((song = getSongFromDB(name)) && forEachSong) {
return forEachSong(fp, song, data);
}
myfprintf(fp,"%s: directory or file not found\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_NO_EXIST,
"directory or file not found");
return -1;
}
......@@ -684,7 +1071,7 @@ int printDirectoryInDirectory(FILE * fp, Directory * directory, void * data) {
}
int printSongInDirectory(FILE * fp, Song * song, void * data) {
myfprintf(fp,"file: %s\n",song->utf8file);
myfprintf(fp,"file: %s\n",song->utf8url);
return 0;
}
......@@ -716,7 +1103,7 @@ int searchForTitleInDirectory(FILE * fp, Song * song, void * string) {
}
int searchForFilenameInDirectory(FILE * fp, Song * song, void * string) {
char * dup = strDupToUpper(song->utf8file);
char * dup = strDupToUpper(song->utf8url);
if(strstr(dup,(char *)string)) printSongInfo(fp,song);
free(dup);
return 0;
......@@ -742,7 +1129,7 @@ int searchForSongsIn(FILE * fp, char * name, char * item, char * string) {
ret = traverseAllIn(fp,name,searchForFilenameInDirectory,NULL,
(void *)dup);
}
else myfprintf(fp,"%s unknown table\n",COMMAND_RESPOND_ERROR);
else commandError(fp, ACK_ERROR_ARG, "unknown table");
free(dup);
......@@ -779,7 +1166,7 @@ int findSongsIn(FILE * fp, char * name, char * item, char * string) {
(void *)string);
}
myfprintf(fp,"%s unknown table\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_ARG, "unknown table");
return -1;
}
......@@ -831,12 +1218,20 @@ unsigned long sumSongTimesIn(FILE * fp, char * name) {
}
void initMp3Directory() {
mp3rootDirectory = newDirectory(NULL,NULL,0);
struct stat st;
mp3rootDirectory = newDirectory(NULL);
exploreDirectory(mp3rootDirectory);
stats.numberOfSongs = countSongsIn(stderr,NULL);
stats.dbPlayTime = sumSongTimesIn(stderr,NULL);
if(stat(directory_db,&st)==0) directory_dbModTime = st.st_mtime;
}
Song * getSong(char * file) {
void * song;
Song * getSongDetails(char * file, char ** shortnameRet,
Directory ** directoryRet)
{
void * song = NULL;
Directory * directory;
char * dir = NULL;
char * dup = strdup(file);
......@@ -857,7 +1252,7 @@ Song * getSong(char * file) {
dir = dup;
}
if(!(directory = getSubDirectory(mp3rootDirectory,dir))) {
if(!(directory = getDirectory(dir))) {
free(dup);
return NULL;
}
......@@ -868,14 +1263,16 @@ Song * getSong(char * file) {
}
free(dup);
if(shortnameRet) *shortnameRet = shortname;
if(directoryRet) *directoryRet = directory;
return (Song *)song;
}
time_t getDbModTime() {
time_t mtime = 0;
struct stat st;
if(stat(directorydb,&st)==0) mtime = st.st_mtime;
Song * getSongFromDB(char * file) {
return getSongDetails(file,NULL,NULL);
}
return mtime;
time_t getDbModTime() {
return directory_dbModTime;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -22,11 +22,22 @@
#include "../config.h"
#include "song.h"
#include "list.h"
#include <stdio.h>
#include <sys/param.h>
extern char directorydb[MAXPATHLEN+1];
extern char * directory_db;
void readDirectoryDBIfUpdateIsFinished();
void clearUpdatePid();
int isUpdatingDB();
void directory_sigChldHandler(int pid, int status);
int updateInit(FILE * fp, List * pathList);
void initMp3Directory();
......@@ -38,7 +49,7 @@ int writeDirectoryDB();
int readDirectoryDB();
int updateMp3Directory(FILE * fp);
void updateMp3Directory();
int printAllIn(FILE * fp, char * name);
......@@ -54,8 +65,9 @@ int countSongsIn(FILE * fp, char * name);
unsigned long sumSongTimesIn(FILE * fp, char * name);
Song * getSong(char * file);
Song * getSongFromDB(char * file);
time_t getDbModTime();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "flac_decode.h"
#ifdef HAVE_FLAC
#include "utils.h"
#include "log.h"
#include "pcm_utils.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <FLAC/file_decoder.h>
#include <FLAC/metadata.h>
typedef struct {
unsigned char chunk[CHUNK_SIZE];
int chunk_length;
float time;
int bitRate;
FLAC__uint64 position;
Buffer * cb;
AudioFormat * af;
DecoderControl * dc;
char * file;
} FlacData;
/* this code is based on flac123, from flac-tools */
int flacSendChunk(FlacData * data);
void flacPlayfile(const char * file, Buffer * cb, ao_sample_format * format);
void flacError(const FLAC__FileDecoder *, FLAC__StreamDecoderErrorStatus, void *);
void flacPrintErroredState(FLAC__FileDecoderState state, char * file);
void flacMetadata(const FLAC__FileDecoder *, const FLAC__StreamMetadata *, void *);
FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__FileDecoder *, const FLAC__Frame *, const FLAC__int32 * const buf[], void *);
void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
DecoderControl *dc)
{
FLAC__FileDecoder * flacDec;
FlacData data;
int status = 1;
data.chunk_length = 0;
data.time = 0;
data.position = 0;
data.bitRate = 0;
data.cb = cb;
data.af = af;
data.dc = dc;
data.file = file;
if(!(flacDec = FLAC__file_decoder_new())) return;
/*status&=FLAC__file_decoder_set_md5_checking(flacDec,1);*/
status&=FLAC__file_decoder_set_filename(flacDec,file);
status&=FLAC__file_decoder_set_write_callback(flacDec,flacWrite);
status&=FLAC__file_decoder_set_metadata_callback(flacDec,flacMetadata);
status&=FLAC__file_decoder_set_error_callback(flacDec,flacError);
status&=FLAC__file_decoder_set_client_data(flacDec, (void *)&data);
if(!status) {
ERROR("flac problem before init(): %s\n",file);
flacPrintErroredState(FLAC__file_decoder_get_state(flacDec),file);
FLAC__file_decoder_delete(flacDec);
return;
}
if(FLAC__file_decoder_init(flacDec)!=
FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
{
ERROR("flac problem doing init(): %s\n",file);
flacPrintErroredState(FLAC__file_decoder_get_state(flacDec),file);
FLAC__file_decoder_delete(flacDec);
return;
}
if(!FLAC__file_decoder_process_until_end_of_metadata(flacDec)) {
ERROR("flac problem reading metadata: %s\n",file);
flacPrintErroredState(FLAC__file_decoder_get_state(flacDec),file);
FLAC__file_decoder_delete(flacDec);
return;
}
while(1) {
FLAC__file_decoder_process_single(flacDec);
if(FLAC__file_decoder_get_state(flacDec)!=
FLAC__FILE_DECODER_OK)
{
break;
}
if(dc->seek) {
FLAC__uint64 sampleToSeek = dc->seekWhere*
af->sampleRate+0.5;
cb->end = cb->begin;
cb->wrap = 0;
if(FLAC__file_decoder_seek_absolute(flacDec,
sampleToSeek))
{
data.time = ((float)sampleToSeek)/
af->sampleRate;
data.position = 0;
}
dc->seek = 0;
}
}
/* I don't think we need this bit here! =shank */
/*FLAC__file_decoder_process_until_end_of_file(flacDec);*/
if(!dc->stop) {
flacPrintErroredState(FLAC__file_decoder_get_state(flacDec),
file);
FLAC__file_decoder_finish(flacDec);
}
FLAC__file_decoder_delete(flacDec);
/* send last little bit */
if(data.chunk_length>0 && !dc->stop) flacSendChunk(&data);
}
void flacError(const FLAC__FileDecoder *dec, FLAC__StreamDecoderErrorStatus status, void *fdata) {
FlacData * data = (FlacData *) fdata;
if(data->dc->stop) return;
switch(status) {
case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
ERROR("flac lost sync: %s\n",data->file);
break;
case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
ERROR("bad header %s\n",data->file);
break;
case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
ERROR("crc mismatch %s\n",data->file);
break;
default:
ERROR("unknow flac error %s\n",data->file);
}
}
void flacPrintErroredState(FLAC__FileDecoderState state, char * file) {
switch(state) {
case FLAC__FILE_DECODER_ERROR_OPENING_FILE:
ERROR("error opening flac: %s\n",file);
break;
case FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR:
ERROR("flac allocation error\n");
break;
case FLAC__FILE_DECODER_SEEK_ERROR:
ERROR("flac seek error: %s\n",file);
break;
case FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR:
ERROR("flac seekable stream error: %s\n",file);
break;
case FLAC__FILE_DECODER_ALREADY_INITIALIZED:
ERROR("flac decoder already initilaized: %s\n",file);
break;
case FLAC__FILE_DECODER_INVALID_CALLBACK:
ERROR("invalid flac callback\n");
break;
case FLAC__FILE_DECODER_UNINITIALIZED:
ERROR("flac decoder uninitialized: %s\n",file);
break;
case FLAC__FILE_DECODER_OK:
case FLAC__FILE_DECODER_END_OF_FILE:
break;
}
}
void flacMetadata(const FLAC__FileDecoder *dec, const FLAC__StreamMetadata *meta, void *data) {
}
int flacSendChunk(FlacData * data) {
while(data->cb->begin==data->cb->end && data->cb->wrap &&
!data->dc->stop && !data->dc->seek)
{
my_usleep(10000);
}
if(data->dc->stop) return -1;
if(data->dc->seek) return 0;
memcpy(data->cb->chunks+data->cb->end*CHUNK_SIZE,data->chunk,
CHUNK_SIZE);
data->cb->chunkSize[data->cb->end] = data->chunk_length;
data->cb->times[data->cb->end] = data->time;
data->cb->bitRate[data->cb->end] = data->bitRate;
data->cb->end++;
if(data->cb->end>=buffered_chunks) {
data->cb->end = 0;
data->cb->wrap = 1;
}
return 0;
}
FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__FileDecoder *dec, const FLAC__Frame *frame, const FLAC__int32 * const buf[], void * vdata) {
FlacData * data = (FlacData *)vdata;
FLAC__uint32 samples = frame->header.blocksize;
FLAC__uint16 u16;
unsigned char * uc;
int c_samp, c_chan, d_samp;
int i;
float timeChange;
FLAC__uint64 newPosition = 0;
timeChange = ((float)samples)/frame->header.sample_rate;
data->time+= timeChange;
FLAC__file_decoder_get_decode_position(dec,&newPosition);
if(data->position) {
data->bitRate = ((newPosition-data->position)*8.0/timeChange)
/1024+0.5;
}
data->position = newPosition;
for(c_samp = d_samp = 0; c_samp < frame->header.blocksize; c_samp++) {
for(c_chan = 0; c_chan < frame->header.channels;
c_chan++, d_samp++) {
u16 = buf[c_chan][c_samp];
uc = (unsigned char *)&u16;
for(i=0;i<(data->af->bits/8);i++) {
if(data->chunk_length>=CHUNK_SIZE) {
if(flacSendChunk(data)<0) {
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
data->chunk_length = 0;
if(data->dc->seek) {
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
}
data->chunk[data->chunk_length++] = *(uc++);
}
}
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
int flac_getAudioFormatAndTime(char * file, AudioFormat * format, float * time) {
FLAC__Metadata_SimpleIterator * it;
FLAC__StreamMetadata * block = NULL;
int found = 0;
int ret = -1;
if(!(it = FLAC__metadata_simple_iterator_new())) return -1;
if(!FLAC__metadata_simple_iterator_init(it,file,1,0)) {
FLAC__metadata_simple_iterator_delete(it);
return -1;
}
do {
if(block) FLAC__metadata_object_delete(block);
block = FLAC__metadata_simple_iterator_get_block(it);
if(block->type == FLAC__METADATA_TYPE_STREAMINFO) found=1;
} while(!found && FLAC__metadata_simple_iterator_next(it));
if(found) {
format->bits = block->data.stream_info.bits_per_sample;
format->bits = 16;
format->sampleRate = block->data.stream_info.sample_rate;
format->channels = block->data.stream_info.channels;
*time = ((float)block->data.stream_info.total_samples)/
format->sampleRate;
ret = 0;
}
if(block) FLAC__metadata_object_delete(block);
FLAC__metadata_simple_iterator_delete(it);
return ret;
}
int getFlacTotalTime(char * file) {
float totalTime;
AudioFormat af;
if(flac_getAudioFormatAndTime(file,&af,&totalTime)<0) return -1;
return (int)(totalTime+0.5);
}
int flac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
if(flac_getAudioFormatAndTime(dc->file,af,&(cb->totalTime))<0) {
ERROR("\"%s\" doesn't seem to be a flac\n",dc->file);
return -1;
}
dc->state = DECODE_STATE_DECODE;
dc->start = 0;
flacPlayFile(dc->file,cb,af,dc);
if(dc->seek) dc->seek = 0;
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
else dc->state = DECODE_STATE_STOP;
return 0;
}
#endif
#include "inputPlugin.h"
#include "list.h"
#include "myfprintf.h"
#include <stdlib.h>
#include <string.h>
static List * inputPlugin_list = NULL;
void loadInputPlugin(InputPlugin * inputPlugin) {
if(!inputPlugin) return;
if(!inputPlugin->name) return;
if(inputPlugin->initFunc && inputPlugin->initFunc() < 0) return;
insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin);
}
void unloadInputPlugin(InputPlugin * inputPlugin) {
if(inputPlugin->finishFunc) inputPlugin->finishFunc();
deleteFromList(inputPlugin_list, inputPlugin->name);
}
static int stringFoundInStringArray(char ** array, char * suffix) {
while(array && *array) {
if(strcasecmp(*array, suffix) == 0) return 1;
array++;
}
return 0;
}
InputPlugin * getInputPluginFromSuffix(char * suffix) {
ListNode * node = inputPlugin_list->firstNode;
InputPlugin * plugin = NULL;
if(suffix == NULL) return NULL;
while(node != NULL) {
plugin = node->data;
if(stringFoundInStringArray(plugin->suffixes, suffix)) {
return plugin;
}
node = node->nextNode;
}
return NULL;
}
InputPlugin * getInputPluginFromMimeType(char * mimeType) {
ListNode * node = inputPlugin_list->firstNode;
InputPlugin * plugin = NULL;
if(mimeType == NULL) return NULL;
while(node != NULL) {
plugin = node->data;
if(stringFoundInStringArray(plugin->mimeTypes, mimeType)) {
return plugin;
}
node = node->nextNode;
}
return NULL;
}
InputPlugin * getInputPluginFromName(char * name) {
void * plugin = NULL;
findInList(inputPlugin_list, name, &plugin);
return (InputPlugin *)plugin;
}
void printAllInputPluginSuffixes(FILE * fp) {
ListNode * node = inputPlugin_list->firstNode;
InputPlugin * plugin;
char ** suffixes;
while(node) {
plugin = (InputPlugin *)node->data;
suffixes = plugin->suffixes;
while(suffixes && *suffixes) {
myfprintf(fp, "%s ", *suffixes);
suffixes++;
}
node = node->nextNode;
}
myfprintf(fp, "\n");
}
extern InputPlugin mp3Plugin;
extern InputPlugin oggPlugin;
extern InputPlugin flacPlugin;
extern InputPlugin audiofilePlugin;
extern InputPlugin mp4Plugin;
extern InputPlugin aacPlugin;
extern InputPlugin modPlugin;
void initInputPlugins() {
inputPlugin_list = makeList(NULL);
/* load plugins here */
loadInputPlugin(&mp3Plugin);
loadInputPlugin(&oggPlugin);
loadInputPlugin(&flacPlugin);
loadInputPlugin(&audiofilePlugin);
loadInputPlugin(&mp4Plugin);
loadInputPlugin(&modPlugin);
}
void finishInputPlugins() {
freeList(inputPlugin_list);
}
#ifndef INPUT_PLUGIN_H
#define INPUT_PLUGIN_H
#include "../config.h"
#include "inputStream.h"
#include "decode.h"
#include "outputBuffer.h"
#include "tag.h"
#define INPUT_PLUGIN_STREAM_FILE 0x01
#define INPUT_PLUGIN_STREAM_URL 0x02
typedef int (* InputPlugin_initFunc) ();
typedef void (* InputPlugin_finishFunc) ();
typedef int (* InputPlugin_streamDecodeFunc) (OutputBuffer *, DecoderControl *,
InputStream *);
typedef int (* InputPlugin_fileDecodeFunc) (OutputBuffer *, DecoderControl *,
char * path);
/* file should be the full path! */
typedef MpdTag * (* InputPlugin_tagDupFunc) (char * file);
typedef struct _InputPlugin {
char * name;
InputPlugin_initFunc initFunc;
InputPlugin_finishFunc finishFunc;
InputPlugin_streamDecodeFunc streamDecodeFunc;
InputPlugin_fileDecodeFunc fileDecodeFunc;
InputPlugin_tagDupFunc tagDupFunc;
unsigned char streamTypes;
char ** suffixes;
char ** mimeTypes;
} InputPlugin;
/* individual functions to load/unload plugins */
void loadInputPlugin(InputPlugin * inputPlugin);
void unloadInputPlugin(InputPlugin * inputPlugin);
/* interface for using plugins */
InputPlugin * getInputPluginFromSuffix(char * suffix);
InputPlugin * getInputPluginFromMimeType(char * mimeType);
InputPlugin * getInputPluginFromName(char * name);
void printAllInputPluginSuffixes(FILE * fp);
/* this is where we "load" all the "plugins" ;-) */
void initInputPlugins();
/* this is where we "unload" all the "plugins" */
void finishInputPlugins();
#endif
......@@ -16,16 +16,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "aac_decode.h"
#include "../inputPlugin.h"
#ifdef HAVE_FAAD
#define AAC_MAX_CHANNELS 6
#include "command.h"
#include "utils.h"
#include "audio.h"
#include "log.h"
#include "../utils.h"
#include "../audio.h"
#include "../log.h"
#include "../inputStream.h"
#include "../outputBuffer.h"
#include <stdio.h>
#include <unistd.h>
......@@ -35,12 +36,12 @@
/* all code here is either based on or copied from FAAD2's frontend code */
typedef struct {
InputStream * inStream;
long bytesIntoBuffer;
long bytesConsumed;
long fileOffset;
unsigned char *buffer;
int atEof;
FILE *infile;
} AacBuffer;
void fillAacBuffer(AacBuffer *b) {
......@@ -53,8 +54,9 @@ void fillAacBuffer(AacBuffer *b) {
}
if(!b->atEof) {
bread = fread((void *)(b->buffer+b->bytesIntoBuffer),1,
b->bytesConsumed,b->infile);
bread = readFromInputStream(b->inStream,
(void *)(b->buffer+b->bytesIntoBuffer),
1,b->bytesConsumed);
if(bread!=b->bytesConsumed) b->atEof = 1;
b->bytesIntoBuffer+=bread;
}
......@@ -132,7 +134,7 @@ int adtsParse(AacBuffer * b, float * length) {
return 1;
}
void initAacBuffer(FILE * fp, AacBuffer * b, float * length,
void initAacBuffer(InputStream * inStream, AacBuffer * b, float * length,
size_t * retFileread, size_t * retTagsize)
{
size_t fileread;
......@@ -143,17 +145,15 @@ void initAacBuffer(FILE * fp, AacBuffer * b, float * length,
memset(b,0,sizeof(AacBuffer));
b->infile = fp;
b->inStream = inStream;
fseek(b->infile,0,SEEK_END);
fileread = ftell(b->infile);
fseek(b->infile,0,SEEK_SET);
fileread = inStream->size;
b->buffer = malloc(FAAD_MIN_STREAMSIZE*AAC_MAX_CHANNELS);
memset(b->buffer,0,FAAD_MIN_STREAMSIZE*AAC_MAX_CHANNELS);
bread = fread(b->buffer,1,FAAD_MIN_STREAMSIZE*AAC_MAX_CHANNELS,
b->infile);
bread = readFromInputStream(inStream,b->buffer,1,
FAAD_MIN_STREAMSIZE*AAC_MAX_CHANNELS);
b->bytesIntoBuffer = bread;
b->bytesConsumed = 0;
b->fileOffset = 0;
......@@ -177,11 +177,10 @@ void initAacBuffer(FILE * fp, AacBuffer * b, float * length,
if((b->buffer[0] == 0xFF) && ((b->buffer[1] & 0xF6) == 0xF0)) {
adtsParse(b, length);
fseek(b->infile, tagsize, SEEK_SET);
seekInputStream(b->inStream, tagsize, SEEK_SET);
bread = fread(b->buffer, 1,
FAAD_MIN_STREAMSIZE*AAC_MAX_CHANNELS,
b->infile);
bread = readFromInputStream(b->inStream, b->buffer, 1,
FAAD_MIN_STREAMSIZE*AAC_MAX_CHANNELS);
if(bread != FAAD_MIN_STREAMSIZE*AAC_MAX_CHANNELS) b->atEof = 1;
else b->atEof = 0;
b->bytesIntoBuffer = bread;
......@@ -209,12 +208,12 @@ float getAacFloatTotalTime(char * file) {
faacDecConfigurationPtr config;
unsigned long sampleRate;
unsigned char channels;
FILE * fp = fopen(file,"r");
InputStream inStream;
size_t bread;
if(fp==NULL) return -1;
if(openInputStream(&inStream,file) < 0) return -1;
initAacBuffer(fp,&b,&length,&fileread,&tagsize);
initAacBuffer(&inStream,&b,&length,&fileread,&tagsize);
if(length < 0) {
decoder = faacDecOpen();
......@@ -236,7 +235,7 @@ float getAacFloatTotalTime(char * file) {
}
if(b.buffer) free(b.buffer);
fclose(b.infile);
closeInputStream(&inStream);
return length;
}
......@@ -251,7 +250,7 @@ int getAacTotalTime(char * file) {
}
int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
int aac_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
float time;
float totalTime;
faacDecHandle decoder;
......@@ -264,21 +263,18 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
unsigned int sampleCount;
char * sampleBuffer;
size_t sampleBufferLen;
int chunkLen = 0;
/*float * seekTable;
long seekTableEnd = -1;
int seekPositionFound = 0;*/
mpd_uint16 bitRate = 0;
AacBuffer b;
FILE * fp;
InputStream inStream;
if((totalTime = getAacFloatTotalTime(dc->file)) < 0) return -1;
if((totalTime = getAacFloatTotalTime(path)) < 0) return -1;
fp = fopen(dc->file,"r");
if(openInputStream(&inStream, path) < 0) return -1;
if(fp==NULL) return -1;
initAacBuffer(fp,&b,NULL,NULL,NULL);
initAacBuffer(&inStream,&b,NULL,NULL,NULL);
decoder = faacDecOpen();
......@@ -303,14 +299,14 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
if(bread < 0) {
ERROR("Error not a AAC stream.\n");
faacDecClose(decoder);
fclose(b.infile);
closeInputStream(b.inStream);
if(b.buffer) free(b.buffer);
return -1;
}
af->bits = 16;
dc->audioFormat.bits = 16;
cb->totalTime = totalTime;
dc->totalTime = totalTime;
time = 0.0;
......@@ -332,7 +328,7 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
#endif
if(frameInfo.error > 0) {
ERROR("error decoding AAC file: %s\n",dc->file);
ERROR("error decoding AAC file: %s\n", path);
ERROR("faad2 error: %s\n",
faacDecGetErrorMessage(frameInfo.error));
eof = 1;
......@@ -343,11 +339,12 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleRate = frameInfo.samplerate;
#endif
if(dc->start) {
af->channels = frameInfo.channels;
af->sampleRate = sampleRate;
if(dc->state != DECODE_STATE_DECODE) {
dc->audioFormat.channels = frameInfo.channels;
dc->audioFormat.sampleRate = sampleRate;
getOutputAudioFormat(&(dc->audioFormat),
&(cb->audioFormat));
dc->state = DECODE_STATE_DECODE;
dc->start = 0;
}
advanceAacBuffer(&b,frameInfo.bytesconsumed);
......@@ -357,70 +354,37 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
if(sampleCount>0) {
bitRate = frameInfo.bytesconsumed*8.0*
frameInfo.channels*sampleRate/
frameInfo.samples/1024+0.5;
frameInfo.samples/1000+0.5;
time+= (float)(frameInfo.samples)/frameInfo.channels/
sampleRate;
}
sampleBufferLen = sampleCount*2;
while(sampleBufferLen>0) {
size_t size = sampleBufferLen>CHUNK_SIZE-chunkLen ?
CHUNK_SIZE-chunkLen:
sampleBufferLen;
while(cb->begin==cb->end && cb->wrap &&
!dc->stop && !dc->seek)
{
my_usleep(10000);
}
if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
}
else if(dc->stop) {
eof = 1;
break;
}
else {
sampleBufferLen-=size;
memcpy(cb->chunks+cb->end*CHUNK_SIZE+chunkLen,
sampleBuffer,size);
cb->times[cb->end] = time;
cb->bitRate[cb->end] = bitRate;
sampleBuffer+=size;
chunkLen+=size;
if(chunkLen>=CHUNK_SIZE) {
cb->chunkSize[cb->end] = CHUNK_SIZE;
++cb->end;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
chunkLen = 0;
}
}
sendDataToOutputBuffer(cb, NULL, dc, 0, sampleBuffer,
sampleBufferLen, time, bitRate);
if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
}
else if(dc->stop) {
eof = 1;
break;
}
} while (!eof);
flushOutputBuffer(cb);
faacDecClose(decoder);
fclose(b.infile);
closeInputStream(b.inStream);
if(b.buffer) free(b.buffer);
if(dc->start) return -1;
if(!dc->stop && !dc->seek && chunkLen>0) {
cb->chunkSize[cb->end] = chunkLen;
++cb->end;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
chunkLen = 0;
}
if(dc->state != DECODE_STATE_DECODE) return -1;
if(dc->seek) dc->seek = 0;
if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
}
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
......@@ -431,4 +395,48 @@ int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
return 0;
}
MpdTag * aacTagDup(char * file) {
MpdTag * ret = NULL;
int time;
time = getAacTotalTime(file);
if(time>=0) {
if((ret = id3Dup(file))==NULL) ret = newMpdTag();
ret->time = time;
}
return ret;
}
char * aacSuffixes[] = {"aac", NULL};
InputPlugin aacPlugin =
{
"aac",
NULL,
NULL,
NULL,
aac_decode,
aacTagDup,
INPUT_PLUGIN_STREAM_FILE,
aacSuffixes,
NULL
};
#else
InputPlugin aacPlugin =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
};
#endif /* HAVE_FAAD */
......@@ -18,15 +18,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "audiofile_decode.h"
#include "../inputPlugin.h"
#ifdef HAVE_AUDIOFILE
#include "command.h"
#include "utils.h"
#include "audio.h"
#include "log.h"
#include "pcm_utils.h"
#include "../utils.h"
#include "../audio.h"
#include "../log.h"
#include "../pcm_utils.h"
#include "../playerData.h"
#include <stdio.h>
#include <unistd.h>
......@@ -51,39 +51,39 @@ int getAudiofileTotalTime(char * file)
return time;
}
int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
{
int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
int fs, frame_count;
AFfilehandle af_fp;
int bits;
mpd_uint16 bitRate;
struct stat st;
if(stat(dc->file,&st) < 0) {
ERROR("failed to stat: %s\n",dc->file);
if(stat(path, &st) < 0) {
ERROR("failed to stat: %s\n", path);
return -1;
}
af_fp = afOpenFile(dc->file,"r", NULL);
af_fp = afOpenFile(path, "r", NULL);
if(af_fp == AF_NULL_FILEHANDLE) {
ERROR("failed to open: %s\n",dc->file);
ERROR("failed to open: %s\n", path);
return -1;
}
afGetSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits);
af->bits = bits;
af->sampleRate = afGetRate(af_fp, AF_DEFAULT_TRACK);
af->channels = afGetChannels(af_fp,AF_DEFAULT_TRACK);
dc->audioFormat.bits = bits;
dc->audioFormat.sampleRate = afGetRate(af_fp, AF_DEFAULT_TRACK);
dc->audioFormat.channels = afGetChannels(af_fp,AF_DEFAULT_TRACK);
getOutputAudioFormat(&(dc->audioFormat),&(cb->audioFormat));
frame_count = afGetFrameCount(af_fp,AF_DEFAULT_TRACK);
cb->totalTime = ((float)frame_count/(float)af->sampleRate);
dc->totalTime = ((float)frame_count/(float)dc->audioFormat.sampleRate);
bitRate = st.st_size*8.0/cb->totalTime/1024.0+0.5;
bitRate = st.st_size*8.0/dc->totalTime/1000.0+0.5;
if (af->bits != 8 && af->bits != 16) {
if (dc->audioFormat.bits != 8 && dc->audioFormat.bits != 16) {
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",
dc->file,af->bits);
path, dc->audioFormat.bits);
afCloseFile(af_fp);
return -1;
}
......@@ -91,49 +91,42 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
fs = (int)afGetFrameSize(af_fp, AF_DEFAULT_TRACK,1);
dc->state = DECODE_STATE_DECODE;
dc->start = 0;
{
int ret, eof = 0, current = 0;
unsigned char chunk[CHUNK_SIZE];
while(!eof) {
if(dc->seek) {
cb->end = cb->begin;
cb->wrap = 0;
current = dc->seekWhere * af->sampleRate;
clearOutputBuffer(cb);
current = dc->seekWhere *
dc->audioFormat.sampleRate;
afSeekFrame(af_fp, AF_DEFAULT_TRACK,current);
dc->seek = 0;
}
ret = afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk, CHUNK_SIZE/fs);
if(ret<=0) eof = 1;
else {
while(cb->begin==cb->end && cb->wrap &&
!dc->stop && !dc->seek){
my_usleep(10000);
}
if(dc->stop) break;
else if(dc->seek) continue;
memcpy(cb->chunks+cb->end*CHUNK_SIZE,chunk,
CHUNK_SIZE);
cb->chunkSize[cb->end] = CHUNK_SIZE;
current += ret;
cb->times[cb->end] = (float)current/(float)af->sampleRate;
cb->bitRate[cb->end] = bitRate;
++cb->end;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
sendDataToOutputBuffer(cb,
NULL,
dc,
1,
chunk,
ret*fs,
(float)current /
(float)dc->audioFormat.sampleRate,
bitRate);
if(dc->stop) break;
}
}
if(dc->seek) dc->seek = 0;
flushOutputBuffer(cb);
/*if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
}*/
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
......@@ -146,4 +139,46 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
return 0;
}
MpdTag * audiofileTagDup(char * file) {
MpdTag * ret = NULL;
int time = getAudiofileTotalTime(file);
if (time>=0) {
if(!ret) ret = newMpdTag();
ret->time = time;
}
return ret;
}
char * audiofileSuffixes[] = {"wav", "au", "aiff", NULL};
InputPlugin audiofilePlugin =
{
"audiofile",
NULL,
NULL,
NULL,
audiofile_decode,
audiofileTagDup,
INPUT_PLUGIN_STREAM_FILE,
audiofileSuffixes,
NULL
};
#else
InputPlugin audiofilePlugin =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL
};
#endif /* HAVE_AUDIOFILE */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "../inputPlugin.h"
#ifdef HAVE_FLAC
#include "../utils.h"
#include "../log.h"
#include "../pcm_utils.h"
#include "../inputStream.h"
#include "../outputBuffer.h"
#include "../replayGain.h"
#include "../audio.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <FLAC/seekable_stream_decoder.h>
#include <FLAC/metadata.h>
typedef struct {
#define FLAC_CHUNK_SIZE 4080
unsigned char chunk[FLAC_CHUNK_SIZE];
int chunk_length;
float time;
int bitRate;
FLAC__uint64 position;
OutputBuffer * cb;
DecoderControl * dc;
InputStream inStream;
float replayGainScale;
char * path;
} FlacData;
/* this code is based on flac123, from flac-tools */
int flacSendChunk(FlacData * data);
void flacError(const FLAC__SeekableStreamDecoder *,
FLAC__StreamDecoderErrorStatus, void *);
void flacPrintErroredState(FLAC__SeekableStreamDecoderState state, char * file);
void flacMetadata(const FLAC__SeekableStreamDecoder *,
const FLAC__StreamMetadata *, void *);
FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__SeekableStreamDecoder *,
const FLAC__Frame *, const FLAC__int32 * const buf[], void *);
FLAC__SeekableStreamDecoderReadStatus flacRead(
const FLAC__SeekableStreamDecoder *, FLAC__byte buf[],
unsigned *, void *);
FLAC__SeekableStreamDecoderSeekStatus flacSeek(
const FLAC__SeekableStreamDecoder *, FLAC__uint64, void *);
FLAC__SeekableStreamDecoderTellStatus flacTell(
const FLAC__SeekableStreamDecoder *, FLAC__uint64 *, void *);
FLAC__SeekableStreamDecoderLengthStatus flacLength(
const FLAC__SeekableStreamDecoder *, FLAC__uint64 *, void *);
FLAC__bool flacEOF(const FLAC__SeekableStreamDecoder *, void *);
int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
FLAC__SeekableStreamDecoder * flacDec;
FlacData data;
int status = 1;
data.chunk_length = 0;
data.time = 0;
data.position = 0;
data.bitRate = 0;
data.cb = cb;
data.dc = dc;
data.replayGainScale = 1.0;
data.path = path;
if(openInputStream(&(data.inStream), path)<0) {
ERROR("unable to open flac: %s\n", path);
return -1;
}
if(!(flacDec = FLAC__seekable_stream_decoder_new())) return -1;
/*status&=FLAC__file_decoder_set_md5_checking(flacDec,1);*/
status&=FLAC__seekable_stream_decoder_set_read_callback(flacDec,
flacRead);
status&=FLAC__seekable_stream_decoder_set_seek_callback(flacDec,
flacSeek);
status&=FLAC__seekable_stream_decoder_set_tell_callback(flacDec,
flacTell);
status&=FLAC__seekable_stream_decoder_set_length_callback(flacDec,
flacLength);
status&=FLAC__seekable_stream_decoder_set_eof_callback(flacDec,flacEOF);
status&=FLAC__seekable_stream_decoder_set_write_callback(flacDec,
flacWrite);
status&=FLAC__seekable_stream_decoder_set_metadata_callback(flacDec,
flacMetadata);
status&=FLAC__seekable_stream_decoder_set_error_callback(flacDec,
flacError);
status&=FLAC__seekable_stream_decoder_set_client_data(flacDec,
(void *)&data);
if(!status) {
ERROR("flac problem before init(): %s\n", path);
flacPrintErroredState(
FLAC__seekable_stream_decoder_get_state(flacDec),
path);
FLAC__seekable_stream_decoder_delete(flacDec);
return -1;
}
if(FLAC__seekable_stream_decoder_init(flacDec)!=
FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
{
ERROR("flac problem doing init(): %s\n", path);
flacPrintErroredState(
FLAC__seekable_stream_decoder_get_state(flacDec),
path);
FLAC__seekable_stream_decoder_delete(flacDec);
return -1;
}
if(!FLAC__seekable_stream_decoder_process_until_end_of_metadata(flacDec)) {
ERROR("flac problem reading metadata: %s\n", path);
flacPrintErroredState(
FLAC__seekable_stream_decoder_get_state(flacDec),
path);
FLAC__seekable_stream_decoder_delete(flacDec);
return -1;
}
dc->state = DECODE_STATE_DECODE;
while(1) {
FLAC__seekable_stream_decoder_process_single(flacDec);
if(FLAC__seekable_stream_decoder_get_state(flacDec)!=
FLAC__SEEKABLE_STREAM_DECODER_OK)
{
break;
}
if(dc->seek) {
FLAC__uint64 sampleToSeek = dc->seekWhere*
dc->audioFormat.sampleRate+0.5;
if(FLAC__seekable_stream_decoder_seek_absolute(flacDec,
sampleToSeek))
{
clearOutputBuffer(cb);
data.time = ((float)sampleToSeek)/
dc->audioFormat.sampleRate;
data.position = 0;
}
else dc->seekError = 1;
dc->seek = 0;
}
}
/* I don't think we need this bit here! -shank */
/*FLAC__file_decoder_process_until_end_of_file(flacDec);*/
if(!dc->stop) {
flacPrintErroredState(
FLAC__seekable_stream_decoder_get_state(flacDec),
path);
FLAC__seekable_stream_decoder_finish(flacDec);
}
FLAC__seekable_stream_decoder_delete(flacDec);
/* send last little bit */
if(data.chunk_length>0 && !dc->stop) {
flacSendChunk(&data);
flushOutputBuffer(data.cb);
}
/*if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
} */
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
else dc->state = DECODE_STATE_STOP;
return 0;
}
FLAC__SeekableStreamDecoderReadStatus flacRead(
const FLAC__SeekableStreamDecoder * flacDec, FLAC__byte buf[],
unsigned * bytes, void * fdata) {
FlacData * data = (FlacData *) fdata;
*bytes = readFromInputStream(&(data->inStream),(void *)buf,1,*bytes);
if(*bytes==0) return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
}
FLAC__SeekableStreamDecoderSeekStatus flacSeek(
const FLAC__SeekableStreamDecoder * flacDec,
FLAC__uint64 offset, void * fdata)
{
FlacData * data = (FlacData *) fdata;
if(seekInputStream(&(data->inStream),offset,SEEK_SET)<0) {
return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
}
return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
}
FLAC__SeekableStreamDecoderTellStatus flacTell(
const FLAC__SeekableStreamDecoder * flacDec,
FLAC__uint64 * offset, void * fdata)
{
FlacData * data = (FlacData *) fdata;
*offset = data->inStream.offset;
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
}
FLAC__SeekableStreamDecoderLengthStatus flacLength(
const FLAC__SeekableStreamDecoder * flacDec,
FLAC__uint64 * length, void * fdata)
{
FlacData * data = (FlacData *) fdata;
*length = data->inStream.size;
return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
}
FLAC__bool flacEOF(const FLAC__SeekableStreamDecoder * flacDec, void * fdata) {
FlacData * data = (FlacData *) fdata;
switch(inputStreamAtEOF(&(data->inStream))) {
case 1:
return true;
default:
return false;
}
}
void flacError(const FLAC__SeekableStreamDecoder *dec,
FLAC__StreamDecoderErrorStatus status, void *fdata)
{
FlacData * data = (FlacData *) fdata;
if(data->dc->stop) return;
switch(status) {
case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
ERROR("flac lost sync: %s\n", data->path);
break;
case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
ERROR("bad header %s\n", data->path);
break;
case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
ERROR("crc mismatch %s\n", data->path);
break;
default:
ERROR("unknow flac error %s\n", data->path);
}
}
void flacPrintErroredState(FLAC__SeekableStreamDecoderState state,
char * file)
{
switch(state) {
case FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
ERROR("flac allocation error\n");
break;
case FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR:
ERROR("flac read error: %s\n",file);
break;
case FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR:
ERROR("flac seek error: %s\n",file);
break;
case FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR:
ERROR("flac seekable stream error: %s\n",file);
break;
case FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED:
ERROR("flac decoder already initilaized: %s\n",file);
break;
case FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK:
ERROR("invalid flac callback\n");
break;
case FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED:
ERROR("flac decoder uninitialized: %s\n",file);
break;
case FLAC__SEEKABLE_STREAM_DECODER_OK:
case FLAC__SEEKABLE_STREAM_DECODER_SEEKING:
case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:
break;
}
}
int flacFindVorbisCommentFloat(const FLAC__StreamMetadata * block, char * cmnt,
float * fl)
{
int offset = FLAC__metadata_object_vorbiscomment_find_entry_from(
block,0,cmnt);
if(offset >= 0) {
int pos = strlen(cmnt)+1; /* 1 is for '=' */
int len = block->data.vorbis_comment.comments[offset].length
-pos;
if(len > 0) {
char * dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
*fl = atof(dup);
free(dup);
return 1;
}
}
return 0;
}
/* replaygain stuff by AliasMrJones */
void flacParseReplayGain(const FLAC__StreamMetadata *block, FlacData * data) {
int found;
float gain = 0.0;
float peak = 0.0;
int state = getReplayGainState();
if(state == REPLAYGAIN_OFF) return;
found = flacFindVorbisCommentFloat(block,"replaygain_album_gain",&gain);
if(found) {
flacFindVorbisCommentFloat(block,"replaygain_album_peak",
&peak);
}
if(!found || state == REPLAYGAIN_TRACK) {
if(flacFindVorbisCommentFloat(block,"replaygain_track_gain",
&gain))
{
peak = 0.0;
flacFindVorbisCommentFloat(block,
"replaygain_track_peak",&peak);
}
}
data->replayGainScale = computeReplayGainScale(gain,peak);
}
void flacMetadata(const FLAC__SeekableStreamDecoder *dec,
const FLAC__StreamMetadata *block, void *vdata)
{
FlacData * data = (FlacData *)vdata;
switch(block->type) {
case FLAC__METADATA_TYPE_STREAMINFO:
data->dc->audioFormat.bits =
block->data.stream_info.bits_per_sample;
data->dc->audioFormat.sampleRate =
block->data.stream_info.sample_rate;
data->dc->audioFormat.channels =
block->data.stream_info.channels;
data->dc->totalTime =
((float)block->data.stream_info.total_samples)/
data->dc->audioFormat.sampleRate;
getOutputAudioFormat(&(data->dc->audioFormat),
&(data->cb->audioFormat));
break;
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
flacParseReplayGain(block,data);
default:
break;
}
}
int flacSendChunk(FlacData * data) {
doReplayGain(data->chunk,data->chunk_length,&(data->dc->audioFormat),
data->replayGainScale);
switch(sendDataToOutputBuffer(data->cb, NULL, data->dc, 1, data->chunk,
data->chunk_length, data->time, data->bitRate))
{
case OUTPUT_BUFFER_DC_STOP:
return -1;
default:
return 0;
}
return 0;
}
FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__SeekableStreamDecoder *dec,
const FLAC__Frame *frame, const FLAC__int32 * const buf[],
void * vdata)
{
FlacData * data = (FlacData *)vdata;
FLAC__uint32 samples = frame->header.blocksize;
FLAC__uint16 u16;
unsigned char * uc;
int c_samp, c_chan, d_samp;
int i;
float timeChange;
FLAC__uint64 newPosition = 0;
timeChange = ((float)samples)/frame->header.sample_rate;
data->time+= timeChange;
FLAC__seekable_stream_decoder_get_decode_position(dec,&newPosition);
if(data->position) {
data->bitRate = ((newPosition-data->position)*8.0/timeChange)
/1000+0.5;
}
data->position = newPosition;
for(c_samp = d_samp = 0; c_samp < frame->header.blocksize; c_samp++) {
for(c_chan = 0; c_chan < frame->header.channels;
c_chan++, d_samp++) {
u16 = buf[c_chan][c_samp];
uc = (unsigned char *)&u16;
for(i=0;i<(data->dc->audioFormat.bits/8);i++) {
if(data->chunk_length>=FLAC_CHUNK_SIZE) {
if(flacSendChunk(data)<0) {
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
data->chunk_length = 0;
if(data->dc->seek) {
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
}
data->chunk[data->chunk_length++] = *(uc++);
}
}
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
MpdTag * ret = NULL;
FLAC__Metadata_SimpleIterator * it;
FLAC__StreamMetadata * block = NULL;
int offset;
int len, pos;
*vorbisCommentFound = 0;
it = FLAC__metadata_simple_iterator_new();
if(!FLAC__metadata_simple_iterator_init(it, file ,1,0)) {
FLAC__metadata_simple_iterator_delete(it);
return ret;
}
do {
block = FLAC__metadata_simple_iterator_get_block(it);
if(!block) break;
if(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
char * dup;
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"artist");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("artist=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
ret->artist = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"album");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("album=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
ret->album = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"title");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("title=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
ret->title = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"tracknumber");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("tracknumber=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
ret->track = dup;
}
}
}
else if(block->type == FLAC__METADATA_TYPE_STREAMINFO) {
if(!ret) ret = newMpdTag();
ret->time = ((float)block->data.stream_info.
total_samples) /
block->data.stream_info.sample_rate +
0.5;
}
FLAC__metadata_object_delete(block);
} while(FLAC__metadata_simple_iterator_next(it));
FLAC__metadata_simple_iterator_delete(it);
return ret;
}
MpdTag * flacTagDup(char * file) {
MpdTag * ret = NULL;
int foundVorbisComment = 0;
ret = flacMetadataDup(file, &foundVorbisComment);
if(!ret) return NULL;
if(!foundVorbisComment) {
MpdTag * temp = id3Dup(file);
if(temp) {
temp->time = ret->time;
freeMpdTag(ret);
ret = temp;
}
}
return ret;
}
char * flacSuffixes[] = {"flac", NULL};
InputPlugin flacPlugin =
{
"flac",
NULL,
NULL,
NULL,
flac_decode,
flacTagDup,
INPUT_PLUGIN_STREAM_FILE,
flacSuffixes,
NULL
};
#else
InputPlugin flacPlugin =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
};
#endif
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* libaudiofile (wave) support added by Eric Wong <normalperson@yhbt.net>
*
* 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 "../inputPlugin.h"
#ifdef HAVE_MIKMOD
#include "../utils.h"
#include "../audio.h"
#include "../log.h"
#include "../pcm_utils.h"
#include "../playerData.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <mikmod.h>
/* this is largely copied from alsaplayer */
#define MIKMOD_FRAME_SIZE 4096
static BOOL mod_mpd_Init() {
return VC_Init();
}
static void mod_mpd_Exit() {
VC_Exit();
}
static void mod_mpd_Update() {
}
static BOOL mod_mpd_IsThere() {
return 1;
}
MDRIVER drv_mpd =
{
NULL,
"MPD",
"MPD Output Driver v0.1",
0,
255,
"mpd",
NULL,
mod_mpd_IsThere,
VC_SampleLoad,
VC_SampleUnload,
VC_SampleSpace,
VC_SampleLength,
mod_mpd_Init,
mod_mpd_Exit,
NULL,
VC_SetNumVoices,
VC_PlayStart,
VC_PlayStop,
mod_mpd_Update,
NULL,
VC_VoiceSetVolume,
VC_VoiceGetVolume,
VC_VoiceSetFrequency,
VC_VoiceGetFrequency,
VC_VoiceSetPanning,
VC_VoiceGetPanning,
VC_VoicePlay,
VC_VoiceStop,
VC_VoiceStopped,
VC_VoiceGetPosition,
VC_VoiceRealVolume
};
static int mod_mikModInitiated = 0;
static int mod_mikModInitError = 0;
static int mod_initMikMod() {
if(mod_mikModInitiated) return 0;
if(mod_mikModInitError) return -1;
mod_mikModInitiated = 1;
MikMod_RegisterDriver(&drv_mpd);
MikMod_RegisterAllLoaders();
md_reverb = 0;
md_mode = (DMODE_SOFT_MUSIC | DMODE_SOFT_SNDFX | DMODE_STEREO |
DMODE_16BITS);
if(MikMod_Init("")) {
ERROR("Could not init MikMod: %s\n",
MikMod_strerror(MikMod_errno));
mod_mikModInitError = 1;
return -1;
}
return 0;
}
void mod_finishMikMod() {
MikMod_Exit();
}
typedef struct _mod_Data {
MODULE * moduleHandle;
SBYTE * audio_buffer;
} mod_Data;
static mod_Data * mod_open(char * path) {
MODULE * moduleHandle;
mod_Data * data;
if(!(moduleHandle = Player_Load(path, 255, 0))) return NULL;
data = malloc(sizeof(mod_Data));
data->audio_buffer = malloc(MIKMOD_FRAME_SIZE);
data->moduleHandle = moduleHandle;
Player_Start(data->moduleHandle);
return data;
}
static void mod_close(mod_Data * data) {
Player_Stop();
Player_Free(data->moduleHandle);
free(data->audio_buffer);
free(data);
}
int mod_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
mod_Data * data;
float time = 0.0;
int ret;
float secPerByte;
if(mod_initMikMod() < 0) return -1;
if(!(data = mod_open(path))) {
ERROR("failed to open mod: %s\n", path);
return -1;
}
dc->audioFormat.bits = 16;
dc->audioFormat.sampleRate = 44100;
dc->audioFormat.channels = 2;
getOutputAudioFormat(&(dc->audioFormat),&(cb->audioFormat));
secPerByte = 1.0/((dc->audioFormat.bits*dc->audioFormat.channels/8.0)*
(float)dc->audioFormat.sampleRate);
dc->state = DECODE_STATE_DECODE;
while(1) {
if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
}
if(dc->stop) break;
if(!Player_Active()) break;
ret = VC_WriteBytes(data->audio_buffer, MIKMOD_FRAME_SIZE);
time += ret*secPerByte;
sendDataToOutputBuffer(cb, NULL, dc, 0,
(char *)data->audio_buffer, ret, time,
0);
}
flushOutputBuffer(cb);
mod_close(data);
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
else dc->state = DECODE_STATE_STOP;
return 0;
}
MpdTag * modTagDup(char * file) {
MpdTag * ret = NULL;
MODULE * moduleHandle;
if(mod_initMikMod() < 0) return NULL;
if(!(moduleHandle = Player_Load(file, 255, 0))) return NULL;
Player_Free(moduleHandle);
ret = newMpdTag();
ret->time = 0;
ret->title = Player_LoadTitle(file);
return ret;
}
char * modSuffixes[] = {"amf",
"dsm",
"far",
"gdm",
"imf",
"it",
"med",
"mod",
"mtm",
"s3m",
"stm",
"stx",
"ult",
"uni",
"xm",
NULL};
InputPlugin modPlugin =
{
"audiofile",
NULL,
mod_finishMikMod,
NULL,
mod_decode,
modTagDup,
INPUT_PLUGIN_STREAM_FILE,
modSuffixes,
NULL
};
#else
InputPlugin modPlugin =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL
};
#endif /* HAVE_AUDIOFILE */
......@@ -16,32 +16,33 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mp3_decode.h"
#include "../inputPlugin.h"
#ifdef HAVE_MAD
#include "pcm_utils.h"
#include "../pcm_utils.h"
#ifdef USE_MPD_MAD
#include "libmad/mad.h"
#include "../libmad/mad.h"
#else
#include <mad.h>
#endif
#ifdef HAVE_ID3TAG
#ifdef USE_MPD_ID3TAG
#include "libid3tag/id3tag.h"
#include "../libid3tag/id3tag.h"
#else
#include <id3tag.h>
#endif
#endif
#include "playerData.h"
#include "log.h"
#include "utils.h"
#include "../log.h"
#include "../utils.h"
#include "../tag.h"
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#define FRAMES_CUSHION 2000
......@@ -52,6 +53,9 @@
#define DECODE_CONT -1
#define DECODE_OK 0
#define MUTEFRAME_SKIP 1
#define MUTEFRAME_SEEK 2
/* this is stolen from mpg321! */
struct audio_dither {
mad_fixed_t error[3];
......@@ -109,14 +113,15 @@ signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct au
/* decoder stuff is based on madlld */
#define MP3_DATA_OUTPUT_BUFFER_SIZE 4096
typedef struct _mp3DecodeData {
FILE * fp;
struct mad_stream stream;
struct mad_frame frame;
struct mad_synth synth;
mad_timer_t timer;
unsigned char readBuffer[READ_BUFFER_SIZE];
char outputBuffer[CHUNK_SIZE];
char outputBuffer[MP3_DATA_OUTPUT_BUFFER_SIZE];
char * outputPtr;
char * outputBufferEnd;
float totalTime;
......@@ -125,43 +130,49 @@ typedef struct _mp3DecodeData {
long * frameOffset;
mad_timer_t * times;
long highestFrame;
long currentOffset;
long maxFrames;
long currentFrame;
int flush;
unsigned long bitRate;
InputStream * inStream;
} mp3DecodeData;
void initMp3DecodeData(mp3DecodeData * data) {
void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) {
data->outputPtr = data->outputBuffer;
data->outputBufferEnd = data->outputBuffer+CHUNK_SIZE;
data->outputBufferEnd = data->outputBuffer+MP3_DATA_OUTPUT_BUFFER_SIZE;
data->muteFrame = 0;
data->currentOffset = 0;
data->highestFrame = 0;
data->maxFrames = 0;
data->frameOffset = NULL;
data->times = NULL;
data->currentFrame = 0;
data->flush = 1;
data->inStream = inStream;
mad_stream_init(&data->stream);
data->stream.options |= MAD_OPTION_IGNORECRC;
mad_frame_init(&data->frame);
mad_synth_init(&data->synth);
mad_timer_reset(&data->timer);
}
int fillMp3InputBuffer(mp3DecodeData * data, long offset) {
int seekMp3InputBuffer(mp3DecodeData * data, long offset) {
if(seekInputStream(data->inStream,offset,SEEK_SET) < 0) {
return -1;
}
mad_stream_buffer(&data->stream,data->readBuffer,0);
(data->stream).error = 0;
return 0;
}
int fillMp3InputBuffer(mp3DecodeData * data) {
size_t readSize;
size_t remaining;
size_t readed;
unsigned char * readStart;
if(offset>=0) {
if(fseek(data->fp,offset,SEEK_SET)==0) {
data->currentOffset = offset;
}
}
if(offset==-1 && (data->stream).next_frame!=NULL) {
if((data->stream).next_frame!=NULL) {
remaining = (data->stream).bufend-(data->stream).next_frame;
memmove(data->readBuffer,(data->stream).next_frame,remaining);
readStart = (data->readBuffer)+remaining;
......@@ -172,21 +183,71 @@ int fillMp3InputBuffer(mp3DecodeData * data, long offset) {
readStart = data->readBuffer,
remaining = 0;
}
readSize = fread(readStart,1,readSize,data->fp);
if(readSize<=0) return -1;
data->currentOffset+=readSize;
readed = readFromInputStream(data->inStream, readStart, (size_t)1,
readSize);
if(readed <= 0 && inputStreamAtEOF(data->inStream)) return -1;
/* sleep for a fraction of a second! */
else if(readed <= 0) my_usleep(10000);
mad_stream_buffer(&data->stream,data->readBuffer,readSize+remaining);
mad_stream_buffer(&data->stream,data->readBuffer,readed+remaining);
(data->stream).error = 0;
return 0;
}
int decodeNextFrameHeader(mp3DecodeData * data) {
#ifdef HAVE_ID3TAG
static MpdTag * mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize) {
MpdTag * ret = NULL;
struct id3_tag * id3Tag = NULL;
id3_length_t count;
id3_byte_t const *id3_data;
id3_byte_t * allocated = NULL;
count = data->stream.bufend - data->stream.this_frame;
if(tagsize <= count) {
id3_data = data->stream.this_frame;
mad_stream_skip(&(data->stream), tagsize);
}
else {
allocated = malloc(tagsize);
if(!allocated) goto fail;
memcpy(allocated, data->stream.this_frame, count);
mad_stream_skip(&(data->stream), count);
while(count < tagsize) {
int len;
len = readFromInputStream(data->inStream,
allocated+count, (size_t)1,
tagsize-count);
if(len <= 0 && inputStreamAtEOF(data->inStream)) {
break;
}
else if(len <= 0) my_usleep(10000);
else count += len;
}
if(count != tagsize) goto fail;
id3_data = allocated;
}
id3Tag = id3_tag_parse(id3_data, tagsize);
ret = parseId3Tag(id3Tag);
fail:
if(allocated) free(allocated);
return ret;
}
#endif
int decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag) {
if((data->stream).buffer==NULL || (data->stream).error==MAD_ERROR_BUFLEN) {
if(fillMp3InputBuffer(data,/*data->currentOffset*/-1) < 0) {
if(fillMp3InputBuffer(data) < 0) {
return DECODE_BREAK;
}
}
......@@ -199,13 +260,20 @@ int decodeNextFrameHeader(mp3DecodeData * data) {
(data->stream).this_frame,
(data->stream).bufend-
(data->stream).this_frame);
if(tagsize>0) {
mad_stream_skip(&(data->stream),tagsize);
if(tag) *tag =mp3_parseId3Tag(data, tagsize);
else {
mad_stream_skip(&(data->stream),
tagsize);
}
return DECODE_CONT;
}
}
#endif
if(MAD_RECOVERABLE((data->stream).error)) return DECODE_SKIP;
if(MAD_RECOVERABLE((data->stream).error)) {
return DECODE_SKIP;
}
else {
if((data->stream).error==MAD_ERROR_BUFLEN) return DECODE_CONT;
else
......@@ -224,7 +292,7 @@ int decodeNextFrameHeader(mp3DecodeData * data) {
int decodeNextFrame(mp3DecodeData * data) {
if((data->stream).buffer==NULL || (data->stream).error==MAD_ERROR_BUFLEN) {
if(fillMp3InputBuffer(data,/*data->currentOffset*/-1) < 0) {
if(fillMp3InputBuffer(data) < 0) {
return DECODE_BREAK;
}
}
......@@ -241,7 +309,9 @@ int decodeNextFrame(mp3DecodeData * data) {
}
}
#endif
if(MAD_RECOVERABLE((data->stream).error)) return DECODE_SKIP;
if(MAD_RECOVERABLE((data->stream).error)) {
return DECODE_SKIP;
}
else {
if((data->stream).error==MAD_ERROR_BUFLEN) return DECODE_CONT;
else
......@@ -315,8 +385,9 @@ fail:
return 0;
}
int decodeFirstFrame(mp3DecodeData * data) {
struct stat filestat;
int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc,
MpdTag ** tag)
{
struct xing xing;
int ret;
int skip;
......@@ -326,11 +397,13 @@ int decodeFirstFrame(mp3DecodeData * data) {
while(1) {
skip = 0;
while((ret = decodeNextFrameHeader(data))==DECODE_CONT);
while((ret = decodeNextFrameHeader(data, tag))==DECODE_CONT &&
(!dc || !dc->stop));
if(ret==DECODE_SKIP) skip = 1;
else if(ret==DECODE_BREAK) return -1;
while((ret = decodeNextFrame(data))==DECODE_CONT);
if(ret==DECODE_BREAK) return -1;
else if(ret==DECODE_BREAK || (dc && dc->stop)) return -1;
while((ret = decodeNextFrame(data))==DECODE_CONT &&
(!dc || !dc->stop));
if(ret==DECODE_BREAK || (dc && dc->stop)) return -1;
if(!skip && ret==DECODE_OK) break;
}
......@@ -338,27 +411,33 @@ int decodeFirstFrame(mp3DecodeData * data) {
if(xing.flags & XING_FRAMES) {
mad_timer_t duration = data->frame.header.duration;
mad_timer_multiply(&duration,xing.frames);
data->muteFrame = 1;
data->muteFrame = MUTEFRAME_SKIP;
data->totalTime = ((float)mad_timer_count(duration,
MAD_UNITS_MILLISECONDS))/1000;
data->maxFrames = xing.frames;
}
}
else {
size_t offset = data->currentOffset;
size_t offset = data->inStream->offset;
mad_timer_t duration = data->frame.header.duration;
float frameTime = ((float)mad_timer_count(duration,
MAD_UNITS_MILLISECONDS))/1000;
fstat(fileno(data->fp),&filestat);
if(data->stream.this_frame!=NULL) {
offset-= data->stream.bufend-data->stream.this_frame;
}
else {
offset-= data->stream.bufend-data->stream.buffer;
}
data->totalTime = ((filestat.st_size-offset)*8.0)/
if(data->inStream->size >= offset) {
data->totalTime = ((data->inStream->size-offset)*8.0)/
(data->frame).header.bitrate;
data->maxFrames = data->totalTime/frameTime+FRAMES_CUSHION;
data->maxFrames =
data->totalTime/frameTime+FRAMES_CUSHION;
}
else {
data->maxFrames = FRAMES_CUSHION;
data->totalTime = 0;
}
}
data->frameOffset = malloc(sizeof(long)*data->maxFrames);
......@@ -372,76 +451,56 @@ void mp3DecodeDataFinalize(mp3DecodeData * data) {
mad_frame_finish(&data->frame);
mad_stream_finish(&data->stream);
if(data->fp) fclose(data->fp);
if(data->frameOffset) free(data->frameOffset);
if(data->times) free(data->times);
}
/* this is primarily used for getting total time for tags */
int getMp3TotalTime(char * file) {
InputStream inStream;
mp3DecodeData data;
int ret;
while(!(data.fp = fopen(file,"r")) && errno==EINTR);
if(!data.fp) return -1;
initMp3DecodeData(&data);
if(decodeFirstFrame(&data)<0) ret = -1;
if(openInputStream(&inStream, file) < 0) return -1;
initMp3DecodeData(&data,&inStream);
data.stream.options |= MAD_OPTION_IGNORECRC;
if(decodeFirstFrame(&data, NULL, NULL)<0) ret = -1;
else ret = data.totalTime+0.5;
mp3DecodeDataFinalize(&data);
closeInputStream(&inStream);
return ret;
}
int openMp3(char * file, mp3DecodeData * data) {
if((data->fp = fopen(file,"r"))<=0) {
ERROR("problems opening \"%s\"\n",file);
return -1;
}
initMp3DecodeData(data);
if(decodeFirstFrame(data)<0) {
int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data,
DecoderControl * dc, MpdTag ** tag)
{
initMp3DecodeData(data, inStream);
data->stream.options |= MAD_OPTION_IGNORECRC;
*tag = NULL;
if(decodeFirstFrame(data, dc, tag)<0) {
mp3DecodeDataFinalize(data);
if(tag && *tag) freeMpdTag(*tag);
return -1;
}
return 0;
}
int mp3ChildSendData(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
while(cb->begin==cb->end && cb->wrap && !dc->stop && !dc->seek)
my_usleep(10000);
if(dc->stop) return -1;
/* just for now, so it doesn't hang */
if(dc->seek) return 0;
/* be sure to remove this! */
memcpy(cb->chunks+cb->end*CHUNK_SIZE,data->outputBuffer,CHUNK_SIZE);
cb->chunkSize[cb->end] = data->outputPtr-data->outputBuffer;
cb->bitRate[cb->end] = data->bitRate/1024;
cb->times[cb->end] = data->elapsedTime;
cb->end++;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
return 0;
}
int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
static int i;
static int ret;
static struct audio_dither dither;
static int skip;
int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
int i;
int ret;
struct audio_dither dither;
int skip;
if(data->currentFrame>=data->highestFrame &&
data->highestFrame<data->maxFrames)
{
if(data->currentFrame>=data->highestFrame) {
mad_timer_add(&data->timer,(data->frame).header.duration);
data->bitRate = (data->frame).header.bitrate;
data->frameOffset[data->currentFrame] =
data->currentOffset;
if(data->currentFrame>=data->maxFrames) {
data->currentFrame = data->maxFrames - 1;
}
else data->highestFrame++;
data->frameOffset[data->currentFrame] = data->inStream->offset;
if(data->stream.this_frame!=NULL) {
data->frameOffset[data->currentFrame]-=
data->stream.bufend-
......@@ -452,20 +511,24 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
data->stream.bufend-data->stream.buffer;
}
data->times[data->currentFrame] = data->timer;
data->highestFrame++;
}
else data->timer = data->times[data->currentFrame];
data->currentFrame++;
data->elapsedTime = ((float)mad_timer_count(data->timer,MAD_UNITS_MILLISECONDS))/1000;
if(data->muteFrame) {
if(!dc->seek) data->muteFrame = 0;
else if(dc->seekWhere<=data->elapsedTime) {
switch(data->muteFrame) {
case MUTEFRAME_SKIP:
data->muteFrame = 0;
break;
case MUTEFRAME_SEEK:
if(dc->seekWhere<=data->elapsedTime) {
data->outputPtr = data->outputBuffer;
clearOutputBuffer(cb);
data->muteFrame = 0;
dc->seek = 0;
}
}
else {
break;
default:
mad_synth_frame(&data->synth,&data->frame);
for(i=0;i<(data->synth).pcm.length;i++) {
......@@ -486,20 +549,28 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
}
if(data->outputPtr==data->outputBufferEnd) {
if(mp3ChildSendData(data,cb,dc)<0) {
data->flush = 0;
return DECODE_BREAK;
}
data->outputPtr = data->outputBuffer;
if(dc->seek) break;
long ret;
ret = sendDataToOutputBuffer(cb,
data->inStream,
dc,
data->inStream->seekable,
data->outputBuffer,
MP3_DATA_OUTPUT_BUFFER_SIZE,
data->elapsedTime,
data->bitRate/1000);
if(ret == OUTPUT_BUFFER_DC_STOP) {
return DECODE_BREAK;
}
data->outputPtr = data->outputBuffer;
if(ret == OUTPUT_BUFFER_DC_SEEK) break;
}
}
if(dc->seek) {
if(dc->seek && data->inStream->seekable) {
long i = 0;
cb->wrap = 0;
cb->end = cb->begin;
data->muteFrame = 1;
data->muteFrame = MUTEFRAME_SEEK;
while(i<data->highestFrame && dc->seekWhere >
((float)mad_timer_count(data->times[i],
MAD_UNITS_MILLISECONDS))/1000)
......@@ -507,26 +578,40 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
i++;
}
if(i<data->highestFrame) {
data->currentFrame = i;
fillMp3InputBuffer(data,data->frameOffset[i]);
if(seekMp3InputBuffer(data,
data->frameOffset[i]) == 0)
{
data->outputPtr = data->outputBuffer;
clearOutputBuffer(cb);
data->currentFrame = i;
}
else dc->seekError = 1;
data->muteFrame = 0;
dc->seek = 0;
}
}
else if(dc->seek && !data->inStream->seekable) {
dc->seek = 0;
dc->seekError = 1;
}
}
while(1) {
skip = 0;
while((ret = decodeNextFrameHeader(data))==DECODE_CONT);
if(ret==DECODE_SKIP) skip = 1;
else if(ret==DECODE_BREAK) break;
while((ret = decodeNextFrameHeader(data, NULL))==DECODE_CONT &&
!dc->stop && !dc->seek);
if(ret==DECODE_BREAK || dc->stop || dc->seek) break;
else if(ret==DECODE_SKIP) skip = 1;
if(!data->muteFrame) {
while((ret = decodeNextFrame(data))==DECODE_CONT);
if(ret==DECODE_BREAK) break;
while((ret = decodeNextFrame(data))==DECODE_CONT &&
!dc->stop && !dc->seek);
if(ret==DECODE_BREAK || dc->stop || dc->seek) break;
}
if(!skip && ret==DECODE_OK) break;
}
if(dc->stop) return DECODE_BREAK;
return ret;
}
......@@ -536,28 +621,53 @@ void initAudioFormatFromMp3DecodeData(mp3DecodeData * data, AudioFormat * af) {
af->channels = MAD_NCHANNELS(&(data->frame).header);
}
int mp3_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) {
mp3DecodeData data;
MpdTag * tag;
if(openMp3FromInputStream(inStream, &data, dc, &tag) < 0) {
closeInputStream(inStream);
if(!dc->stop) {
ERROR("Input does not appear to be a mp3 bit stream.\n");
return -1;
}
else {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
return 0;
}
if(openMp3(dc->file,&data) < 0) {
ERROR("Input does not appear to be a mp3 bit stream.\n");
return -1;
initAudioFormatFromMp3DecodeData(&data, &(dc->audioFormat));
getOutputAudioFormat(&(dc->audioFormat), &(cb->audioFormat));
dc->totalTime = data.totalTime;
if(tag) {
copyMpdTagToDecoderControlMetadata(dc, tag);
freeMpdTag(tag);
}
initAudioFormatFromMp3DecodeData(&data,af);
cb->totalTime = data.totalTime;
dc->start = 0;
dc->state = DECODE_STATE_DECODE;
while(mp3Read(&data,cb,dc)!=DECODE_BREAK);
/* send last little bit if not dc->stop */
if(data.outputPtr!=data.outputBuffer && data.flush) {
mp3ChildSendData(&data,cb,dc);
sendDataToOutputBuffer(cb, NULL, dc,
data.inStream->seekable,
data.outputBuffer,
data.outputPtr-data.outputBuffer,
data.elapsedTime,data.bitRate/1000);
}
flushOutputBuffer(cb);
mp3DecodeDataFinalize(&data);
closeInputStream(inStream);
if(dc->seek) dc->seek = 0;
/*if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
}*/
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
......@@ -568,4 +678,50 @@ int mp3_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
return 0;
}
MpdTag * mp3_tagDup(char * file) {
MpdTag * ret = NULL;
int time;
ret = id3Dup(file);
time = getMp3TotalTime(file);
if(time>=0) {
if(!ret) ret = newMpdTag();
ret->time = time;
}
return ret;
}
char * mp3_suffixes[] = {"mp3", NULL};
char * mp3_mimeTypes[] = {"audio/mpeg", NULL};
InputPlugin mp3Plugin =
{
"mp3",
NULL,
NULL,
mp3_decode,
NULL,
mp3_tagDup,
INPUT_PLUGIN_STREAM_FILE | INPUT_PLUGIN_STREAM_URL,
mp3_suffixes,
mp3_mimeTypes
};
#else
InputPlugin mp3Plugin =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL
};
#endif
......@@ -16,17 +16,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mp4_decode.h"
#include "../inputPlugin.h"
#ifdef HAVE_FAAD
#include "command.h"
#include "utils.h"
#include "audio.h"
#include "log.h"
#include "pcm_utils.h"
#include "../utils.h"
#include "../audio.h"
#include "../log.h"
#include "../pcm_utils.h"
#include "../inputStream.h"
#include "../outputBuffer.h"
#include "../decode.h"
#include "mp4ff/mp4ff.h"
#include "../mp4ff/mp4ff.h"
#include <stdio.h>
#include <unistd.h>
......@@ -72,17 +74,18 @@ int mp4_getAACTrack(mp4ff_t *infile) {
return -1;
}
uint32_t mp4_readCallback(void *user_data, void *buffer, uint32_t length) {
return fread(buffer, 1, length, (FILE*)user_data);
uint32_t mp4_inputStreamReadCallback(void *inStream, void *buffer,
uint32_t length)
{
return readFromInputStream((InputStream*) inStream, buffer, 1, length);
}
uint32_t mp4_seekCallback(void *user_data, uint64_t position) {
return fseek((FILE*)user_data, position, SEEK_SET);
uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position) {
return seekInputStream((InputStream *) inStream, position, SEEK_SET);
}
int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
FILE * fh;
int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
mp4ff_t * mp4fh;
mp4ff_callback_t * mp4cb;
int32_t track;
......@@ -103,29 +106,28 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
char * sampleBuffer;
size_t sampleBufferLen;
unsigned int initial = 1;
int chunkLen = 0;
float * seekTable;
long seekTableEnd = -1;
int seekPositionFound = 0;
long offset;
mpd_uint16 bitRate = 0;
InputStream inStream;
fh = fopen(dc->file,"r");
if(!fh) {
ERROR("failed to open %s\n",dc->file);
if(openInputStream(&inStream, path) < 0) {
ERROR("failed to open %s\n", path);
return -1;
}
mp4cb = malloc(sizeof(mp4ff_callback_t));
mp4cb->read = mp4_readCallback;
mp4cb->seek = mp4_seekCallback;
mp4cb->user_data = fh;
mp4cb->read = mp4_inputStreamReadCallback;
mp4cb->seek = mp4_inputStreamSeekCallback;
mp4cb->user_data = &inStream;
mp4fh = mp4ff_open_read(mp4cb);
if(!mp4fh) {
ERROR("Input does not appear to be a mp4 stream.\n");
free(mp4cb);
fclose(fh);
closeInputStream(&inStream);
return -1;
}
......@@ -133,7 +135,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
if(track < 0) {
ERROR("No AAC track found in mp4 stream.\n");
mp4ff_close(mp4fh);
fclose(fh);
closeInputStream(&inStream);
free(mp4cb);
return -1;
}
......@@ -150,7 +152,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
#endif
faacDecSetConfiguration(decoder,config);
af->bits = 16;
dc->audioFormat.bits = 16;
mp4Buffer = NULL;
mp4BufferSize = 0;
......@@ -163,12 +165,12 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
faacDecClose(decoder);
mp4ff_close(mp4fh);
free(mp4cb);
fclose(fh);
closeInputStream(&inStream);
return -1;
}
af->sampleRate = sampleRate;
af->channels = channels;
dc->audioFormat.sampleRate = sampleRate;
dc->audioFormat.channels = channels;
time = mp4ff_get_track_duration_use_offsets(mp4fh,track);
scale = mp4ff_time_scale(mp4fh,track);
......@@ -178,11 +180,11 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
ERROR("Error getting audio format of mp4 AAC track.\n");
faacDecClose(decoder);
mp4ff_close(mp4fh);
fclose(fh);
closeInputStream(&inStream);
free(mp4cb);
return -1;
}
cb->totalTime = ((float)time)/scale;
dc->totalTime = ((float)time)/scale;
numSamples = mp4ff_num_samples(mp4fh,track);
......@@ -217,9 +219,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
if(dc->seek && seekPositionFound) {
seekPositionFound = 0;
chunkLen = 0;
cb->end = cb->begin;
cb->wrap = 0;
clearOutputBuffer(cb);
dc->seek = 0;
}
......@@ -241,22 +241,23 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
if(mp4Buffer) free(mp4Buffer);
if(frameInfo.error > 0) {
ERROR("error decoding MP4 file: %s\n",dc->file);
ERROR("error decoding MP4 file: %s\n", path);
ERROR("faad2 error: %s\n",
faacDecGetErrorMessage(frameInfo.error));
eof = 1;
break;
}
if(dc->start) {
if(dc->state != DECODE_STATE_DECODE) {
channels = frameInfo.channels;
#ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE
scale = frameInfo.samplerate;
#endif
af->sampleRate = scale;
af->channels = frameInfo.channels;
dc->audioFormat.sampleRate = scale;
dc->audioFormat.channels = frameInfo.channels;
getOutputAudioFormat(&(dc->audioFormat),
&(cb->audioFormat));
dc->state = DECODE_STATE_DECODE;
dc->start = 0;
}
if(channels*(dur+offset) > frameInfo.samples) {
......@@ -270,7 +271,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
initial =0;
bitRate = frameInfo.bytesconsumed*8.0*
frameInfo.channels*scale/
frameInfo.samples/1024+0.5;
frameInfo.samples/1000+0.5;
}
......@@ -278,61 +279,28 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleBuffer+=offset*channels*2;
while(sampleBufferLen>0 && !dc->seek) {
size_t size = sampleBufferLen>CHUNK_SIZE-chunkLen ?
CHUNK_SIZE-chunkLen:
sampleBufferLen;
while(cb->begin==cb->end && cb->wrap &&
!dc->stop && !dc->seek)
{
my_usleep(10000);
}
if(dc->stop) {
eof = 1;
break;
}
else if(!dc->seek) {
sampleBufferLen-=size;
memcpy(cb->chunks+cb->end*CHUNK_SIZE+chunkLen,
sampleBuffer,size);
cb->times[cb->end] = time;
cb->bitRate[cb->end] = bitRate;
sampleBuffer+=size;
chunkLen+=size;
if(chunkLen>=CHUNK_SIZE) {
cb->chunkSize[cb->end] = CHUNK_SIZE;
++cb->end;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
chunkLen = 0;
}
}
sendDataToOutputBuffer(cb, NULL, dc, 1, sampleBuffer,
sampleBufferLen, time, bitRate);
if(dc->stop) {
eof = 1;
break;
}
}
flushOutputBuffer(cb);
free(seekTable);
faacDecClose(decoder);
mp4ff_close(mp4fh);
fclose(fh);
closeInputStream(&inStream);
free(mp4cb);
if(dc->start) return -1;
if(dc->state != DECODE_STATE_DECODE) return -1;
if(!dc->stop && !dc->seek && chunkLen>0) {
cb->chunkSize[cb->end] = chunkLen;
++cb->end;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
chunkLen = 0;
}
if(dc->seek) dc->seek = 0;
/*if(dc->seek) {
dc->seekError = 1;
dc->seek = 0;
}*/
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
......@@ -343,4 +311,120 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
return 0;
}
MpdTag * mp4DataDup(char * file, int * mp4MetadataFound) {
MpdTag * ret = NULL;
InputStream inStream;
mp4ff_t * mp4fh;
mp4ff_callback_t * cb;
int32_t track;
int32_t time;
int32_t scale;
*mp4MetadataFound = 0;
if(openInputStream(&inStream, file) < 0) return NULL;
cb = malloc(sizeof(mp4ff_callback_t));
cb->read = mp4_inputStreamReadCallback;
cb->seek = mp4_inputStreamSeekCallback;
cb->user_data = &inStream;
mp4fh = mp4ff_open_read(cb);
if(!mp4fh) {
free(cb);
closeInputStream(&inStream);
return NULL;
}
track = mp4_getAACTrack(mp4fh);
if(track < 0) {
mp4ff_close(mp4fh);
closeInputStream(&inStream);
free(cb);
return NULL;
}
ret = newMpdTag();
time = mp4ff_get_track_duration_use_offsets(mp4fh,track);
scale = mp4ff_time_scale(mp4fh,track);
if(scale < 0) {
mp4ff_close(mp4fh);
closeInputStream(&inStream);
free(cb);
freeMpdTag(ret);
return NULL;
}
ret->time = ((float)time)/scale+0.5;
if(!mp4ff_meta_get_artist(mp4fh,&ret->artist)) {
*mp4MetadataFound = 1;
}
if(!mp4ff_meta_get_album(mp4fh,&ret->album)) {
*mp4MetadataFound = 1;
}
if(!mp4ff_meta_get_title(mp4fh,&ret->title)) {
*mp4MetadataFound = 1;
}
if(!mp4ff_meta_get_track(mp4fh,&ret->track)) {
*mp4MetadataFound = 1;
}
mp4ff_close(mp4fh);
closeInputStream(&inStream);
free(cb);
return ret;
}
MpdTag * mp4TagDup(char * file) {
MpdTag * ret = NULL;
int mp4MetadataFound = 0;
ret = mp4DataDup(file, &mp4MetadataFound);
if(!ret) return NULL;
if(!mp4MetadataFound) {
MpdTag * temp = id3Dup(file);
if(temp) {
temp->time = ret->time;
freeMpdTag(ret);
ret = temp;
}
}
return ret;
}
char * mp4Suffixes[] = {"m4a", "mp4", NULL};
InputPlugin mp4Plugin =
{
"mp4",
NULL,
NULL,
NULL,
mp4_decode,
mp4TagDup,
INPUT_PLUGIN_STREAM_FILE,
mp4Suffixes,
NULL
};
#else
InputPlugin mp4Plugin =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL
};
#endif /* HAVE_FAAD */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "../inputPlugin.h"
#ifdef HAVE_OGG
#include "../utils.h"
#include "../audio.h"
#include "../log.h"
#include "../pcm_utils.h"
#include "../inputStream.h"
#include "../outputBuffer.h"
#include "../replayGain.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <vorbis/vorbisfile.h>
#include <errno.h>
#ifdef WORDS_BIGENDIAN
#define OGG_DECODE_USE_BIGENDIAN 1
#else
#define OGG_DECODE_USE_BIGENDIAN 0
#endif
typedef struct _OggCallbackData {
InputStream * inStream;
DecoderControl * dc;
} OggCallbackData;
/* this is just for tag parsing for db import! */
int getOggTotalTime(char * file) {
OggVorbis_File vf;
FILE * oggfp;
int totalTime;
if(!(oggfp = fopen(file,"r"))) return -1;
if(ov_open(oggfp, &vf, NULL, 0) < 0) {
fclose(oggfp);
return -1;
}
totalTime = ov_time_total(&vf,-1)+0.5;
ov_clear(&vf);
return totalTime;
}
size_t ogg_read_cb(void * ptr, size_t size, size_t nmemb, void * vdata)
{
size_t ret = 0;
OggCallbackData * data = (OggCallbackData *)vdata;
while(1) {
ret = readFromInputStream(data->inStream,ptr,size,nmemb);
if(ret == 0 && !inputStreamAtEOF(data->inStream) &&
!data->dc->stop)
{
my_usleep(10000);
}
else break;
}
errno = 0;
/*if(ret<0) errno = ((InputStream *)inStream)->error;*/
return ret;
}
int ogg_seek_cb(void * vdata, ogg_int64_t offset, int whence) {
OggCallbackData * data = (OggCallbackData *)vdata;
return seekInputStream(data->inStream,offset,whence);
}
int ogg_close_cb(void * vdata) {
OggCallbackData * data = (OggCallbackData *)vdata;
return closeInputStream(data->inStream);
}
long ogg_tell_cb(void * vdata) {
OggCallbackData * data = (OggCallbackData *)vdata;
return (long)(data->inStream->offset);
}
char * ogg_parseComment(char * comment, char * needle) {
int len = strlen(needle);
if(strncasecmp(comment, needle, len) == 0 && *(comment+len) == '=') {
return comment+len+1;
}
return NULL;
}
float ogg_getReplayGainScale(char ** comments) {
int trackGainFound = 0;
int albumGainFound = 0;
float trackGain = 1.0;
float albumGain = 1.0;
float trackPeak = 0.0;
float albumPeak = 0.0;
char * temp;
int replayGainState = getReplayGainState();
if(replayGainState == REPLAYGAIN_OFF) return 1.0;
while(*comments) {
if((temp = ogg_parseComment(*comments,"replaygain_track_gain")))
{
trackGain = atof(temp);
trackGainFound = 1;
}
else if((temp = ogg_parseComment(*comments,
"replaygain_album_gain")))
{
albumGain = atof(temp);
albumGainFound = 1;
}
else if((temp = ogg_parseComment(*comments,
"replaygain_track_peak")))
{
trackPeak = atof(temp);
}
else if((temp = ogg_parseComment(*comments,
"replaygain_album_peak")))
{
albumPeak = atof(temp);
}
comments++;
}
switch(replayGainState) {
case REPLAYGAIN_ALBUM:
if(albumGainFound) {
return computeReplayGainScale(albumGain,albumPeak);
}
default:
return computeReplayGainScale(trackGain,trackPeak);
}
return 1.0;
}
MpdTag * oggCommentsParse(char ** comments) {
MpdTag * ret = NULL;
char * temp;
while(*comments) {
if((temp = ogg_parseComment(*comments,"artist"))) {
if(!ret) ret = newMpdTag();
if(!ret->artist) {
ret->artist = strdup(temp);
}
}
else if((temp = ogg_parseComment(*comments,"title"))) {
if(!ret) ret = newMpdTag();
if(!ret->title) {
ret->title = strdup(temp);
}
}
else if((temp = ogg_parseComment(*comments,"album"))) {
if(!ret) ret = newMpdTag();
if(!ret->album) {
ret->album = strdup(temp);
}
}
else if((temp = ogg_parseComment(*comments,"tracknumber"))) {
if(!ret) ret = newMpdTag();
if(!ret->track) {
ret->track = strdup(temp);
}
}
comments++;
}
return ret;
}
void putOggCommentsIntoDecoderControlMetadata(DecoderControl * dc,
char ** comments)
{
MpdTag * tag;
if(dc->metadataSet) return;
tag = oggCommentsParse(comments);
if(!tag) return;
copyMpdTagToDecoderControlMetadata(dc, tag);
freeMpdTag(tag);
}
int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
{
OggVorbis_File vf;
ov_callbacks callbacks;
OggCallbackData data;
int current_section;
int eof = 0;
long ret;
#define OGG_CHUNK_SIZE 4096
char chunk[OGG_CHUNK_SIZE];
int chunkpos = 0;
long bitRate = 0;
long test;
float replayGainScale;
char ** comments;
data.inStream = inStream;
data.dc = dc;
callbacks.read_func = ogg_read_cb;
callbacks.seek_func = ogg_seek_cb;
callbacks.close_func = ogg_close_cb;
callbacks.tell_func = ogg_tell_cb;
if(ov_open_callbacks(&data, &vf, NULL, 0, callbacks) < 0) {
closeInputStream(inStream);
if(!dc->stop) {
ERROR("Input does not appear to be an Ogg Vorbis stream.\n");
return -1;
}
else {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
return 0;
}
{
vorbis_info *vi=ov_info(&vf,-1);
dc->audioFormat.bits = 16;
dc->audioFormat.channels = vi->channels;
dc->audioFormat.sampleRate = vi->rate;
getOutputAudioFormat(&(dc->audioFormat),&(cb->audioFormat));
}
dc->totalTime = ov_time_total(&vf,-1);
if(dc->totalTime < 0) dc->totalTime = 0;
comments = ov_comment(&vf, -1)->user_comments;
putOggCommentsIntoDecoderControlMetadata(dc, comments);
dc->state = DECODE_STATE_DECODE;
replayGainScale = ogg_getReplayGainScale(comments);
while(!eof) {
if(dc->seek) {
if(0 == ov_time_seek_page(&vf,dc->seekWhere)) {
clearOutputBuffer(cb);
chunkpos = 0;
}
else dc->seekError = 1;
dc->seek = 0;
}
ret = ov_read(&vf, chunk+chunkpos,
OGG_CHUNK_SIZE-chunkpos,
OGG_DECODE_USE_BIGENDIAN,
2, 1, &current_section);
if(ret <= 0 && ret != OV_HOLE) {
eof = 1;
break;
}
if(ret == OV_HOLE) ret = 0;
chunkpos+=ret;
if(chunkpos >= OGG_CHUNK_SIZE) {
if((test = ov_bitrate_instant(&vf))>0) {
bitRate = test/1000;
}
doReplayGain(chunk,ret,&(dc->audioFormat),
replayGainScale);
sendDataToOutputBuffer(cb, inStream, dc,
inStream->seekable,
chunk, chunkpos,
ov_time_tell(&vf),
bitRate);
if(dc->stop) break;
chunkpos = 0;
}
}
if(!dc->stop && chunkpos > 0) {
sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable,
chunk, chunkpos,
ov_time_tell(&vf), bitRate);
}
ov_clear(&vf);
flushOutputBuffer(cb);
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
else dc->state = DECODE_STATE_STOP;
return 0;
}
MpdTag * oggTagDup(char * file) {
MpdTag * ret = NULL;
FILE * fp;
OggVorbis_File vf;
fp = fopen(file,"r");
if(!fp) return NULL;
if(ov_open(fp,&vf,NULL,0)<0) {
fclose(fp);
return NULL;
}
ret = oggCommentsParse(ov_comment(&vf,-1)->user_comments);
if(!ret) ret = newMpdTag();
ret->time = (int)(ov_time_total(&vf,-1)+0.5);
ov_clear(&vf);
return ret;
}
char * oggSuffixes[] = {"ogg", NULL};
char * oggMimeTypes[] = {"application/ogg", NULL};
InputPlugin oggPlugin =
{
"ogg",
NULL,
NULL,
ogg_decode,
NULL,
oggTagDup,
INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
oggSuffixes,
oggMimeTypes
};
#else
InputPlugin oggPlugin =
{
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL
};
#endif
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "inputStream.h"
#include "inputStream_file.h"
#include "inputStream_http.h"
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int openInputStream(InputStream * inStream, char * url) {
if(inputStream_fileOpen(inStream,url) == 0) return 0;
if(inputStream_httpOpen(inStream,url) == 0) return 0;
return -1;
}
int seekInputStream(InputStream * inStream, long offset, int whence) {
return inStream->seekFunc(inStream,offset,whence);
}
size_t readFromInputStream(InputStream * inStream, void * ptr, size_t size,
size_t nmemb)
{
return inStream->readFunc(inStream,ptr,size,nmemb);
}
int closeInputStream(InputStream * inStream) {
return inStream->closeFunc(inStream);
}
int inputStreamAtEOF(InputStream * inStream) {
return inStream->atEOFFunc(inStream);
}
int bufferInputStream(InputStream * inStream) {
return inStream->bufferFunc(inStream);
}
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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
*/
#ifndef INPUT_STREAM_H
#define INPUT_STREAM_H
#include <stdlib.h>
typedef struct _InputStream InputStream;
typedef int (* InputStreamSeekFunc) (InputStream * inStream, long offset,
int whence);
typedef size_t (* InputStreamReadFunc) (InputStream * inStream, void * ptr, size_t size,
size_t nmemb);
typedef int (* InputStreamCloseFunc) (InputStream * inStream);
typedef int (* InputStreamAtEOFFunc) (InputStream * inStream);
typedef int (* InputStreamBufferFunc) (InputStream * inStream);
struct _InputStream {
int error;
long offset;
size_t size;
char * mime;
int seekable;
/* don't touc this stuff */
InputStreamSeekFunc seekFunc;
InputStreamReadFunc readFunc;
InputStreamCloseFunc closeFunc;
InputStreamAtEOFFunc atEOFFunc;
InputStreamBufferFunc bufferFunc;
void * data;
char * metaTitle;
};
int isUrlSaneForInputStream(char * url);
/* if an error occurs for these 3 functions, then -1 is returned and errno
for the input stream is set */
int openInputStream(InputStream * inStream, char * url);
int seekInputStream(InputStream * inStream, long offset, int whence);
int closeInputStream(InputStream * inStream);
int inputStreamAtEOF(InputStream * inStream);
/* return value: -1 is error, 1 inidicates stuff was buffered, 0 means nothing
was buffered */
int bufferInputStream(InputStream * inStream);
size_t readFromInputStream(InputStream * inStream, void * ptr, size_t size,
size_t nmemb);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "inputStream_file.h"
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
int inputStream_fileOpen(InputStream * inStream, char * filename) {
FILE * fp;
fp = fopen(filename,"r");
if(!fp) {
inStream->error = errno;
return -1;
}
inStream->offset = 0;
inStream->seekable = 1;
inStream->mime = NULL;
inStream->metaTitle = NULL;
fseek(fp,0,SEEK_END);
inStream->size = ftell(fp);
fseek(fp,0,SEEK_SET);
inStream->data = fp;
inStream->seekFunc = inputStream_fileSeek;
inStream->closeFunc = inputStream_fileClose;
inStream->readFunc = inputStream_fileRead;
inStream->atEOFFunc = inputStream_fileAtEOF;
inStream->bufferFunc = inputStream_fileBuffer;
return 0;
}
int inputStream_fileSeek(InputStream * inStream, long offset, int whence) {
if(fseek((FILE *)inStream->data,offset,whence)==0) {
inStream->offset = ftell((FILE *)inStream->data);
}
else {
inStream->error = errno;
return -1;
}
return 0;
}
size_t inputStream_fileRead(InputStream * inStream, void * ptr, size_t size,
size_t nmemb)
{
size_t readSize;
readSize = fread(ptr,size,nmemb,(FILE *)inStream->data);
inStream->offset = ftell((FILE *)inStream->data);
return readSize;
}
int inputStream_fileClose(InputStream * inStream) {
if(fclose((FILE *)inStream->data)<0) {
inStream->error = errno;
}
else return -1;
return 0;
}
int inputStream_fileAtEOF(InputStream * inStream) {
return feof((FILE *)inStream->data);
}
int inputStream_fileBuffer(InputStream * inStream) {
return 0;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -16,20 +16,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MP3_DECODE_H
#define MP3_DECODE_H
#ifndef INPUT_STREAM_FILE_H
#define INPUT_STREAM_FILE_H
#include "../config.h"
#include "inputStream.h"
#ifdef HAVE_MAD
int inputStream_fileOpen(InputStream * inStream, char * filename);
#include "playerData.h"
int inputStream_fileSeek(InputStream * inStream, long offset, int whence);
/* this is primarily used in tag.c */
int getMp3TotalTime(char * file);
size_t inputStream_fileRead(InputStream * inStream, void * ptr, size_t size,
size_t nmemb);
int mp3_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);
int inputStream_fileClose(InputStream * inStream);
#endif
int inputStream_fileAtEOF(InputStream * inStream);
int inputStream_fileBuffer(InputStream * inStream);
#endif
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "inputStream_http.h"
#include "utils.h"
#include "log.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#define HTTP_CONN_STATE_CLOSED 0
#define HTTP_CONN_STATE_INIT 1
#define HTTP_CONN_STATE_HELLO 2
#define HTTP_CONN_STATE_OPEN 3
#define HTTP_CONN_STATE_REOPEN 4
#define HTTP_BUFFER_SIZE 131072
#define HTTP_PREBUFFER_SIZE (HTTP_BUFFER_SIZE >> 2)
//#define HTTP_PREBUFFER_SIZE 0
#define HTTP_REDIRECT_MAX 10
typedef struct _InputStreemHTTPData {
char * host;
char * path;
int port;
int sock;
int connState;
char buffer[HTTP_BUFFER_SIZE];
size_t buflen;
int timesRedirected;
int icyMetaint;
int prebuffer;
} InputStreamHTTPData;
static InputStreamHTTPData * newInputStreamHTTPData() {
InputStreamHTTPData * ret = malloc(sizeof(InputStreamHTTPData));
ret->host = NULL;
ret->path = NULL;
ret->port = 80;
ret->connState = HTTP_CONN_STATE_CLOSED;
ret->timesRedirected = 0;
ret->icyMetaint = 0;
ret->prebuffer = 0;
return ret;
}
static void freeInputStreamHTTPData(InputStreamHTTPData * data) {
if(data->host) free(data->host);
if(data->path) free(data->path);
free(data);
}
static int parseUrl(InputStreamHTTPData * data, char * url) {
char * temp;
char * colon;
char * slash;
int len;
if(strncmp("http://",url,strlen("http://"))!=0) return -1;
temp = url+strlen("http://");
slash = strchr(temp, '/');
colon = strchr(temp, ':');
if(slash && colon && slash <= colon) return -1;
/* fetch the host portion */
if(colon) len = colon-temp+1;
else if(slash) len = slash-temp+1;
else len = strlen(temp)+1;
if(len<=1) return -1;
data->host = malloc(len);
strncpy(data->host,temp,len-1);
data->host[len-1] = '\0';
/* fetch the port */
if(colon && (!slash || slash != colon+1)) {
char * test;
data->port = strtol(colon+1,&test,10);
if(data->port <= 0 || (*test != '\0' && *test != '/')) {
return -1;
}
}
/* fetch the path */
data->path = strdup(slash ? slash : "/");
return 0;
}
static int initHTTPConnection(InputStream * inStream) {
struct hostent * he;
struct sockaddr * dest;
socklen_t destlen;
struct sockaddr_in sin;
InputStreamHTTPData * data = (InputStreamHTTPData *)inStream->data;
int flags;
int ret;
#ifdef HAVE_IPV6
struct sockaddr_in6 sin6;
#endif
if(!(he = gethostbyname(data->host))) {
return -1;
}
memset(&sin,0,sizeof(struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_port = htons(data->port);
#ifdef HAVE_IPV6
memset(&sin6,0,sizeof(struct sockaddr_in6));
sin6.sin6_family = AF_INET6;
sin6.sin6_port = sin.sin_port;
#endif
switch(he->h_addrtype) {
case AF_INET:
memcpy((char *)&sin.sin_addr.s_addr,(char *)he->h_addr,
he->h_length);
dest = (struct sockaddr *)&sin;
destlen = sizeof(struct sockaddr_in);
break;
#ifdef HAVE_IPV6
case AF_INET6:
if(!ipv6Supported()) {
return -1;
}
memcpy((char *)&sin6.sin6_addr.s6_addr,(char *)he->h_addr,
he->h_length);
dest = (struct sockaddr *)&sin6;
destlen = sizeof(struct sockaddr_in6);
break;
#endif
default:
return -1;
}
if((data->sock = socket(dest->sa_family,SOCK_STREAM,0)) < 0) {
return -1;
}
flags = fcntl(data->sock, F_GETFL, 0);
fcntl(data->sock, F_SETFL, flags | O_NONBLOCK);
ret = connect(data->sock,dest,destlen);
if(ret < 0 && errno!=EINPROGRESS) {
close(data->sock);
return -1;
}
data->connState = HTTP_CONN_STATE_INIT;
data->buflen = 0;
return 0;
}
static int finishHTTPInit(InputStream * inStream) {
InputStreamHTTPData * data = (InputStreamHTTPData *)inStream->data;
struct timeval tv;
fd_set writeSet;
fd_set errorSet;
int error;
int error_len = sizeof(int);
int ret;
char request[2049];
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&writeSet);
FD_ZERO(&errorSet);
FD_SET(data->sock, &writeSet);
FD_SET(data->sock, &errorSet);
ret = select(data->sock+1, NULL, &writeSet, &errorSet, &tv);
if(ret == 0 || (ret < 0 && errno==EINTR)) return 0;
if(ret < 0) {
close(data->sock);
data->connState = HTTP_CONN_STATE_CLOSED;
return -1;
}
getsockopt(data->sock, SOL_SOCKET, SO_ERROR, &error, &error_len);
if(error) {
close(data->sock);
data->connState = HTTP_CONN_STATE_CLOSED;
return -1;
}
memset(request, 0, 2049);
/* deal with ICY metadata later, for now its fucking up stuff! */
snprintf(request, 2048, "GET %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Connection: close\r\n"
"User-Agent: %s/%s\r\n"
"Range: bytes=%ld-\r\n"
/*"Icy-Metadata:1\r\n"*/
"\r\n",
data->path, data->host, "httpTest", "0.0.0",
inStream->offset);
ret = write(data->sock, request, strlen(request));
if(ret!=strlen(request)) {
close(data->sock);
data->connState = HTTP_CONN_STATE_CLOSED;
return -1;
}
data->connState = HTTP_CONN_STATE_HELLO;
return 0;
}
static int getHTTPHello(InputStream * inStream) {
InputStreamHTTPData * data = (InputStreamHTTPData *)inStream->data;
fd_set readSet;
struct timeval tv;
int ret;
char * needle;
char * cur = data->buffer;
int rc;
long readed;
FD_ZERO(&readSet);
FD_SET(data->sock, &readSet);
tv.tv_sec = 0;
tv.tv_usec = 0;
ret = select(data->sock+1,&readSet,NULL,NULL,&tv);
if(ret == 0 || (ret < 0 && errno==EINTR)) return 0;
if(ret < 0) {
data->connState = HTTP_CONN_STATE_CLOSED;
close(data->sock);
data->buflen = 0;
return -1;
}
if(data->buflen >= HTTP_BUFFER_SIZE-1) {
data->connState = HTTP_CONN_STATE_CLOSED;
close(data->sock);
return -1;
}
readed = recv(data->sock, data->buffer+data->buflen,
HTTP_BUFFER_SIZE-1-data->buflen, 0);
if(readed < 0 && (errno == EAGAIN || errno == EINTR)) return 0;
if(readed <= 0) {
data->connState = HTTP_CONN_STATE_CLOSED;
close(data->sock);
data->buflen = 0;
return -1;
}
data->buffer[data->buflen+readed] = '\0';
data->buflen += readed;
needle = strstr(data->buffer,"\r\n\r\n");
if(!needle) return 0;
if(0 == strncmp(cur, "HTTP/1.0 ", 9)) {
inStream->seekable = 0;
rc = atoi(cur+9);
}
else if(0 == strncmp(cur, "HTTP/1.1 ", 9)) {
inStream->seekable = 1;
rc = atoi(cur+9);
}
else if(0 == strncmp(cur, "ICY 200 OK", 10)) {
inStream->seekable = 0;
rc = 200;
}
else if(0 == strncmp(cur, "ICY 400 Server Full", 19)) rc = 400;
else if(0 == strncmp(cur, "ICY 404", 7)) rc = 404;
else {
close(data->sock);
data->connState = HTTP_CONN_STATE_CLOSED;
return -1;
}
switch(rc) {
case 200:
case 206:
break;
case 301:
case 302:
cur = strstr(cur, "Location: ");
if(cur) {
char * url;
int curlen = 0;
cur+= strlen("Location: ");
while(*(cur+curlen)!='\0' && *(cur+curlen)!='\r') {
curlen++;
}
url = malloc(curlen+1);
memcpy(url,cur,curlen);
url[curlen] = '\0';
ret = parseUrl(data,url);
free(url);
if(ret == 0 && data->timesRedirected <
HTTP_REDIRECT_MAX)
{
data->timesRedirected++;
close(data->sock);
data->connState = HTTP_CONN_STATE_REOPEN;
data->buflen = 0;
return 0;
}
}
case 404:
case 400:
case 401:
default:
close(data->sock);
data->connState = HTTP_CONN_STATE_CLOSED;
data->buflen = 0;
return -1;
}
cur = strstr(data->buffer,"\r\n");
while(cur && cur!=needle) {
if(0 == strncmp(cur,"\r\nContent-Length: ",18)) {
if(!inStream->size) inStream->size = atol(cur+18);
}
else if(0 == strncmp(cur, "\r\nicy-metaint:", 14)) {
data->icyMetaint = atoi(cur+14);
}
else if(0 == strncmp(cur, "\r\nicy-name:", 11)) {
int incr = 11;
char * temp = strstr(cur+incr,"\r\n");
if(!temp) break;
*temp = '\0';
if(inStream->metaTitle) free(inStream->metaTitle);
while(*(incr+cur) == ' ') incr++;
inStream->metaTitle = strdup(cur+incr);
*temp = '\r';
}
else if(0 == strncmp(cur, "\r\nx-audiocast-name:", 19)) {
int incr = 19;
char * temp = strstr(cur+incr,"\r\n");
if(!temp) break;
*temp = '\0';
if(inStream->metaTitle) free(inStream->metaTitle);
while(*(incr+cur) == ' ') incr++;
inStream->metaTitle = strdup(cur+incr);
*temp = '\r';
}
else if(0 == strncmp(cur, "\r\nContent-Type:", 15)) {
int incr = 15;
char * temp = strstr(cur+incr,"\r\n");
if(!temp) break;
*temp = '\0';
if(inStream->mime) free(inStream->mime);
while(*(incr+cur) == ' ') incr++;
inStream->mime = strdup(cur+15);
*temp = '\r';
}
cur = strstr(cur+2,"\r\n");
}
if(inStream->size <= 0) inStream->seekable = 0;
needle += 4; /* 4 == strlen("\r\n\r\n") */
data->buflen -= (needle-data->buffer);
/*fwrite(data->buffer, 1, data->buflen, stdout);*/
memmove(data->buffer, needle, data->buflen);
data->connState = HTTP_CONN_STATE_OPEN;
data->prebuffer = 1;
/*mark as unseekable till we actually implement seeking*/
inStream->seekable = 0;
return 0;
}
int inputStream_httpOpen(InputStream * inStream, char * url) {
InputStreamHTTPData * data = newInputStreamHTTPData();
inStream->data = data;
if(parseUrl(data,url) < 0) {
freeInputStreamHTTPData(data);
return -1;
}
if(initHTTPConnection(inStream) < 0) {
freeInputStreamHTTPData(data);
return -1;
}
inStream->seekFunc = inputStream_httpSeek;
inStream->closeFunc = inputStream_httpClose;
inStream->readFunc = inputStream_httpRead;
inStream->atEOFFunc = inputStream_httpAtEOF;
inStream->bufferFunc = inputStream_httpBuffer;
inStream->offset = 0;
inStream->size = 0;
inStream->error = 0;
inStream->mime = NULL;
inStream->seekable = 0;
inStream->metaTitle = NULL;
return 0;
}
int inputStream_httpSeek(InputStream * inStream, long offset, int whence) {
return -1;
}
size_t inputStream_httpRead(InputStream * inStream, void * ptr, size_t size,
size_t nmemb)
{
InputStreamHTTPData * data = (InputStreamHTTPData *)inStream->data;
long tosend = 0;
long inlen = size*nmemb;
inputStream_httpBuffer(inStream);
switch(data->connState) {
case HTTP_CONN_STATE_OPEN:
case HTTP_CONN_STATE_CLOSED:
break;
default:
return 0;
}
if(data->prebuffer) return 0;
if(data->buflen > 0) {
tosend = inlen > data->buflen ? data->buflen : inlen;
tosend = (tosend/size)*size;
memcpy(ptr, data->buffer, tosend);
/*fwrite(ptr,1,readed,stdout);*/
data->buflen -= tosend;
/*fwrite(data->buffer,1,readed,stdout);*/
memmove(data->buffer, data->buffer+tosend, data->buflen);
inStream->offset += tosend;
}
return tosend/size;
}
int inputStream_httpClose(InputStream * inStream) {
InputStreamHTTPData * data = (InputStreamHTTPData *)inStream->data;
switch(data->connState) {
case HTTP_CONN_STATE_CLOSED:
break;
default:
close(data->sock);
}
if(inStream->mime) free(inStream->mime);
freeInputStreamHTTPData(data);
return 0;
}
int inputStream_httpAtEOF(InputStream * inStream) {
InputStreamHTTPData * data = (InputStreamHTTPData *)inStream->data;
switch(data->connState) {
case HTTP_CONN_STATE_CLOSED:
if(data->buflen == 0) return 1;
default:
return 0;
}
}
int inputStream_httpBuffer(InputStream * inStream) {
InputStreamHTTPData * data = (InputStreamHTTPData *)inStream->data;
ssize_t readed = 0;
if(data->connState == HTTP_CONN_STATE_REOPEN) {
if(initHTTPConnection(inStream) < 0) return -1;
}
if(data->connState == HTTP_CONN_STATE_INIT) {
if(finishHTTPInit(inStream) < 0) return -1;
}
if(data->connState == HTTP_CONN_STATE_HELLO) {
if(getHTTPHello(inStream) < 0) return -1;
}
switch(data->connState) {
case HTTP_CONN_STATE_OPEN:
case HTTP_CONN_STATE_CLOSED:
break;
default:
return -1;
}
if(data->buflen == 0) data->prebuffer = 1;
else if(data->buflen > HTTP_PREBUFFER_SIZE) data->prebuffer = 0;
if(data->connState == HTTP_CONN_STATE_OPEN &&
data->buflen < HTTP_BUFFER_SIZE-1)
{
readed = read(data->sock, data->buffer+data->buflen,
(size_t)(HTTP_BUFFER_SIZE-1-data->buflen));
if(readed < 0 && (errno == EAGAIN || errno == EINTR)) {
readed = 0;
}
else if(readed <= 0) {
close(data->sock);
data->connState = HTTP_CONN_STATE_CLOSED;
readed = 0;
}
/*fwrite(data->buffer+data->buflen,1,readed,stdout);*/
data->buflen += readed;
}
if(data->buflen > HTTP_PREBUFFER_SIZE) data->prebuffer = 0;
return (readed ? 1 : 0);
}
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
......@@ -16,17 +16,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OGG_DECODE_H
#define OGG_DECODE_H
#ifndef INPUT_STREAM_HTTP_H
#define INPUT_STREAM_HTTP_H
#include "../config.h"
#include "inputStream.h"
#include "playerData.h"
int inputStream_httpOpen(InputStream * inStream, char * filename);
#include <stdio.h>
int inputStream_httpSeek(InputStream * inStream, long offset, int whence);
int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);
size_t inputStream_httpRead(InputStream * inStream, void * ptr, size_t size,
size_t nmemb);
int getOggTotalTime(char * file);
int inputStream_httpClose(InputStream * inStream);
int inputStream_httpAtEOF(InputStream * inStream);
int inputStream_httpBuffer(InputStream * inStream);
#endif
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
......@@ -17,7 +17,6 @@
*/
#include "interface.h"
#include "buffer2array.h"
#include "command.h"
#include "conf.h"
#include "list.h"
......@@ -42,7 +41,7 @@
#include <errno.h>
#include <signal.h>
#define GREETING "MPD"
#define GREETING "OK MPD"
#define INTERFACE_MAX_BUFFER_LENGTH MAXPATHLEN+1024
#define INTERFACE_LIST_MODE_BEGIN "command_list_begin"
......@@ -85,14 +84,13 @@ void openInterface(Interface * interface, int fd) {
assert(interface->open==0);
blockSignals();
interface->bufferLength = 0;
interface->fd = fd;
/* fcntl(interface->fd,F_SETOWN,(int)getpid()); */
flags = fcntl(fd,F_GETFL);
while((flags = fcntl(fd,F_GETFL))<0 && errno==EINTR);
flags|=O_NONBLOCK;
fcntl(interface->fd,F_SETFL,flags);
interface->fp = fdopen(fd,"rw");
while(fcntl(interface->fd,F_SETFL,flags)<0 && errno==EINTR);
while((interface->fp = fdopen(fd,"rw"))==NULL && errno==EINTR);
interface->open = 1;
interface->lastTime = time(NULL);
interface->commandList = NULL;
......@@ -122,10 +120,7 @@ void openInterface(Interface * interface, int fd) {
#endif
interface->outBuffer = malloc(interface->outBufSize);
unblockSignals();
myfprintf(interface->fp,"%s %s %s\n",COMMAND_RESPOND_OK,GREETING,
VERSION);
myfprintf(interface->fp, "%s %s\n", GREETING, VERSION);
printInterfaceOutBuffer(interface);
}
......@@ -222,35 +217,26 @@ int interfaceReadInput(Interface * interface) {
closeInterface(interface);
}
else if(interface->buffer[interface->bufferLength-1]=='\n') {
char ** argArray;
int argArrayLength;
interface->buffer[interface->bufferLength-1] = '\0';
interface->bufferLength = 0;
argArrayLength = buffer2array(interface->buffer,&argArray);
if(interface->commandList) {
if(argArrayLength==0);
else if(strcmp(argArray[0],INTERFACE_LIST_MODE_END)==0) {
ListNode * node = interface->commandList->firstNode;
ret = 0;
while(node!=NULL) {
char ** argArray;
int argArrayLength;
argArrayLength = buffer2array((char *)node->data,&argArray);
DEBUG("interface %i: process command \"%s\"\n",interface->num,node->data);
ret = processCommand(interface->fp,&(interface->permission),argArrayLength,argArray);
DEBUG("interface %i: command returned %i\n",interface->num,ret);
freeArgArray(argArray,argArrayLength);
node = node->nextNode;
if(ret!=0 ||
interface->expired) {
node = NULL;
}
}
if(strcmp(interface->buffer,
INTERFACE_LIST_MODE_END)==0)
{
DEBUG("interface %i: process command "
"list\n",interface->num);
ret = proccessListOfCommands(
interface->fp,
&(interface->permission),
&(interface->expired),
interface->commandList);
DEBUG("interface %i: process command "
"list returned %i\n",
interface->num,
ret);
if(ret==0) {
myfprintf(interface->fp,"%s\n",COMMAND_RESPOND_OK);
commandSuccess(interface->fp);
}
else if(ret==COMMAND_RETURN_CLOSE ||
interface->expired) {
......@@ -262,21 +248,34 @@ int interfaceReadInput(Interface * interface) {
interface->commandList = NULL;
}
else {
interface->commandListSize+=sizeof(ListNode);
interface->commandListSize+=strlen(interface->buffer)+1;
if(interface->commandListSize>interface_max_command_list_size) {
ERROR("interface %i: command list size (%lli) is larger than the max (%lli)\n",interface->num,interface->commandListSize,interface_max_command_list_size);
interface->commandListSize+=
sizeof(ListNode);
interface->commandListSize+=
strlen(interface->buffer)+1;
if(interface->commandListSize >
interface_max_command_list_size)
{
ERROR("interface %i: command "
"list size (%lli) is "
"larger than the max "
"(%lli)\n",
interface->num,
interface->
commandListSize,
interface_max_command_list_size);
closeInterface(interface);
}
else {
insertInListWithoutKey(interface->commandList,strdup(interface->buffer));
insertInListWithoutKey(
interface->commandList,
strdup(interface->
buffer));
}
}
}
else {
if(argArrayLength &&
strcmp(argArray[0],
if(strcmp(interface->buffer,
INTERFACE_LIST_MODE_BEGIN)==0)
{
interface->commandList = makeList(free);
......@@ -285,21 +284,26 @@ int interfaceReadInput(Interface * interface) {
ret = 1;
}
else {
if(argArrayLength==0) ret = 0;
else if(strcmp(argArray[0],
if(strcmp(interface->buffer,
INTERFACE_LIST_MODE_END)
==0)
{
myfprintf(interface->fp,"%s not in command list mode\n",COMMAND_RESPOND_ERROR);
commandError(interface->fp,
ACK_ERROR_NOT_LIST,
"not in command list mode");
ret = -1;
}
else {
DEBUG("interface %i: process command \"%s\"\n",interface->num,interface->buffer);
ret = processCommand(interface->fp,&(interface->permission),argArrayLength,argArray);
ret = processCommand(
interface->fp,
&(interface->
permission),
interface->buffer);
DEBUG("interface %i: command returned %i\n",interface->num,ret);
}
if(ret==0) {
myfprintf(interface->fp,"%s\n",COMMAND_RESPOND_OK);
commandSuccess(interface->fp);
}
else if(ret==COMMAND_RETURN_CLOSE ||
interface->expired) {
......@@ -308,7 +312,6 @@ int interfaceReadInput(Interface * interface) {
printInterfaceOutBuffer(interface);
}
}
freeArgArray(argArray,argArrayLength);
}
return ret;
}
......@@ -418,25 +421,25 @@ void initInterfaces() {
interface_timeout = strtol((getConf())[CONF_CONNECTION_TIMEOUT],&test,10);
if(*test!='\0' || interface_timeout<=0) {
ERROR("connection timeout \"%s\" is not a positive integer\n",(getConf())[CONF_CONNECTION_TIMEOUT]);
exit(-1);
exit(EXIT_FAILURE);
}
interface_max_connections = strtol((getConf())[CONF_MAX_CONNECTIONS],&test,10);
if(*test!='\0' || interface_max_connections<=0) {
ERROR("max connections \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_CONNECTIONS]);
exit(-1);
exit(EXIT_FAILURE);
}
interface_max_command_list_size = strtoll((getConf())[CONF_MAX_COMMAND_LIST_SIZE],&test,10);
if(*test!='\0' || interface_max_command_list_size<=0) {
ERROR("max command list size \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_COMMAND_LIST_SIZE]);
exit(-1);
exit(EXIT_FAILURE);
}
interface_max_output_buffer_size = strtoll((getConf())[CONF_MAX_OUTPUT_BUFFER_SIZE],&test,10);
if(*test!='\0' || interface_max_output_buffer_size<=0) {
ERROR("max output buffer size \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_OUTPUT_BUFFER_SIZE]);
exit(-1);
exit(EXIT_FAILURE);
}
interface_max_command_list_size*=1024;
......@@ -645,3 +648,4 @@ void printInterfaceOutBuffer(Interface * interface) {
interface->outBuflen = 0;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -38,3 +38,4 @@ int interfacePrintWithFD(int fd, char * buffer);
int doIOForInterfaces();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -914,6 +914,20 @@ case $host in
rm -rf conftest*
;;
*-*-linux*)
# Test if the compiler is 64bit
echo 'int i;' > conftest.$ac_ext
lt_cv_cc_64bit_output=no
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
*"ELF 64"*)
lt_cv_cc_64bit_output=yes
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
......@@ -2191,6 +2205,30 @@ EOF
hardcode_shlibpath_var=no
;;
linux*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
*\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
if test $supports_anon_versioning = yes; then
archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
$archive_expsym_cmds="$archive_cmds"
fi
else
ld_shlibs=no
fi
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
......@@ -2724,8 +2762,8 @@ shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib"
case $host_os in
aix3*)
......@@ -2959,6 +2997,13 @@ linux-gnu*)
# before this can be enabled.
hardcode_into_libs=yes
case $host_cpu:$lt_cv_cc_64bit_output in
powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64"
sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64"
;;
esac
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
......@@ -2970,7 +3015,7 @@ linux-gnu*)
# Find out which ABI we are using (multilib Linux x86_64 hack).
libsuff=
case "$host_cpu" in
x86_64*|s390x*)
x86_64*)
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
......
/* C code produced by gperf version 2.7.2 */
/* C code produced by gperf version 3.0.1 */
/* Command-line: gperf -tCcTonD -K id -N id3_compat_lookup -s -3 -k '*' compat.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
#line 1 "compat.gperf"
/*
* libid3tag - ID3 tag manipulation library
* Copyright (C) 2000-2004 Underbit Technologies, Inc.
......@@ -50,9 +80,9 @@ static id3_compat_func_t translate_TCON;
#define TOTAL_KEYWORDS 73
#define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 4
#define MIN_HASH_VALUE 1
#define MAX_HASH_VALUE 84
/* maximum key range = 84, duplicates = 10 */
#define MIN_HASH_VALUE 6
#define MAX_HASH_VALUE 127
/* maximum key range = 122, duplicates = 0 */
#ifdef __GNUC__
__inline
......@@ -68,44 +98,46 @@ hash (str, len)
{
static const unsigned char asso_values[] =
{
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 22,
21, 27, 26, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 9, 3, 0, 27, 16,
6, 30, 85, 15, 85, 22, 2, 15, 4, 1,
0, 30, 13, 17, 22, 0, 24, 5, 31, 25,
15, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 64,
58, 20, 15, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 10, 18, 3, 6, 1,
47, 0, 128, 42, 62, 30, 31, 0, 19, 52,
10, 24, 8, 30, 5, 3, 30, 8, 25, 47,
3, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128
};
register int hval = 0;
switch (len)
{
default:
case 4:
hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]];
hval += asso_values[(unsigned char)str[1]+1];
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
......@@ -123,95 +155,166 @@ id3_compat_lookup (str, len)
{
static const struct id3_compat wordlist[] =
{
{"POP", EQ(POPM) /* Popularimeter */},
{"WCP", EQ(WCOP) /* Copyright/legal information */},
{"WPB", EQ(WPUB) /* Publishers official webpage */},
{"BUF", EQ(RBUF) /* Recommended buffer size */},
{"PIC", EQ(APIC) /* Attached picture */},
#line 97 "compat.gperf"
{"TLE", EQ(TLEN) /* Length */},
#line 68 "compat.gperf"
{"ETC", EQ(ETCO) /* Event timing codes */},
#line 126 "compat.gperf"
{"ULT", EQ(USLT) /* Unsynchronised lyric/text transcription */},
#line 123 "compat.gperf"
{"TYE", OBSOLETE /* Year [obsolete] */},
#line 92 "compat.gperf"
{"TFT", EQ(TFLT) /* File type */},
#line 84 "compat.gperf"
{"TCM", EQ(TCOM) /* Composer */},
#line 66 "compat.gperf"
{"EQU", OBSOLETE /* Equalization [obsolete] */},
#line 63 "compat.gperf"
{"COM", EQ(COMM) /* Comments */},
{"IPL", EQ(TIPL) /* Involved people list */},
{"MLL", EQ(MLLT) /* MPEG location lookup table */},
{"WAF", EQ(WOAF) /* Official audio file webpage */},
#line 130 "compat.gperf"
{"WCM", EQ(WCOM) /* Commercial information */},
{"UFI", EQ(UFID) /* Unique file identifier */},
{"CRA", EQ(AENC) /* Audio encryption */},
{"TCO", TX(TCON) /* Content type */},
{"ULT", EQ(USLT) /* Unsynchronised lyric/text transcription */},
{"TOL", EQ(TOLY) /* Original lyricist(s)/text writer(s) */},
{"TBP", EQ(TBPM) /* BPM (beats per minute) */},
{"TPB", EQ(TPUB) /* Publisher */},
{"CNT", EQ(PCNT) /* Play counter */},
{"TCON", TX(TCON) /* Content type */},
{"WAR", EQ(WOAR) /* Official artist/performer webpage */},
{"LNK", EQ(LINK) /* Linked information */},
{"CRM", OBSOLETE /* Encrypted meta frame [obsolete] */},
{"TOF", EQ(TOFN) /* Original filename */},
{"MCI", EQ(MCDI) /* Music CD identifier */},
{"TPA", EQ(TPOS) /* Part of a set */},
{"WAS", EQ(WOAS) /* Official audio source webpage */},
{"TOA", EQ(TOPE) /* Original artist(s)/performer(s) */},
{"TAL", EQ(TALB) /* Album/movie/show title */},
#line 96 "compat.gperf"
{"TLA", EQ(TLAN) /* Language(s) */},
{"IPLS", EQ(TIPL) /* Involved people list */},
#line 88 "compat.gperf"
{"TDA", OBSOLETE /* Date [obsolete] */},
#line 124 "compat.gperf"
{"TYER", OBSOLETE /* Year [obsolete] */},
#line 83 "compat.gperf"
{"TBP", EQ(TBPM) /* BPM (beats per minute) */},
#line 87 "compat.gperf"
{"TCR", EQ(TCOP) /* Copyright message */},
{"TRC", EQ(TSRC) /* ISRC (international standard recording code) */},
{"TOR", EQ(TDOR) /* Original release year [obsolete] */},
{"TCM", EQ(TCOM) /* Composer */},
{"ETC", EQ(ETCO) /* Event timing codes */},
{"STC", EQ(SYTC) /* Synchronised tempo codes */},
{"TLE", EQ(TLEN) /* Length */},
{"SLT", EQ(SYLT) /* Synchronised lyric/text */},
{"TEN", EQ(TENC) /* Encoded by */},
{"TP2", EQ(TPE2) /* Band/orchestra/accompaniment */},
{"TP1", EQ(TPE1) /* Lead performer(s)/soloist(s) */},
#line 104 "compat.gperf"
{"TOT", EQ(TOAL) /* Original album/movie/show title */},
{"EQU", OBSOLETE /* Equalization [obsolete] */},
#line 89 "compat.gperf"
{"TDAT", OBSOLETE /* Date [obsolete] */},
#line 67 "compat.gperf"
{"EQUA", OBSOLETE /* Equalization [obsolete] */},
#line 102 "compat.gperf"
{"TOR", EQ(TDOR) /* Original release year [obsolete] */},
#line 131 "compat.gperf"
{"WCP", EQ(WCOP) /* Copyright/legal information */},
#line 99 "compat.gperf"
{"TOA", EQ(TOPE) /* Original artist(s)/performer(s) */},
#line 78 "compat.gperf"
{"RVA", OBSOLETE /* Relative volume adjustment [obsolete] */},
{"GEO", EQ(GEOB) /* General encapsulated object */},
#line 120 "compat.gperf"
{"TT3", EQ(TIT3) /* Subtitle/description refinement */},
#line 98 "compat.gperf"
{"TMT", EQ(TMED) /* Media type */},
#line 76 "compat.gperf"
{"POP", EQ(POPM) /* Popularimeter */},
#line 74 "compat.gperf"
{"MLL", EQ(MLLT) /* MPEG location lookup table */},
#line 79 "compat.gperf"
{"RVAD", OBSOLETE /* Relative volume adjustment [obsolete] */},
#line 65 "compat.gperf"
{"CRM", OBSOLETE /* Encrypted meta frame [obsolete] */},
#line 128 "compat.gperf"
{"WAR", EQ(WOAR) /* Official artist/performer webpage */},
#line 80 "compat.gperf"
{"SLT", EQ(SYLT) /* Synchronised lyric/text */},
#line 81 "compat.gperf"
{"STC", EQ(SYTC) /* Synchronised tempo codes */},
#line 95 "compat.gperf"
{"TKE", EQ(TKEY) /* Initial key */},
#line 111 "compat.gperf"
{"TRC", EQ(TSRC) /* ISRC (international standard recording code) */},
#line 109 "compat.gperf"
{"TPA", EQ(TPOS) /* Part of a set */},
#line 117 "compat.gperf"
{"TSS", EQ(TSSE) /* Software/hardware and settings used for encoding */},
#line 112 "compat.gperf"
{"TRD", OBSOLETE /* Recording dates [obsolete] */},
#line 64 "compat.gperf"
{"CRA", EQ(AENC) /* Audio encryption */},
#line 108 "compat.gperf"
{"TP4", EQ(TPE4) /* Interpreted, remixed, or otherwise modified by */},
#line 125 "compat.gperf"
{"UFI", EQ(UFID) /* Unique file identifier */},
#line 101 "compat.gperf"
{"TOL", EQ(TOLY) /* Original lyricist(s)/text writer(s) */},
#line 110 "compat.gperf"
{"TPB", EQ(TPUB) /* Publisher */},
#line 73 "compat.gperf"
{"MCI", EQ(MCDI) /* Music CD identifier */},
#line 107 "compat.gperf"
{"TP3", EQ(TPE3) /* Conductor/performer refinement */},
{"TFT", EQ(TFLT) /* File type */},
{"TIM", OBSOLETE /* Time [obsolete] */},
{"REV", EQ(RVRB) /* Reverb */},
#line 132 "compat.gperf"
{"WPB", EQ(WPUB) /* Publishers official webpage */},
#line 113 "compat.gperf"
{"TRDA", OBSOLETE /* Recording dates [obsolete] */},
#line 115 "compat.gperf"
{"TSI", OBSOLETE /* Size [obsolete] */},
{"EQUA", OBSOLETE /* Equalization [obsolete] */},
{"TSS", EQ(TSSE) /* Software/hardware and settings used for encoding */},
#line 90 "compat.gperf"
{"TDY", EQ(TDLY) /* Playlist delay */},
#line 82 "compat.gperf"
{"TAL", EQ(TALB) /* Album/movie/show title */},
#line 116 "compat.gperf"
{"TSIZ", OBSOLETE /* Size [obsolete] */},
#line 129 "compat.gperf"
{"WAS", EQ(WOAS) /* Official audio source webpage */},
#line 121 "compat.gperf"
{"TXT", EQ(TEXT) /* Lyricist/text writer */},
#line 62 "compat.gperf"
{"CNT", EQ(PCNT) /* Play counter */},
#line 100 "compat.gperf"
{"TOF", EQ(TOFN) /* Original filename */},
#line 85 "compat.gperf"
{"TCO", TX(TCON) /* Content type */},
#line 114 "compat.gperf"
{"TRK", EQ(TRCK) /* Track number/position in set */},
{"TDA", OBSOLETE /* Date [obsolete] */},
{"TMT", EQ(TMED) /* Media type */},
{"TKE", EQ(TKEY) /* Initial key */},
{"TORY", EQ(TDOR) /* Original release year [obsolete] */},
{"TRD", OBSOLETE /* Recording dates [obsolete] */},
{"TYE", OBSOLETE /* Year [obsolete] */},
#line 119 "compat.gperf"
{"TT2", EQ(TIT2) /* Title/songname/content description */},
#line 93 "compat.gperf"
{"TIM", OBSOLETE /* Time [obsolete] */},
#line 94 "compat.gperf"
{"TIME", OBSOLETE /* Time [obsolete] */},
#line 103 "compat.gperf"
{"TORY", EQ(TDOR) /* Original release year [obsolete] */},
#line 91 "compat.gperf"
{"TEN", EQ(TENC) /* Encoded by */},
#line 118 "compat.gperf"
{"TT1", EQ(TIT1) /* Content group description */},
#line 127 "compat.gperf"
{"WAF", EQ(WOAF) /* Official audio file webpage */},
#line 75 "compat.gperf"
{"PIC", EQ(APIC) /* Attached picture */},
#line 122 "compat.gperf"
{"TXX", EQ(TXXX) /* User defined text information frame */},
#line 133 "compat.gperf"
{"WXX", EQ(WXXX) /* User defined URL link frame */},
{"TIME", OBSOLETE /* Time [obsolete] */},
{"TSIZ", OBSOLETE /* Size [obsolete] */},
{"TT3", EQ(TIT3) /* Subtitle/description refinement */},
{"TRDA", OBSOLETE /* Recording dates [obsolete] */},
{"RVAD", OBSOLETE /* Relative volume adjustment [obsolete] */},
{"TDY", EQ(TDLY) /* Playlist delay */},
{"TXT", EQ(TEXT) /* Lyricist/text writer */},
{"TYER", OBSOLETE /* Year [obsolete] */},
{"TDAT", OBSOLETE /* Date [obsolete] */},
{"TXX", EQ(TXXX) /* User defined text information frame */}
#line 86 "compat.gperf"
{"TCON", TX(TCON) /* Content type */},
#line 77 "compat.gperf"
{"REV", EQ(RVRB) /* Reverb */},
#line 106 "compat.gperf"
{"TP2", EQ(TPE2) /* Band/orchestra/accompaniment */},
#line 105 "compat.gperf"
{"TP1", EQ(TPE1) /* Lead performer(s)/soloist(s) */},
#line 61 "compat.gperf"
{"BUF", EQ(RBUF) /* Recommended buffer size */},
#line 70 "compat.gperf"
{"IPL", EQ(TIPL) /* Involved people list */},
#line 69 "compat.gperf"
{"GEO", EQ(GEOB) /* General encapsulated object */},
#line 72 "compat.gperf"
{"LNK", EQ(LINK) /* Linked information */},
#line 71 "compat.gperf"
{"IPLS", EQ(TIPL) /* Involved people list */}
};
static const short lookup[] =
{
-1, 0, -1, -53, -2, 1, -49, -2,
2, 3, -1, -46, -2, -43, -2, 4,
5, 6, -1, 7, -163, 10, 11, 12,
13, -161, 17, -159, -77, 22, 23, -80,
26, -85, 29, -87, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, -155, 44,
45, 46, 47, -1, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59,
-1, 60, 61, 62, 63, 64, -1, -151,
-1, 67, 68, 69, 70, -8, -2, -1,
71, -31, -2, -1, 72, -55, -2, -59,
-3, -65, -2
-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
-1, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, -1, -1, 50, -1, 51, 52, -1, 53, 54, 55, 56, -1,
57, 58, 59, 60, -1, 61, -1, 62, -1, -1, 63, -1, 64, -1,
-1, 65, -1, 66, -1, -1, -1, -1, -1, 67, -1, 68, -1, 69,
-1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 72
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
......@@ -229,25 +332,12 @@ id3_compat_lookup (str, len)
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[index];
}
else if (index < -TOTAL_KEYWORDS)
{
register int offset = - 1 - TOTAL_KEYWORDS - index;
register const struct id3_compat *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
register const struct id3_compat *wordendptr = wordptr + -lookup[offset + 1];
while (wordptr < wordendptr)
{
register const char *s = wordptr->id;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return wordptr;
wordptr++;
}
}
}
}
return 0;
}
#line 134 "compat.gperf"
static
int translate_TCON(struct id3_frame *frame, char const *oldid,
......
......@@ -72,6 +72,8 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
#! /bin/sh
# From configure.ac Id: configure.ac,v 1.12 2004/01/23 23:22:46 rob Exp .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for ID3 Tag 0.15.1b.
# Generated by GNU Autoconf 2.59 for ID3 Tag 0.15.1b.
#
# Report bugs to <support@underbit.com>.
#
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
......@@ -23,9 +22,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
......@@ -44,7 +44,7 @@ for as_var in \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
......@@ -221,16 +221,17 @@ rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
# IFS
......@@ -829,7 +830,7 @@ done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
localstatedir libdir includedir oldincludedir infodir mandir
localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
......@@ -869,10 +870,10 @@ if test -z "$srcdir"; then
# Try the directory containing this script, then its parent.
ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......@@ -964,9 +965,9 @@ _ACEOF
cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
......@@ -1074,12 +1075,45 @@ case $srcdir in
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
cd $ac_dir
# Check for guested configure; otherwise get Cygnus style configure.
......@@ -1090,7 +1124,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
echo
$SHELL $ac_srcdir/configure --help=recursive
elif test -f $ac_srcdir/configure.ac ||
test -f $ac_srcdir/configure.in; then
test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
......@@ -1104,10 +1138,9 @@ test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
ID3 Tag configure 0.15.1b
generated by GNU Autoconf 2.57
generated by GNU Autoconf 2.59
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
......@@ -1119,7 +1152,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ID3 Tag $as_me 0.15.1b, which was
generated by GNU Autoconf 2.57. Invocation command line was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
......@@ -1196,19 +1229,19 @@ do
2)
ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
# Get rid of the leading space.
......@@ -1242,12 +1275,12 @@ _ASBOX
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
;;
*)
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
}
......@@ -1276,7 +1309,7 @@ _ASBOX
for ac_var in $ac_subst_files
do
eval ac_val=$`echo $ac_var`
echo "$ac_var='"'"'$ac_val'"'"'"
echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
fi
......@@ -1295,7 +1328,7 @@ _ASBOX
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
rm -f core core.* *.core &&
rm -f core *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
......@@ -1375,7 +1408,7 @@ fi
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val="\$ac_cv_env_${ac_var}_value"
......@@ -1392,13 +1425,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
{ echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
{ echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
ac_cache_corrupted=:
ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
......@@ -1495,6 +1528,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
......@@ -1511,6 +1545,7 @@ do
case $as_dir/ in
./ | .// | /cC/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
......@@ -1518,20 +1553,20 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
elif test $ac_prog = install &&
grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# program-specific install script used by HP pwplus--don't use.
:
else
ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
break 3
fi
fi
done
done
;;
......@@ -1675,7 +1710,7 @@ done
echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
......@@ -2239,7 +2274,6 @@ ac_compiler=`set X $ac_compile; echo $2`
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -2259,8 +2293,8 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
echo "$as_me:$LINENO: checking for C compiler default output" >&5
echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
(eval $ac_link_default) 2>&5
......@@ -2280,23 +2314,23 @@ do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
;;
;;
conftest.$ac_ext )
# This is the source file.
;;
# This is the source file.
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
# FIXME: I believe we export ac_cv_exeext for Libtool,
# but it would be cool to find out if it's true. Does anybody
# maintain Libtool? --akim.
export ac_cv_exeext
break;;
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
# FIXME: I believe we export ac_cv_exeext for Libtool,
# but it would be cool to find out if it's true. Does anybody
# maintain Libtool? --akim.
export ac_cv_exeext
break;;
* )
break;;
break;;
esac
done
else
......@@ -2370,8 +2404,8 @@ for ac_file in conftest.exe conftest conftest.*; do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
export ac_cv_exeext
break;;
export ac_cv_exeext
break;;
* ) break;;
esac
done
......@@ -2396,7 +2430,6 @@ if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -2447,7 +2480,6 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -2467,11 +2499,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -2484,7 +2526,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
......@@ -2500,7 +2542,6 @@ if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -2517,11 +2558,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -2534,7 +2585,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cc_g=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
......@@ -2561,7 +2612,6 @@ else
ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -2589,6 +2639,16 @@ static char *f (char * (*g) (char **, int), char **p, ...)
va_end (v);
return s;
}
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
as 'x'. The following induces an error, until -std1 is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
that's true only with -std1. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
......@@ -2615,11 +2675,21 @@ do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -2632,7 +2702,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext
rm -f conftest.err conftest.$ac_objext
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
......@@ -2660,19 +2730,28 @@ cat >conftest.$ac_ext <<_ACEOF
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
''\
'#include <stdlib.h>' \
'' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
......@@ -2680,14 +2759,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
$ac_declaration
#include <stdlib.h>
int
main ()
{
......@@ -2698,11 +2776,21 @@ exit (42);
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -2715,9 +2803,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
continue
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -2734,11 +2821,21 @@ exit (42);
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -2750,7 +2847,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
......@@ -2764,7 +2861,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
......@@ -3672,7 +3769,6 @@ do
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -3683,7 +3779,7 @@ cat >>conftest.$ac_ext <<_ACEOF
#else
# include <assert.h>
#endif
Syntax error
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
......@@ -3695,6 +3791,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
......@@ -3715,7 +3812,6 @@ rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -3733,6 +3829,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
......@@ -3779,7 +3876,6 @@ do
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -3790,7 +3886,7 @@ cat >>conftest.$ac_ext <<_ACEOF
#else
# include <assert.h>
#endif
Syntax error
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
......@@ -3802,6 +3898,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
......@@ -3822,7 +3919,6 @@ rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -3840,6 +3936,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
......@@ -3900,7 +3997,6 @@ if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -3921,11 +4017,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -3938,12 +4044,11 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_stdc=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -3965,7 +4070,6 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -3990,7 +4094,6 @@ if test $ac_cv_header_stdc = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -4002,9 +4105,9 @@ cat >>conftest.$ac_ext <<_ACEOF
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
......@@ -4015,7 +4118,7 @@ main ()
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
|| toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
......@@ -4040,7 +4143,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
......@@ -4065,7 +4168,7 @@ fi
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
......@@ -4074,7 +4177,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -4086,11 +4188,21 @@ $ac_includes_default
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -4103,7 +4215,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
......@@ -4134,7 +4246,6 @@ else
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -4145,11 +4256,21 @@ $ac_includes_default
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -4162,7 +4283,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
......@@ -4170,7 +4291,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -4188,6 +4308,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
......@@ -4207,33 +4328,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes )
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
## ----------------------------------- ##
## Report this to support@underbit.com ##
## ----------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
......@@ -4244,7 +4364,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=$ac_header_preproc"
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
......@@ -4579,7 +4699,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 4582 "configure"' > conftest.$ac_ext
echo '#line 4702 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
......@@ -4600,6 +4720,24 @@ case $host in
rm -rf conftest*
;;
*-*-linux*)
# Test if the compiler is 64bit
echo 'int i;' > conftest.$ac_ext
lt_cv_cc_64bit_output=no
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
case `/usr/bin/file conftest.$ac_objext` in
*"ELF 64"*)
lt_cv_cc_64bit_output=yes
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
......@@ -4618,7 +4756,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -4635,11 +4772,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -4652,7 +4799,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
lt_cv_cc_needs_belf=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
......@@ -4947,7 +5095,6 @@ else
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -4964,11 +5111,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -4997,7 +5154,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
lt_cv_prog_cc_pic_works=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
fi
......@@ -5035,7 +5192,6 @@ else
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -5052,11 +5208,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -5068,7 +5234,8 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
fi
......@@ -5108,7 +5275,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
if { (eval echo configure:5111: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
if { (eval echo configure:5278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
......@@ -5149,7 +5316,6 @@ else
save_objext="$ac_objext"
ac_objext=lo
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -5166,11 +5332,21 @@ int some_variable = 0;
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -5189,7 +5365,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_objext="$save_objext"
CFLAGS="$save_CFLAGS"
......@@ -5234,7 +5410,6 @@ echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_
CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
compiler_rtti_exceptions=no
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -5251,11 +5426,21 @@ int some_variable = 0;
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -5274,7 +5459,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5
echo "${ECHO_T}$compiler_rtti_exceptions" >&6
......@@ -5505,6 +5690,30 @@ EOF
hardcode_shlibpath_var=no
;;
linux*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
*\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
if test $supports_anon_versioning = yes; then
archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
$archive_expsym_cmds="$archive_cmds"
fi
else
ld_shlibs=no
fi
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
......@@ -6045,8 +6254,8 @@ shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib"
case $host_os in
aix3*)
......@@ -6280,6 +6489,13 @@ linux-gnu*)
# before this can be enabled.
hardcode_into_libs=yes
case $host_cpu:$lt_cv_cc_64bit_output in
powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64"
sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64"
;;
esac
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
......@@ -6291,8 +6507,8 @@ linux-gnu*)
# Find out which ABI we are using (multilib Linux x86_64 hack).
libsuff=
case "$host_cpu" in
x86_64*|s390x*)
echo '#line 6295 "configure"' > conftest.$ac_ext
x86_64*)
echo '#line 6511 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
......@@ -6545,21 +6761,28 @@ if test "${ac_cv_func_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define shl_load innocuous_shl_load
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shl_load (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef shl_load
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
......@@ -6590,11 +6813,21 @@ return f != shl_load;
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -6607,7 +6840,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_shl_load=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
echo "${ECHO_T}$ac_cv_func_shl_load" >&6
......@@ -6622,7 +6856,6 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -6646,11 +6879,21 @@ shl_load ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -6663,7 +6906,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_dld_shl_load=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
......@@ -6677,21 +6921,28 @@ if test "${ac_cv_func_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define dlopen innocuous_dlopen
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlopen (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef dlopen
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
......@@ -6722,11 +6973,21 @@ return f != dlopen;
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -6739,7 +7000,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_dlopen=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
echo "${ECHO_T}$ac_cv_func_dlopen" >&6
......@@ -6754,7 +7016,6 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -6778,11 +7039,21 @@ dlopen ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -6795,7 +7066,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_dl_dlopen=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
......@@ -6811,7 +7083,6 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsvld $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -6835,11 +7106,21 @@ dlopen ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -6852,7 +7133,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_svld_dlopen=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
......@@ -6868,7 +7150,6 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -6892,11 +7173,21 @@ dld_link ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -6909,7 +7200,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_dld_dld_link=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
......@@ -6964,7 +7256,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 6967 "configure"
#line 7259 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -7062,7 +7354,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7065 "configure"
#line 7357 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -7850,7 +8142,6 @@ if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -7871,11 +8162,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -7888,12 +8189,11 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_header_stdc=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -7915,7 +8215,6 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -7940,7 +8239,6 @@ if test $ac_cv_header_stdc = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -7952,9 +8250,9 @@ cat >>conftest.$ac_ext <<_ACEOF
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
......@@ -7965,7 +8263,7 @@ main ()
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
|| toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
......@@ -7990,7 +8288,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
......@@ -8022,7 +8320,6 @@ else
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -8033,11 +8330,21 @@ $ac_includes_default
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -8050,7 +8357,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
......@@ -8058,7 +8365,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -8076,6 +8382,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
......@@ -8095,33 +8402,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes )
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
## ----------------------------------- ##
## Report this to support@underbit.com ##
## ----------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
......@@ -8132,7 +8438,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=$ac_header_preproc"
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
......@@ -8161,7 +8467,6 @@ else
echo "$as_me:$LINENO: checking zlib.h usability" >&5
echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -8172,11 +8477,21 @@ $ac_includes_default
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -8189,7 +8504,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
......@@ -8197,7 +8512,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking zlib.h presence" >&5
echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -8215,6 +8529,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
......@@ -8234,33 +8549,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
{ echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes )
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
## Report this to bug-autoconf@gnu.org. ##
## ------------------------------------ ##
## ----------------------------------- ##
## Report this to support@underbit.com ##
## ----------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
......@@ -8302,7 +8616,6 @@ if test "${ac_cv_c_const+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -8365,11 +8678,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -8382,7 +8705,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_const=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
echo "${ECHO_T}$ac_cv_c_const" >&6
......@@ -8402,7 +8725,6 @@ else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -8417,11 +8739,21 @@ $ac_kw foo_t foo () {return 0; }
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -8433,23 +8765,27 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
fi
echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
echo "${ECHO_T}$ac_cv_c_inline" >&6
case $ac_cv_c_inline in
inline | yes) ;;
no)
cat >>confdefs.h <<\_ACEOF
#define inline
_ACEOF
;;
*) cat >>confdefs.h <<_ACEOF
#define inline $ac_cv_c_inline
*)
case $ac_cv_c_inline in
no) ac_val=;;
*) ac_val=$ac_cv_c_inline;;
esac
cat >>confdefs.h <<_ACEOF
#ifndef __cplusplus
#define inline $ac_val
#endif
_ACEOF
;;
;;
esac
......@@ -8464,21 +8800,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
......@@ -8509,11 +8852,21 @@ return f != $ac_func;
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -8526,7 +8879,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
......@@ -8548,7 +8902,6 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lz $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
......@@ -8572,11 +8925,21 @@ compress2 ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
......@@ -8589,7 +8952,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_z_compress2=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress2" >&5
......@@ -8645,13 +9009,13 @@ _ACEOF
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} |
......@@ -8773,13 +9137,13 @@ _ACEOF
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n \
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} |
......@@ -8809,13 +9173,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
s/^\([^=]*=[ ]*\):*/\1/;
s/^\([^=]*=[ ]*\):*/\1/;
s/:*$//;
s/^[^=]*=[ ]*$//;
s/^[^=]*=[ ]*$//;
}'
fi
......@@ -8826,7 +9190,7 @@ ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_i=`echo "$ac_i" |
sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
# 2. Add them.
ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
......@@ -8884,9 +9248,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
......@@ -8905,7 +9270,7 @@ for as_var in \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
LC_TELEPHONE LC_TIME
do
if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
$as_unset $as_var
......@@ -9084,16 +9449,17 @@ rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
# IFS
......@@ -9120,7 +9486,7 @@ _ASBOX
cat >&5 <<_CSEOF
This file was extended by ID3 Tag $as_me 0.15.1b, which was
generated by GNU Autoconf 2.57. Invocation command line was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
......@@ -9164,9 +9530,9 @@ Usage: $0 [OPTIONS] [FILE]...
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
instantiate the configuration header FILE
Configuration files:
$config_files
......@@ -9183,11 +9549,10 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
ID3 Tag config.status 0.15.1b
configured by $0, generated by GNU Autoconf 2.57,
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir
......@@ -9462,9 +9827,9 @@ _ACEOF
(echo ':t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
if test -z "$ac_sed_cmds"; then
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
else
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
fi
ac_sed_frag=`expr $ac_sed_frag + 1`
ac_beg=$ac_end
......@@ -9482,21 +9847,21 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......@@ -9512,10 +9877,10 @@ echo X"$ac_file" |
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......@@ -9553,12 +9918,45 @@ case $srcdir in
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
case $INSTALL in
......@@ -9580,7 +9978,7 @@ echo "$as_me: creating $ac_file" >&6;}
configure_input="$ac_file. "
fi
configure_input=$configure_input"Generated from `echo $ac_file_in |
sed 's,.*/,,'` by configure."
sed 's,.*/,,'` by configure."
# First look for the input files in the build tree, otherwise in the
# src tree.
......@@ -9589,24 +9987,24 @@ echo "$as_me: creating $ac_file" >&6;}
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
echo "$f";;
*) # Relative
if test -f "$f"; then
# Build tree
echo $f
elif test -f "$srcdir/$f"; then
# Source tree
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
if test -f "$f"; then
# Build tree
echo "$f"
elif test -f "$srcdir/$f"; then
# Source tree
echo "$srcdir/$f"
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
fi;;
esac
done` || { (exit 1); exit 1; }
_ACEOF
......@@ -9648,12 +10046,12 @@ cat >>$CONFIG_STATUS <<\_ACEOF
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='[ ].*$,\1#\2'
ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='[ ].*$,\1#\2'
ac_dC=' '
ac_dD=',;t'
# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='$,\1#\2define\3'
ac_uC=' '
ac_uD=',;t'
......@@ -9662,11 +10060,11 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
cat >$tmp/stdin
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
......@@ -9680,28 +10078,29 @@ echo "$as_me: creating $ac_file" >&6;}
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
# Absolute (can't be DOS-style, as IFS=:)
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
# Do quote $f, to prevent DOS paths from being IFS'd.
echo "$f";;
*) # Relative
if test -f "$f"; then
# Build tree
echo $f
elif test -f "$srcdir/$f"; then
# Source tree
echo $srcdir/$f
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
if test -f "$f"; then
# Build tree
echo "$f"
elif test -f "$srcdir/$f"; then
# Source tree
echo "$srcdir/$f"
else
# /dev/null tree
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
fi;;
esac
done` || { (exit 1); exit 1; }
# Remove the trailing spaces.
sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
_ACEOF
......@@ -9724,9 +10123,9 @@ s/[\\&,]/\\&/g
s,[\\$`],\\&,g
t clear
: clear
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
t end
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
: end
_ACEOF
# If some macros were called several times there might be several times
......@@ -9740,13 +10139,13 @@ rm -f confdef2sed.sed
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >>conftest.undefs <<\_ACEOF
s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
_ACEOF
# Break up conftest.defines because some shells have a limit on the size
# of here documents, and old seds have small limits too (100 cmds).
echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
echo ' :' >>$CONFIG_STATUS
rm -f conftest.tail
......@@ -9755,7 +10154,7 @@ do
# Write a limited-size here document to $tmp/defines.sed.
echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
# Speed up: don't consider the non `#define' lines.
echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
# Work around the forget-to-reset-the-flag bug.
echo 't clr' >>$CONFIG_STATUS
echo ': clr' >>$CONFIG_STATUS
......@@ -9782,7 +10181,7 @@ do
# Write a limited-size here document to $tmp/undefs.sed.
echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
# Speed up: don't consider the non `#undef'
echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
# Work around the forget-to-reset-the-flag bug.
echo 't clr' >>$CONFIG_STATUS
echo ': clr' >>$CONFIG_STATUS
......@@ -9816,10 +10215,10 @@ echo "$as_me: $ac_file is unchanged" >&6;}
else
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......@@ -9835,10 +10234,10 @@ echo X"$ac_file" |
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......@@ -9876,16 +10275,41 @@ for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_dest" : 'X\(//\)[^/]' \| \
X"$ac_dest" : 'X\(//\)$' \| \
X"$ac_dest" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$ac_dest" : 'X\(//\)[^/]' \| \
X"$ac_dest" : 'X\(//\)$' \| \
X"$ac_dest" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$ac_dest" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
{ if $as_mkdir_p; then
mkdir -p "$ac_dir"
else
as_dir="$ac_dir"
as_dirs=
while test ! -d "$as_dir"; do
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
done
test ! -n "$as_dirs" || mkdir $as_dirs
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
ac_builddir=.
if test "$ac_dir" != .; then
......@@ -9911,12 +10335,45 @@ case $srcdir in
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
case "$ac_dir" in
.) ac_abs_builddir=`pwd`;;
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
*) ac_abs_builddir=`pwd`/"$ac_dir";;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
case ${ac_top_builddir}. in
.) ac_abs_top_builddir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
case $ac_srcdir in
.) ac_abs_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
case $ac_top_srcdir in
.) ac_abs_top_srcdir=$ac_abs_builddir;;
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
esac;;
esac
{ echo "$as_me:$LINENO: executing $ac_dest commands" >&5
......@@ -9934,10 +10391,10 @@ echo "$as_me: executing $ac_dest commands" >&6;}
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`(dirname "$mf") 2>/dev/null ||
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(//\)$' \| \
X"$mf" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(//\)$' \| \
X"$mf" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......@@ -9973,10 +10430,10 @@ echo X"$mf" |
test -f "$dirpart/$file" && continue
fdir=`(dirname "$file") 2>/dev/null ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......@@ -9992,10 +10449,10 @@ echo X"$file" |
as_dirs="$as_dir $as_dirs"
as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| \
. : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
......
/* C code produced by gperf version 2.7.2 */
/* C code produced by gperf version 3.0.1 */
/* Command-line: gperf -tCcTonD -K id -N id3_frametype_lookup -s -3 -k '*' frametype.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
#line 1 "frametype.gperf"
/*
* libid3tag - ID3 tag manipulation library
* Copyright (C) 2000-2004 Underbit Technologies, Inc.
......@@ -273,9 +303,9 @@ FRAMETYPE(obsolete, unknown, OBSOLETE, "Obsolete frame");
#define TOTAL_KEYWORDS 84
#define MIN_WORD_LENGTH 4
#define MAX_WORD_LENGTH 4
#define MIN_HASH_VALUE 0
#define MAX_HASH_VALUE 111
/* maximum key range = 112, duplicates = 12 */
#define MIN_HASH_VALUE 7
#define MAX_HASH_VALUE 155
/* maximum key range = 149, duplicates = 0 */
#ifdef __GNUC__
__inline
......@@ -291,49 +321,34 @@ hash (str, len)
{
static const unsigned char asso_values[] =
{
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 20,
18, 2, 25, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 19, 26, 1, 28, 15,
9, 31, 112, 0, 112, 29, 3, 0, 10, 0,
30, 0, 8, 5, 0, 29, 31, 24, 29, 24,
30, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
43, 4, 47, 49, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 31, 53, 3, 15, 3,
24, 25, 10, 52, 69, 34, 23, 30, 1, 5,
10, 62, 20, 0, 28, 28, 22, 19, 47, 3,
10, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156
};
register int hval = 0;
switch (len)
{
default:
case 4:
hval += asso_values[(unsigned char)str[3]];
case 3:
hval += asso_values[(unsigned char)str[2]];
case 2:
hval += asso_values[(unsigned char)str[1]];
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval;
return asso_values[(unsigned char)str[3]+1] + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]];
}
#ifdef __GNUC__
......@@ -346,108 +361,190 @@ id3_frametype_lookup (str, len)
{
static const struct id3_frametype wordlist[] =
{
{"TMOO", FRAME(text), PRESERVE, "Mood"},
#line 282 "frametype.gperf"
{"ENCR", FRAME(ENCR), PRESERVE, "Encryption method registration"},
#line 292 "frametype.gperf"
{"POPM", FRAME(POPM), PRESERVE, "Popularimeter"},
#line 351 "frametype.gperf"
{"WCOM", FRAME(url), PRESERVE, "Commercial information"},
#line 298 "frametype.gperf"
{"SEEK", FRAME(SEEK), DISCARD, "Seek frame"},
#line 349 "frametype.gperf"
{"USER", FRAME(USER), PRESERVE, "Terms of use"},
#line 285 "frametype.gperf"
{"GEOB", FRAME(GEOB), PRESERVE, "General encapsulated object"},
#line 304 "frametype.gperf"
{"TCOM", FRAME(text), PRESERVE, "Composer"},
{"COMM", FRAME(COMM), PRESERVE, "Comments"},
{"TIT3", FRAME(text), PRESERVE, "Subtitle/description refinement"},
{"TMCL", FRAME(text), PRESERVE, "Musician credits list"},
{"TSOT", FRAME(text), PRESERVE, "Title sort order"},
{"MLLT", FRAME(MLLT), DISCARD, "MPEG location lookup table"},
#line 281 "frametype.gperf"
{"COMR", FRAME(COMR), PRESERVE, "Commercial frame"},
{"TSST", FRAME(text), PRESERVE, "Set subtitle"},
#line 280 "frametype.gperf"
{"COMM", FRAME(COMM), PRESERVE, "Comments"},
#line 305 "frametype.gperf"
{"TCON", FRAME(text), PRESERVE, "Content type"},
{"TFLT", FRAME(text), PRESERVE, "File type"},
{"TRSO", FRAME(text), PRESERVE, "Internet radio station owner"},
{"TSRC", FRAME(text), PRESERVE, "ISRC (international standard recording code)"},
#line 291 "frametype.gperf"
{"PCNT", FRAME(PCNT), PRESERVE, "Play counter"},
#line 293 "frametype.gperf"
{"POSS", FRAME(POSS), DISCARD, "Position synchronisation frame"},
#line 284 "frametype.gperf"
{"ETCO", FRAME(ETCO), DISCARD, "Event timing codes"},
{"TIT2", FRAME(text), PRESERVE, "Title/songname/content description"},
{"TOFN", FRAME(text), PRESERVE, "Original filename"},
{"TIT1", FRAME(text), PRESERVE, "Content group description"},
{"TOAL", FRAME(text), PRESERVE, "Original album/movie/show title"},
{"TRSN", FRAME(text), PRESERVE, "Internet radio station name"},
{"TSOA", FRAME(text), PRESERVE, "Album sort order"},
{"TSSE", FRAME(text), PRESERVE, "Software/hardware and settings used for encoding"},
{"WCOM", FRAME(url), PRESERVE, "Commercial information"},
{"TENC", FRAME(text), DISCARD, "Encoded by"},
{"TOLY", FRAME(text), PRESERVE, "Original lyricist(s)/text writer(s)"},
{"TLEN", FRAME(text), DISCARD, "Length"},
{"MCDI", FRAME(MCDI), PRESERVE, "Music CD identifier"},
#line 332 "frametype.gperf"
{"TPE2", FRAME(text), PRESERVE, "Band/orchestra/accompaniment"},
#line 301 "frametype.gperf"
{"SYTC", FRAME(SYTC), DISCARD, "Synchronised tempo codes"},
{"TCOP", FRAME(text), PRESERVE, "Copyright message"},
#line 313 "frametype.gperf"
{"TENC", FRAME(text), DISCARD, "Encoded by"},
#line 309 "frametype.gperf"
{"TDOR", FRAME(text), PRESERVE, "Original release time"},
#line 290 "frametype.gperf"
{"OWNE", FRAME(OWNE), PRESERVE, "Ownership frame"},
#line 277 "frametype.gperf"
{"AENC", FRAME(AENC), DISCARD, "Audio encryption"},
#line 307 "frametype.gperf"
{"TDEN", FRAME(text), PRESERVE, "Encoding time"},
#line 345 "frametype.gperf"
{"TSSE", FRAME(text), PRESERVE, "Software/hardware and settings used for encoding"},
#line 339 "frametype.gperf"
{"TRSN", FRAME(text), PRESERVE, "Internet radio station name"},
#line 300 "frametype.gperf"
{"SYLT", FRAME(SYLT), DISCARD, "Synchronised lyric/text"},
{"TLAN", FRAME(text), PRESERVE, "Language(s)"},
{"TIPL", FRAME(text), PRESERVE, "Involved people list"},
{"ENCR", FRAME(ENCR), PRESERVE, "Encryption method registration"},
#line 354 "frametype.gperf"
{"WOAR", FRAME(url), PRESERVE, "Official artist/performer webpage"},
#line 346 "frametype.gperf"
{"TSST", FRAME(text), PRESERVE, "Set subtitle"},
#line 330 "frametype.gperf"
{"TOWN", FRAME(text), PRESERVE, "File owner/licensee"},
#line 340 "frametype.gperf"
{"TRSO", FRAME(text), PRESERVE, "Internet radio station owner"},
#line 322 "frametype.gperf"
{"TLEN", FRAME(text), DISCARD, "Length"},
#line 358 "frametype.gperf"
{"WPUB", FRAME(url), PRESERVE, "Publishers official webpage"},
#line 343 "frametype.gperf"
{"TSOT", FRAME(text), PRESERVE, "Title sort order"},
#line 327 "frametype.gperf"
{"TOFN", FRAME(text), PRESERVE, "Original filename"},
#line 344 "frametype.gperf"
{"TSRC", FRAME(text), PRESERVE, "ISRC (international standard recording code)"},
#line 324 "frametype.gperf"
{"TMED", FRAME(text), PRESERVE, "Media type"},
#line 297 "frametype.gperf"
{"RVRB", FRAME(RVRB), PRESERVE, "Reverb"},
#line 328 "frametype.gperf"
{"TOLY", FRAME(text), PRESERVE, "Original lyricist(s)/text writer(s)"},
#line 329 "frametype.gperf"
{"TOPE", FRAME(text), PRESERVE, "Original artist(s)/performer(s)"},
#line 336 "frametype.gperf"
{"TPRO", FRAME(text), PRESERVE, "Produced notice"},
#line 337 "frametype.gperf"
{"TPUB", FRAME(text), PRESERVE, "Publisher"},
#line 357 "frametype.gperf"
{"WPAY", FRAME(url), PRESERVE, "Payment"},
#line 335 "frametype.gperf"
{"TPOS", FRAME(text), PRESERVE, "Part of a set"},
{"TSOP", FRAME(text), PRESERVE, "Performer sort order"},
{"TDOR", FRAME(text), PRESERVE, "Original release time"},
{"TDRC", FRAME(text), PRESERVE, "Recording time"},
#line 356 "frametype.gperf"
{"WORS", FRAME(url), PRESERVE, "Official Internet radio station homepage"},
{"USLT", FRAME(USLT), PRESERVE, "Unsynchronised lyric/text transcription"},
#line 325 "frametype.gperf"
{"TMOO", FRAME(text), PRESERVE, "Mood"},
#line 338 "frametype.gperf"
{"TRCK", FRAME(text), PRESERVE, "Track number/position in set"},
{"TPRO", FRAME(text), PRESERVE, "Produced notice"},
{"TDRL", FRAME(text), PRESERVE, "Release time"},
{"POSS", FRAME(POSS), DISCARD, "Position synchronisation frame"},
{"PCNT", FRAME(PCNT), PRESERVE, "Play counter"},
{"LINK", FRAME(LINK), PRESERVE, "Linked information"},
{"TMED", FRAME(text), PRESERVE, "Media type"},
{"TEXT", FRAME(text), PRESERVE, "Lyricist/text writer"},
{"TOPE", FRAME(text), PRESERVE, "Original artist(s)/performer(s)"},
{"AENC", FRAME(AENC), DISCARD, "Audio encryption"},
#line 320 "frametype.gperf"
{"TKEY", FRAME(text), PRESERVE, "Initial key"},
#line 308 "frametype.gperf"
{"TDLY", FRAME(text), PRESERVE, "Playlist delay"},
#line 296 "frametype.gperf"
{"RVA2", FRAME(RVA2), DISCARD, "Relative volume adjustment (2)"},
#line 310 "frametype.gperf"
{"TDRC", FRAME(text), PRESERVE, "Recording time"},
#line 350 "frametype.gperf"
{"USLT", FRAME(USLT), PRESERVE, "Unsynchronised lyric/text transcription"},
#line 353 "frametype.gperf"
{"WOAF", FRAME(url), PRESERVE, "Official audio file webpage"},
#line 312 "frametype.gperf"
{"TDTG", FRAME(text), PRESERVE, "Tagging time"},
#line 299 "frametype.gperf"
{"SIGN", FRAME(SIGN), PRESERVE, "Signature frame"},
{"TPE3", FRAME(text), PRESERVE, "Conductor/performer refinement"},
#line 355 "frametype.gperf"
{"WOAS", FRAME(url), PRESERVE, "Official audio source webpage"},
#line 331 "frametype.gperf"
{"TPE1", FRAME(text), PRESERVE, "Lead performer(s)/soloist(s)"},
#line 302 "frametype.gperf"
{"TALB", FRAME(text), PRESERVE, "Album/movie/show title"},
{"OWNE", FRAME(OWNE), PRESERVE, "Ownership frame"},
{"APIC", FRAME(APIC), PRESERVE, "Attached picture"},
{"WOAR", FRAME(url), PRESERVE, "Official artist/performer webpage"},
{"WOAF", FRAME(url), PRESERVE, "Official audio file webpage"},
{"TDEN", FRAME(text), PRESERVE, "Encoding time"},
{"ASPI", FRAME(ASPI), DISCARD, "Audio seek point index"},
#line 341 "frametype.gperf"
{"TSOA", FRAME(text), PRESERVE, "Album sort order"},
#line 321 "frametype.gperf"
{"TLAN", FRAME(text), PRESERVE, "Language(s)"},
#line 333 "frametype.gperf"
{"TPE3", FRAME(text), PRESERVE, "Conductor/performer refinement"},
#line 352 "frametype.gperf"
{"WCOP", FRAME(url), PRESERVE, "Copyright/legal information"},
{"TDLY", FRAME(text), PRESERVE, "Playlist delay"},
#line 334 "frametype.gperf"
{"TPE4", FRAME(text), PRESERVE, "Interpreted, remixed, or otherwise modified by"},
#line 323 "frametype.gperf"
{"TMCL", FRAME(text), PRESERVE, "Musician credits list"},
#line 303 "frametype.gperf"
{"TBPM", FRAME(text), PRESERVE, "BPM (beats per minute)"},
{"USER", FRAME(USER), PRESERVE, "Terms of use"},
{"TDTG", FRAME(text), PRESERVE, "Tagging time"},
{"POPM", FRAME(POPM), PRESERVE, "Popularimeter"},
#line 311 "frametype.gperf"
{"TDRL", FRAME(text), PRESERVE, "Release time"},
#line 326 "frametype.gperf"
{"TOAL", FRAME(text), PRESERVE, "Original album/movie/show title"},
#line 342 "frametype.gperf"
{"TSOP", FRAME(text), PRESERVE, "Performer sort order"},
#line 363 "frametype.gperf"
{"ZOBS", FRAME(ZOBS), OBSOLETE, "Obsolete frame"},
#line 283 "frametype.gperf"
{"EQU2", FRAME(EQU2), DISCARD, "Equalisation (2)"},
{"TPE2", FRAME(text), PRESERVE, "Band/orchestra/accompaniment"},
{"SEEK", FRAME(SEEK), DISCARD, "Seek frame"},
{"TPE1", FRAME(text), PRESERVE, "Lead performer(s)/soloist(s)"},
{"UFID", FRAME(UFID), PRESERVE, "Unique file identifier"},
#line 306 "frametype.gperf"
{"TCOP", FRAME(text), PRESERVE, "Copyright message"},
#line 287 "frametype.gperf"
{"LINK", FRAME(LINK), PRESERVE, "Linked information"},
#line 286 "frametype.gperf"
{"GRID", FRAME(GRID), PRESERVE, "Group identification registration"},
{"TKEY", FRAME(text), PRESERVE, "Initial key"},
#line 294 "frametype.gperf"
{"PRIV", FRAME(PRIV), PRESERVE, "Private frame"},
{"TPE4", FRAME(text), PRESERVE, "Interpreted, remixed, or otherwise modified by"},
{"GEOB", FRAME(GEOB), PRESERVE, "General encapsulated object"},
{"RBUF", FRAME(RBUF), PRESERVE, "Recommended buffer size"},
{"RVRB", FRAME(RVRB), PRESERVE, "Reverb"},
{"RVA2", FRAME(RVA2), DISCARD, "Relative volume adjustment (2)"},
{"TPUB", FRAME(text), PRESERVE, "Publisher"},
#line 315 "frametype.gperf"
{"TFLT", FRAME(text), PRESERVE, "File type"},
#line 289 "frametype.gperf"
{"MLLT", FRAME(MLLT), DISCARD, "MPEG location lookup table"},
#line 314 "frametype.gperf"
{"TEXT", FRAME(text), PRESERVE, "Lyricist/text writer"},
#line 348 "frametype.gperf"
{"UFID", FRAME(UFID), PRESERVE, "Unique file identifier"},
#line 278 "frametype.gperf"
{"APIC", FRAME(APIC), PRESERVE, "Attached picture"},
#line 279 "frametype.gperf"
{"ASPI", FRAME(ASPI), DISCARD, "Audio seek point index"},
#line 318 "frametype.gperf"
{"TIT2", FRAME(text), PRESERVE, "Title/songname/content description"},
#line 359 "frametype.gperf"
{"WXXX", FRAME(WXXX), PRESERVE, "User defined URL link frame"},
#line 288 "frametype.gperf"
{"MCDI", FRAME(MCDI), PRESERVE, "Music CD identifier"},
#line 316 "frametype.gperf"
{"TIPL", FRAME(text), PRESERVE, "Involved people list"},
#line 347 "frametype.gperf"
{"TXXX", FRAME(TXXX), PRESERVE, "User defined text information frame"},
{"WPAY", FRAME(url), PRESERVE, "Payment"},
{"WPUB", FRAME(url), PRESERVE, "Publishers official webpage"},
{"WXXX", FRAME(WXXX), PRESERVE, "User defined URL link frame"}
#line 295 "frametype.gperf"
{"RBUF", FRAME(RBUF), PRESERVE, "Recommended buffer size"},
#line 317 "frametype.gperf"
{"TIT1", FRAME(text), PRESERVE, "Content group description"},
#line 319 "frametype.gperf"
{"TIT3", FRAME(text), PRESERVE, "Subtitle/description refinement"}
};
static const short lookup[] =
{
0, -92, 3, -1, 4, 5, 6, -83,
-2, 7, 8, 9, 10, 11, 12, -1,
13, -1, 14, 15, 16, -1, 17, 18,
19, -183, 22, 23, 24, 25, 26, 27,
-179, 30, -177, -175, 35, -173, -168, 41,
42, 43, 44, 45, 46, -166, 49, 50,
-164, 53, 54, 55, 56, 57, 58, -162,
61, 62, -1, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, -1,
-159, 77, -9, -2, 78, -25, -2, -33,
-2, -37, -2, -45, -2, 79, -1, 80,
-48, -3, -51, -2, -53, -2, -56, -2,
-1, 81, -64, -2, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 82, -1, 83
-1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1,
2, 3, -1, 4, -1, -1, -1, -1, 5, 6, 7, 8, -1, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, -1, 70, 71, -1, 72, 73, 74, -1, 75, -1,
76, -1, -1, -1, 77, 78, -1, -1, 79, -1, -1, -1, -1, 80,
81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1,
-1, 83
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
......@@ -465,21 +562,6 @@ id3_frametype_lookup (str, len)
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[index];
}
else if (index < -TOTAL_KEYWORDS)
{
register int offset = - 1 - TOTAL_KEYWORDS - index;
register const struct id3_frametype *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
register const struct id3_frametype *wordendptr = wordptr + -lookup[offset + 1];
while (wordptr < wordendptr)
{
register const char *s = wordptr->id;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return wordptr;
wordptr++;
}
}
}
}
return 0;
......
......@@ -946,6 +946,20 @@ case $host in
rm -rf conftest*
;;
*-*-linux*)
# Test if the compiler is 64bit
echo 'int i;' > conftest.$ac_ext
lt_cv_cc_64bit_output=no
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
*"ELF 64"*)
lt_cv_cc_64bit_output=yes
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
......@@ -2223,6 +2237,30 @@ EOF
hardcode_shlibpath_var=no
;;
linux*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
*\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
if test $supports_anon_versioning = yes; then
archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
$archive_expsym_cmds="$archive_cmds"
fi
else
ld_shlibs=no
fi
;;
*)
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
......@@ -2756,8 +2794,8 @@ shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib"
case $host_os in
aix3*)
......@@ -2991,6 +3029,13 @@ linux-gnu*)
# before this can be enabled.
hardcode_into_libs=yes
case $host_cpu:$lt_cv_cc_64bit_output in
powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64"
sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64"
;;
esac
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
......@@ -3002,7 +3047,7 @@ linux-gnu*)
# Find out which ABI we are using (multilib Linux x86_64 hack).
libsuff=
case "$host_cpu" in
x86_64*|s390x*)
x86_64*)
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
......
......@@ -125,9 +125,11 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -24,12 +24,12 @@
extern "C" {
# endif
# define FPM_INTEL
# define FPM_DEFAULT
# define SIZEOF_INT 4
# define SIZEOF_LONG 4
# define SIZEOF_LONG 8
# define SIZEOF_LONG_LONG 8
......
......@@ -56,6 +56,54 @@ List * makeList(ListFreeDataFunc * freeDataFunc) {
return list;
}
int insertInListBeforeNode(List * list, ListNode * beforeNode, char * key,
void * data)
{
ListNode * node;
assert(list!=NULL);
assert(key!=NULL);
/*assert(data!=NULL);*/
node = malloc(sizeof(ListNode));
assert(node!=NULL);
if(list->nodesArray) freeListNodesArray(list);
if(beforeNode==NULL) beforeNode = list->firstNode;
node->nextNode = beforeNode;
if(beforeNode==list->firstNode) {
if(list->firstNode==NULL) {
assert(list->lastNode==NULL);
list->lastNode = node;
}
else {
assert(list->lastNode!=NULL);
assert(list->lastNode->nextNode==NULL);
list->firstNode->prevNode = node;
}
node->prevNode = NULL;
list->firstNode = node;
}
else {
node->prevNode = beforeNode->prevNode;
if(node->prevNode) {
node->prevNode->nextNode = node;
}
beforeNode->prevNode = node;
}
node->key = malloc((strlen(key)+1)*sizeof(char));
assert(node->key!=NULL);
strcpy(node->key,key);
node->data = data;
list->numberOfNodes++;
return 1;
}
int insertInList(List * list,char * key,void * data) {
ListNode * node;
......@@ -434,3 +482,4 @@ void sortList(List * list) {
quickSort(list->nodesArray,0,list->numberOfNodes-1);
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -69,6 +69,9 @@ List * makeList(ListFreeDataFunc * freeDataFunc);
*/
int insertInList(List * list,char * key,void * data);
int insertInListBeforeNode(List * list, ListNode * beforeNode, char * key,
void * data);
int insertInListWithoutKey(List * list,void * data);
/* deletes the first node in the list with the key _key_
......@@ -99,3 +102,4 @@ void clearList(List * list);
void sortList(List * list);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -20,6 +20,7 @@
#include "interface.h"
#include "conf.h"
#include "log.h"
#include "utils.h"
#include <unistd.h>
#include <stdio.h>
......@@ -42,16 +43,6 @@
int listenSocket;
#ifdef HAVE_IPV6
int ipv6Supported() {
int s;
s = socket(AF_INET6,SOCK_STREAM,0);
if(s == -1) return 0;
close(s);
return 1;
}
#endif
int establish(unsigned short port) {
int allowReuse = ALLOW_REUSE;
int sock;
......@@ -90,7 +81,7 @@ int establish(unsigned short port) {
if(!(he = gethostbyname((getConf())[CONF_BIND_TO_ADDRESS]))) {
ERROR("can't lookup host \"%s\"\n",
(getConf())[CONF_BIND_TO_ADDRESS]);
exit(-1);
exit(EXIT_FAILURE);
}
switch(he->h_addrtype) {
#ifdef HAVE_IPV6
......@@ -99,7 +90,7 @@ int establish(unsigned short port) {
ERROR("no IPv6 support, but a IPv6 address "
"found for \"%s\"\n",
(getConf())[CONF_BIND_TO_ADDRESS]);
exit(-1);
exit(EXIT_FAILURE);
}
bcopy((char *)he->h_addr,(char *)
&sin6.sin6_addr.s6_addr,he->h_length);
......@@ -116,7 +107,7 @@ int establish(unsigned short port) {
default:
ERROR("address type for \"%s\" is not IPv4 or IPv6\n",
(getConf())[CONF_BIND_TO_ADDRESS]);
exit(-1);
exit(EXIT_FAILURE);
}
}
......@@ -184,3 +175,4 @@ void getConnections(int sock) {
}
else if(fd<0) ERROR("Problems accept()'ing\n");
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -28,3 +28,4 @@ int establish(unsigned short port);
void getConnections(int sock);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -37,3 +37,4 @@ void initLog() {
}
else ERROR("unknown log level \"%s\"\n",getConf()[CONF_LOG_LEVEL]);
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -29,17 +29,18 @@
extern int logLevel;
#define ERROR(x, arg...) myfprintf(stderr, x , ##arg)
#define ERROR(...) myfprintf(stderr, __VA_ARGS__)
#define LOG(x, arg...) myfprintf(stdout, x , ##arg)
#define LOG(...) myfprintf(stdout, __VA_ARGS__)
#define SECURE(x, arg...) if(logLevel>=LOG_LEVEL_SECURE) \
myfprintf(stdout, x , ##arg)
#define SECURE(...) if(logLevel>=LOG_LEVEL_SECURE) \
myfprintf(stdout, __VA_ARGS__)
#define DEBUG(x, arg...) if(logLevel>=LOG_LEVEL_DEBUG) \
myfprintf(stdout, x , ##arg)
#define DEBUG(...) if(logLevel>=LOG_LEVEL_DEBUG) \
myfprintf(stdout, __VA_ARGS__)
void initLog();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -17,11 +17,11 @@
*/
#include "ls.h"
#include "command.h"
#include "playlist.h"
#include "path.h"
#include "myfprintf.h"
#include "log.h"
#include "utf8.h"
#include <sys/types.h>
#include <sys/stat.h>
......@@ -41,11 +41,87 @@ char * dupAndStripPlaylistSuffix(char * file) {
return ret;
}
static char * remoteUrlPrefixes[] =
{
"http://",
NULL
};
int printRemoteUrlHandlers(FILE * fp) {
char ** prefixes = remoteUrlPrefixes;
while (*prefixes) {
myfprintf(fp,"handler: %s\n", *prefixes);
prefixes++;
}
return 0;
}
int isValidRemoteUtf8Url(char * utf8url) {
int ret = 0;
char * temp;
switch(isRemoteUrl(utf8url)) {
case 1:
ret = 1;
temp = utf8url;
while(*temp) {
if((*temp >= 'a' && *temp <= 'z') ||
(*temp >= 'A' && *temp <= 'z') ||
(*temp >= '0' && *temp <= '9') ||
*temp == '$' ||
*temp == '-' ||
*temp == '.' ||
*temp == '+' ||
*temp == '!' ||
*temp == '*' ||
*temp == '\'' ||
*temp == '(' ||
*temp == ')' ||
*temp == ',' ||
*temp == '%' ||
*temp == '/' ||
*temp == ':' ||
*temp == '?' ||
*temp == ';' ||
*temp == '&' ||
*temp == '=')
{
}
else {
ret = 1;
break;
}
temp++;
}
break;
}
return ret;
}
int isRemoteUrl(char * url) {
int count = 0;
char ** urlPrefixes = remoteUrlPrefixes;
while(*urlPrefixes) {
count++;
if(strncmp(*urlPrefixes,url,strlen(*urlPrefixes)) == 0) {
return count;
}
urlPrefixes++;
}
return 0;
}
int lsPlaylists(FILE * fp, char * utf8path) {
DIR * dir;
struct stat st;
struct dirent * ent;
char * dup;
char * utf8;
char s[MAXPATHLEN+1];
List * list = NULL;
ListNode * node = NULL;
......@@ -62,6 +138,7 @@ int lsPlaylists(FILE * fp, char * utf8path) {
}
s[MAXPATHLEN] = '\0';
/* this is safe, notice actlen > MAXPATHLEN-1 above */
strcpy(s,actualPath);
strcat(s,"/");
......@@ -78,8 +155,9 @@ int lsPlaylists(FILE * fp, char * utf8path) {
if(list==NULL) list = makeList(NULL);
dup = strdup(ent->d_name);
dup[suff] = '\0';
insertInList(list,
fsCharsetToUtf8(dup),NULL);
if((utf8 = fsCharsetToUtf8(dup))) {
insertInList(list,utf8,NULL);
}
free(dup);
}
}
......@@ -99,7 +177,9 @@ int lsPlaylists(FILE * fp, char * utf8path) {
node = list->firstNode;
while(node!=NULL) {
myfprintf(fp,"playlist: %s%s\n",dup,node->key);
if(!strchr(node->key, '\n')) {
myfprintf(fp,"playlist: %s%s\n",dup,node->key);
}
node = node->nextNode;
}
......@@ -128,22 +208,24 @@ int isFile(char * utf8file, time_t * mtime) {
return 0;
}
int hasSuffix(char * utf8file, char * suffix) {
char * file = utf8ToFsCharset(utf8file);
char * dup = strdup(file);
char * cLast;
char * cNext;
int ret = 0;
cNext = cLast = strtok(dup,".");
while((cNext = strtok(NULL,"."))) cLast = cNext;
if(cLast && 0==strcasecmp(cLast,suffix)) ret = 1;
free(dup);
/* suffixes should be ascii only characters */
char * getSuffix(char * utf8file) {
char * ret = NULL;
while(*utf8file) {
if(*utf8file == '.') ret = utf8file+1;
utf8file++;
}
return ret;
}
int hasSuffix(char * utf8file, char * suffix) {
char * s = getSuffix(utf8file);
if(s && 0==strcmp(s,suffix)) return 1;
return 0;
}
int isPlaylist(char * utf8file) {
if(isFile(utf8file,NULL)) {
return hasSuffix(utf8file,PLAYLIST_FILE_SUFFIX);
......@@ -177,12 +259,11 @@ int hasMp3Suffix(char * utf8file) {
return hasSuffix(utf8file,"mp3");
}
int isDir(char * utf8name, time_t * mtime) {
int isDir(char * utf8name) {
struct stat st;
if(stat(rmp2amp(utf8ToFsCharset(utf8name)),&st)==0) {
if(S_ISDIR(st.st_mode)) {
if(mtime) *mtime = st.st_mtime;
return 1;
}
}
......@@ -194,26 +275,15 @@ int isDir(char * utf8name, time_t * mtime) {
return 0;
}
int isMusic(char * utf8file, time_t * mtime) {
InputPlugin * isMusic(char * utf8file, time_t * mtime) {
InputPlugin * ret = NULL;
if(isFile(utf8file,mtime)) {
#ifdef HAVE_OGG
if(hasOggSuffix(utf8file)) return 1;
#endif
#ifdef HAVE_FLAC
if(hasFlacSuffix(utf8file)) return 1;
#endif
#ifdef HAVE_MAD
if(hasMp3Suffix(utf8file)) return 1;
#endif
#ifdef HAVE_AUDIOFILE
if(hasWaveSuffix(utf8file)) return 1;
#endif
#ifdef HAVE_FAAD
if(hasMp4Suffix(utf8file)) return 1;
if(hasAacSuffix(utf8file)) return 1;
#endif
char * s = getSuffix(utf8file);
if(s) ret = getInputPluginFromSuffix(s);
}
return 0;
return ret;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -21,31 +21,30 @@
#include "../config.h"
#include "inputPlugin.h"
#include <stdio.h>
#include <time.h>
int lsPlaylists(FILE * fp, char * utf8path);
int isFile(char * utf8file, time_t * mtime);
int isDir(char * utf8name, time_t * mtime);
int isPlaylist(char * utf8file);
char * getSuffix(char * utf8file);
int isMusic(char * utf8file, time_t * mtime);
int isValidRemoteUtf8Url(char * utf8url);
int hasWaveSuffix(char * utf8file);
int isRemoteUrl(char * url);
int hasMp3Suffix(char * utf8file);
int hasAacSuffix(char * utf8file);
int isFile(char * utf8file, time_t * mtime);
int hasMp4Suffix(char * utf8file);
int isDir(char * utf8name);
int hasOggSuffix(char * utf8file);
int isPlaylist(char * utf8file);
int hasFlacSuffix(char * utf8file);
InputPlugin * isMusic(char * utf8file, time_t * mtime);
char * dupAndStripPlaylistSuffix(char * file);
int printRemoteUrlHandlers(FILE * fp);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -32,6 +32,9 @@
#include "volume.h"
#include "log.h"
#include "permission.h"
#include "replayGain.h"
#include "inputPlugin.h"
#include "../config.h"
#include <stdio.h>
#include <sys/select.h>
......@@ -57,7 +60,9 @@ typedef struct _Options {
char * usr;
char * dbFile;
int daemon;
int stdOutput;
int createDB;
int updateDB;
} Options;
void usage(char * argv[]) {
......@@ -71,18 +76,25 @@ void usage(char * argv[]) {
ERROR("options:\n");
ERROR(" --help this usage statement\n");
ERROR(" --no-daemon don't detach from console\n");
ERROR(" --create-db force (re)creation database\n");
ERROR(" --stdout print msgs to stdout and stderr\n");
ERROR(" --create-db force (re)creation database and exit\n");
ERROR(" --update-db create database and exit\n");
ERROR(" --no-create-db don't create database\n");
ERROR(" --verbose verbose logging\n");
ERROR(" --version prints version information\n");
}
void version() {
ERROR("mpd (MPD: Music Player Daemon) %s\n",VERSION);
ERROR("\n");
ERROR("Copyright (C) 2003 Warren Dukes <shank@mercury.chem.pitt.edu>\n");
ERROR("This is free software; see the source for copying conditions. There is NO\n");
ERROR("warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
LOG("mpd (MPD: Music Player Daemon) %s\n",VERSION);
LOG("\n");
LOG("Copyright (C) 2003 Warren Dukes <shank@mercury.chem.pitt.edu>\n");
LOG("This is free software; see the source for copying conditions. There is NO\n");
LOG("warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
LOG("\n");
LOG("Supported formats:\n");
initInputPlugins();
printAllInputPluginSuffixes(stdout);
}
void parseOptions(int argc, char ** argv, Options * options) {
......@@ -90,7 +102,9 @@ void parseOptions(int argc, char ** argv, Options * options) {
options->usr = NULL;
options->daemon = 1;
options->stdOutput = 0;
options->createDB = 0;
options->updateDB = 0;
options->dbFile = NULL;
if(argc>1) {
......@@ -99,16 +113,24 @@ void parseOptions(int argc, char ** argv, Options * options) {
if(strncmp(argv[i],"--",2)==0) {
if(strcmp(argv[i],"--help")==0) {
usage(argv);
exit(0);
exit(EXIT_SUCCESS);
}
else if(strcmp(argv[i],"--no-daemon")==0) {
options->daemon = 0;
argcLeft--;
}
else if(strcmp(argv[i],"--stdout")==0) {
options->stdOutput = 1;
argcLeft--;
}
else if(strcmp(argv[i],"--create-db")==0) {
options->createDB = 1;
argcLeft--;
}
else if(strcmp(argv[i],"--update-db")==0) {
options->updateDB = 1;
argcLeft--;
}
else if(strcmp(argv[i],"--no-create-db")==0) {
options->createDB = -1;
argcLeft--;
......@@ -119,11 +141,11 @@ void parseOptions(int argc, char ** argv, Options * options) {
}
else if(strcmp(argv[i],"--version")==0) {
version();
exit(0);
exit(EXIT_SUCCESS);
}
else {
myfprintf(stderr,"unknown command line option: %s\n",argv[i]);
exit(-1);
exit(EXIT_FAILURE);
}
}
else break;
......@@ -176,15 +198,10 @@ void parseOptions(int argc, char ** argv, Options * options) {
}
usage(argv);
exit(-1);
exit(EXIT_FAILURE);
}
int main(int argc, char * argv[]) {
int port, uid, gid;
struct stat st;
FILE * out;
FILE * err;
Options options;
void closeAllFDs() {
int i;
for(i=0;i<FD_SETSIZE;i++) {
......@@ -197,227 +214,171 @@ int main(int argc, char * argv[]) {
close(i);
}
}
}
initConf();
parseOptions(argc,argv,&options);
void establishListen(Options * options) {
int port;
initStats();
initLog();
if((port = atoi(options.portStr))<0) {
if((port = atoi(options->portStr))<0) {
ERROR("problem with port number\n");
return -1;
exit(EXIT_FAILURE);
}
if((listenSocket = establish(port))<0) {
if(!options->createDB && !options->updateDB &&
(listenSocket = establish(port))<0)
{
ERROR("error binding port\n");
return -1;
exit(EXIT_FAILURE);
}
}
/*
* lose privileges as early as possible
*/
/* change uid */
if (options.usr && strlen(options.usr)) {
void changeToUser(Options * options) {
if (options->usr && strlen(options->usr)) {
int uid, gid;
#ifdef _BSD_SOURCE
gid_t gid_list[NGROUPS_MAX];
#endif
/* get uid */
struct passwd * userpwd;
if ((userpwd = getpwnam(options.usr)) == NULL) {
ERROR("no such user: %s\n", options.usr);
return -1;
if ((userpwd = getpwnam(options->usr)) == NULL) {
ERROR("no such user: %s\n", options->usr);
exit(EXIT_FAILURE);
}
uid = userpwd->pw_uid;
gid = userpwd->pw_gid;
if(setgid(gid) == -1) {
ERROR("cannot setgid of user %s: %s\n", options.usr,
ERROR("cannot setgid of user %s: %s\n", options->usr,
strerror(errno));
return -1;
exit(EXIT_FAILURE);
}
#ifdef _BSD_SOURCE
/* init suplementary groups
* (must be done before we change our uid)
*/
if (initgroups(options.usr, gid) == -1) {
if (initgroups(options->usr, gid) == -1) {
ERROR("cannot init suplementary groups "
"of user %s: %s\n", options.usr,
"of user %s: %s\n", options->usr,
strerror(errno));
}
else if(getgroups(NGROUPS_MAX, gid_list) == -1) {
ERROR("cannot get groups "
"of user %s: %s\n", options.usr,
"of user %s: %s\n", options->usr,
strerror(errno));
return -1;
exit(EXIT_FAILURE);
}
else if(setgroups(NGROUPS_MAX, gid_list) == -1) {
ERROR("cannot set groups "
"of user %s: %s\n", options.usr,
"of user %s: %s\n", options->usr,
strerror(errno));
return -1;
exit(EXIT_FAILURE);
}
#endif
/* set uid */
if (setuid(uid) == -1) {
ERROR("cannot change to uid of user "
"%s: %s\n", options.usr,
"%s: %s\n", options->usr,
strerror(errno));
return -1;
exit(EXIT_FAILURE);
}
}
}
if(NULL==(out=fopen(options.logFile,"a"))) {
ERROR("problem opening file \"%s\" for writing\n",
options.logFile);
return -1;
}
void openLogFiles(Options * options, FILE ** out, FILE ** err) {
if(options->stdOutput) return;
if(NULL==(err=fopen(options.errorFile,"a"))) {
if(NULL==(*out=fopen(options->logFile,"a"))) {
ERROR("problem opening file \"%s\" for writing\n",
options.errorFile);
return -1;
}
initPaths();
initPermissions();
if(options.playlistDirArg[0]=='/') {
strcpy(playlistDir,options.playlistDirArg);
}
else {
getcwd(playlistDir,MAXPATHLEN-strlen(options.playlistDirArg)-1);
if(playlistDir[strlen(playlistDir)-1]!='/') {
strcat(playlistDir,"/");
}
strcat(playlistDir,options.playlistDirArg);
}
if(playlistDir[strlen(playlistDir)-1]!='/') {
strcat(playlistDir,"/");
}
if((stat(playlistDir,&st))<0) {
ERROR("problem stat'ing \"%s\"\n",options.playlistDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
ERROR("\"%s\" is not a directory\n",options.playlistDirArg);
return -1;
options->logFile);
exit(EXIT_FAILURE);
}
if(options.musicDirArg[0]=='/') {
strcpy(musicDir,options.musicDirArg);
}
else {
getcwd(musicDir,MAXPATHLEN-strlen(options.musicDirArg)-1);
if(musicDir[strlen(musicDir)-1]!='/') strcat(musicDir,"/");
strcat(musicDir,options.musicDirArg);
}
if(musicDir[strlen(musicDir)-1]!='/') strcat(musicDir,"/");
if((stat(musicDir,&st))<0) {
ERROR("problem stat'ing \"%s\"\n",options.musicDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
ERROR("\"%s\" is not a directory\n",options.musicDirArg);
return -1;
if(NULL==(*err=fopen(options->errorFile,"a"))) {
ERROR("problem opening file \"%s\" for writing\n",
options->errorFile);
exit(EXIT_FAILURE);
}
}
initTables();
initPlaylist();
void openDB(Options * options, char * argv0) {
if(!options->dbFile) directory_db = strdup(rpp2app(".mpddb"));
else directory_db = strdup(options->dbFile);
if(!options.dbFile) {
strncpy(directorydb,playlistDir,MAXPATHLEN);
directorydb[MAXPATHLEN] = '\0';
strncat(directorydb,"/.mpddb",MAXPATHLEN-strlen(playlistDir));
}
else {
strncpy(directorydb,options.dbFile,MAXPATHLEN);
directorydb[MAXPATHLEN] = '\0';
}
if(options.createDB>0 || readDirectoryDB()<0) {
if(options.createDB<0) {
if(options->createDB>0 || readDirectoryDB()<0) {
if(options->createDB<0) {
ERROR("can't open db file and using \"--no-create-db\""
" command line option\n");
exit(-1);
ERROR("try running \"%s --create-db\"\n",
argv0);
exit(EXIT_FAILURE);
}
initMp3Directory();
if(writeDirectoryDB()<0) {
ERROR("problem opening db for reading or writing\n");
exit(-1);
exit(EXIT_FAILURE);
}
if(options->createDB) exit(EXIT_SUCCESS);
}
if(options->updateDB) {
updateMp3Directory();
exit(EXIT_SUCCESS);
}
}
initCommands();
initAudioDriver();
initPlayerData();
initVolume();
initInterfaces();
close(STDIN_FILENO);
if(options.daemon) {
void daemonize(Options * options) {
if(options->daemon) {
int pid;
fflush(NULL);
pid = fork();
if(pid>0) _exit(0);
if(pid>0) _exit(EXIT_SUCCESS);
else if(pid<0) {
ERROR("problems fork'ing for daemon!\n");
exit(-1);
exit(EXIT_FAILURE);
}
if(chdir("/")<0) {
ERROR("problems changing to root directory\n");
exit(-1);
exit(EXIT_FAILURE);
}
if(setsid()<0) {
ERROR("problems setsid'ing\n");
exit(-1);
exit(EXIT_FAILURE);
}
if(close(STDOUT_FILENO)) {
fprintf(err,"problems closing stdout : %s\n",
strerror(errno));
exit(-1);
fflush(NULL);
pid = fork();
if(pid>0) _exit(EXIT_SUCCESS);
else if(pid<0) {
ERROR("problems fork'ing for daemon!\n");
exit(EXIT_FAILURE);
}
}
}
if(close(STDERR_FILENO)) {
fprintf(err,"problems closing stderr : %s\n",
strerror(errno));
exit(-1);
}
void setupLogOutput(Options * options, FILE * out, FILE * err) {
if(!options->stdOutput) {
fflush(NULL);
if(dup2(fileno(out),STDOUT_FILENO)<0) {
fprintf(err,"problems dup2 stdout : %s\n",
myfprintf(err,"problems dup2 stdout : %s\n",
strerror(errno));
exit(-1);
exit(EXIT_FAILURE);
}
if(dup2(fileno(err),STDERR_FILENO)<0) {
fprintf(err,"problems dup2 stderr : %s\n",
myfprintf(err,"problems dup2 stderr : %s\n",
strerror(errno));
exit(-1);
exit(EXIT_FAILURE);
}
myfprintfStdLogMode(out,err);
fflush(NULL);
pid = fork();
if(pid>0) _exit(0);
else if(pid<0) {
ERROR("problems fork'ing for daemon!\n");
exit(-1);
}
}
else {
fclose(out);
fclose(err);
myfprintfStdLogMode(out, err, options->logFile,
options->errorFile);
}
/* lets redirect stdin to dev null as a work around for libao bug */
......@@ -426,14 +387,59 @@ int main(int argc, char * argv[]) {
if(fd<0) {
ERROR("not able to open /dev/null to redirect stdin: "
"%s\n",strerror(errno));
exit(-1);
exit(EXIT_FAILURE);
}
if(dup2(fd,STDIN_FILENO)<0) {
ERROR("problems dup2's stdin for redirection: "
"%s\n",strerror(errno));
exit(-1);
exit(EXIT_FAILURE);
}
}
}
int main(int argc, char * argv[]) {
FILE * out;
FILE * err;
Options options;
closeAllFDs();
initConf();
parseOptions(argc, argv, &options);
initStats();
initLog();
establishListen(&options);
/*
* lose privileges as early as possible
*/
changeToUser(&options);
openLogFiles(&options, &out, &err);
initPaths(options.playlistDirArg,options.musicDirArg);
initPermissions();
initReplayGainState();
initTables();
initPlaylist();
initInputPlugins();
openDB(&options, argv[0]);
initCommands();
initAudioConfig();
initAudioDriver();
initPlayerData();
initVolume();
initInterfaces();
daemonize(&options);
setupLogOutput(&options, out, err);
openVolumeDevice();
initSigHandlers();
......@@ -442,10 +448,10 @@ int main(int argc, char * argv[]) {
while(COMMAND_RETURN_KILL!=doIOForInterfaces()) {
syncPlayerAndPlaylist();
closeOldInterfaces();
if(COMMAND_RETURN_KILL==handlePendingSignals()) break;
readDirectoryDBIfUpdateIsFinished();
}
finishSigHandlers();
savePlaylistState();
playerKill();
......@@ -456,10 +462,13 @@ int main(int argc, char * argv[]) {
finishPlaylist();
freePlayerData();
finishAudioDriver();
finishAudioConfig();
finishVolume();
finishPaths();
finishPermissions();
finishCommands();
finishInputPlugins();
return 0;
return EXIT_SUCCESS;
}
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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
*/
#ifndef MP4_DECODE_H
#define MP4_DECODE_H
#include "../config.h"
#ifdef HAVE_FAAD
#include "playerData.h"
#include "mp4ff/mp4ff.h"
int mp4_getAACTrack(mp4ff_t *infile);
uint32_t mp4_readCallback(void *user_data, void *buffer, uint32_t length);
uint32_t mp4_seekCallback(void *user_data, uint64_t position);
int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);
#endif /* HAVE_FAAD */
#endif
......@@ -84,6 +84,10 @@ ID3_SUBDIR = @ID3_SUBDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBMIKMOD_CFLAGS = @LIBMIKMOD_CFLAGS@
LIBMIKMOD_CONFIG = @LIBMIKMOD_CONFIG@
LIBMIKMOD_LDADD = @LIBMIKMOD_LDADD@
LIBMIKMOD_LIBS = @LIBMIKMOD_LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAD_LIB = @MAD_LIB@
......
......@@ -41,3 +41,4 @@ typedef signed long mpd_sint32;
#endif
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -18,6 +18,8 @@
#include "myfprintf.h"
#include "interface.h"
#include "path.h"
#include "log.h"
#include <stdarg.h>
#include <sys/param.h>
......@@ -32,39 +34,93 @@
int myfprintf_stdLogMode = 0;
FILE * myfprintf_out;
FILE * myfprintf_err;
char * myfprintf_outFilename;
char * myfprintf_errFilename;
void myfprintfStdLogMode(FILE * out, FILE * err) {
void blockingWrite(int fd, char * string) {
int len = strlen(string);
int ret;
while(len) {
ret = write(fd,string,len);
if(ret<0) {
switch(errno) {
case EAGAIN:
case EINTR:
continue;
default:
return;
}
}
len-= ret;
string+= ret;
}
}
void myfprintfStdLogMode(FILE * out, FILE * err, char * outFilename,
char * errFilename)
{
myfprintf_stdLogMode = 1;
myfprintf_out = out;
myfprintf_err = err;
myfprintf_outFilename = prependCwdToPathDup(outFilename);
myfprintf_errFilename = prependCwdToPathDup(errFilename);
}
void myfprintf(FILE * fp, char * format, ... ) {
char buffer[BUFFER_LENGTH+1];
va_list arglist;
int fd = fileno(fp);
int fcntlret;
memset(buffer,0,BUFFER_LENGTH+1);
va_start(arglist,format);
while((fcntlret=fcntl(fd,F_GETFL))==-1 && errno==EINTR);
if(myfprintf_stdLogMode && (fd==1 || fd==2)) {
char str[15];
time_t t = time(NULL);
if(fd==1) fp = myfprintf_out;
else fp = myfprintf_err;
strftime(str,14,"%b %e %R",localtime(&t));
fprintf(fp,"%s : ",str);
vfprintf(fp,format,arglist);
strftime(buffer,14,"%b %e %R",localtime(&t));
blockingWrite(fd,buffer);
blockingWrite(fd," : ");
vsnprintf(buffer,BUFFER_LENGTH,format,arglist);
blockingWrite(fd,buffer);
}
else if(fcntlret & O_NONBLOCK) {
char buffer[BUFFER_LENGTH+1];
else {
vsnprintf(buffer,BUFFER_LENGTH,format,arglist);
if(interfacePrintWithFD(fd,buffer)<0) {
/* not a fd from a interface */
vfprintf(fp,format,arglist);
if(!(fcntlret & O_NONBLOCK) ||
interfacePrintWithFD(fd,buffer)<0)
{
blockingWrite(fd,buffer);
}
}
else vfprintf(fp,format,arglist);
fflush(fp);
va_end(arglist);
}
int myfprintfCloseAndOpenLogFile() {
if(myfprintf_stdLogMode) {
while(fclose(myfprintf_out)<0 && errno==EINTR);
while(fclose(myfprintf_err)<0 && errno==EINTR);
while((myfprintf_out = fopen(myfprintf_outFilename,"a+"))==NULL
&& errno==EINTR);
if(!myfprintf_out) {
ERROR("error re-opening log file: %s\n",
myfprintf_out);
return -1;
}
while((myfprintf_err = fopen(myfprintf_errFilename,"a+"))==NULL
&& errno==EINTR);
if(!myfprintf_out) {
ERROR("error re-opening log file: %s\n",
myfprintf_out);
return -1;
}
while(dup2(fileno(myfprintf_out),1)<0 && errno==EINTR);
while(dup2(fileno(myfprintf_err),2)<0 && errno==EINTR);
}
return 0;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -23,8 +23,12 @@
#include <stdio.h>
void myfprintfStdLogMode(FILE * out, FILE * err);
void myfprintfStdLogMode(FILE * out, FILE * err, char * outFilename,
char * errFilename);
void myfprintf(FILE * fp, char * format, ... );
int myfprintfCloseAndOpenLogFile();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "ogg_decode.h"
#ifdef HAVE_OGG
#include "command.h"
#include "utils.h"
#include "audio.h"
#include "log.h"
#include "pcm_utils.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <vorbis/vorbisfile.h>
#ifdef WORDS_BIGENDIAN
#define OGG_DECODE_USE_BIGENDIAN 1
#else
#define OGG_DECODE_USE_BIGENDIAN 0
#endif
int getOggTotalTime(char * file) {
OggVorbis_File vf;
FILE * oggfp;
int totalTime;
if(!(oggfp = fopen(file,"r"))) return -1;
if(ov_open(oggfp, &vf, NULL, 0) < 0) {
fclose(oggfp);
return -1;
}
totalTime = ov_time_total(&vf,-1)+0.5;
ov_clear(&vf);
return totalTime;
}
int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
{
OggVorbis_File vf;
FILE * oggfp;
if(!(oggfp = fopen(dc->file,"r"))) {
ERROR("failed to open ogg\n");
return -1;
}
if(ov_open(oggfp, &vf, NULL, 0) < 0) {
ERROR("Input does not appear to be an Ogg bit stream.\n");
fclose(oggfp);
return -1;
}
{
vorbis_info *vi=ov_info(&vf,-1);
af->bits = 16;
af->channels = vi->channels;
af->sampleRate = vi->rate;
}
cb->totalTime = ov_time_total(&vf,-1);
dc->state = DECODE_STATE_DECODE;
dc->start = 0;
{
int current_section;
int eof = 0;
long ret;
char chunk[CHUNK_SIZE];
int chunkpos = 0;
long bitRate = 0;
long test;
while(!eof) {
if(dc->seek) {
cb->end = cb->begin;
cb->wrap = 0;
chunkpos = 0;
ov_time_seek_page(&vf,dc->seekWhere);
dc->seek = 0;
}
ret = ov_read(&vf,chunk+chunkpos,
CHUNK_SIZE-chunkpos,
OGG_DECODE_USE_BIGENDIAN,
2,1,
&current_section);
if(ret<=0) eof = 1;
else chunkpos+=ret;
if(chunkpos>=CHUNK_SIZE || eof) {
while(cb->begin==cb->end && cb->wrap &&
!dc->stop && !dc->seek)
{
my_usleep(10000);
}
if(dc->stop) break;
else if(dc->seek) continue;
memcpy(cb->chunks+cb->end*CHUNK_SIZE,
chunk,chunkpos);
cb->chunkSize[cb->end] = chunkpos;
chunkpos = 0;
cb->times[cb->end] = ov_time_tell(&vf);
if((test = ov_bitrate_instant(&vf))>0) {
bitRate = test/1024;
}
cb->bitRate[cb->end] = bitRate;
cb->end++;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
}
}
ov_clear(&vf);
if(dc->seek) dc->seek = 0;
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
}
else dc->state = DECODE_STATE_STOP;
}
return 0;
}
#endif
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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 "outputBuffer.h"
#include "pcm_utils.h"
#include "playerData.h"
#include "utils.h"
#include <string.h>
static mpd_sint16 currentChunk = -1;
void clearOutputBuffer(OutputBuffer * cb) {
currentChunk = -1;
cb->end = cb->begin;
cb->wrap = 0;
}
void flushOutputBuffer(OutputBuffer * cb) {
if(currentChunk == cb->end) {
cb->end++;
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
currentChunk = -1;
}
}
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
DecoderControl * dc, int seekable, char * dataIn,
long dataInLen, float time, mpd_uint16 bitRate)
{
mpd_uint16 dataToSend;
mpd_uint16 chunkLeft;
char * data;
size_t datalen;
static char * convBuffer = NULL;
static long convBufferLen = 0;
if(memcmp(&(cb->audioFormat),&(dc->audioFormat),sizeof(AudioFormat))==0)
{
data = dataIn;
datalen = dataInLen;
}
else {
datalen = pcm_sizeOfOutputBufferForAudioFormatConversion(
&(dc->audioFormat), dataIn, dataInLen,
&(cb->audioFormat));
if(datalen > convBufferLen) {
convBuffer = realloc(convBuffer,datalen);
convBufferLen = datalen;
}
data = convBuffer;
pcm_convertAudioFormat(&(dc->audioFormat), dataIn, dataInLen,
&(cb->audioFormat),data);
}
while(datalen) {
if(currentChunk != cb->end) {
while(cb->begin==cb->end && cb->wrap && !dc->stop)
{
if(dc->seek) {
if(seekable) {
return OUTPUT_BUFFER_DC_SEEK;
}
else {
dc->seekError = 1;
dc->seek = 0;
}
}
if(!inStream ||
bufferInputStream(inStream) <= 0)
{
my_usleep(10000);
}
}
if(dc->stop) return OUTPUT_BUFFER_DC_STOP;
currentChunk = cb->end;
cb->chunkSize[currentChunk] = 0;
}
chunkLeft = CHUNK_SIZE-cb->chunkSize[currentChunk];
dataToSend = datalen > chunkLeft ? chunkLeft : datalen;
memcpy(cb->chunks+currentChunk*CHUNK_SIZE+
cb->chunkSize[currentChunk],
data, dataToSend);
cb->chunkSize[currentChunk]+= dataToSend;
cb->bitRate[currentChunk] = bitRate;
cb->times[currentChunk] = time;
datalen-= dataToSend;
data+= dataToSend;
if(cb->chunkSize[currentChunk] == CHUNK_SIZE) {
flushOutputBuffer(cb);
}
}
return 0;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.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
*/
#ifndef OUTPUT_BUFFER_H
#define OUTPUT_BUFFER_H
#include "mpd_types.h"
#include "decode.h"
#include "audio.h"
#include "inputStream.h"
#define OUTPUT_BUFFER_DC_STOP -1
#define OUTPUT_BUFFER_DC_SEEK -2
typedef struct _OutputBuffer {
char * volatile chunks;
mpd_uint16 * volatile chunkSize;
mpd_uint16 * volatile bitRate;
float * volatile times;
mpd_sint16 volatile begin;
mpd_sint16 volatile end;
mpd_sint16 volatile next;
mpd_sint8 volatile wrap;
AudioFormat audioFormat;
} OutputBuffer;
void clearOutputBuffer(OutputBuffer * cb);
void flushOutputBuffer(OutputBuffer * cb);
/* we send inStream for buffering the inputStream while waiting to
send the next chunk */
int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
DecoderControl * dc, int seekable, char * data, long datalen,
float time, mpd_uint16 bitRate);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -20,9 +20,13 @@
#include "log.h"
#include "charConv.h"
#include "conf.h"
#include "utf8.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO_CODESET
......@@ -31,8 +35,8 @@
#endif
#endif
char musicDir[MAXPATHLEN+1];
char playlistDir[MAXPATHLEN+1];
char * musicDir;
char * playlistDir;
char * fsCharset = NULL;
......@@ -46,24 +50,35 @@ char * pathConvCharset(char * to, char * from, char * str, char * ret) {
ret = convStrDup(str);
}
if(!ret) ret = strdup(str);
return ret;
}
char * fsCharsetToUtf8(char * str) {
static char * ret = NULL;
return ret = pathConvCharset("UTF-8",fsCharset,str,ret);
ret = pathConvCharset("UTF-8",fsCharset,str,ret);
if(ret && !validUtf8String(ret)) {
free(ret);
ret = NULL;
}
return ret;
}
char * utf8ToFsCharset(char * str) {
static char * ret = NULL;
return ret = pathConvCharset(fsCharset,"UTF-8",str,ret);
ret = pathConvCharset(fsCharset,"UTF-8",str,ret);
if(!ret) ret = strdup(str);
return ret;
}
void setFsCharset(char * charset) {
int error = 0;
if(fsCharset) free(fsCharset);
fsCharset = strdup(charset);
......@@ -74,11 +89,19 @@ void setFsCharset(char * charset) {
ERROR("fs charset conversion problem: "
"not able to convert from \"%s\" to \"%s\"\n",
fsCharset,"UTF-8");
error = 1;
}
if(setCharSetConversion(fsCharset,"UTF-8")!=0) {
ERROR("fs charset conversion problem: "
"not able to convert from \"%s\" to \"%s\"\n",
"UTF-8",fsCharset);
error = 1;
}
if(error) {
free(fsCharset);
ERROR("setting fs charset to ISO-8859-1!\n");
fsCharset = strdup("ISO-8859-1");
}
}
......@@ -86,9 +109,30 @@ char * getFsCharset() {
return fsCharset;
}
void initPaths() {
void initPaths(char * playlistDirArg, char * musicDirArg) {
char * charset = NULL;
char * originalLocale;
struct stat st;
playlistDir = prependCwdToPathDup(playlistDirArg);
if((stat(playlistDir,&st))<0) {
ERROR("problem stat'ing \"%s\"\n",playlistDirArg);
exit(EXIT_FAILURE);
}
if(!S_ISDIR(st.st_mode)) {
ERROR("\"%s\" is not a directory\n",playlistDirArg);
exit(EXIT_FAILURE);
}
musicDir = prependCwdToPathDup(musicDirArg);
if((stat(musicDir,&st))<0) {
ERROR("problem stat'ing \"%s\"\n",musicDirArg);
exit(EXIT_FAILURE);
}
if(!S_ISDIR(st.st_mode)) {
ERROR("\"%s\" is not a directory\n",musicDirArg);
exit(EXIT_FAILURE);
}
if(getConf()[CONF_FS_CHARSET]) {
charset = strdup(getConf()[CONF_FS_CHARSET]);
......@@ -183,3 +227,73 @@ char * parentPath(char * path) {
return parentPath;
}
char * sanitizePathDup(char * path) {
int len = strlen(path)+1;
char * ret = malloc(len);
char * cp = ret;
memset(ret,0,len);
len = 0;
/* illeminate more than one '/' in a row, like "///" */
while(*path) {
while(*path=='/') path++;
if(*path=='.') {
/* we dont want to have hidden directoires, or '.' or
".." in our path */
free(ret);
return NULL;
}
while(*path && *path!='/') {
*(cp++) = *(path++);
len++;
}
if(*path=='/') {
*(cp++) = *(path++);
len++;
}
}
if(len && ret[len-1]=='/') {
len--;
ret[len] = '\0';
}
printf("sanitized: %s\n", ret);
return realloc(ret,len+1);
}
char * prependCwdToPathDup(char * path) {
int len = MAXPATHLEN+1;
char * ret = malloc(len);
memset(ret,0,len);
len = 0;
if(path[0]=='/') {
strncpy(ret,path,MAXPATHLEN);
len = strlen(ret);
}
else {
getcwd(ret,MAXPATHLEN);
len = strlen(ret);
if(ret[len-1]!='/') {
strncat(ret,"/",MAXPATHLEN-len);
len = strlen(ret);
}
strncat(ret,path,MAXPATHLEN-len);
len = strlen(ret);
}
if(ret[len-1]!='/') {
strncat(ret,"/",MAXPATHLEN-len);
len = strlen(ret);
}
return realloc(ret,len+1);
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -23,10 +23,9 @@
#include <sys/param.h>
extern char musicDir[MAXPATHLEN+1];
extern char playlistDir[MAXPATHLEN+1];
extern char * musicDir;
void initPaths();
void initPaths(char * playlistDirArg, char * musicDirArg);
void finishPaths();
......@@ -49,4 +48,10 @@ char * rpp2app(char * file);
/* static char * returned */
char * parentPath(char * path);
/* strips extra "///" and leading "/" and trailing "/" */
char * sanitizePathDup(char * path);
char * prependCwdToPathDup(char * path);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -24,6 +24,7 @@
#include <string.h>
#include <math.h>
#include <assert.h>
void pcm_changeBufferEndianness(char * buffer, int bufferSize, int bits) {
char temp;
......@@ -47,7 +48,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
mpd_sint8 * buffer8 = (mpd_sint8 *)buffer;
mpd_sint16 * buffer16 = (mpd_sint16 *)buffer;
if(volume>=100) return;
if(volume>=1000) return;
if(volume<=0) {
memset(buffer,0,bufferSize);
......@@ -59,7 +60,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
while(bufferSize>0) {
temp32 = *buffer16;
temp32*= volume;
temp32/=100;
temp32/=1000;
*buffer16 = temp32>32767 ? 32767 :
(temp32<-32768 ? -32768 : temp32);
buffer16++;
......@@ -70,7 +71,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
while(bufferSize>0) {
temp32 = *buffer8;
temp32*= volume;
temp32/=100;
temp32/=1000;
*buffer8 = temp32>127 ? 127 :
(temp32<-128 ? -128 : temp32);
buffer8++;
......@@ -80,7 +81,7 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
default:
ERROR("%i bits not supported by pcm_volumeChange!\n",
format->bits);
exit(-1);
exit(EXIT_FAILURE);
}
}
......@@ -96,7 +97,7 @@ void pcm_add(char * buffer1, char * buffer2, size_t bufferSize1,
switch(format->bits) {
case 16:
while(bufferSize1>0 && bufferSize2>0) {
temp32 = (vol1*(*buffer16_1)+vol2*(*buffer16_2))/100;
temp32 = (vol1*(*buffer16_1)+vol2*(*buffer16_2))/1000;
*buffer16_1 = temp32>32767 ? 32767 :
(temp32<-32768 ? -32768 : temp32);
buffer16_1++;
......@@ -108,7 +109,7 @@ void pcm_add(char * buffer1, char * buffer2, size_t bufferSize1,
break;
case 8:
while(bufferSize1>0 && bufferSize2>0) {
temp32 = (vol1*(*buffer8_1)+vol2*(*buffer8_2))/100;
temp32 = (vol1*(*buffer8_1)+vol2*(*buffer8_2))/1000;
*buffer8_1 = temp32>127 ? 127 :
(temp32<-128 ? -128 : temp32);
buffer8_1++;
......@@ -120,7 +121,7 @@ void pcm_add(char * buffer1, char * buffer2, size_t bufferSize1,
break;
default:
ERROR("%i bits not supported by pcm_add!\n",format->bits);
exit(-1);
exit(EXIT_FAILURE);
}
}
......@@ -131,8 +132,154 @@ void pcm_mix(char * buffer1, char * buffer2, size_t bufferSize1,
float s = sin(M_PI_2*portion1);
s*=s;
vol1 = s*100+0.5;
vol1 = vol1>100 ? 100 : ( vol1<0 ? 0 : vol1 );
vol1 = s*1000+0.5;
vol1 = vol1>1000 ? 1000 : ( vol1<0 ? 0 : vol1 );
pcm_add(buffer1,buffer2,bufferSize1,bufferSize2,vol1,100-vol1,format);
pcm_add(buffer1,buffer2,bufferSize1,bufferSize2,vol1,1000-vol1,format);
}
/* outFormat bits must be 16 and channels must be 2! */
void pcm_convertAudioFormat(AudioFormat * inFormat, char * inBuffer, size_t
inSize, AudioFormat * outFormat, char * outBuffer)
{
static char * bitConvBuffer = NULL;
static int bitConvBufferLength = 0;
static char * channelConvBuffer = NULL;
static int channelConvBufferLength = 0;
char * dataChannelConv;
int dataChannelLen;
char * dataBitConv;
int dataBitLen;
assert(outFormat->bits==16);
assert(outFormat->channels==2);
/* converts */
switch(inFormat->bits) {
case 8:
dataBitLen = inSize << 1;
if(dataBitLen > bitConvBufferLength) {
bitConvBuffer = realloc(bitConvBuffer, dataBitLen);
bitConvBufferLength = dataBitLen;
}
dataBitConv = bitConvBuffer;
{
mpd_sint8 * in = (mpd_sint8 *)inBuffer;
mpd_sint16 * out = (mpd_sint16 *)dataBitConv;
int i;
for(i=0; i<inSize; i++) {
*out++ = (*in++) << 8;
}
}
break;
case 16:
dataBitConv = inBuffer;
dataBitLen = inSize;
break;
case 24:
/* put dithering code from mp3_decode here */
default:
ERROR("only 8 or 16 bits are supported for conversion!\n");
exit(EXIT_FAILURE);
}
/* converts only between 16 bit audio between mono and stereo */
switch(inFormat->channels) {
case 1:
dataChannelLen = (dataBitLen >> 1) << 2;
if(dataChannelLen > channelConvBufferLength) {
channelConvBuffer = realloc(channelConvBuffer,
dataChannelLen);
channelConvBufferLength = dataChannelLen;
}
dataChannelConv = channelConvBuffer;
{
mpd_sint16 * in = (mpd_sint16 *)dataBitConv;
mpd_sint16 * out = (mpd_sint16 *)dataChannelConv;
int i, inSamples = dataBitLen >> 1;
for(i=0;i<inSamples;i++) {
*out++ = *in;
*out++ = *in++;
}
}
break;
case 2:
dataChannelConv = dataBitConv;
dataChannelLen = dataBitLen;
break;
default:
ERROR("only 1 or 2 channels are supported for conversion!\n");
exit(EXIT_FAILURE);
}
if(inFormat->sampleRate == outFormat->sampleRate) {
memcpy(outBuffer,dataChannelConv,dataChannelLen);
}
else {
/* only works if outFormat is 16-bit stereo! */
/* resampling code blatantly ripped from ESD */
mpd_sint32 rd_dat = 0;
mpd_uint32 wr_dat = 0;
mpd_sint16 lsample, rsample;
register mpd_sint16 * out = (mpd_sint16 *)outBuffer;
register mpd_sint16 * in = (mpd_sint16 *)dataChannelConv;
const int shift = sizeof(mpd_sint16);
mpd_uint32 nlen = ((( dataChannelLen >> shift) *
(mpd_uint32)(outFormat->sampleRate)) /
inFormat->sampleRate);
nlen <<= shift;
while( wr_dat < nlen / shift) {
rd_dat = wr_dat * inFormat->sampleRate /
outFormat->sampleRate;
rd_dat &= ~1;
lsample = in[ rd_dat++ ];
rsample = in[ rd_dat++ ];
out[ wr_dat++ ] = lsample;
out[ wr_dat++ ] = rsample;
}
}
return;
}
size_t pcm_sizeOfOutputBufferForAudioFormatConversion(AudioFormat * inFormat,
char * inBuffer, size_t inSize, AudioFormat * outFormat)
{
const int shift = sizeof(mpd_sint16);
size_t outSize = inSize;
switch(inFormat->bits) {
case 8:
outSize = outSize << 1;
break;
case 16:
break;
default:
ERROR("only 8 or 16 bits are supported for conversion!\n");
exit(EXIT_FAILURE);
}
switch(inFormat->channels) {
case 1:
outSize = (outSize >> 1) << 2;
break;
case 2:
break;
default:
ERROR("only 1 or 2 channels are supported for conversion!\n");
exit(EXIT_FAILURE);
}
outSize = (((outSize >> shift) * (mpd_uint32)(outFormat->sampleRate)) /
inFormat->sampleRate);
outSize <<= shift;
return outSize;
}
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
......@@ -33,4 +33,10 @@ void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
void pcm_mix(char * buffer1, char * buffer2, size_t bufferSize1,
size_t bufferSize2, AudioFormat * format, float portion1);
void pcm_convertAudioFormat(AudioFormat * inFormat, char * inBuffer, size_t
inSize, AudioFormat * outFormat, char * outBuffer);
size_t pcm_sizeOfOutputBufferForAudioFormatConversion(AudioFormat * inFormat,
char * inBuffer, size_t inSize, AudioFormat * outFormat);
#endif
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
......@@ -59,7 +59,7 @@ unsigned int parsePermissions(char * string) {
}
else {
ERROR("uknown permission \"%s\"\n",temp);
exit(-1);
exit(EXIT_FAILURE);
}
temp = strtok_r(NULL,PERMISSION_SEPERATOR,&tok);
......@@ -99,12 +99,12 @@ void initPermissions() {
ERROR("\"%s\" not found in password string \"%s\"\n",
PERMISSION_PASSWORD_CHAR,
nextSet);
exit(-1);
exit(EXIT_FAILURE);
}
if(!(temp = strtok_r(nextSet,PERMISSION_PASSWORD_CHAR,&cp2))) {
ERROR("something weird just happend in permission.c\n");
exit(-1);
exit(EXIT_FAILURE);
}
password = temp;
......@@ -139,3 +139,4 @@ void finishPermissions() {
unsigned int getDefaultPermissions() {
return permission_default;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -35,3 +35,4 @@ void finishPermissions();
unsigned int getDefaultPermissions();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -23,7 +23,6 @@
#include "playlist.h"
#include "ls.h"
#include "listen.h"
#include "path.h"
#include "log.h"
#include "utils.h"
#include "tables.h"
......@@ -31,6 +30,7 @@
#include "volume.h"
#include "playerData.h"
#include "permission.h"
#include "sig_handlers.h"
#include <stdio.h>
#include <sys/types.h>
......@@ -44,14 +44,27 @@
#include <errno.h>
#include <fcntl.h>
int player_pid = 0;
int player_termSent = 0;
volatile int player_pid = 0;
void clearPlayerPid() {
player_pid = 0;
}
static void resetPlayerMetadata() {
PlayerControl * pc = &(getPlayerData()->playerControl);
if(pc->metadataState == PLAYER_METADATA_STATE_READ) {
pc->metadataState = PLAYER_METADATA_STATE_WRITE;
pc->title = -1;
pc->artist = -1;
pc->album = -1;
}
}
void resetPlayer() {
int pid;
player_pid = 0;
player_termSent = 0;
clearPlayerPid();
getPlayerData()->playerControl.stop = 0;
getPlayerData()->playerControl.play = 0;
getPlayerData()->playerControl.pause = 0;
......@@ -60,59 +73,63 @@ void resetPlayer() {
getPlayerData()->playerControl.state = PLAYER_STATE_STOP;
getPlayerData()->playerControl.queueState = PLAYER_QUEUE_UNLOCKED;
getPlayerData()->playerControl.seek = 0;
getPlayerData()->playerControl.metadataState =
PLAYER_METADATA_STATE_WRITE;
getPlayerData()->playerControl.title = -1;
/* kill decode process if it got left running */
pid = getPlayerData()->playerControl.decode_pid;
if(pid>0) kill(pid,SIGTERM);
getPlayerData()->playerControl.decode_pid = 0;
}
void player_sigHandler(int signal) {
if(signal==SIGCHLD) {
int status;
int pid = wait3(&status,WNOHANG,NULL);
if(player_pid==pid) {
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR("player process died from a "
"non-TERM signal: %i\n",
WTERMSIG(status));
}
resetPlayer();
}
else if(pid==getPlayerData()->playerControl.decode_pid &&
player_pid<=0)
void player_sigChldHandler(int pid, int status) {
if(player_pid==pid) {
DEBUG("SIGCHLD caused by player process\n");
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM &&
WTERMSIG(status)!=SIGINT)
{
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR("(caught by master parent) "
"decode process died from a "
"non-TERM signal: %i\n",
WTERMSIG(status));
}
getPlayerData()->playerControl.decode_pid = 0;
ERROR("player process died from signal: %i\n",
WTERMSIG(status));
}
resetPlayer();
}
else if(pid==getPlayerData()->playerControl.decode_pid && player_pid<=0)
{
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR("(caught by master parent) "
"decode process died from a "
"non-TERM signal: %i\n",
WTERMSIG(status));
}
getPlayerData()->playerControl.decode_pid = 0;
}
}
int playerInit() {
blockSignals();
player_pid = fork();
if(player_pid==0) {
PlayerControl * pc = &(getPlayerData()->playerControl);
struct sigaction sa;
clearUpdatePid();
unblockSignals();
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE,&sa,NULL);
finishSigHandlers();
sa.sa_handler = decodeSigHandler;
sigaction(SIGCHLD,&sa,NULL);
sigaction(SIGTERM,&sa,NULL);
while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGTERM,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGINT,&sa,NULL)<0 && errno==EINTR);
close(listenSocket);
while(close(listenSocket)<0 && errno==EINTR);
freeAllInterfaces();
closeMp3Directory();
finishPlaylist();
closeTables();
finishPaths();
finishPermissions();
finishCommands();
finishVolume();
......@@ -122,7 +139,7 @@ int playerInit() {
else if(pc->stop) pc->stop = 0;
else if(pc->pause) pc->pause = 0;
else if(pc->closeAudio) {
finishAudio();
closeAudioDevice();
pc->closeAudio = 0;
kill(getppid(),SIGUSR1);
}
......@@ -134,51 +151,35 @@ int playerInit() {
pc->queueLockState = PLAYER_QUEUE_UNLOCKED;
pc->unlockQueue = 0;
}
else if(pc->cycleLogFiles) {
myfprintfCloseAndOpenLogFile();
pc->cycleLogFiles = 0;
}
else my_usleep(10000);
}
exit(0);
exit(EXIT_SUCCESS);
}
else if(player_pid<0) {
unblockSignals();
ERROR("player Problems fork()'ing\n");
player_pid = 0;
return -1;
}
unblockSignals();
return 0;
}
int playerGetDecodeType(char * utf8file) {
if(!isFile(utf8file,NULL));
#ifdef HAVE_MAD
else if(hasMp3Suffix(utf8file)) return DECODE_TYPE_MP3;
#endif
#ifdef HAVE_OGG
else if(hasOggSuffix(utf8file)) return DECODE_TYPE_OGG;
#endif
#ifdef HAVE_FLAC
else if(hasFlacSuffix(utf8file)) return DECODE_TYPE_FLAC;
#endif
#ifdef HAVE_AUDIOFILE
else if(hasWaveSuffix(utf8file)) return DECODE_TYPE_AUDIOFILE;
#endif
#ifdef HAVE_FAAD
else if(hasAacSuffix(utf8file)) return DECODE_TYPE_AAC;
else if(hasMp4Suffix(utf8file)) return DECODE_TYPE_MP4;
#endif
return -1;
}
int playerPlay(FILE * fp, char * utf8file) {
int playerPlay(FILE * fp, Song * song) {
PlayerControl * pc = &(getPlayerData()->playerControl);
int decodeType;
if(fp==NULL) fp = stderr;
if(playerStop(fp)<0) return -1;
{
/*{
struct stat st;
if(stat(rmp2amp(utf8ToFsCharset(utf8file)),&st)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
......@@ -186,19 +187,13 @@ int playerPlay(FILE * fp, char * utf8file) {
pc->error = PLAYER_ERROR_FILENOTFOUND;
return 0;
}
}
}*/
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_UNKTYPE;
return 0;
}
pc->decodeType = decodeType;
if(song->tag) pc->fileTime = song->tag->time;
else pc->fileTime = 0;
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
strncpy(pc->utf8url, song->utf8url, MAXPATHLEN);
pc->utf8url[MAXPATHLEN] = '\0';
pc->play = 1;
if(player_pid==0 && playerInit()<0) {
......@@ -206,6 +201,7 @@ int playerPlay(FILE * fp, char * utf8file) {
return -1;
}
resetPlayerMetadata();
while(player_pid>0 && pc->play) my_usleep(1000);
return 0;
......@@ -227,11 +223,11 @@ int playerStop(FILE * fp) {
void playerKill() {
int pid;
PlayerControl * pc = &(getPlayerData()->playerControl);
/*PlayerControl * pc = &(getPlayerData()->playerControl);
playerStop(stderr);
playerCloseAudio(stderr);
if(player_pid>0 && pc->closeAudio) sleep(1);
if(player_pid>0 && pc->closeAudio) sleep(1);*/
pid = player_pid;
if(pid>0) kill(pid,SIGTERM);
......@@ -290,29 +286,42 @@ int getPlayerError() {
}
char * getPlayerErrorStr() {
static char error[2*MAXPATHLEN];
static char * error = NULL;
int errorlen = MAXPATHLEN+1024;
PlayerControl * pc = &(getPlayerData()->playerControl);
error = realloc(error,errorlen+1);
memset(error,0,errorlen+1);
switch(pc->error) {
case PLAYER_ERROR_FILENOTFOUND:
sprintf(error,"file \"%s\" does not exist or is inaccesible",
pc->erroredFile);
return error;
snprintf(error,errorlen,
"file \"%s\" does not exist or is inaccesible",
pc->erroredUrl);
break;
case PLAYER_ERROR_FILE:
sprintf(error,"problems decoding \"%s\"",pc->erroredFile);
return error;
snprintf(error,errorlen,"problems decoding \"%s\"",
pc->erroredUrl);
break;
case PLAYER_ERROR_AUDIO:
sprintf(error,"problems opening audio device");
return error;
snprintf(error,errorlen,"problems opening audio device");
break;
case PLAYER_ERROR_SYSTEM:
sprintf(error,"system error occured");
return error;
snprintf(error,errorlen,"system error occured");
break;
case PLAYER_ERROR_UNKTYPE:
sprintf(error,"file type of \"%s\" is unknown",pc->erroredFile);
return error;
snprintf(error,errorlen,"file type of \"%s\" is unknown",
pc->erroredUrl);
default:
return NULL;
break;
}
errorlen = strlen(error);
error = realloc(error,errorlen+1);
if(errorlen) return error;
return NULL;
}
void playerCloseAudio() {
......@@ -324,17 +333,15 @@ void playerCloseAudio() {
}
}
int queueSong(char * utf8file) {
int queueSong(Song * song) {
PlayerControl * pc = &(getPlayerData()->playerControl);
int decodeType;
if(pc->queueState==PLAYER_QUEUE_BLANK) {
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
strncpy(pc->utf8url, song->utf8url, MAXPATHLEN);
pc->utf8url[MAXPATHLEN] = '\0';
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) return -1;
pc->decodeType = decodeType;
if(song->tag) pc->fileTime = song->tag->time;
else pc->fileTime = 0;
pc->queueState = PLAYER_QUEUE_FULL;
return 0;
......@@ -375,32 +382,25 @@ void playerQueueUnlock() {
}
}
int playerSeek(FILE * fp, char * utf8file, float time) {
int playerSeek(FILE * fp, Song * song, float time) {
PlayerControl * pc = &(getPlayerData()->playerControl);
char * file;
int decodeType;
if(pc->state==PLAYER_STATE_STOP) {
myfprintf(fp,"%s player not currently playing\n",
COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_PLAYER_SYNC,
"player not currently playing");
return -1;
}
file = rmp2amp(utf8ToFsCharset(utf8file));
if(strcmp(pc->file,file)!=0) {
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) {
myfprintf(fp,"%s unknown file type: %s\n",
COMMAND_RESPOND_ERROR, utf8file);
return -1;
}
pc->decodeType = decodeType;
if(strcmp(pc->utf8url, song->utf8url)!=0) {
if(song->tag) pc->fileTime = song->tag->time;
else pc->fileTime = 0;
strncpy(pc->file,file,MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
strncpy(pc->utf8url, song->utf8url, MAXPATHLEN);
pc->utf8url[MAXPATHLEN] = '\0';
}
if(pc->error==PLAYER_ERROR_NOERROR) {
resetPlayerMetadata();
pc->seekWhere = time;
pc->seek = 1;
while(player_pid>0 && pc->seek) my_usleep(1000);
......@@ -426,7 +426,7 @@ void setPlayerCrossFade(float crossFadeInSeconds) {
void setPlayerSoftwareVolume(int volume) {
PlayerControl * pc;
volume = (volume>100) ? 100 : (volume<0 ? 0 : volume);
volume = (volume>1000) ? 1000 : (volume<0 ? 0 : volume);
pc = &(getPlayerData()->playerControl);
......@@ -442,11 +442,7 @@ int getPlayerSoftwareVolume() {
double getPlayerTotalPlayTime() {
PlayerControl * pc = &(getPlayerData()->playerControl);
if(pc->state==PLAYER_STATE_STOP) {
return pc->totalPlayTime;
}
return pc->totalPlayTime+pc->elapsedTime-pc->beginTime;
return pc->totalPlayTime;
}
unsigned int getPlayerSampleRate() {
......@@ -466,3 +462,43 @@ int getPlayerChannels() {
return pc->channels;
}
void playerCycleLogFiles() {
PlayerControl * pc = &(getPlayerData()->playerControl);
DecoderControl * dc = &(getPlayerData()->decoderControl);
pc->cycleLogFiles = 1;
dc->cycleLogFiles = 1;
}
/* this actually creates a dupe of the current metadata */
Song * playerCurrentDecodeSong() {
static Song * song = NULL;
PlayerControl * pc = &(getPlayerData()->playerControl);
if(pc->metadataState == PLAYER_METADATA_STATE_READ &&
(!song || strcmp(song->utf8url, pc->currentUrl)))
{
if(song) freeJustSong(song);
song = newNullSong();
song->tag = newMpdTag();
if(song->utf8url) free(song->utf8url);
song->utf8url = strdup(pc->currentUrl);
if(pc->title >= 0) {
song->tag->title = strdup(pc->title + pc->metadata);
}
if(pc->artist >= 0) {
song->tag->artist = strdup(pc->artist + pc->metadata);
}
if(pc->album >= 0) {
song->tag->album = strdup(pc->album + pc->metadata);
}
validateUtf8Tag(song->tag);
resetPlayerMetadata();
return song;
}
return NULL;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -21,7 +21,9 @@
#include "../config.h"
#include "decode.h"
#include "mpd_types.h"
#include "song.h"
#include <stdio.h>
#include <sys/param.h>
......@@ -50,38 +52,49 @@
#define PLAYER_QUEUE_UNLOCKED 0
#define PLAYER_QUEUE_LOCKED 1
#define PLAYER_METADATA_STATE_READ 1
#define PLAYER_METADATA_STATE_WRITE 2
typedef struct _PlayerControl {
mpd_sint8 decodeType;
mpd_sint8 stop;
mpd_sint8 play;
mpd_sint8 pause;
mpd_sint8 state;
mpd_sint8 closeAudio;
mpd_sint8 error;
mpd_uint16 bitRate;
mpd_sint8 bits;
mpd_sint8 channels;
mpd_uint32 sampleRate;
float beginTime;
float totalTime;
float elapsedTime;
char file[MAXPATHLEN+1];
char erroredFile[MAXPATHLEN+1];
mpd_sint8 queueState;
mpd_sint8 queueLockState;
mpd_sint8 lockQueue;
mpd_sint8 unlockQueue;
mpd_sint8 seek;
double seekWhere;
float crossFade;
mpd_sint8 softwareVolume;
double totalPlayTime;
int decode_pid;
volatile mpd_sint8 stop;
volatile mpd_sint8 play;
volatile mpd_sint8 pause;
volatile mpd_sint8 state;
volatile mpd_sint8 closeAudio;
volatile mpd_sint8 error;
volatile mpd_uint16 bitRate;
volatile mpd_sint8 bits;
volatile mpd_sint8 channels;
volatile mpd_uint32 sampleRate;
volatile float totalTime;
volatile float elapsedTime;
volatile float fileTime;
char utf8url[MAXPATHLEN+1];
char currentUrl[MAXPATHLEN+1];
char erroredUrl[MAXPATHLEN+1];
volatile mpd_sint8 queueState;
volatile mpd_sint8 queueLockState;
volatile mpd_sint8 lockQueue;
volatile mpd_sint8 unlockQueue;
volatile mpd_sint8 seek;
volatile double seekWhere;
volatile float crossFade;
volatile mpd_uint16 softwareVolume;
volatile double totalPlayTime;
volatile int decode_pid;
volatile mpd_sint8 cycleLogFiles;
volatile mpd_sint8 metadataState;
char metadata[DECODE_METADATA_LENGTH];
volatile mpd_sint16 title;
volatile mpd_sint16 artist;
volatile mpd_sint16 album;
} PlayerControl;
void player_sigHandler(int signal);
void clearPlayerPid();
void player_sigChldHandler(int pid, int status);
int playerPlay(FILE * fp, char * utf8file);
int playerPlay(FILE * fp, Song * song);
int playerSetPause(FILE * fp, int pause);
......@@ -111,7 +124,7 @@ int getPlayerError();
int playerInit();
int queueSong(char * utf8file);
int queueSong(Song * song);
int getPlayerQueueState();
......@@ -121,7 +134,7 @@ void playerQueueLock();
void playerQueueUnlock();
int playerSeek(FILE * fp, char * utf8file, float time);
int playerSeek(FILE * fp, Song * song, float time);
void setPlayerCrossFade(float crossFadeInSeconds);
......@@ -139,4 +152,9 @@ int getPlayerBits();
int getPlayerChannels();
void playerCycleLogFiles();
Song * playerCurrentDecodeSong();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -39,13 +39,13 @@ void initPlayerData() {
int crossfade = 0;
size_t bufferSize;
size_t allocationSize;
Buffer * buffer;
OutputBuffer * buffer;
bufferSize = strtol(getConf()[CONF_BUFFER_SIZE],&test,10);
if(*test!='\0' || bufferSize<=0) {
ERROR("buffer size \"%s\" is not a positive integer\n",
getConf()[CONF_BUFFER_SIZE]);
exit(-1);
exit(EXIT_FAILURE);
}
bufferSize*=1024;
......@@ -53,7 +53,7 @@ void initPlayerData() {
if(buffered_chunks >= 1<<15) {
ERROR("buffer size \"%i\" is too big\n",bufferSize);
exit(-1);
exit(EXIT_FAILURE);
}
perc = strtod((getConf())[CONF_BUFFER_BEFORE_PLAY],&test);
......@@ -61,7 +61,7 @@ void initPlayerData() {
ERROR("buffered before play \"%s\" is not a positive "
"percentage and less than 100 percent\n",
(getConf())[CONF_BUFFER_BEFORE_PLAY]);
exit(-1);
exit(EXIT_FAILURE);
}
buffered_before_play = (perc/100)*buffered_chunks;
if(buffered_before_play>buffered_chunks) {
......@@ -77,15 +77,15 @@ void initPlayerData() {
if((shmid = shmget(IPC_PRIVATE,allocationSize,IPC_CREAT|0600))<0) {
ERROR("problems shmget'ing\n");
exit(-1);
exit(EXIT_FAILURE);
}
if((playerData_pd = shmat(shmid,NULL,0))<0) {
ERROR("problems shmat'ing\n");
exit(-1);
exit(EXIT_FAILURE);
}
if (shmctl(shmid, IPC_RMID, 0)<0) {
ERROR("problems shmctl'ing\n");
exit(-1);
exit(EXIT_FAILURE);
}
buffer = &(playerData_pd->buffer);
......@@ -108,19 +108,33 @@ void initPlayerData() {
playerData_pd->playerControl.queueState = PLAYER_QUEUE_BLANK;
playerData_pd->playerControl.queueLockState = PLAYER_QUEUE_UNLOCKED;
playerData_pd->playerControl.seek = 0;
memset(playerData_pd->playerControl.file,0,MAXPATHLEN+1);
memset(playerData_pd->playerControl.erroredFile,0,MAXPATHLEN+1);
memset(playerData_pd->playerControl.utf8url, 0, MAXPATHLEN+1);
memset(playerData_pd->playerControl.erroredUrl, 0, MAXPATHLEN+1);
memset(playerData_pd->playerControl.currentUrl, 0, MAXPATHLEN+1);
memset(playerData_pd->playerControl.metadata, 0,
DECODE_METADATA_LENGTH);
playerData_pd->playerControl.crossFade = crossfade;
playerData_pd->playerControl.softwareVolume = 100;
playerData_pd->playerControl.softwareVolume = 1000;
playerData_pd->playerControl.totalPlayTime = 0;
playerData_pd->playerControl.decode_pid = 0;
playerData_pd->playerControl.title = -1;
playerData_pd->playerControl.artist = -1;
playerData_pd->playerControl.album = -1;
playerData_pd->playerControl.metadataState =
PLAYER_METADATA_STATE_WRITE;
playerData_pd->decoderControl.stop = 0;
playerData_pd->decoderControl.start = 0;
playerData_pd->decoderControl.state = DECODE_STATE_STOP;
playerData_pd->decoderControl.seek = 0;
playerData_pd->decoderControl.error = DECODE_ERROR_NOERROR;
memset(playerData_pd->decoderControl.file,0,MAXPATHLEN+1);
memset(playerData_pd->decoderControl.utf8url, 0, MAXPATHLEN+1);
memset(playerData_pd->decoderControl.metadata, 0,
DECODE_METADATA_LENGTH);
playerData_pd->decoderControl.title = -1;
playerData_pd->decoderControl.artist = -1;
playerData_pd->decoderControl.album = -1;
playerData_pd->decoderControl.metadataSet = 0;
}
PlayerData * getPlayerData() {
......@@ -130,3 +144,4 @@ PlayerData * getPlayerData() {
void freePlayerData() {
shmdt(playerData_pd);
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -25,6 +25,7 @@
#include "player.h"
#include "decode.h"
#include "mpd_types.h"
#include "outputBuffer.h"
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
#define CHUNK_SIZE 1020
......@@ -32,21 +33,8 @@
extern int buffered_before_play;
extern int buffered_chunks;
typedef struct _Buffer {
char * chunks;
mpd_uint16 * chunkSize;
mpd_uint16 * bitRate;
float * times;
mpd_sint16 begin;
mpd_sint16 end;
mpd_sint16 next;
mpd_sint8 wrap;
float totalTime;
} Buffer;
typedef struct _PlayerData {
Buffer buffer;
AudioFormat audioFormat;
OutputBuffer buffer;
PlayerControl playerControl;
DecoderControl decoderControl;
} PlayerData;
......@@ -54,8 +42,8 @@ typedef struct _PlayerData {
void initPlayerData();
PlayerData * getPlayerData();
Buffer * getBuffer();
void freePlayerData();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -71,21 +71,21 @@ typedef struct _Playlist {
unsigned long version;
} Playlist;
Playlist playlist;
int playlist_state = PLAYLIST_STATE_STOP;
int playlist_max_length;
int playlist_stopOnError;
int playlist_errorCount = 0;
int playlist_queueError;
int playlist_noGoToNext = 0;
static Playlist playlist;
static int playlist_state = PLAYLIST_STATE_STOP;
static int playlist_max_length;
static int playlist_stopOnError;
static int playlist_errorCount = 0;
static int playlist_queueError;
static int playlist_noGoToNext = 0;
int playlist_saveAbsolutePaths;
static int playlist_saveAbsolutePaths;
char * playlist_stateFile = NULL;
static char * playlist_stateFile = NULL;
void swapOrder(int a, int b);
int playPlaylistOrderNumber(FILE * fp, int orderNum);
void randomizeOrder(int start, int end);
static void swapOrder(int a, int b);
static int playPlaylistOrderNumber(FILE * fp, int orderNum);
static void randomizeOrder(int start, int end);
void incrPlaylistVersion() {
static unsigned long max = ((unsigned long)1<<BITS_FOR_VERSION)-1;
......@@ -93,6 +93,16 @@ void incrPlaylistVersion() {
if(playlist.version>=max) playlist.version = 0;
}
static void incrPlaylistCurrent() {
if(playlist.current < 0) return;
if(playlist.current >= playlist.length-1) {
if(playlist.repeat) playlist.current = 0;
else playlist.current = -1;
}
else playlist.current++;
}
void initPlaylist() {
char * test;
......@@ -101,14 +111,13 @@ void initPlaylist() {
playlist.version = 0;
playlist.random = 0;
playlist.queued = -1;
blockTermSignal();
playlist.current = -1;
playlist_max_length = strtol((getConf())[CONF_MAX_PLAYLIST_LENGTH],&test,10);
if(*test!='\0') {
ERROR("max playlist length \"%s\" is not an integer\n",
(getConf())[CONF_MAX_PLAYLIST_LENGTH]);
exit(-1);
exit(EXIT_FAILURE);
}
if(strcmp("yes",(getConf())[CONF_SAVE_ABSOLUTE_PATHS_IN_PLAYLISTS])
......@@ -123,7 +132,7 @@ void initPlaylist() {
ERROR("save_absolute_paths_in_playlist \"%s\" is not yes or "
"no\n",
(getConf())[CONF_SAVE_ABSOLUTE_PATHS_IN_PLAYLISTS]);
exit(-1);
exit(EXIT_FAILURE);
}
playlist.songs = malloc(sizeof(Song *)*playlist_max_length);
......@@ -137,14 +146,19 @@ void initPlaylist() {
playlist_stateFile = getConf()[CONF_STATE_FILE];
}
unblockTermSignal();
}
void finishPlaylist() {
stopPlaylist(stderr);
clearPlaylist(stderr);
int i;
for(i=0;i<playlist.length;i++) {
if(playlist.songs[i]->type == SONG_TYPE_URL) {
freeJustSong(playlist.songs[i]);
}
}
free(playlist.songs);
playlist.songs = NULL;
free(playlist.order);
playlist.order = NULL;
}
int clearPlaylist(FILE * fp) {
......@@ -152,10 +166,14 @@ int clearPlaylist(FILE * fp) {
if(stopPlaylist(fp)<0) return -1;
blockTermSignal();
for(i=0;i<playlist.length;i++) playlist.songs[i] = NULL;
for(i=0;i<playlist.length;i++) {
if(playlist.songs[i]->type == SONG_TYPE_URL) {
freeJustSong(playlist.songs[i]);
}
playlist.songs[i] = NULL;
}
playlist.length = 0;
unblockTermSignal();
playlist.current = -1;
incrPlaylistVersion();
......@@ -166,7 +184,7 @@ int showPlaylist(FILE * fp) {
int i;
for(i=0;i<playlist.length;i++) {
myfprintf(fp,"%i:%s\n",i,(playlist.songs[i])->utf8file);
myfprintf(fp,"%i:%s\n",i,(playlist.songs[i])->utf8url);
}
return 0;
......@@ -176,7 +194,6 @@ void savePlaylistState() {
if(playlist_stateFile) {
FILE * fp;
blockTermSignal();
while(!(fp = fopen(playlist_stateFile,"w")) && errno==EINTR);
if(!fp) {
ERROR("problems opening state file \"%s\" for "
......@@ -216,7 +233,6 @@ void savePlaylistState() {
myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_PLAYLIST_END);
while(fclose(fp) && errno==EINTR);
unblockTermSignal();
}
}
......@@ -228,14 +244,14 @@ void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current,
if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) {
ERROR("error parsing state file \"%s\"\n",playlist_stateFile);
exit(-1);
exit(EXIT_FAILURE);
}
while(strcmp(buffer,PLAYLIST_STATE_FILE_PLAYLIST_END)) {
song = atoi(strtok(buffer,":"));
if(!(temp = strtok(NULL,""))) {
ERROR("error parsing state file \"%s\"\n",
playlist_stateFile);
exit(-1);
exit(EXIT_FAILURE);
}
if(addToPlaylist(stderr,temp)==0 && current==song) {
if(state!=PLAYER_STATE_STOP) {
......@@ -252,7 +268,7 @@ void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current,
if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) {
ERROR("error parsing state file \"%s\"\n",
playlist_stateFile);
exit(-1);
exit(EXIT_FAILURE);
}
}
}
......@@ -270,14 +286,14 @@ void readPlaylistState() {
if(!S_ISREG(st.st_mode)) {
ERROR("state file \"%s\" is not a regular "
"file\n",playlist_stateFile);
exit(-1);
exit(EXIT_FAILURE);
}
fp = fopen(playlist_stateFile,"r");
if(!fp) {
ERROR("problems opening state file \"%s\" for "
"reading\n",playlist_stateFile);
exit(-1);
exit(EXIT_FAILURE);
}
while(myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) {
......@@ -329,7 +345,7 @@ void readPlaylistState() {
ERROR("error parsing state "
"file \"%s\"\n",
playlist_stateFile);
exit(-1);
exit(EXIT_FAILURE);
}
current = atoi(&(buffer
[strlen(PLAYLIST_STATE_FILE_CURRENT)]));
......@@ -359,12 +375,13 @@ int playlistInfo(FILE * fp,int song) {
end = song+1;
}
if(song>=playlist.length) {
myfprintf(fp,"%s song doesn't exist\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", song);
return -1;
}
for(i=begin;i<end;i++) {
myfprintf(fp,"file: %s\n",(playlist.songs[i])->utf8file);
myfprintf(fp,"file: %s\n",(playlist.songs[i])->utf8url);
if((tag = (playlist.songs[i])->tag)) {
printMpdTag(fp,tag);
}
......@@ -387,9 +404,10 @@ void queueNextSongInPlaylist() {
DEBUG("playlist: queue song %i:\"%s\"\n",
playlist.queued,
playlist.songs[playlist.order[
playlist.queued]]->utf8file);
if(queueSong(playlist.songs[playlist.order[
playlist.queued]]->utf8file)<0) {
playlist.queued]]->utf8url);
if(queueSong(playlist.songs[playlist.order[playlist.queued]]) <
0)
{
playlist.queued = -1;
playlist_queueError = 1;
}
......@@ -402,9 +420,10 @@ void queueNextSongInPlaylist() {
DEBUG("playlist: queue song %i:\"%s\"\n",
playlist.queued,
playlist.songs[playlist.order[
playlist.queued]]->utf8file);
if(queueSong(playlist.songs[playlist.order[
playlist.queued]]->utf8file)<0) {
playlist.queued]]->utf8url);
if(queueSong(playlist.songs[playlist.order[playlist.queued]]) <
0)
{
playlist.queued = -1;
playlist_queueError = 1;
}
......@@ -456,13 +475,21 @@ void clearPlayerQueue() {
}
}
int addToPlaylist(FILE * fp, char * file) {
int addToPlaylist(FILE * fp, char * url) {
Song * song;
DEBUG("add to playlist: %s\n",file);
DEBUG("add to playlist: %s\n",url);
if(!(song = getSong(file))) {
myfprintf(fp,"%s \"%s\" is not in the music db\n",COMMAND_RESPOND_ERROR,file);
if((song = getSongFromDB(url))) {
}
else if(isValidRemoteUtf8Url(url) &&
(song = newSong(url,SONG_TYPE_URL)))
{
}
else {
commandError(fp, ACK_ERROR_NO_EXIST,
"\"%s\" is not in the music db or is"
"not a valid url\n", url);
return -1;
}
......@@ -471,7 +498,8 @@ int addToPlaylist(FILE * fp, char * file) {
int addSongToPlaylist(FILE * fp, Song * song) {
if(playlist.length==playlist_max_length) {
myfprintf(fp,"%s playlist is at the max size\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_PLAYLIST_MAX,
"playlist is at the max size");
return -1;
}
......@@ -490,12 +518,14 @@ int addSongToPlaylist(FILE * fp, Song * song) {
if(playlist.random) {
int swap;
int start;
if(playlist_state==PLAYLIST_STATE_STOP) start = 0;
else if(playlist.queued>=0) start = playlist.queued+1;
/*if(playlist_state==PLAYLIST_STATE_STOP) start = 0;
else */if(playlist.queued>=0) start = playlist.queued+1;
else start = playlist.current+1;
swap = rand()%(playlist.length-start);
swap+=start;
swapOrder(playlist.length-1,swap);
if(start < playlist.length) {
swap = rand()%(playlist.length-start);
swap+=start;
swapOrder(playlist.length-1,swap);
}
}
incrPlaylistVersion();
......@@ -508,17 +538,16 @@ int swapSongsInPlaylist(FILE * fp, int song1, int song2) {
int currentSong = -1;
if(song1<0 || song1>=playlist.length) {
fprintf(fp,"%s \"%i\" is not in the playlist\n",
COMMAND_RESPOND_ERROR,song1);
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", song1);
return -1;
}
if(song2<0 || song2>=playlist.length) {
fprintf(fp,"%s \"%i\" is not in the playlist\n",
COMMAND_RESPOND_ERROR,song2);
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", song2);
return -1;
}
blockTermSignal();
if(playlist_state==PLAYLIST_STATE_PLAY) {
if(playlist.queued>=0) {
......@@ -552,8 +581,6 @@ int swapSongsInPlaylist(FILE * fp, int song1, int song2) {
else if(playlist.current==song2) playlist.current = song1;
}
unblockTermSignal();
incrPlaylistVersion();
return 0;
......@@ -563,16 +590,12 @@ int deleteFromPlaylist(FILE * fp, int song) {
int i;
int songOrder;
if(song<0) {
myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
return -1;
}
if(song>=playlist.length) {
myfprintf(fp,"%s song doesn't exist\n",COMMAND_RESPOND_ERROR);
if(song<0 || song>=playlist.length) {
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", song);
return -1;
}
blockTermSignal();
if(playlist_state==PLAYLIST_STATE_PLAY) {
if(playlist.queued>=0 && (playlist.order[playlist.queued]==song
|| playlist.order[playlist.current]==song))
......@@ -583,6 +606,10 @@ int deleteFromPlaylist(FILE * fp, int song) {
}
}
if(playlist.songs[song]->type == SONG_TYPE_URL) {
freeJustSong(playlist.songs[song]);
}
/* delete song from songs array */
for(i=song;i<playlist.length-1;i++) {
playlist.songs[i] = playlist.songs[i+1];
......@@ -602,8 +629,6 @@ int deleteFromPlaylist(FILE * fp, int song) {
playlist.songs[playlist.length-1] = NULL;
playlist.length--;
unblockTermSignal();
incrPlaylistVersion();
if(playlist_state!=PLAYLIST_STATE_STOP && playlist.current==songOrder) {
......@@ -612,12 +637,15 @@ int deleteFromPlaylist(FILE * fp, int song) {
playerStop(stderr);
playlist_noGoToNext = 1;
}
else if(playlist_state!=PLAYLIST_STATE_STOP &&
playlist.current>songOrder) {
if(playlist.current>=playlist.length) {
incrPlaylistCurrent();
}
else if(playlist.current>songOrder) {
playlist.current--;
}
if(playlist_state!=PLAYLIST_STATE_STOP && playlist.queued>songOrder) {
if(playlist.queued>songOrder) {
playlist.queued--;
}
......@@ -626,6 +654,8 @@ int deleteFromPlaylist(FILE * fp, int song) {
void deleteASongFromPlaylist(Song * song) {
int i;
if(NULL==playlist.songs) return;
for(i=0;i<playlist.length;i++) {
if(song==playlist.songs[i]) {
......@@ -653,17 +683,17 @@ int playPlaylistOrderNumber(FILE * fp, int orderNum) {
playlist_noGoToNext = 0;
playlist.queued = -1;
playlist_queueError = 0;
playlist.current = orderNum;
DEBUG("playlist: play %i:\"%s\"\n",orderNum,
(playlist.songs[playlist.order[orderNum]])->utf8file);
(playlist.songs[playlist.order[orderNum]])->utf8url);
if(playerPlay(fp,(playlist.songs[playlist.order[orderNum]])->
utf8file)<0)
{
if(playerPlay(fp,(playlist.songs[playlist.order[orderNum]])) < 0) {
stopPlaylist(fp);
return -1;
}
else playlist.current++;
playlist.current = orderNum;
return 0;
}
......@@ -673,35 +703,38 @@ int playPlaylist(FILE * fp, int song, int stopOnError) {
clearPlayerError();
if(song==-1) i = 0;
else if(song<0) {
myfprintf(fp,"%s need integer >= -1\n",COMMAND_RESPOND_ERROR);
playlist_state = PLAYLIST_STATE_STOP;
return -1;
}
if(!playlist.length) {
myfprintf(fp,"%s playlist is empty\n",COMMAND_RESPOND_ERROR);
playlist_state = PLAYLIST_STATE_STOP;
return -1;
}
else if(song>=playlist.length) {
myfprintf(fp,"%s song doesn't exist\n",COMMAND_RESPOND_ERROR);
playlist_state = PLAYLIST_STATE_STOP;
if(song==-1) {
if(playlist.length == 0) return 0;
if(playlist_state == PLAYLIST_STATE_PLAY) {
return playerSetPause(fp, 0);
}
if(playlist.current >= 0 && playlist.current < playlist.length)
{
i = playlist.current;
}
else {
i = 0;
}
}
else if(song<0 || song>=playlist.length) {
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", song);
return -1;
}
if(playlist.random) {
/*if(song == -1 && playlist_state==PLAYLIST_STATE_PLAY) {
if(song == -1 && playlist_state==PLAYLIST_STATE_PLAY) {
randomizeOrder(0,playlist.length-1);
}
else {*/
else {
if(song>=0) for(i=0;song!=playlist.order[i];i++);
if(playlist_state==PLAYLIST_STATE_STOP) {
playlist.current = 0;
}
swapOrder(i,playlist.current);
i = playlist.current;
/*}*/
}
}
playlist_stopOnError = stopOnError;
......@@ -710,11 +743,33 @@ int playPlaylist(FILE * fp, int song, int stopOnError) {
return playPlaylistOrderNumber(fp,i);
}
void syncCurrentPlayerDecodeMetadata() {
Song * songPlayer = playerCurrentDecodeSong();
Song * song;
if(!songPlayer) return;
if(playlist_state!=PLAYLIST_STATE_PLAY) return;
song = playlist.songs[playlist.order[playlist.current]];
if(song->type == SONG_TYPE_URL &&
0 == strcmp(song->utf8url, songPlayer->utf8url) &&
!mpdTagsAreEqual(song->tag, songPlayer->tag))
{
if(song->tag) freeMpdTag(song->tag);
song->tag = mpdTagDup(songPlayer->tag);
incrPlaylistVersion();
}
}
void syncPlayerAndPlaylist() {
if(playlist_state!=PLAYLIST_STATE_PLAY) return;
if(getPlayerState()==PLAYER_STATE_STOP) playPlaylistIfPlayerStopped();
else syncPlaylistWithQueue(!playlist_queueError);
syncCurrentPlayerDecodeMetadata();
}
int currentSongInPlaylist(FILE * fp) {
......@@ -724,7 +779,7 @@ int currentSongInPlaylist(FILE * fp) {
syncPlaylistWithQueue(0);
if(playlist.current<playlist.length) {
if(playlist.current>= 0 && playlist.current<playlist.length) {
return playPlaylistOrderNumber(fp,playlist.current);
}
else return stopPlaylist(fp);;
......@@ -747,6 +802,7 @@ int nextSongInPlaylist(FILE * fp) {
return playPlaylistOrderNumber(fp,0);
}
else {
incrPlaylistCurrent();
return stopPlaylist(fp);;
}
......@@ -783,7 +839,7 @@ int getPlaylistRandomStatus() {
int setPlaylistRepeatStatus(FILE * fp, int status) {
if(status!=0 && status!=1) {
myfprintf(fp,"%s \"%i\" is not 0 or 1\n",COMMAND_RESPOND_ERROR,status);
commandError(fp, ACK_ERROR_ARG, "\"%i\" is not 0 or 1", status);
return -1;
}
......@@ -807,18 +863,17 @@ int moveSongInPlaylist(FILE * fp, int from, int to) {
int currentSong = -1;
if(from<0 || from>=playlist.length) {
fprintf(fp,"%s \"%i\" is not a song in the playlist\n",
COMMAND_RESPOND_ERROR,from);
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", from);
return -1;
}
if(to<0 || to>=playlist.length) {
fprintf(fp,"%s \"%i\" is not a song in the playlist\n",
COMMAND_RESPOND_ERROR,to);
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", to);
return -1;
}
blockTermSignal();
if(playlist_state==PLAYLIST_STATE_PLAY) {
if(playlist.queued>=0) {
......@@ -864,8 +919,6 @@ int moveSongInPlaylist(FILE * fp, int from, int to) {
playlist.current++;
}
unblockTermSignal();
incrPlaylistVersion();
return 0;
......@@ -876,7 +929,6 @@ void orderPlaylist() {
playlist.current = playlist.order[playlist.current];
blockTermSignal();
if(playlist_state==PLAYLIST_STATE_PLAY) {
if(playlist.queued>=0) {
lockPlaylistInteraction();
......@@ -889,7 +941,6 @@ void orderPlaylist() {
playlist.order[i] = i;
}
unblockTermSignal();
}
void swapOrder(int a, int b) {
......@@ -904,8 +955,6 @@ void randomizeOrder(int start,int end) {
DEBUG("playlist: randomize from %i to %i\n",start,end);
blockTermSignal();
if(playlist_state==PLAYLIST_STATE_PLAY) {
if(playlist.queued>=start && playlist.queued<=end) {
lockPlaylistInteraction();
......@@ -921,14 +970,13 @@ void randomizeOrder(int start,int end) {
swapOrder(i,ri);
}
unblockTermSignal();
}
int setPlaylistRandomStatus(FILE * fp, int status) {
int statusWas = playlist.random;
if(status!=0 && status!=1) {
myfprintf(fp,"%s \"%i\" is not 0 or 1\n",COMMAND_RESPOND_ERROR,status);
commandError(fp, ACK_ERROR_ARG, "\"%i\" is not 0 or 1", status);
return -1;
}
......@@ -953,7 +1001,10 @@ int previousSongInPlaylist(FILE * fp) {
syncPlaylistWithQueue(0);
if (getPlayerElapsedTime()>PLAYLIST_PREV_UNLESS_ELAPSED) {
if (getPlayerElapsedTime()>PLAYLIST_PREV_UNLESS_ELAPSED &&
playlist.songs[playlist.order[playlist.current]]->type
!= SONG_TYPE_URL)
{
return playPlaylistOrderNumber(fp,playlist.current);
}
else {
......@@ -976,7 +1027,6 @@ int shufflePlaylist(FILE * fp) {
int ri;
if(playlist.length>1) {
blockTermSignal();
if(playlist_state==PLAYLIST_STATE_PLAY) {
lockPlaylistInteraction();
clearPlayerQueue();
......@@ -991,13 +1041,15 @@ int shufflePlaylist(FILE * fp) {
else playlist.current = 0;
i = 1;
}
else i = 0;
else {
i = 0;
playlist.current = -1;
}
/* shuffle the rest of the list */
for(;i<playlist.length;i++) {
ri = rand()%(playlist.length-1)+1;
swapSongs(i,ri);
}
unblockTermSignal();
incrPlaylistVersion();
}
......@@ -1018,13 +1070,14 @@ int deletePlaylist(FILE * fp, char * utf8file) {
if((actualFile = rpp2app(rfile)) && isPlaylist(actualFile)) free(rfile);
else {
free(rfile);
myfprintf(fp,"%s playlist \"%s\" not found\n",
COMMAND_RESPOND_ERROR,utf8file);
commandError(fp, ACK_ERROR_NO_EXIST,
"playlist \"%s\" not found", utf8file);
return -1;
}
if(unlink(actualFile)<0) {
myfprintf(fp,"%s problems deleting file\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_SYSTEM,
"problems deleting file");
return -1;
}
......@@ -1040,9 +1093,9 @@ int savePlaylist(FILE * fp, char * utf8file) {
char * actualFile;
if(strstr(utf8file,"/")) {
myfprintf(fp,"%s cannot save \"%s\", saving playlists to "
"subdirectories is not supported\n",
COMMAND_RESPOND_ERROR,utf8file);
commandError(fp, ACK_ERROR_ARG,
"cannot save \"%s\", saving playlists to "
"subdirectories is not supported", utf8file);
return -1;
}
......@@ -1062,24 +1115,26 @@ int savePlaylist(FILE * fp, char * utf8file) {
free(rfile);
if(0==stat(actualFile,&st)) {
myfprintf(fp,"%s A file or directory already exists with the name \"%s\"\n",COMMAND_RESPOND_ERROR,utf8file);
myfprintf(fp, "a file or directory already exists with the name"
" \"%s\"", utf8file);
return -1;
}
while(!(fileP = fopen(actualFile,"w")) && errno==EINTR);
if(fileP==NULL) {
myfprintf(fp,"%s Problems opening file\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_SYSTEM, "problems opening file");
return -1;
}
for(i=0;i<playlist.length;i++) {
if(playlist_saveAbsolutePaths) {
myfprintf(fileP,"%s%s\n",musicDir,
utf8ToFsCharset((playlist.songs[i])->utf8file));
if(playlist_saveAbsolutePaths &&
playlist.songs[i]->type==SONG_TYPE_FILE)
{
myfprintf(fileP,"%s\n",rmp2amp(utf8ToFsCharset((
playlist.songs[i])->utf8url)));
}
else myfprintf(fileP,"%s\n",
utf8ToFsCharset((playlist.songs[i])->utf8file));
utf8ToFsCharset((playlist.songs[i])->utf8url));
}
while(fclose(fileP) && errno==EINTR);
......@@ -1109,15 +1164,15 @@ int loadPlaylist(FILE * fp, char * utf8file) {
if((actualFile = rpp2app(rfile)) && isPlaylist(actualFile)) free(rfile);
else {
free(rfile);
myfprintf(fp,"%s playlist \"%s\" not found\n",
COMMAND_RESPOND_ERROR,utf8file);
commandError(fp, ACK_ERROR_NO_EXIST,
"playlist \"%s\" not found", utf8file);
return -1;
}
while(!(fileP = fopen(actualFile,"r")) && errno==EINTR);
if(fileP==NULL) {
myfprintf(fp,"%s Problems opening file \"%s\"\n",
COMMAND_RESPOND_ERROR,utf8file);
commandError(fp, ACK_ERROR_SYSTEM,
"problems opening file \"%s\"", utf8file);
return -1;
}
......@@ -1135,7 +1190,10 @@ int loadPlaylist(FILE * fp, char * utf8file) {
strncat(s,"/",MAXPATHLEN-parentlen);
strncat(s,temp,MAXPATHLEN-parentlen-1);
if(strlen(s)>=MAXPATHLEN) {
myfprintf(fp,"%s \"%s\" too long\n",COMMAND_RESPOND_ERROR,temp);
commandError(fp,
ACK_ERROR_PLAYLIST_LOAD,
"\"%s\" too long",
temp);
free(temp);
while(fclose(fileP) && errno==EINTR);
if(erroredFile) free(erroredFile);
......@@ -1144,8 +1202,12 @@ int loadPlaylist(FILE * fp, char * utf8file) {
free(temp);
}
slength = 0;
temp = strdup(fsCharsetToUtf8(s));
if(s[0]==PLAYLIST_COMMENT && !getSong(temp)) {
temp = fsCharsetToUtf8(s);
if(!temp) continue;
temp = strdup(temp);
if(s[0]==PLAYLIST_COMMENT && !getSongFromDB(temp)
&& !isRemoteUrl(temp))
{
free(temp);
continue;
}
......@@ -1156,7 +1218,8 @@ int loadPlaylist(FILE * fp, char * utf8file) {
}
else if(slength==MAXPATHLEN) {
s[slength] = '\0';
myfprintf(fp,"%s \"%s\" too long\n",COMMAND_RESPOND_ERROR,s);
commandError(fp, ACK_ERROR_PLAYLIST_LOAD,
"\"%s\" too long", s);
while(fclose(fileP) && errno==EINTR);
if(erroredFile) free(erroredFile);
return -1;
......@@ -1167,8 +1230,8 @@ int loadPlaylist(FILE * fp, char * utf8file) {
while(fclose(fileP) && errno==EINTR);
if(erroredFile) {
myfprintf(fp,"%s can't add file \"%s\"\n",COMMAND_RESPOND_ERROR,
erroredFile);
commandError(fp, ACK_ERROR_PLAYLIST_LOAD,
"can't add file \"%s\"", erroredFile);
free(erroredFile);
return -1;
}
......@@ -1177,7 +1240,11 @@ int loadPlaylist(FILE * fp, char * utf8file) {
}
int getPlaylistCurrentSong() {
return playlist.order[playlist.current];
if(playlist.current >= 0 && playlist.current < playlist.length) {
return playlist.order[playlist.current];
}
return -1;
}
unsigned long getPlaylistVersion() {
......@@ -1191,16 +1258,9 @@ int getPlaylistLength() {
int seekSongInPlaylist(FILE * fp, int song, float time) {
int i = song;
if(song<0) {
myfprintf(fp,"%s need integer >= -1\n",COMMAND_RESPOND_ERROR);
return -1;
}
if(!playlist.length) {
myfprintf(fp,"%s playlist is empty\n",COMMAND_RESPOND_ERROR);
return -1;
}
else if(song>=playlist.length) {
myfprintf(fp,"%s song doesn't exist\n",COMMAND_RESPOND_ERROR);
if(song<0 || song>=playlist.length) {
commandError(fp, ACK_ERROR_NO_EXIST,
"song doesn't exist: \"%i\"", song);
return -1;
}
......@@ -1223,5 +1283,5 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
if(playPlaylistOrderNumber(fp,i)<0) return -1;
}
return playerSeek(fp,playlist.songs[playlist.order[i]]->utf8file,time);
return playerSeek(fp, playlist.songs[playlist.order[i]], time);
}
......@@ -96,3 +96,4 @@ int seekSongInPlaylist(FILE * fp, int song, float time);
void incrPlaylistVersion();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* (c)2004 replayGain code by AliasMrJones
* This project's homepage is: http://www.musicpd.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 "replayGain.h"
#include "log.h"
#include "conf.h"
#include <string.h>
#include <math.h>
#include <stdlib.h>
/* Added 4/14/2004 by AliasMrJones */
static int replayGainState = REPLAYGAIN_OFF;
void initReplayGainState() {
if(!getConf()[CONF_REPLAYGAIN]) return;
if(strcmp(getConf()[CONF_REPLAYGAIN],"track")==0) {
replayGainState = REPLAYGAIN_TRACK;
}
else if(strcmp(getConf()[CONF_REPLAYGAIN],"album")==0) {
replayGainState = REPLAYGAIN_ALBUM;
}
else {
ERROR("replaygain value \"%s\" is invalid\n",
getConf()[CONF_REPLAYGAIN]);
exit(EXIT_FAILURE);
}
}
int getReplayGainState() {
return replayGainState;
}
float computeReplayGainScale(float gain, float peak){
float scale;
if(gain == 0.0) return(1);
scale = pow(10.0, gain/20.0);
if(scale > 15.0) scale = 15.0;
if (scale * peak > 1.0) {
scale = 1.0 / peak;
}
return(scale);
}
void doReplayGain(char * buffer, int bufferSize, AudioFormat * format,
float scale)
{
mpd_sint16 * buffer16 = (mpd_sint16 *)buffer;
mpd_sint8 * buffer8 = (mpd_sint8 *)buffer;
mpd_sint32 temp32;
if(scale == 1.0) return;
switch(format->bits) {
case 16:
while(bufferSize > 0){
temp32 = *buffer16;
temp32 *= scale;
*buffer16 = temp32>32767 ? 32767 :
(temp32<-32768 ? -32768 : temp32);
buffer16++;
bufferSize-=2;
}
break;
case 8:
while(bufferSize>0){
temp32 = *buffer8;
temp32 *= scale;
*buffer8 = temp32>127 ? 127 :
(temp32<-128 ? -128 : temp32);
buffer8++;
bufferSize--;
}
break;
default:
ERROR("%i bits not supported by doReplaygain!\n", format->bits);
}
}
/* End of added code */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* (c)2004 replayGain code by AliasMrJones
* This project's homepage is: http://www.musicpd.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
......@@ -16,19 +17,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AAC_DECODE_H
#define AAC_DECODE_H
#ifndef REPLAYGAIN_H
#define REPLAYGAIN_H
#include "../config.h"
#include "audio.h"
#ifdef HAVE_FAAD
#define REPLAYGAIN_OFF 0
#define REPLAYGAIN_TRACK 1
#define REPLAYGAIN_ALBUM 2
#include "playerData.h"
void initReplayGainState();
int getAacTotalTime(char * file);
int getReplayGainState();
int aac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);
float computeReplayGainScale(float gain, float peak);
#endif /* HAVE_FAAD */
void doReplayGain(char * buffer, int bufferSize, AudioFormat * format,
float scale);
#endif
......@@ -19,20 +19,51 @@
#include "sig_handlers.h"
#include "player.h"
#include "playlist.h"
#include "directory.h"
#include "command.h"
#include "signal_check.h"
#include "log.h"
#include "player.h"
#include <signal.h>
struct sigaction original_termSa;
void termSigHandler(int signal) {
if(signal==SIGTERM) {
savePlaylistState();
playerKill();
exit(0);
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <errno.h>
int handlePendingSignals() {
if(signal_is_pending(SIGINT) || signal_is_pending(SIGTERM)) {
DEBUG("got SIGINT or SIGTERM, exiting\n");
return COMMAND_RETURN_KILL;
}
if(signal_is_pending(SIGHUP)) {
DEBUG("got SIGHUP, rereading DB\n");
signal_clear(SIGHUP);
if(!isUpdatingDB()) {
readDirectoryDB();
incrPlaylistVersion();
}
if(myfprintfCloseAndOpenLogFile()<0) return COMMAND_RETURN_KILL;
playerCycleLogFiles();
}
return 0;
}
void usr1SigHandler(int signal) {
void chldSigHandler(int signal) {
int status;
int pid;
DEBUG("got SIGCHLD\n");
while(0 != (pid = wait3(&status,WNOHANG,NULL))) {
if(pid<0) {
if(errno==EINTR) continue;
else break;
}
player_sigChldHandler(pid,status);
directory_sigChldHandler(pid,status);
}
}
void initSigHandlers() {
......@@ -41,50 +72,57 @@ void initSigHandlers() {
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE,&sa,NULL);
sa.sa_handler = usr1SigHandler;
sigaction(SIGUSR1,&sa,NULL);
sa.sa_handler = player_sigHandler;
sigaction(SIGCHLD,&sa,NULL);
sa.sa_handler = termSigHandler;
sigaddset(&sa.sa_mask,SIGTERM);
sigaction(SIGTERM,&sa,&original_termSa);
while(sigaction(SIGPIPE,&sa,NULL)<0 && errno==EINTR);
sa.sa_handler = chldSigHandler;
while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
signal_handle(SIGUSR1);
signal_handle(SIGINT);
signal_handle(SIGTERM);
signal_handle(SIGHUP);
}
void finishSigHandlers() {
sigaction(SIGTERM,&original_termSa,NULL);
signal_unhandle(SIGINT);
signal_unhandle(SIGUSR1);
signal_unhandle(SIGTERM);
signal_unhandle(SIGHUP);
}
void blockSignals() {
sigset_t sset;
void ignoreSignals() {
struct sigaction sa;
sigemptyset(&sset);
sigaddset(&sset,SIGCHLD);
sigaddset(&sset,SIGUSR1);
sigprocmask(SIG_BLOCK,&sset,NULL);
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_IGN;
while(sigaction(SIGPIPE,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGCHLD,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGUSR1,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGINT,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGTERM,&sa,NULL)<0 && errno==EINTR);
while(sigaction(SIGHUP,&sa,NULL)<0 && errno==EINTR);
}
void unblockSignals() {
void blockSignals() {
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset,SIGCHLD);
sigaddset(&sset,SIGUSR1);
sigprocmask(SIG_UNBLOCK,&sset,NULL);
}
void blockTermSignal() {
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset,SIGHUP);
sigaddset(&sset,SIGINT);
sigaddset(&sset,SIGTERM);
sigprocmask(SIG_BLOCK,&sset,NULL);
while(sigprocmask(SIG_BLOCK,&sset,NULL)<0 && errno==EINTR);
}
void unblockTermSignal() {
void unblockSignals() {
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset,SIGCHLD);
sigaddset(&sset,SIGUSR1);
sigaddset(&sset,SIGHUP);
sigaddset(&sset,SIGINT);
sigaddset(&sset,SIGTERM);
sigprocmask(SIG_UNBLOCK,&sset,NULL);
while(sigprocmask(SIG_UNBLOCK,&sset,NULL)<0 && errno==EINTR);
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -21,10 +21,14 @@
#include "../config.h"
int handlePendingSignals();
void initSigHandlers();
void finishSigHandlers();
void ignoreSignals();
void blockSignals();
void unblockSignals();
......@@ -34,3 +38,4 @@ void blockTermSignal();
void unblockTermSignal();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu
* (c)2004 by mackstann
* This project's homepage is: http://www.musicpd.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 "signal_check.h"
#include <errno.h>
volatile sig_atomic_t __caught_signals[NSIG];
static void __signal_handler(int sig)
{
__caught_signals[sig] = 1;
}
static void __set_signal_handler(int sig, void (* handler)(int))
{
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = handler;
while(sigaction(sig, &act, 0) && errno==EINTR);
}
void signal_handle(int sig)
{
__set_signal_handler(sig, __signal_handler);
}
void signal_unhandle(int sig)
{
signal_clear(sig);
__set_signal_handler(sig, SIG_DFL);
}
int signal_is_pending(int sig)
{
return __caught_signals[sig];
}
void signal_clear(int sig)
{
__caught_signals[sig] = 0;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu
* (c)2004 by mackstann
* This project's homepage is: http://www.musicpd.org
*
* libaudiofile (wave) support added by Eric Wong <normalperson@yhbt.net>
*
* 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
......@@ -18,18 +17,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AUDIOFILE_DECODE_H
#define AUDIOFILE_DECODE_H
#ifndef SIGNAL_CHECK_H
#define SIGNAL_CHECK_H
#include "../config.h"
#include <signal.h>
#ifdef HAVE_AUDIOFILE
void signal_handle(int sig);
void signal_unhandle(int sig);
int signal_is_pending(int sig);
void signal_clear(int sig);
#include "playerData.h"
#endif /* SIGNAL_CHECK_H */
int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);;
int getAudiofileTotalTime(char * file);
#endif /* HAVE_AUDIOFILE */
#endif /* AUDIOFILE_DECODE_H */
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -23,13 +23,10 @@
#include "utils.h"
#include "tag.h"
#include "log.h"
#include "mp3_decode.h"
#include "audiofile_decode.h"
#include "ogg_decode.h"
#include "flac_decode.h"
#include "path.h"
#include "playlist.h"
#include "tables.h"
#include "inputPlugin.h"
#define SONG_KEY "key: "
#define SONG_FILE "file: "
......@@ -47,59 +44,49 @@ Song * newNullSong() {
Song * song = malloc(sizeof(Song));
song->tag = NULL;
song->utf8file = NULL;
song->utf8url = NULL;
song->type = SONG_TYPE_FILE;
return song;
}
Song * newSong(char * utf8file) {
Song * song = newNullSong();
Song * newSong(char * utf8url, SONG_TYPE type) {
Song * song = NULL;
song->utf8file = strdup(utf8file);
if(strchr(utf8url, '\n')) return NULL;
if(!isFile(utf8file,&(song->mtime)));
#ifdef HAVE_OGG
else if(hasOggSuffix(utf8file)) {
song->tag = oggTagDup(utf8file);
}
#endif
#ifdef HAVE_FLAC
else if((hasFlacSuffix(utf8file))) {
song->tag = flacTagDup(utf8file);
}
#endif
#ifdef HAVE_MAD
else if(hasMp3Suffix(utf8file)) {
song->tag = mp3TagDup(utf8file);
}
#endif
#ifdef HAVE_AUDIOFILE
else if(hasWaveSuffix(utf8file)) {
song->tag = audiofileTagDup(utf8file);
}
#endif
#ifdef HAVE_FAAD
else if(hasAacSuffix(utf8file)) {
song->tag = aacTagDup(utf8file);
}
else if(hasMp4Suffix(utf8file)) {
song->tag = mp4TagDup(utf8file);
}
#endif
song = newNullSong();
if(!song->tag || song->tag->time<0) {
freeSong(song);
song = NULL;
song->utf8url = strdup(utf8url);
song->type = type;
if(song->type == SONG_TYPE_FILE) {
InputPlugin * plugin;
if((plugin = isMusic(utf8url,&(song->mtime)))) {
song->tag = plugin->tagDupFunc(
rmp2amp(utf8ToFsCharset(utf8url)));
if(song->tag) validateUtf8Tag(song->tag);
}
if(!song->tag || song->tag->time<0) {
freeSong(song);
song = NULL;
}
else addSongToTables(song);
}
else addSongToTables(song);
return song;
}
void freeSong(Song * song) {
deleteASongFromPlaylist(song);
removeASongFromTables(song);
free(song->utf8file);
if(song->type == SONG_TYPE_FILE) removeASongFromTables(song);
free(song->utf8url);
if(song->tag) freeMpdTag(song->tag);
free(song);
}
void freeJustSong(Song * song) {
free(song->utf8url);
if(song->tag) freeMpdTag(song->tag);
free(song);
}
......@@ -108,11 +95,20 @@ SongList * newSongList() {
return makeList((ListFreeDataFunc *)freeSong);
}
Song * addSongToList(SongList * list, char * key, char * utf8file) {
Song * addSongToList(SongList * list, char * key, char * utf8url,
SONG_TYPE type)
{
Song * song = NULL;
if(isMusic(utf8file,NULL)) {
song = newSong(utf8file);
switch(type) {
case SONG_TYPE_FILE:
if(isMusic(utf8url,NULL)) {
song = newSong(utf8url,type);
}
break;
case SONG_TYPE_URL:
song = newSong(utf8url,type);
break;
}
if(song==NULL) return NULL;
......@@ -127,7 +123,7 @@ void freeSongList(SongList * list) {
}
int printSongInfo(FILE * fp, Song * song) {
myfprintf(fp,"%s%s\n",SONG_FILE,song->utf8file);
myfprintf(fp,"%s%s\n",SONG_FILE,song->utf8url);
if(song->tag) printMpdTag(fp,song->tag);
......@@ -160,28 +156,68 @@ void writeSongInfoFromList(FILE * fp, SongList * list) {
myfprintf(fp,"%s\n",SONG_END);
}
void insertSongIntoList(SongList * list, ListNode ** nextSongNode, char * key,
Song * song)
{
ListNode * nodeTemp;
int cmpRet= 0;
while(*nextSongNode && (cmpRet = strcmp(key,(*nextSongNode)->key)) > 0)
{
nodeTemp = (*nextSongNode)->nextNode;
deleteNodeFromList(list,*nextSongNode);
*nextSongNode = nodeTemp;
}
if(!(*nextSongNode)) {
insertInList(list,key,(void *)song);
addSongToTables(song);
}
else if(cmpRet == 0) {
Song * tempSong = (Song *)((*nextSongNode)->data);
if(tempSong->mtime != song->mtime) {
removeASongFromTables(tempSong);
freeMpdTag(tempSong->tag);
tempSong->tag = song->tag;
tempSong->mtime = song->mtime;
song->tag = NULL;
addSongToTables(tempSong);
}
freeJustSong(song);
*nextSongNode = (*nextSongNode)->nextNode;
}
else {
addSongToTables(song);
insertInListBeforeNode(list,*nextSongNode,key,(void *)song);
}
}
void readSongInfoIntoList(FILE * fp, SongList * list) {
char buffer[MAXPATHLEN+1024];
int bufferSize = MAXPATHLEN+1024;
Song * song = NULL;
char * key = NULL;
ListNode * nextSongNode = list->firstNode;
ListNode * nodeTemp;
while(myFgets(buffer,bufferSize,fp) && 0!=strcmp(SONG_END,buffer)) {
if(0==strncmp(SONG_KEY,buffer,strlen(SONG_KEY))) {
if(song) {
insertInList(list,key,(void *)song);
addSongToTables(song);
insertSongIntoList(list,&nextSongNode,key,song);
song = NULL;
free(key);
}
key = strdup(&(buffer[strlen(SONG_KEY)]));
song = newNullSong();
song->type = SONG_TYPE_FILE;
}
else if(0==strncmp(SONG_FILE,buffer,strlen(SONG_FILE))) {
if(!song || song->utf8file) {
if(!song || song->utf8url) {
ERROR("Problems reading song info\n");
exit(-1);
exit(EXIT_FAILURE);
}
song->utf8file = strdup(&(buffer[strlen(SONG_FILE)]));
song->utf8url = strdup(&(buffer[strlen(SONG_FILE)]));
}
else if(0==strncmp(SONG_ARTIST,buffer,strlen(SONG_ARTIST))) {
if(!song->tag) song->tag = newMpdTag();
......@@ -208,57 +244,42 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
}
else {
ERROR("songinfo: unknown line in db: %s\n",buffer);
exit(-1);
exit(EXIT_FAILURE);
}
}
if(song) {
insertInList(list,key,(void *)song);
addSongToTables(song);
insertSongIntoList(list,&nextSongNode,key,song);
song = NULL;
free(key);
}
while(nextSongNode) {
nodeTemp = nextSongNode->nextNode;
deleteNodeFromList(list,nextSongNode);
nextSongNode = nodeTemp;
}
}
int updateSongInfo(Song * song) {
char * utf8file = song->utf8file;
char * utf8url = song->utf8url;
removeASongFromTables(song);
if(song->tag) freeMpdTag(song->tag);
if(song->type == SONG_TYPE_FILE) {
InputPlugin * plugin;
song->tag = NULL;
removeASongFromTables(song);
if(song->tag) freeMpdTag(song->tag);
if(!isFile(utf8file,&(song->mtime)));
#ifdef HAVE_OGG
else if(hasOggSuffix(utf8file)) {
song->tag = oggTagDup(utf8file);
}
#endif
#ifdef HAVE_FLAC
else if((hasFlacSuffix(utf8file))) {
song->tag = flacTagDup(utf8file);
}
#endif
#ifdef HAVE_MAD
else if(hasMp3Suffix(utf8file)) {
song->tag = mp3TagDup(utf8file);
}
#endif
#ifdef HAVE_AUDIOFILE
else if(hasWaveSuffix(utf8file)) {
song->tag = audiofileTagDup(utf8file);
}
#endif
#ifdef HAVE_FAAD
else if(hasAacSuffix(utf8file)) {
song->tag = aacTagDup(utf8file);
}
else if(hasMp4Suffix(utf8file)) {
song->tag = mp4TagDup(utf8file);
}
#endif
song->tag = NULL;
if(!song->tag || song->tag->time<0) return -1;
else addSongToTables(song);
if((plugin = isMusic(utf8url,&(song->mtime)))) {
song->tag = plugin->tagDupFunc(
rmp2amp(utf8ToFsCharset(utf8url)));
if(song->tag) validateUtf8Tag(song->tag);
}
if(!song->tag || song->tag->time<0) return -1;
else addSongToTables(song);
}
return 0;
}
......@@ -266,9 +287,11 @@ int updateSongInfo(Song * song) {
Song * songDup(Song * song) {
Song * ret = malloc(sizeof(Song));
ret->utf8file = strdup(song->utf8file);
ret->utf8url = strdup(song->utf8url);
ret->mtime = song->mtime;
ret->tag = mpdTagDup(song->tag);
ret->type = song->type;
return ret;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -30,23 +30,34 @@
#include "tag.h"
#include "list.h"
typedef enum {
SONG_TYPE_FILE = 1,
SONG_TYPE_URL = 2
} SONG_TYPE;
typedef struct _Song {
char * utf8file;
char * utf8url;
SONG_TYPE type;
MpdTag * tag;
time_t mtime;
} Song;
typedef List SongList;
Song * newSong(char * utf8file);
Song * newNullSong();
Song * newSong(char * utf8url, SONG_TYPE type);
void freeSong(Song *);
void freeJustSong(Song *);
SongList * newSongList();
void freeSongList(SongList * list);
Song * addSongToList(SongList * list, char * key, char * utf8file);
Song * addSongToList(SongList * list, char * key, char * utf8file,
SONG_TYPE type);
int printSongInfo(FILE * fp, Song * song);
......@@ -61,3 +72,4 @@ int updateSongInfo(Song * song);
Song * songDup(Song * song);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -18,7 +18,6 @@
#include "stats.h"
#include "command.h"
#include "tables.h"
#include "directory.h"
#include "myfprintf.h"
......
......@@ -38,3 +38,4 @@ void initStats();
int printStats(FILE * fp);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -172,8 +172,8 @@ int printAllAlbums(FILE * fp, char * artist) {
}
}
else {
myfprintf(fp,"%s artist \"%s\" not found\n",
COMMAND_RESPOND_ERROR,artist);
commandError(fp, ACK_ERROR_NO_EXIST,
"artist \"%s\" not found", artist);
return -1;
}
}
......@@ -184,7 +184,8 @@ int printAllAlbums(FILE * fp, char * artist) {
int printAllKeysOfTable(FILE * fp, char * table, char * arg1) {
if(strcmp(table,TABLES_ARTIST)==0) {
if(arg1!=NULL) {
myfprintf(fp,"%s %s table takes no args\n",COMMAND_RESPOND_ERROR,table);
commandError(fp, ACK_ERROR_ARG,
"%s table takes no args", table);
return -1;
}
return printAllArtists(fp);
......@@ -193,7 +194,7 @@ int printAllKeysOfTable(FILE * fp, char * table, char * arg1) {
return printAllAlbums(fp,arg1);
}
else {
myfprintf(fp,"%s table \"%s\" does not exist or not available for listing\n",COMMAND_RESPOND_ERROR,table);
commandError(fp, ACK_ERROR_ARG, "unknown table", table);
return -1;
}
}
......@@ -41,3 +41,4 @@ unsigned long numberOfAlbums();
int printAllKeysOfTable(FILE * fp, char * table, char * arg1);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -19,12 +19,10 @@
#include "tag.h"
#include "path.h"
#include "myfprintf.h"
#include "sig_handlers.h"
#include "mp3_decode.h"
#include "audiofile_decode.h"
#include "mp4_decode.h"
#include "aac_decode.h"
#include "utils.h"
#include "utf8.h"
#include "log.h"
#include "inputStream.h"
#include <sys/stat.h>
#include <stdlib.h>
......@@ -39,16 +37,6 @@
#include <FLAC/file_decoder.h>
#include <FLAC/metadata.h>
#endif
#ifdef HAVE_ID3TAG
#ifdef USE_MPD_ID3TAG
#include "libid3tag/id3tag.h"
#else
#include <id3tag.h>
#endif
#endif
#ifdef HAVE_FAAD
#include "mp4ff/mp4ff.h"
#endif
void printMpdTag(FILE * fp, MpdTag * tag) {
if(tag->artist) myfprintf(fp,"Artist: %s\n",tag->artist);
......@@ -58,6 +46,24 @@ void printMpdTag(FILE * fp, MpdTag * tag) {
if(tag->time>=0) myfprintf(fp,"Time: %i\n",tag->time);
}
#define fixUtf8(str) { \
if(str && !validUtf8String(str)) { \
char * temp; \
DEBUG("not valid utf8 in tag: %s\n",str); \
temp = latin1StrToUtf8Dup(str); \
free(str); \
str = temp; \
stripReturnChar(str); \
} \
}
void validateUtf8Tag(MpdTag * tag) {
fixUtf8(tag->artist);
fixUtf8(tag->album);
fixUtf8(tag->track);
fixUtf8(tag->title);
}
#ifdef HAVE_ID3TAG
char * getID3Info(struct id3_tag * tag, char * id) {
struct id3_frame const * frame;
......@@ -83,28 +89,11 @@ char * getID3Info(struct id3_tag * tag, char * id) {
}
#endif
MpdTag * id3Dup(char * utf8filename) {
MpdTag * ret = NULL;
#ifdef HAVE_ID3TAG
struct id3_file * file;
struct id3_tag * tag;
MpdTag * parseId3Tag(struct id3_tag * tag) {
MpdTag * ret = NULL;
char * str;
blockSignals();
file = id3_file_open(rmp2amp(utf8ToFsCharset(utf8filename)),
ID3_FILE_MODE_READONLY);
if(!file) {
unblockSignals();
return NULL;
}
tag = id3_file_tag(file);
if(!tag) {
id3_file_close(file);
unblockSignals();
return NULL;
}
str = getID3Info(tag,ID3_FRAME_ARTIST);
if(str) {
if(!ret) ret = newMpdTag();
......@@ -133,339 +122,35 @@ MpdTag * id3Dup(char * utf8filename) {
ret->track = str;
}
id3_file_close(file);
unblockSignals();
#endif
return ret;
}
#ifdef HAVE_AUDIOFILE
MpdTag * audiofileTagDup(char * utf8file) {
MpdTag * ret = NULL;
int time = getAudiofileTotalTime(rmp2amp(utf8ToFsCharset(utf8file)));
if (time>=0) {
if(!ret) ret = newMpdTag();
ret->time = time;
}
return ret;
}
#endif
#ifdef HAVE_MAD
MpdTag * mp3TagDup(char * utf8file) {
MpdTag * id3Dup(char * file) {
MpdTag * ret = NULL;
int time;
ret = id3Dup(utf8file);
time = getMp3TotalTime(rmp2amp(utf8ToFsCharset(utf8file)));
if(time>=0) {
if(!ret) ret = newMpdTag();
ret->time = time;
}
return ret;
}
#endif
#ifdef HAVE_FAAD
MpdTag * aacTagDup(char * utf8file) {
MpdTag * ret = NULL;
int time;
blockSignals();
time = getAacTotalTime(rmp2amp(utf8ToFsCharset(utf8file)));
if(time>=0) {
if((ret = id3Dup(utf8file))==NULL) ret = newMpdTag();
ret->time = time;
}
unblockSignals();
return ret;
}
MpdTag * mp4DataDup(char * utf8file, int * mp4MetadataFound) {
MpdTag * ret = NULL;
FILE * fh;
mp4ff_t * mp4fh;
mp4ff_callback_t * cb;
int32_t track;
int32_t time;
int32_t scale;
*mp4MetadataFound = 0;
blockSignals();
fh = fopen(rmp2amp(utf8ToFsCharset(utf8file)),"r");
if(!fh) {
unblockSignals();
return NULL;
}
cb = malloc(sizeof(mp4ff_callback_t));
cb->read = mp4_readCallback;
cb->seek = mp4_seekCallback;
cb->user_data = fh;
mp4fh = mp4ff_open_read(cb);
if(!mp4fh) {
free(cb);
fclose(fh);
unblockSignals();
return NULL;
}
#ifdef HAVE_ID3TAG
struct id3_file * id3_file;
struct id3_tag * tag;
track = mp4_getAACTrack(mp4fh);
if(track < 0) {
mp4ff_close(mp4fh);
fclose(fh);
free(cb);
unblockSignals();
id3_file = id3_file_open(file, ID3_FILE_MODE_READONLY);
if(!id3_file) {
return NULL;
}
ret = newMpdTag();
time = mp4ff_get_track_duration_use_offsets(mp4fh,track);
scale = mp4ff_time_scale(mp4fh,track);
if(scale < 0) {
mp4ff_close(mp4fh);
fclose(fh);
free(cb);
freeMpdTag(ret);
unblockSignals();
tag = id3_file_tag(id3_file);
if(!tag) {
id3_file_close(id3_file);
return NULL;
}
ret->time = ((float)time)/scale+0.5;
if(!mp4ff_meta_get_artist(mp4fh,&ret->artist)) {
*mp4MetadataFound = 1;
}
if(!mp4ff_meta_get_album(mp4fh,&ret->album)) {
*mp4MetadataFound = 1;
}
if(!mp4ff_meta_get_title(mp4fh,&ret->title)) {
*mp4MetadataFound = 1;
}
if(!mp4ff_meta_get_track(mp4fh,&ret->track)) {
*mp4MetadataFound = 1;
}
ret = parseId3Tag(tag);
mp4ff_close(mp4fh);
fclose(fh);
free(cb);
unblockSignals();
id3_file_close(id3_file);
return ret;
}
MpdTag * mp4TagDup(char * utf8file) {
MpdTag * ret = NULL;
int mp4MetadataFound = 0;
ret = mp4DataDup(utf8file,&mp4MetadataFound);
if(ret && !mp4MetadataFound) {
MpdTag * temp = id3Dup(utf8file);
if(temp) {
temp->time = ret->time;
freeMpdTag(ret);
ret = temp;
}
}
return ret;
}
#endif
#ifdef HAVE_OGG
MpdTag * oggTagDup(char * utf8file) {
MpdTag * ret = NULL;
FILE * fp;
OggVorbis_File vf;
char ** comments;
char * temp;
char * s1;
char * s2;
while(!(fp = fopen(rmp2amp(utf8ToFsCharset(utf8file)),"r"))
&& errno==EINTR);
if(!fp) return NULL;
blockSignals();
if(ov_open(fp,&vf,NULL,0)<0) {
unblockSignals();
while(fclose(fp) && errno==EINTR);
return NULL;
}
ret = newMpdTag();
ret->time = (int)(ov_time_total(&vf,-1)+0.5);
comments = ov_comment(&vf,-1)->user_comments;
while(*comments) {
temp = strdup(*comments);
++comments;
if(!(s1 = strtok(temp,"="))) continue;
s2 = strtok(NULL,"");
if(!s1 || !s2);
else if(0==strcasecmp(s1,"artist")) {
if(!ret->artist) {
stripReturnChar(s2);
ret->artist = strdup(s2);
}
}
else if(0==strcasecmp(s1,"title")) {
if(!ret->title) {
stripReturnChar(s2);
ret->title = strdup(s2);
}
}
else if(0==strcasecmp(s1,"album")) {
if(!ret->album) {
stripReturnChar(s2);
ret->album = strdup(s2);
}
}
else if(0==strcasecmp(s1,"tracknumber")) {
if(!ret->track) {
stripReturnChar(s2);
ret->track = strdup(s2);
}
}
free(temp);
}
ov_clear(&vf);
unblockSignals();
return ret;
}
#endif
#ifdef HAVE_FLAC
MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) {
MpdTag * ret = NULL;
FLAC__Metadata_SimpleIterator * it;
FLAC__StreamMetadata * block = NULL;
int offset;
int len, pos;
*vorbisCommentFound = 0;
blockSignals();
it = FLAC__metadata_simple_iterator_new();
if(!FLAC__metadata_simple_iterator_init(it,rmp2amp(utf8ToFsCharset(utf8file)),1,0)) {
FLAC__metadata_simple_iterator_delete(it);
unblockSignals();
return ret;
}
do {
block = FLAC__metadata_simple_iterator_get_block(it);
if(!block) break;
if(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
char * dup;
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"artist");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("artist=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
stripReturnChar(dup);
ret->artist = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"album");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("album=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
stripReturnChar(dup);
ret->album = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"title");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("title=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
stripReturnChar(dup);
ret->title = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"tracknumber");
if(offset>=0) {
*vorbisCommentFound = 1;
if(!ret) ret = newMpdTag();
pos = strlen("tracknumber=");
len = block->data.vorbis_comment.comments[offset].length-pos;
if(len>0) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
stripReturnChar(dup);
ret->track = dup;
}
}
}
else if(block->type == FLAC__METADATA_TYPE_STREAMINFO) {
if(!ret) ret = newMpdTag();
ret->time = ((float)block->data.stream_info.
total_samples) /
block->data.stream_info.sample_rate +
0.5;
}
FLAC__metadata_object_delete(block);
} while(FLAC__metadata_simple_iterator_next(it));
FLAC__metadata_simple_iterator_delete(it);
unblockSignals();
return ret;
}
MpdTag * flacTagDup(char * utf8file) {
MpdTag * ret = NULL;
int foundVorbisComment = 0;
ret = flacMetadataDup(utf8file,&foundVorbisComment);
if(!ret) return NULL;
if(!foundVorbisComment) {
MpdTag * temp = id3Dup(utf8file);
if(temp) {
temp->time = ret->time;
freeMpdTag(ret);
ret = temp;
}
}
return ret;
}
#endif
MpdTag * newMpdTag() {
MpdTag * ret = malloc(sizeof(MpdTag));
......@@ -477,11 +162,15 @@ MpdTag * newMpdTag() {
return ret;
}
void freeMpdTag(MpdTag * tag) {
void clearMpdTag(MpdTag * tag) {
if(tag->artist) free(tag->artist);
if(tag->album) free(tag->album);
if(tag->title) free(tag->title);
if(tag->track) free(tag->track);
}
void freeMpdTag(MpdTag * tag) {
clearMpdTag(tag);
free(tag);
}
......@@ -490,12 +179,35 @@ MpdTag * mpdTagDup(MpdTag * tag) {
if(tag) {
ret = newMpdTag();
ret->artist = strdup(tag->artist);
ret->album = strdup(tag->album);
ret->title = strdup(tag->title);
ret->track = strdup(tag->track);
if(tag->artist) ret->artist = strdup(tag->artist);
if(tag->album) ret->album = strdup(tag->album);
if(tag->title) ret->title = strdup(tag->title);
if(tag->track) ret->track = strdup(tag->track);
ret->time = tag->time;
}
return ret;
}
int mpdTagStringsAreEqual(char * s1, char * s2) {
if(s1 && s2) {
if(strcmp(s1, s2)) return 0;
}
else if(s1 || s2) return 0;
return 1;
}
int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2) {
if(tag1 == NULL && tag2 == NULL) return 1;
else if(!tag1 || ! !tag2) return 0;
if(tag1->time != tag2->time) return 0;
if(!mpdTagStringsAreEqual(tag1->artist, tag2->artist)) return 0;
if(!mpdTagStringsAreEqual(tag1->album, tag2->album)) return 0;
if(!mpdTagStringsAreEqual(tag1->track, tag2->track)) return 0;
if(!mpdTagStringsAreEqual(tag1->title, tag2->title)) return 0;
return 1;
}
......@@ -22,6 +22,13 @@
#include "../config.h"
#include <stdio.h>
#ifdef HAVE_ID3TAG
#ifdef USE_MPD_ID3TAG
#include "libid3tag/id3tag.h"
#else
#include <id3tag.h>
#endif
#endif
typedef struct _MpdTag {
char * artist;
......@@ -31,34 +38,25 @@ typedef struct _MpdTag {
int time;
} MpdTag;
MpdTag * newMpdTag();
void freeMpdTag(MpdTag * tag);
#ifdef HAVE_MAD
MpdTag * mp3TagDup(char * utf8file);
#ifdef HAVE_ID3TAG
MpdTag * parseId3Tag(struct id3_tag *);
#endif
#ifdef HAVE_FAAD
MpdTag * aacTagDup(char * utf8file);
MpdTag * mp4TagDup(char * utf8file);
#endif
MpdTag * id3Dup(char * file);
#ifdef HAVE_OGG
MpdTag * oggTagDup(char * utf8file);
#endif
MpdTag * newMpdTag();
#ifdef HAVE_FLAC
MpdTag * flacTagDup(char * utf8file);
#endif
void clearMpdTag(MpdTag * tag);
#ifdef HAVE_AUDIOFILE
MpdTag * audiofileTagDup(char * utf8file);
#endif
void freeMpdTag(MpdTag * tag);
void printMpdTag(FILE * fp, MpdTag * tag);
MpdTag * mpdTagDup(MpdTag * tag);
void validateUtf8Tag(MpdTag * tag);
int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu
* This project's homepage is: http://www.musicpd.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 "utf8.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
unsigned char * latin1ToUtf8(unsigned char c) {
static unsigned char utf8[3];
memset(utf8,0,3);
if(c < 128) utf8[0] = c;
else if(c<192) {
utf8[0] = 194;
utf8[1] = c;
}
else {
utf8[0] = 195;
utf8[1] = c-64;
}
return utf8;
}
unsigned char * latin1StrToUtf8Dup(unsigned char * latin1) {
/* utf8 should have at most two char's per latin1 char */
int len = strlen(latin1)*2+1;
unsigned char * ret = malloc(len);
unsigned char * cp = ret;
unsigned char * utf8;
memset(ret,0,len);
len = 0;
while(*latin1) {
utf8 = latin1ToUtf8(*latin1);
while(*utf8) {
*(cp++) = *(utf8++);
len++;
}
latin1++;
}
return realloc(ret,len+1);
}
unsigned char utf8ToLatin1(unsigned char * utf8) {
unsigned char c = 0;
if(utf8[0]<128) return utf8[0];
else if(utf8[0]==195) c+=64;
else if(utf8[0]!=194) return '?';
return c+utf8[1];
}
int validateUtf8Char(unsigned char * utf8Char) {
if(utf8Char[0]<0x80) return 1;
if(utf8Char[0]>=0xC0 && utf8Char[0]<=0xFD) {
int count = 1;
unsigned char t = 1 << 5;
int i;
while(count < 6 && (t & utf8Char[0])) {
t = (t >> 1);
count++;
}
if(count > 5) return 0;
for(i=1;i<=count;i++) {
if(utf8Char[i] < 0x80 || utf8Char[i] > 0xBF) return 0;
}
return count+1;
}
else return 0;
}
int validUtf8String(unsigned char * string) {
int ret;
while(*string) {
ret = validateUtf8Char(string);
if(0==ret) return 0;
string+= ret;
}
return 1;
}
unsigned char * utf8StrToLatin1Dup(unsigned char * utf8) {
/* utf8 should have at most two char's per latin1 char */
int len = strlen(utf8)+1;
unsigned char * ret = malloc(len);
unsigned char * cp = ret;
int count;
memset(ret,0,len);
len = 0;
while(*utf8) {
count = validateUtf8Char(utf8);
if(!count) {
free(ret);
return NULL;
}
*(cp++) = utf8ToLatin1(utf8);
utf8+= count;
len++;
}
return realloc(ret,len+1);
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
......@@ -16,17 +16,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FLAC_DECODE_H
#define FLAC_DECODE_H
#ifndef UTF_8_H
#define UTF_8_H
#include "../config.h"
unsigned char * latin1StrToUtf8Dup(unsigned char * latin1);
#include "playerData.h"
unsigned char * utf8StrToLatin1Dup(unsigned char * utf8);
#include <stdio.h>
int flac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);
int getFlacTotalTime(char * file);
int validUtf8String(unsigned char * string);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -22,6 +22,7 @@
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/time.h>
#include <unistd.h>
......@@ -57,3 +58,16 @@ void my_usleep(long usec) {
select(0,NULL,NULL,NULL,&tv);
}
int ipv6Supported() {
#ifdef HAVE_IPV6
int s;
s = socket(AF_INET6,SOCK_STREAM,0);
if(s == -1) return 0;
close(s);
return 1;
#endif
return 0;
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -31,4 +31,7 @@ void stripReturnChar(char * string);
void my_usleep(long usec);
int ipv6Supported();
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -48,7 +48,7 @@
int volume_mixerType = VOLUME_MIXER_TYPE_SOFTWARE;
char * volume_mixerDevice;
int volume_softwareSet = -1;
int volume_softwareSet = 100;
#ifndef NO_OSS_MIXER
int volume_ossFd;
......@@ -144,8 +144,8 @@ int changeOssVolumeLevel(FILE * fp, int change, int rel) {
if (rel) {
if((current = getOssVolumeLevel()) < 0) {
myfprintf(fp,"%s problem getting current volume\n",
COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_SYSTEM,
"problem getting current volume");
return -1;
}
......@@ -159,7 +159,7 @@ int changeOssVolumeLevel(FILE * fp, int change, int rel) {
level = (new << 8) + new;
if(ioctl(volume_ossFd,MIXER_WRITE(volume_ossControl),&level) < 0) {
myfprintf(fp,"%s problems setting volume\n",COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_SYSTEM, "problems setting volume");
return -1;
}
......@@ -271,8 +271,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
if((err = snd_mixer_selem_get_playback_volume(volume_alsaElem,
SND_MIXER_SCHN_FRONT_LEFT,&level))<0) {
myfprintf(fp,"%s problems getting volume\n",
COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_SYSTEM, "problems getting volume");
ERROR("problems getting alsa volume: %s\n",snd_strerror(err));
return -1;
}
......@@ -298,8 +297,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
if((err = snd_mixer_selem_set_playback_volume_all(
volume_alsaElem,level))<0) {
myfprintf(fp,"%s problems setting volume\n",
COMMAND_RESPOND_ERROR);
commandError(fp, ACK_ERROR_SYSTEM, "problems setting volume");
ERROR("problems setting alsa volume: %s\n",snd_strerror(err));
return -1;
}
......@@ -358,7 +356,7 @@ void initVolume() {
}
else {
ERROR("unknown mixer type: %s\n",(getConf())[CONF_MIXER_TYPE]);
exit(-1);
exit(EXIT_FAILURE);
}
if(strlen((getConf())[CONF_MIXER_DEVICE])) {
volume_mixerDevice = (getConf())[CONF_MIXER_DEVICE];
......@@ -373,11 +371,7 @@ void openVolumeDevice() {
}
int getSoftwareVolume() {
if(volume_softwareSet >= 0) {
return volume_softwareSet;
}
return 50*log((getPlayerSoftwareVolume()*(M_E*M_E-1)/100.0)+1)+0.5;
return volume_softwareSet;
}
int getVolumeLevel() {
......@@ -400,14 +394,17 @@ int getVolumeLevel() {
int changeSoftwareVolume(FILE * fp, int change, int rel) {
int new = change;
if(rel) new+=getSoftwareVolume();
if(rel) new+=volume_softwareSet;
if(new>100) new = 100;
else if(new<0) new = 0;
volume_softwareSet = new;
new = 100.0*(exp(new/50.0)-1)/(M_E*M_E-1)+0.5;
/*new = 100.0*(exp(new/50.0)-1)/(M_E*M_E-1)+0.5;*/
if(new>=100) new = 1000;
else if(new<=0) new = 0;
else new = 1000.0*(exp(new/25.0)-1)/(54.5981500331F-1)+0.5;
setPlayerSoftwareVolume(new);
......@@ -427,7 +424,8 @@ int changeVolumeLevel(FILE * fp, int change, int rel) {
case VOLUME_MIXER_TYPE_SOFTWARE:
return changeSoftwareVolume(fp,change,rel);
default:
myfprintf(fp,"%s no volume support!\n",COMMAND_RESPOND_ERROR);
return -1;
return 0;
break;
}
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -38,3 +38,4 @@ int getVolumeLevel();
int changeVolumeLevel(FILE * fp, int change, int rel);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment