Commit 1c3eeaf3 authored by Led's avatar Led

Merge 0.14-alpha1

parents 5fb60cf1 d78491b6
*.Plo
*.Po
*.a
*.bz2
*.d
*.gz
*.la
*.lo
*.o
.deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.mk
config.status
config.sub
config_detected.h
config_detected.mk
configure
depcomp
depmode
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
mpd
stamp-h1
tags
Current Developers
------------------
Max Kellermann <max@duempel.org>
general
Warren Dukes <warren.dukes@gmail.com>
general
J. Alexander Treuman <jat@spatialrift.net>
general, MP3, ID3, PulseAudio, format conversion, stored playlists
Eric Wong <normalperson@yhbt.net>
general, FLAC, mpd-ke branch
Jos Anarch <anarchsss@gmail.com>
JACK plugin
......@@ -24,6 +24,9 @@ Qball Cow <qballcow@gmail.com>
Patrik Weiskircher <pat@icore.at>
Stored playlist commands
Laszlo Ashin <kodest@gmail.com>
WavPack support
Former Developers
-----------------
tw-nym
......@@ -40,5 +43,7 @@ mackstann
AliasMrJones
replayGain
Eric Wong
mp4ff copyrighted by M. Bakker, Ahead Software AG, http://www.nero.com
compress.[ch] copyrighted by fluffy <fluffy@beesbuzz.biz>
Music Player Daemon (MPD) - INSTALL
Dependencies
------------
gcc - http://gcc.gnu.org/
Any other C99 compliant compiler should also work.
glib - http://www.gtk.org/
General-purpose utility library.
Optional Output Dependencies
----------------------------
......@@ -25,6 +36,8 @@ A low-latency sound daemon.
libshout - http://www.icecast.org/
For streaming to an Icecast or Shoutcast server.
You also need an encoder: either libvorbisenc (ogg), or liblame (mp3).
Optional Input Dependencies
---------------------------
......@@ -61,6 +74,10 @@ For Musepack support.
MikMod - http://mikmod.raphnet.net/
For MOD support. You will need libmikmod.
libavcodec, libavformat (ffmpeg) - http://ffmpeg.mplayerhq.hu/
Multi-codec library.
Optional Miscellaneous Dependencies
-----------------------------------
......@@ -70,6 +87,10 @@ For Zeroconf support.
libsamplerate - http://www.mega-nerd.com/SRC/
For advanced samplerate conversions.
libcurl - http://curl.haxx.se/
For playing HTTP streams.
Download
--------
......
AUTOMAKE_OPTIONS = foreign 1.6
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = foreign 1.9 dist-bzip2
SUBDIRS = src doc
docdir = $(prefix)/share/doc/$(PACKAGE)
doc_DATA = README UPGRADING
EXTRA_DIST = COPYING $(doc_DATA)
doc_DATA = AUTHORS COPYING NEWS README TODO UPGRADING
EXTRA_DIST = $(doc_DATA) m4 autogen.sh scripts .gitignore
sparse-check:
sparse-check test:
$(MAKE) -C src $@
.PHONY: sparse-check test
ver 0.14.0 (????/??/??)
* audio outputs:
- fifo: new plugin
- null: new plugin
- shout: block while trying to connect instead of failing
- shout: new timeout parameter
- shout: support mp3 encoding and the shoutcast protocol
- shout: send silence during pause, so clients don't get disconnected
* decoders:
- ffmpeg: new plugin
- wavpack: new plugin
* commands:
- "addid" takes optional second argument to specify position
- "idle" notifies the client when a notable change occurs
* Zeroconf support using Bonjour
* New zeroconf_enabled option so that Zeroconf support can be disabled
* Stop the player/decode processes when not playing to allow the CPU to sleep
* Fix a bug where closing an ALSA dmix device could cause MPD to hang
* Support for reading ReplayGain from LAME tags on MP3s
* MPD is now threaded, which greatly improves performance and stability
* memory usage reduced by merging duplicate tags in the database
* support connecting via unix domain socket
* allow authenticated local users to add any local file to the playlist
* 24 bit audio support
* optimized PCM conversions and dithering
* much code has been replaced by using GLib
* the HTTP client has been replaced with libcurl
ver 0.13.0 (2007/5/28)
* New JACK audio output
* Support for "file" as an alternative to "filename" in search, find, and list
......
......@@ -9,13 +9,7 @@ retrieval, and playlist management can all be managed remotely.
To install MPD, see INSTALL.
MPD includes mp4ff in the source, due to licensing issues of the newer
version and includes bugfixes with the properly licensed version. mp4ff is
released under the GPL and copyrighted by M. Bakker, Ahead Software AG
(http://www.nero.com) and is distributed as a part of the FAAD2 - Freeware
Advance Audio (AAC) Decoder.
MPD is released under the GNU Public License.
MPD is released under the GNU General Public License version 2.
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
......
......@@ -7,32 +7,18 @@
*) input plugins
*) add support for playing aac streams
*) mixer
*) add sun support
*) add OS X support
*) Add support for 24-bit audio
*) cleanup linked list code!
*) implement listener socket protocol as documented here:
http://mpd.wikia.com/wiki/MusicPlayerDaemonListenerProtocol
*) support for dynamically loading plugins
*) cleanup input plugins "API"
*) cleanup output plugins "API"
*) add error codes for status->error
*) Cleanup Config File Code
*) audio output
*) write a esd native audioOutput
*) write a nas native audioOutput
*) allowing "pausing" of audio output devices
*) while pausing, play silence for the devices that don't support
*) while pausing, play silence for the devices that don't support
"pausing"
*) write a sun native audioOutput
*) more accurate time reporting by determining how much of audio_device
buffer has been played
......@@ -43,7 +29,24 @@
*) add playlistreplace command (replace current playlist with saved playlist
and keep playing)
*) add command for inserting songs in a specific position
0.15.0
------
*) support for dynamically loading plugins
*) cleanup input plugins "API"
*) cleanup output plugins "API"
*) implement listener socket protocol as documented here:
http://mpd.wikia.com/wiki/MusicPlayerDaemonListenerProtocol
???
---
*) mixer
*) add sun support
*) add OS X support
*) audio output
*) write a nas native audioOutput
*) write a sun native audioOutput
1.0
---
......
Music Player Daemon (MPD) - UPGRADING
Upgrading to 0.14
-----------------
The filesystem character set is determined by GLib, if it is not
configured. GLib has an affinity towards UTF-8, while older MPD
versions used to choose ISO-Latin-1.
Upgrading to 0.13.0
-------------------
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#!/bin/sh
# Run this to set up the build system: configure, makefiles, etc.
# (at one point this was based on the version in enlightenment's cvs)
package="mpd"
olddir="`pwd`"
srcdir="`dirname $0`"
test -z "$srcdir" && srcdir=.
cd "$srcdir"
DIE=
AM_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
AC_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9][0-9]\).*/\1/"
VERSIONMKINT="sed -e s/[^0-9]//"
if test -n "$AM_FORCE_VERSION"
then
AM_VERSIONS="$AM_FORCE_VERSION"
else
AM_VERSIONS='1.9 1.10'
fi
if test -n "$AC_FORCE_VERSION"
then
AC_VERSIONS="$AC_FORCE_VERSION"
else
AC_VERSIONS='2.58 2.59 2.60 2.61'
fi
versioned_bins ()
{
bin="$1"
needed_int=`echo $VERNEEDED | $VERSIONMKINT`
for i in $VERSIONS
do
i_int=`echo $i | $VERSIONMKINT`
if test $i_int -ge $needed_int
then
echo $bin-$i $bin$i $bin-$i_int $bin$i_int
fi
done
echo $bin
}
for c in autoconf autoheader automake aclocal
do
uc=`echo $c | tr '[:lower:]' '[:upper:]'`
eval "val=`echo '$'$uc`"
if test -n "$val"
then
echo "$uc=$val in environment, will not attempt to auto-detect"
continue
fi
case "$c" in
autoconf|autoheader)
VERNEEDED=`fgrep AC_PREREQ configure.ac | $AC_VERSIONGREP`
VERSIONS="$AC_VERSIONS"
pkg=autoconf
;;
automake|aclocal)
VERNEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $AM_VERSIONGREP`
VERSIONS="$AM_VERSIONS"
pkg=automake
;;
esac
printf "checking for $c ... "
for x in `versioned_bins $c`; do
($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
if test $? -eq 0
then
echo $x
eval $uc=$x
break
fi
done
eval "val=`echo '$'$uc`"
if test -z "$val"
then
if test $c = $pkg
then
DIE="$DIE $c=$VERNEEDED"
else
DIE="$DIE $c($pkg)=$VERNEEDED"
fi
fi
done
if test -n "$LIBTOOLIZE"
then
echo "LIBTOOLIZE=$LIBTOOLIZE in environment," \
"will not attempt to auto-detect"
else
printf "checking for libtoolize ... "
for x in libtoolize glibtoolize
do
($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
if test $? -eq 0
then
echo $x
LIBTOOLIZE=$x
break
fi
done
fi
if test -z "$LIBTOOLIZE"
then
DIE="$DIE libtoolize(libtool)"
fi
if test -n "$DIE"
then
echo "You must have the following installed to compile $package:"
for i in $DIE
do
printf ' '
echo $i | sed -e 's/(/ (from /' -e 's/=\(.*\)/ (>= \1)/'
done
echo "Download the appropriate package(s) for your system,"
echo "or get the source from one of the GNU ftp sites"
echo "listed in http://www.gnu.org/order/ftp.html"
exit 1
fi
echo "Generating configuration files for $package, please wait...."
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
# /usr/share/aclocal is most likely included by default, already...
ac_local_paths='
/usr/local/share/aclocal
/sw/share/aclocal
/usr/pkg/share/aclocal
/opt/share/aclocal
/usr/gnu/share/aclocal
'
for i in $ac_local_paths; do
if test -d "$i"; then
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $i"
# we probably only want one of these...
break
fi
done
echo " $ACLOCAL $ACLOCAL_FLAGS"
$ACLOCAL $ACLOCAL_FLAGS || exit 1
echo " $AUTOHEADER"
$AUTOHEADER || exit 1
echo " $LIBTOOLIZE --automake"
$LIBTOOLIZE --automake || exit 1
echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
echo " $AUTOCONF"
$AUTOCONF || exit 1
cd "$olddir"
if test x$NOCONFIGURE = x; then
"$srcdir"/configure "$@" || exit 1
fi
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
# Copyright 1999, 2000 Free Software Foundation, Inc.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
......@@ -17,91 +18,125 @@
#
# 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.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Usage:
# compile PROGRAM [ARGS]...
# `-o FOO.o' is removed from the args passed to the actual compile.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Usage statement added by Billy Biggs <vektor@dumbterm.net>.
if [ -z $1 ]; then
echo "Wrapper for compilers which do not understand '-c -o'."
echo "usage: compile PROGRAM [ARGS]..."
echo "'-o FOO.o' is removed from the args passed to the actual compile."
exit 1
fi
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
prog=$1
shift
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
args=
while test $# -gt 0; do
case "$1" in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we do something ugly here.
ofile=$2
shift
case "$ofile" in
*.o | *.obj)
;;
*)
args="$args -o $ofile"
ofile=
;;
esac
;;
*.c)
cfile=$1
args="$args $1"
;;
*)
args="$args $1"
;;
esac
shift
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$prog" $args
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir $lockdir > /dev/null 2>&1; then
break
fi
sleep 1
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir $lockdir; exit 1" 1 2 15
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$prog" $args
status=$?
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir $lockdir
exit $status
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2006-07-02'
timestamp='2008-01-23'
# 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
......@@ -56,8 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
......@@ -161,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
......@@ -329,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:*)
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
......@@ -531,7 +532,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[45])
*:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
......@@ -780,7 +781,7 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
i*:MINGW*:*)
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:windows32*:*)
......@@ -790,12 +791,18 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
x86:Interix*:[3456]*)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T:Interix*:[3456]*)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
......@@ -829,7 +836,14 @@ EOF
echo ${UNAME_MACHINE}-pc-minix
exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
......@@ -950,6 +964,9 @@ EOF
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
......@@ -1208,6 +1225,15 @@ EOF
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
......@@ -1458,9 +1484,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
......
......@@ -15,11 +15,8 @@
/* Define to enable Bonjour Zeroconf support */
#undef HAVE_BONJOUR
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `dlopen' function. */
#undef HAVE_DLOPEN
/* Define when libcurl is used for HTTP streaming */
#undef HAVE_CURL
/* Define to 1 if `dontUpSampleImplicitSBR' is member of
`faacDecConfiguration'. */
......@@ -37,18 +34,18 @@
/* Define if FAAD2 uses buflen in function calls */
#undef HAVE_FAAD_BUFLEN_FUNCS
/* Define for FFMPEG support */
#undef HAVE_FFMPEG
/* Define to enable support for writing audio to a FIFO */
#undef HAVE_FIFO
/* Define for FLAC support */
#undef HAVE_FLAC
/* Define to use iconv */
#undef HAVE_ICONV
/* Define to use id3tag */
#undef HAVE_ID3TAG
/* Define to 1 if you have the <id3tag.h> header file. */
#undef HAVE_ID3TAG_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......@@ -58,33 +55,39 @@
/* Define to enable JACK support */
#undef HAVE_JACK
/* Define if you have liblame. */
#undef HAVE_LAME
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
/* Define to 1 if you have the `asound' library (-lasound). */
#undef HAVE_LIBASOUND
/* Define to 1 if you have the `avcodec' library (-lavcodec). */
#undef HAVE_LIBAVCODEC
/* Define to 1 if you have the `FLAC' library (-lFLAC). */
#undef HAVE_LIBFLAC
/* Define to 1 if you have the `mp4ff' library (-lmp4ff). */
#undef HAVE_LIBMP4FF
/* Define to enable libsamplerate */
#undef HAVE_LIBSAMPLERATE
/* libsamplerate doesn't provide src_int_to_float_array() (<0.1.3) */
#undef HAVE_LIBSAMPLERATE_NOINT
/* Define if locale.h is present */
#undef HAVE_LOCALE
/* Define to use libmad */
#undef HAVE_MAD
/* Define to 1 if you have the <mad.h> header file. */
#undef HAVE_MAD_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define for mikmod support */
#undef HAVE_MIKMOD
/* Define to use FAAD2+mp4ff for MP4 decoding */
#undef HAVE_MP4
/* Define to 1 if the system has the type `mp4AudioSpecificConfig'. */
#undef HAVE_MP4AUDIOSPECIFICCONFIG
......@@ -106,6 +109,9 @@
/* Define for compiling OS X support */
#undef HAVE_OSX
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Define to enable PulseAudio support */
#undef HAVE_PULSE
......@@ -115,8 +121,11 @@
/* Define to enable libshout support */
#undef HAVE_SHOUT
/* Define to 1 if you have the <shout/shout.h> header file. */
#undef HAVE_SHOUT_SHOUT_H
/* Define to enable mp3 streaming support */
#undef HAVE_SHOUT_MP3
/* Define to enable ogg streaming support */
#undef HAVE_SHOUT_OGG
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
......@@ -130,6 +139,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if struct ucred is present from sys/socket.h */
#undef HAVE_STRUCT_UCRED
/* Define if sys/inttypes.h present */
#undef HAVE_SYS_INTTYPES_H
......@@ -139,17 +151,26 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if TCP socket support is enabled */
#undef HAVE_TCP
/* Define to use tremor (libvorbisidec) for ogg support */
#undef HAVE_TREMOR
/* Define if unix domain socket support is enabled */
#undef HAVE_UN
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to enable WavPack support */
#undef HAVE_WAVPACK
/* Define to enable Zeroconf support */
#undef HAVE_ZEROCONF
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define if avcodec.h instead of libavcodec/avcodec.h should be included */
#undef OLD_FFMPEG_INCLUDES
/* Name of package */
#undef PACKAGE
......@@ -172,17 +193,9 @@
/* The mpd protocol version */
#undef PROTOCOL_VERSION
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
......
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2006-07-02'
timestamp='2008-01-16'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
......@@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
......@@ -245,12 +245,12 @@ case $basic_machine in
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore \
| maxq | mb | microblaze | mcore | mep \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
......@@ -276,6 +276,7 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
......@@ -284,7 +285,7 @@ case $basic_machine in
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
......@@ -323,7 +324,7 @@ case $basic_machine in
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
......@@ -367,11 +368,15 @@ case $basic_machine in
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
......@@ -442,6 +447,14 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
c90)
basic_machine=c90-cray
os=-unicos
......@@ -474,8 +487,8 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
cr16)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
......@@ -667,6 +680,14 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
......@@ -682,6 +703,10 @@ case $basic_machine in
basic_machine=i386-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe)
basic_machine=m68000-convergent
;;
......@@ -808,6 +833,14 @@ case $basic_machine in
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
......@@ -909,6 +942,10 @@ case $basic_machine in
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei)
basic_machine=mips-sei
os=-seiux
......@@ -920,6 +957,9 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
......@@ -1009,6 +1049,10 @@ case $basic_machine in
basic_machine=tic6x-unknown
os=-coff
;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
......@@ -1214,7 +1258,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
......@@ -1366,6 +1410,9 @@ else
# system, and we'll never get to this point.
case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
......@@ -1406,6 +1453,9 @@ case $basic_machine in
m68*-cisco)
os=-aout
;;
mep-*)
os=-elf
;;
mips*-cisco)
os=-elf
;;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Music Player Daemon - Commands
Music Player Daemon - Commands
WARNING
WARNING
This document has not been updated to reflect recent changes in
the MPD protocol. It does not contain all supported commands,
and some commands may now take additional arguments. However,
......@@ -14,8 +14,8 @@ This document is intended for client developers, not end users.
Format:
-------
If arguments contain spaces, they should be surrounded by double quotation
marks, ".
If arguments contain spaces, they should be surrounded by double quotation
marks, ".
command <type arg1> <type arg2> ...
explanation: w/ arg1 and arg2
......@@ -25,7 +25,7 @@ that in UTF-8 all standard ansi characters, 0-127, are the same as a standard
ansi encoding. Also, no ansi character appears in any multi-byte
characters. So, you can use standard C functions like strlen, and strcpy
just fine with UTF-8 encoded strings. For example: "OK\n" encoded in UTF-8 is
simply "OK\n". For more information on UTF=8:
simply "OK\n". For more information on UTF=8:
http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 )
Command Completion:
......@@ -41,7 +41,7 @@ For manipulating playlists and playing, there are two sets of commands. One
set uses the song id of a song in the playlist, while another set uses the
playlist position of the song. The commands using song id's should be used
instead of the commands that manipulate and control playback based on playlist
position. Using song id's is a safer method when multiple clients are
position. Using song id's is a safer method when multiple clients are
interacting with MPD.
Commands:
......@@ -52,11 +52,22 @@ add <string path>
_path_ can also be a single file
increments playlist version by for each song added
clear
addid <string path> <int position>
_path_ is always a single file or URL
_position_ is optional, a negative number means it is relative
to the currently playing song in the playlist (if there is one)
adds a song to the playlist (non-recursive) and returns the song id;
example:
addid "foo.mp3"
Id: 999
OK
clear
clears the current playlist
increments playlist version by 1
clearerror
clearerror
clear the current error message in status
(this is also accomplished by any command that starts playback)
......@@ -87,7 +98,7 @@ kill
kill MPD
list <string type> <string arg1>
list all tags of _type_
list all tags of _type_
_type_ should be "album" or "artist"
_arg1_ is an optional parameter when type is album, this specifies
to list albums by a artist, where artist is specified with
......@@ -108,6 +119,10 @@ load <string name>
lsinfo <string directory>
list contents of _directory_, from the db. _directory_ is optional
When listing the root directory, this currently returns the
list of stored playlists. This behavior is deprecated; use
"listplaylists" instead.
move <int from> <int to>
move song at _from_ to _to_ in the playlist
increments playlist version by 1
......@@ -115,6 +130,8 @@ move <int from> <int to>
moveid <int songid> <int to>
move song with _songid_ to _to_ in the playlist
increments playlist version by 1
if _to_ is negative, it is relative to the current song in
the playlist (if there is one).
next
plays next song in playlist
......@@ -150,13 +167,13 @@ playlistid <int songid>
_songid_ is optional and specifies a single song to display info for
plchanges <playlist version>
displays changed songs currently in the playlist since
displays changed songs currently in the playlist since
_playlist version_
NOTE: to detect songs that were deleted at the end of the playlist,
use playlistlength returned by status command.
plchangesposid <playlist version>
displays changed songs currently in the playlist since
displays changed songs currently in the playlist since
_playlist version_
This function only returns the position and the id of the changed song, not the complete metadata. This is more bandwidth efficient.
NOTE: to detect songs that were deleted at the end of the playlist,
......@@ -171,6 +188,15 @@ random <int state>
repeat <int state>
set repeat state to _state_, _state_ should be 0 or 1
listplaylists
prints a list of the playlist directory
After each playlist name, the server sends its last
modification time as attribute "Last-Modified" in ISO 8601
format. To avoid problems due to clock differences between
clients and the server, clients should not compare this value
with their local clock.
rm <string name>
removes the playlist <name>.m3u from the playlist directory
......@@ -183,7 +209,7 @@ search <string type> <string what>
search is not case sensitive
seek <int song> <int time>
seeks to the position _time_ (in seconds) of entry _song_ in the
seeks to the position _time_ (in seconds) of entry _song_ in the
playlist
seekid <int songid> <int time>
......@@ -236,7 +262,7 @@ swapid <int songid1> <int songid2>
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
_path_ is an optional argument that maybe a particular directory or
song/file to update.
returned:
updating_db: <int job id>
......@@ -244,7 +270,7 @@ update <string path>
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/efficient. Also, if you use a
it will be much more faster/efficient. Also, if you use a
command_list for updating, only one update_db job id will be returned
per sequence of updates.
......@@ -252,6 +278,29 @@ volume <int change>
change volume by amount _change_
NOTE: volume command is deprecated, use setvol instead
idle
Waits until there is a noteworthy change in one or more of
MPD's subsystems. As soon as there is one, it lists all
changed systems in a line in the format "changed: SUBSYSTEM",
where SUBSYSTEM is one of the following:
database: the song database has been updated
stored_playlist: a stored playlist has been modified, renamed,
created or deleted
playlist: the current playlist has been modified
player: the player has been started, stopped or seeked
mixer: the volume has been changed
output: an audio output has been enabled or disabled
options: options like "repeat", "random", "crossfade"
While a client waits for "idle" results, the server disables
timeouts, allowing a client to wait for events as long as mpd
runs. The "idle" command can be canceled by sending the
command "noidle" (no other commands are allowed). MPD will
then leave "idle" mode and print results immediately; might be
empty at this time.
COMMAND LIST
------------
......@@ -271,5 +320,6 @@ command_list_end
It does not execute any commands until the list has ended. The return
value is whatever the return for a list of commands is. On success
for all commands, OK is returned. If a command fails, no more commands
are executed and the appropriate ACK error is returned. If "command_list_ok_begin is used", "list_OK\n" is returned for each successful command executed
in the command list.
are executed and the appropriate ACK error is returned. If
"command_list_ok_begin is used", "list_OK\n" is returned for each
successful command executed in the command list.
man_MANS = mpd.1 mpd.conf.5
docdir = $(prefix)/share/doc/$(PACKAGE)
doc_DATA = COMMANDS mpdconf.example
EXTRA_DIST = $(man_MANS) $(doc_DATA)
......@@ -274,6 +274,19 @@ Setting this allows you to use memory-mapped I/O. Certain hardware setups may
benefit from this, but most do not. Most users do not need to set this. The
default is to not use memory-mapped I/O.
.TP
.B auto_resample <yes or no>
Setting this to "no" disables ALSA's software resampling, if the
hardware does not support a specific sample rate. This lets MPD do
the resampling. "yes" is the default and allows ALSA to resample.
.TP
.B auto_channels <yes or no>
Setting this to "no" disables ALSA's channel conversion, if the
hardware does not support a specific number of channels. Default: "yes".
.TP
.B auto_format <yes or no>
Setting this to "no" disables ALSA's sample format conversion, if the
hardware does not support a specific sample format. Default: "yes".
.TP
.B buffer_time <time in microseconds>
This sets the length of the hardware sample buffer in microseconds. Increasing
it may help to reduce or eliminate skipping on certain setups. Most users do
......@@ -296,6 +309,8 @@ This specifies the device to use for audio output. The default is "/dev/dsp".
A space separated list of servers to try to connect to. See
<\fBhttp://www.pulseaudio.org/wiki/ServerStrings\fP> for more details. The
default is to let PulseAudio choose a server.
If you specify more than one server name, MPD tries to connect to one
after another until it successfully establishes a connection.
.TP
.B sink <sink>
The sink to output to. The default is to let PulseAudio choose a sink.
......@@ -335,6 +350,17 @@ default is "".
This specifies how many bytes to write to the audio device at once. This
parameter is to work around a bug in older versions of libao on sound cards
with very small buffers. The default is 1024.
.SH REQUIRED FIFO OUTPUT PARAMETERS
.TP
.B path <path>
This specifies the path of the FIFO to output to. Must be an absolute path.
If the path does not exist it will be created when mpd is started, and removed
when mpd is stopped. The FIFO will be created with the same user and group as
mpd is running as. Default permissions can be modified by using the builtin
shell command "umask". If a FIFO already exists at the specified path it will
be reused, and will \fBnot\fP be removed when mpd is stopped. You can use the
"mkfifo" command to create this, and then you may modify the permissions to
your liking.
.SH REQUIRED SHOUT OUTPUT PARAMETERS
.TP
.B name <name>
......@@ -354,9 +380,11 @@ This specifies the icecast mountpoint to use.
This specifies the password to use when logging in to the icecast server.
.TP
.B quality <quality>
This specifies the ogg encoding quality to use. The value must be between 0
This specifies the encoding quality to use. The value must be between 0
and 10. Fractional values, such as 2.5, are permitted. Either the quality or
the bitrate parameter must be specified, but not both.
the bitrate parameter must be specified, but not both. For Ogg, a
higher quality number produces higher quality output. For MP3, it's
just the opposite, with lower numbers producing higher quality output.
.TP
.B bitrate <kbps>
This specifies the bitrate to use for encoding. Either the quality or the
......@@ -367,6 +395,15 @@ This specifies the sample rate, bits per sample, and number of channels to use
for encoding.
.SH OPTIONAL SHOUT OUTPUT PARAMETERS
.TP
.B encoding <encoding>
This specifies which output encoding to use. Should be either "ogg"
or "mp3", "mp3" is needed for shoutcast streaming. The default is "ogg".
.TP
.B protocol <protocol>
This specifies the protocol that wil be used to connect to the
icecast/shoutcast server. The options are "shoutcast", "icecast1" and
"icecast2". The default is "icecast2".
.TP
.B user <username>
This specifies the username to use when logging in to the icecast server. The
default is "source".
......@@ -375,6 +412,10 @@ default is "source".
This specifies whether to request that the stream be listed in all public
stream directories that the icecast server knows about. The default is no.
.TP
.B timeout <seconds>
This specifies the number of seconds to wait before giving up on trying to
connect to the icecast server. The default is 2 seconds.
.TP
.B description <description>
This specifies a description of the stream.
.TP
......
......@@ -112,6 +112,7 @@ error_file "~/.mpd/mpd.error"
#
#audio_output {
# type "shout"
# encoding "ogg" # optional
# name "My Shout Stream"
# host "localhost"
# port "8000"
......@@ -120,10 +121,19 @@ error_file "~/.mpd/mpd.error"
# quality "5.0"
# bitrate "128"
# format "44100:16:1"
# protocol "icecast2" # optional
# user "source" # optional
# description "My Stream Description" # optional
# genre "jazz" # optional
# public "no" # optional
# timeout "2" # optional
#}
#
# An example of a null output (for no audio output):
#
#audio_output {
# type "null"
# name "My Null Output"
#}
#
# Force all decoded audio to be converted to this format before
......
# codeset.m4 serial AM1 (gettext-0.10.40)
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl From Bruno Haible.
AC_DEFUN([AM_LANGINFO_CODESET],
[
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
[AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET);],
am_cv_langinfo_codeset=yes,
am_cv_langinfo_codeset=no)
])
if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi
])
dnl borrowed from oddsock.org
dnl AM_PATH_LAME([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for liblame, and define LAME_CFLAGS and LAME_LIBS
dnl
AC_DEFUN([AM_PATH_LAME],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(lame,[ --with-lame=PFX Prefix where liblame is installed (optional)], lame_prefix="$withval", lame_prefix="")
AC_ARG_WITH(lame-libraries,[ --with-lame-libraries=DIR Directory where liblame library is installed (optional)], lame_libraries="$withval", lame_libraries="")
AC_ARG_WITH(lame-includes,[ --with-lame-includes=DIR Directory where liblame header files are installed (optional)], lame_includes="$withval", lame_includes="")
AC_ARG_ENABLE(lametest, [ --disable-lametest Do not try to compile and run a test liblame program],, enable_lametest=yes)
if test "x$lame_prefix" != "xno" ; then
if test "x$lame_libraries" != "x" ; then
LAME_LIBS="-L$lame_libraries"
elif test "x$lame_prefix" != "x" ; then
LAME_LIBS="-L$lame_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
LAME_LIBS="-L$prefix/lib"
fi
LAME_LIBS="$LAME_LIBS -lmp3lame -lm"
if test "x$lame_includes" != "x" ; then
LAME_CFLAGS="-I$lame_includes"
elif test "x$lame_prefix" != "x" ; then
LAME_CFLAGS="-I$lame_prefix/include"
elif test "x$prefix" != "xNONE"; then
LAME_CFLAGS="-I$prefix/include"
fi
AC_MSG_CHECKING(for liblame)
no_lame=""
if test "x$enable_lametest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LAME_CFLAGS"
LIBS="$LIBS $LAME_LIBS"
dnl
dnl Now check if the installed liblame is sufficiently new.
dnl
rm -f conf.lametest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <lame/lame.h>
int main ()
{
system("touch conf.lametest");
return 0;
}
],, no_lame=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_lame" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.lametest ; then
:
else
echo "*** Could not run liblame test program, checking why..."
CFLAGS="$CFLAGS $LAME_CFLAGS"
LIBS="$LIBS $LAME_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <lame/lame.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding liblame or finding the wrong"
echo "*** version of liblame. If it is not finding liblame, 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 liblame was incorrectly installed"
echo "*** or that you have moved liblame since it was installed." ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
LAME_CFLAGS=""
LAME_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_DEFINE(HAVE_LAME, 1, [Define if you have liblame.])
use_lame="1"
else
LAME_CFLAGS=""
LAME_LIBS=""
fi
AC_SUBST(LAME_CFLAGS)
AC_SUBST(LAME_LIBS)
rm -f conf.lametest
])
# Configure paths for libOggFLAC
# "Inspired" by ogg.m4
dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS
dnl
AC_DEFUN([AM_PATH_LIBOGGFLAC],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(libOggFLAC,[ --with-libOggFLAC=PFX Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="")
AC_ARG_WITH(libOggFLAC-libraries,[ --with-libOggFLAC-libraries=DIR Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="")
AC_ARG_WITH(libOggFLAC-includes,[ --with-libOggFLAC-includes=DIR Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="")
AC_ARG_ENABLE(libOggFLACtest, [ --disable-libOggFLACtest Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes)
if test "x$libOggFLAC_libraries" != "x" ; then
LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries"
elif test "x$libOggFLAC_prefix" != "x" ; then
LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
LIBOGGFLAC_LIBS="-L$libdir"
fi
LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm"
if test "x$libOggFLAC_includes" != "x" ; then
LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes"
elif test "x$libOggFLAC_prefix" != "x" ; then
LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include"
elif test "x$prefix" != "xNONE"; then
LIBOGGFLAC_CFLAGS="-I$prefix/include"
fi
AC_MSG_CHECKING(for libOggFLAC)
no_libOggFLAC=""
if test "x$enable_libOggFLACtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS"
LIBS="$LIBS $LIBOGGFLAC_LIBS"
dnl
dnl Now check if the installed libOggFLAC is sufficiently new.
dnl
rm -f conf.libOggFLACtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <OggFLAC/stream_decoder.h>
int main ()
{
system("touch conf.libOggFLACtest");
return 0;
}
],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
if test "x$no_libOggFLAC" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.libOggFLACtest ; then
:
else
echo "*** Could not run libOggFLAC test program, checking why..."
CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS"
LIBS="$LIBS $LIBOGGFLAC_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <OggFLAC/stream_decoder.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong"
echo "*** version of libOggFLAC. If it is not finding libOggFLAC, 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 libOggFLAC was incorrectly installed"
echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you"
echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
LIBOGGFLAC_CFLAGS=""
LIBOGGFLAC_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(LIBOGGFLAC_CFLAGS)
AC_SUBST(LIBOGGFLAC_LIBS)
rm -f conf.libOggFLACtest
])
AC_DEFUN([MPD_CHECK_FLAG],[
var=`echo "$1" | tr "=-" "__"`
AC_CACHE_CHECK([whether the C compiler accepts $1],
[mpd_check_cflag_$var],[
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE([
int main(void) { return 0; }
], [ eval "mpd_check_cflag_$var=yes"
], [ eval "mpd_check_cflag_$var=no" ])
CFLAGS="$save_CFLAGS"
])
if eval "test x`echo '$mpd_check_cflag_'$var` = xyes"
then
MPD_CFLAGS="$MPD_CFLAGS $1"
fi
])
])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then
if test -n "$$1"; then
pkg_cv_[]$1="$$1"
else
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
fi
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT
])],
[AC_MSG_RESULT([no])
$4])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
[$4])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
fi[]dnl
])# PKG_CHECK_MODULES
# Check if "struct ucred" is available. If not, try harder with
# _GNU_SOURCE.
#
# Author: Max Kellermann <max@duempel.org>
AC_DEFUN([STRUCT_UCRED],[
AC_MSG_CHECKING([for struct ucred])
AC_CACHE_VAL(mpd_cv_have_struct_ucred, [
AC_TRY_COMPILE([#include <sys/socket.h>],
[struct ucred cred;],
mpd_cv_have_struct_ucred=yes,
mpd_cv_have_struct_ucred=no)
if test x$mpd_cv_have_struct_ucred = xno; then
# glibc 2.8 forces _GNU_SOURCE on us
AC_TRY_COMPILE(
[#define _GNU_SOURCE
#include <sys/socket.h>],
[struct ucred cred;],
mpd_cv_have_struct_ucred=yes,
mpd_cv_have_struct_ucred=no)
if test x$mpd_cv_have_struct_ucred = xyes; then
# :(
MPD_CFLAGS="$MPD_CFLAGS -D_GNU_SOURCE"
fi
fi
])
AC_MSG_RESULT($mpd_cv_have_struct_ucred)
if test x$mpd_cv_have_struct_ucred = xyes; then
AC_DEFINE(HAVE_STRUCT_UCRED, 1, [Define if struct ucred is present from sys/socket.h])
fi
])
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi ;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi ;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 3
# End:
# mkinstalldirs ends here
#!/bin/sh
PWD=`pwd`
## If we're not in the scripts directory
## assume the base directory.
if test "`basename $PWD`" == "scripts"; then
cd ../
else
MYOLDPWD=`pwd`
cd `dirname $0`/../
fi
if test -e Makefile
then
make distclean
fi
./autogen.sh
make
make dist
if test "`basename $PWD`" == "scripts"; then
cd contrib/
else
cd $MYOLDPWD
fi
#!/bin/bash
PWD=`pwd`
## If we're not in the scripts directory
## assume the base directory.
if test "`basename $PWD`" != "scripts"; then
MYOLDPWD=`pwd`
cd `dirname $0`
fi
./makedist.sh
rpmbuild -bb mpd.spec
if test $? -eq 0; then
echo 'Your RPM should be ready now'
else
echo 'Something went wrong when building your RPM'
fi
if test -f ../mpd-?.??.?.tar.gz;
then
rm ../mpd-?.??.?.tar.gz
fi
if test "`basename $PWD`" != "scripts"; then
cd $MYOLDPWD
fi
#!/bin/sh
indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cdw -cd0 -c0 -cp0 "$@"
# there doesn't seem to be an indent switch for this, but this
# forces goto labels to the left-most column, without indentation
perl -i -p -e 's/^\s+(\w+):/$1:/g unless /^\s+default:/' "$@"
# the Music Player Daemon (MPD)
# Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
# 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
# please send bugfixes or comments to avuton@gmail.com
%define _prefix /usr
%define _share %_prefix/share
%define _bindir %_prefix/bin
%define _docdir %_share/doc
%define _mandir %_share/man
Summary: Music Player Daemon (MPD)
Name: mpd
Version: 0.14.0
Release: 0
License: GPL
Group: Productivity/Multimedia/Sound/Players
Source: ../%name-%version.tar.gz
#Patch:
BuildRoot: %{_tmppath}/%{name}-build
%description
Music Player Daemon is simply a daemon for playing music
which can be easily controlled over TCP by different
clients. It has very low CPU usage and can be controlled
from different machines at the same time.
%prep
%setup -q
#%patch -q1 -b .buildroot
%build
CFLAGS="%{optflags}" \
CXXFLAGS="%{optflags}" \
LDFLAGS="%{optflags}" \
./configure --prefix=%{_prefix}
make
%install
make DESTDIR=$RPM_BUILD_ROOT install
%clean
[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(-,root,root)
%{_bindir}/%{name}
%doc %{_docdir}
%doc %attr(0444,root,root) %{_mandir}
%changelog
* Fri Jul 21 2006 Avuton Olrich <avuton@gmail.com>
- Initial revision
bin_PROGRAMS = mpd
SUBDIRS = $(MP4FF_SUBDIR)
mpd_audioOutputs = \
audioOutputs/audioOutput_alsa.c \
audioOutputs/audioOutput_ao.c \
audioOutputs/audioOutput_oss.c \
audioOutputs/audioOutput_osx.c \
audioOutputs/audioOutput_pulse.c \
audioOutputs/audioOutput_mvp.c \
audioOutputs/audioOutput_shout.c \
audioOutputs/audioOutput_jack.c
mpd_inputPlugins = \
inputPlugins/_flac_common.c \
inputPlugins/_ogg_common.c \
inputPlugins/oggflac_plugin.c \
inputPlugins/oggvorbis_plugin.c \
inputPlugins/aac_plugin.c \
inputPlugins/audiofile_plugin.c \
inputPlugins/flac_plugin.c \
inputPlugins/mod_plugin.c \
inputPlugins/mp3_plugin.c \
inputPlugins/mp4_plugin.c \
inputPlugins/mpc_plugin.c
mpd_headers = \
notify.h \
ack.h \
audio.h \
audio_format.h \
audioOutput.h \
output_internal.h \
output_api.h \
output_list.h \
output_thread.h \
output_control.h \
output/shout_plugin.h \
buffer2array.h \
charConv.h \
command.h \
idle.h \
condition.h \
conf.h \
crossfade.h \
dbUtils.h \
decode.h \
decoder_thread.h \
decoder_control.h \
decoder_api.h \
decoder_internal.h \
directory.h \
directory_save.h \
directory_print.h \
database.h \
update.h \
dirvec.h \
gcc.h \
inputPlugin.h \
inputPlugins/_flac_common.h \
inputPlugins/_ogg_common.h \
inputStream.h \
inputStream_file.h \
inputStream_http.h \
interface.h \
decoder_list.h \
decoder/_flac_common.h \
decoder/_ogg_common.h \
input_stream.h \
input_file.h \
input_curl.h \
client.h \
list.h \
dlist.h \
listen.h \
log.h \
ls.h \
metadataChunk.h \
mpd_types.h \
myfprintf.h \
main_notify.h \
normalize.h \
compress.h \
outputBuffer.h \
os_compat.h \
pipe.h \
path.h \
mapper.h \
pcm_utils.h \
pcm_channels.h \
pcm_resample.h \
pcm_dither.h \
permission.h \
player.h \
player_thread.h \
player_control.h \
playerData.h \
playlist.h \
playlist_save.h \
replayGain.h \
signal_check.h \
sig_handlers.h \
sllist.h \
song.h \
song_print.h \
song_save.h \
songvec.h \
state_file.h \
stats.h \
tag.h \
tagTracker.h \
tree.h \
utf8.h \
tag_internal.h \
tag_pool.h \
tag_id3.h \
tag_print.h \
tag_save.h \
strset.h \
utils.h \
volume.h \
ioops.h \
zeroconf.h \
locate.h \
storedPlaylist.h
stored_playlist.h \
timer.h
mpd_SOURCES = \
$(mpd_headers) \
$(mpd_audioOutputs) \
$(mpd_inputPlugins) \
notify.c \
audio.c \
audioOutput.c \
output_api.c \
output_list.c \
output_thread.c \
output_control.c \
output_init.c \
output/null_plugin.c \
buffer2array.c \
charConv.c \
command.c \
idle.c \
condition.c \
conf.c \
crossfade.c \
dbUtils.c \
decode.c \
decoder_thread.c \
decoder_control.c \
decoder_api.c \
directory.c \
inputPlugin.c \
inputStream.c \
inputStream_file.c \
inputStream_http.c \
interface.c \
directory_save.c \
directory_print.c \
database.c \
dirvec.c \
update.c \
decoder_list.c \
input_stream.c \
input_file.c \
client.c \
ioops.c \
list.c \
listen.c \
log.c \
ls.c \
main.c \
metadataChunk.c \
myfprintf.c \
main_notify.c \
normalize.c \
compress.c \
outputBuffer.c \
pipe.c \
path.c \
mapper.c \
pcm_utils.c \
pcm_channels.c \
pcm_resample.c \
pcm_dither.c \
permission.c \
player.c \
player_thread.c \
player_control.c \
playerData.c \
playlist.c \
playlist_save.c \
replayGain.c \
sig_handlers.c \
signal_check.c \
sllist.c \
song.c \
song_print.c \
song_save.c \
songvec.c \
state_file.c \
stats.c \
tag.c \
tagTracker.c \
tree.c \
tag_pool.c \
tag_print.c \
tag_save.c \
strset.c \
utils.c \
volume.c \
utf8.c \
zeroconf.c \
locate.c \
storedPlaylist.c
stored_playlist.c \
timer.c
if HAVE_LIBSAMPLERATE
mpd_SOURCES += pcm_resample_libsamplerate.c
else
mpd_SOURCES += pcm_resample_fallback.c
endif
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_LDADD = $(MPD_LIBS) $(MP4FF_LIB)
if HAVE_ID3TAG
mpd_SOURCES += tag_id3.c
endif
# decoder plugins
if HAVE_MAD
mpd_SOURCES += decoder/mp3_plugin.c
endif
if HAVE_MPCDEC
mpd_SOURCES += decoder/mpc_plugin.c
endif
if HAVE_WAVPACK
mpd_SOURCES += decoder/wavpack_plugin.c
endif
if HAVE_FAAD
mpd_SOURCES += decoder/aac_plugin.c
endif
if HAVE_MP4
mpd_SOURCES += decoder/mp4_plugin.c
endif
if HAVE_OGG_COMMON
mpd_SOURCES += decoder/_ogg_common.c
endif
if HAVE_FLAC_COMMON
mpd_SOURCES += decoder/_flac_common.c
endif
if HAVE_OGGVORBIS
mpd_SOURCES += decoder/oggvorbis_plugin.c
endif
if HAVE_FLAC
mpd_SOURCES += decoder/flac_plugin.c
endif
if HAVE_OGGFLAC
mpd_SOURCES += decoder/oggflac_plugin.c
endif
if HAVE_AUDIOFILE
mpd_SOURCES += decoder/audiofile_plugin.c
endif
if HAVE_MIKMOD
mpd_SOURCES += decoder/mod_plugin.c
endif
if HAVE_FFMPEG
mpd_SOURCES += decoder/ffmpeg_plugin.c
endif
if HAVE_ZEROCONF
mpd_SOURCES += zeroconf.c
endif
DIST_SUBDIRS = mp4ff
if HAVE_CURL
mpd_SOURCES += input_curl.c
endif
if HAVE_ALSA
mpd_SOURCES += output/alsa_plugin.c
endif
if HAVE_AO
mpd_SOURCES += output/ao_plugin.c
endif
if HAVE_FIFO
mpd_SOURCES += output/fifo_plugin.c
endif
if HAVE_JACK
mpd_SOURCES += output/jack_plugin.c
endif
if HAVE_MVP
mpd_SOURCES += output/mvp_plugin.c
endif
if HAVE_OSS
mpd_SOURCES += output/oss_plugin.c
endif
if HAVE_OSX
mpd_SOURCES += output/osx_plugin.c
endif
if HAVE_PULSE
mpd_SOURCES += output/pulse_plugin.c
endif
if HAVE_SHOUT
mpd_SOURCES += output/shout_plugin.c
endif
if HAVE_SHOUT_MP3
mpd_SOURCES += output/shout_mp3.c
endif
if HAVE_SHOUT_OGG
mpd_SOURCES += output/shout_ogg.c
endif
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_CPPFLAGS = \
$(CURL_CFLAGS) \
$(AO_CFLAGS) $(ALSA_CFLAGS) \
$(SHOUT_CFLAGS) \
$(OGGVORBIS_CFLAGS) $(VORBISENC_CFLAGS) \
$(patsubst -I%/FLAC,-I%,$(FLAC_CFLAGS)) \
$(AUDIOFILE_CFLAGS) $(LIBMIKMOD_CFLAGS) \
$(ID3TAG_CFLAGS) \
$(MAD_CFLAGS) \
$(FFMPEG_CFLAGS) \
$(GLIB_CFLAGS)
mpd_LDADD = $(MPD_LIBS) \
$(CURL_LIBS) \
$(AO_LIBS) $(ALSA_LIBS) \
$(SHOUT_LIBS) \
$(OGGVORBIS_LIBS) $(VORBISENC_LIBS) $(FLAC_LIBS) \
$(AUDIOFILE_LIBS) $(LIBMIKMOD_LIBS) \
$(ID3TAG_LIBS) \
$(MAD_LIBS) \
$(MP4FF_LIBS) \
$(FFMPEG_LIBS) \
$(GLIB_LIBS)
# sparse is a semantic parser
# URL: git://www.kernel.org/pub/scm/devel/sparse/sparse.git
......@@ -146,3 +312,16 @@ sparse-check:
$(SPARSE) -I. $(mpd_CFLAGS) $(SPARSE_FLAGS) $(srcdir)/$$i || exit; \
done
TEST_CFLAGS = -DUNIT_TEST
TEST_FILES := $(shell grep UNIT_TEST \
$(addprefix $(srcdir)/, $(mpd_SOURCES)) | \
awk -F: '{print $$1}' | uniq)
test: $(addprefix test-, $(subst .c,,$(TEST_FILES)))
test-%: %.c
$(CC) $(CFLAGS) $(TEST_CFLAGS) -o $@ $<
@./$@
@echo $@: OK
.PHONY: sparse-check test
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -16,22 +16,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ACK_H
#define ACK_H
#ifndef MPD_ACK_H
#define MPD_ACK_H
/* Common Errors */
#define ACK_ERROR_NOT_LIST 1
#define ACK_ERROR_ARG 2
#define ACK_ERROR_PASSWORD 3
#define ACK_ERROR_PERMISSION 4
#define ACK_ERROR_UNKNOWN 5
enum ack {
ACK_ERROR_NOT_LIST = 1,
ACK_ERROR_ARG = 2,
ACK_ERROR_PASSWORD = 3,
ACK_ERROR_PERMISSION = 4,
ACK_ERROR_UNKNOWN = 5,
#define ACK_ERROR_NO_EXIST 50
#define ACK_ERROR_PLAYLIST_MAX 51
#define ACK_ERROR_SYSTEM 52
#define ACK_ERROR_PLAYLIST_LOAD 53
#define ACK_ERROR_UPDATE_ALREADY 54
#define ACK_ERROR_PLAYER_SYNC 55
#define ACK_ERROR_EXIST 56
ACK_ERROR_NO_EXIST = 50,
ACK_ERROR_PLAYLIST_MAX = 51,
ACK_ERROR_SYSTEM = 52,
ACK_ERROR_PLAYLIST_LOAD = 53,
ACK_ERROR_UPDATE_ALREADY = 54,
ACK_ERROR_PLAYER_SYNC = 55,
ACK_ERROR_EXIST = 56,
};
#endif
......@@ -16,33 +16,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AUDIO_H
#define AUDIO_H
#include "../config.h"
#include "mpd_types.h"
#include "tag.h"
#ifndef MPD_AUDIO_H
#define MPD_AUDIO_H
#include <stdbool.h>
#include <stdio.h>
#define AUDIO_AO_DRIVER_DEFAULT "default"
typedef struct _AudioFormat {
volatile mpd_sint8 channels;
volatile mpd_uint32 sampleRate;
volatile mpd_sint8 bits;
} AudioFormat;
size_t audio_device_count(void);
void copyAudioFormat(AudioFormat * dest, AudioFormat * src);
struct audio_format;
struct tag;
struct client;
int cmpAudioFormat(AudioFormat * dest, AudioFormat * src);
void getOutputAudioFormat(const struct audio_format *inFormat,
struct audio_format *outFormat);
void getOutputAudioFormat(AudioFormat * inFormat, AudioFormat * outFormat);
int parseAudioConfig(AudioFormat * audioFormat, char *conf);
int parseAudioConfig(struct audio_format *audioFormat, char *conf);
/* make sure initPlayerData is called before this function!! */
void initAudioConfig(void);
......@@ -53,31 +42,30 @@ void initAudioDriver(void);
void finishAudioDriver(void);
int openAudioDevice(AudioFormat * audioFormat);
bool openAudioDevice(const struct audio_format *audioFormat);
bool playAudio(const char *playChunk, size_t size);
int playAudio(char *playChunk, int size);
void audio_output_pause_all(void);
void dropBufferedAudio(void);
void closeAudioDevice(void);
int isAudioDeviceOpen(void);
int isCurrentAudioFormat(AudioFormat * audioFormat);
bool isCurrentAudioFormat(const struct audio_format *audioFormat);
void sendMetadataToAudioDevice(MpdTag * tag);
void sendMetadataToAudioDevice(const struct tag *tag);
/* these functions are called in the main parent process while the child
process is busy playing to the audio */
int enableAudioDevice(int fd, int device);
int enableAudioDevice(unsigned int device);
int disableAudioDevice(int fd, int device);
int disableAudioDevice(unsigned int device);
void printAudioDevices(int fd);
void printAudioDevices(struct client *client);
void readAudioDevicesState(FILE *fp);
void saveAudioDevicesState(FILE *fp);
void loadAudioDrivers(void);
#endif
......@@ -17,253 +17,17 @@
*/
#include "audioOutput.h"
#include "list.h"
#include "log.h"
#include "pcm_utils.h"
#include <string.h>
#define AUDIO_OUTPUT_TYPE "type"
#define AUDIO_OUTPUT_NAME "name"
#define AUDIO_OUTPUT_FORMAT "format"
static List *audioOutputPluginList;
void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin)
{
if (!audioOutputPlugin->name)
return;
insertInList(audioOutputPluginList, audioOutputPlugin->name,
audioOutputPlugin);
}
void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin)
{
if (!audioOutputPlugin->name)
return;
deleteFromList(audioOutputPluginList, audioOutputPlugin->name);
}
void initAudioOutputPlugins(void)
{
audioOutputPluginList = makeList(NULL, 0);
}
void finishAudioOutputPlugins(void)
{
freeList(audioOutputPluginList);
}
#define getBlockParam(name, str, force) { \
bp = getBlockParam(param, name); \
if(force && bp == NULL) { \
FATAL("couldn't find parameter \"%s\" in audio output " \
"definition beginning at %i\n", \
name, param->line); \
} \
if(bp) str = bp->value; \
}
int initAudioOutput(AudioOutput *ao, ConfigParam * param)
{
void *data = NULL;
char *name = NULL;
char *format = NULL;
char *type = NULL;
BlockParam *bp = NULL;
AudioOutputPlugin *plugin = NULL;
if (param) {
getBlockParam(AUDIO_OUTPUT_NAME, name, 1);
getBlockParam(AUDIO_OUTPUT_TYPE, type, 1);
getBlockParam(AUDIO_OUTPUT_FORMAT, format, 0);
if (!findInList(audioOutputPluginList, type, &data)) {
FATAL("couldn't find audio output plugin for type "
"\"%s\" at line %i\n", type, param->line);
}
plugin = (AudioOutputPlugin *) data;
} else {
ListNode *node = audioOutputPluginList->firstNode;
WARNING("No \"%s\" defined in config file\n",
CONF_AUDIO_OUTPUT);
WARNING("Attempt to detect audio output device\n");
while (node) {
plugin = (AudioOutputPlugin *) node->data;
if (plugin->testDefaultDeviceFunc) {
WARNING("Attempting to detect a %s audio "
"device\n", plugin->name);
if (plugin->testDefaultDeviceFunc() == 0) {
WARNING("Successfully detected a %s "
"audio device\n", plugin->name);
break;
}
}
node = node->nextNode;
}
if (!node) {
WARNING("Unable to detect an audio device\n");
return 0;
}
name = "default detected output";
type = plugin->name;
}
ao->name = name;
ao->type = type;
ao->finishDriverFunc = plugin->finishDriverFunc;
ao->openDeviceFunc = plugin->openDeviceFunc;
ao->playFunc = plugin->playFunc;
ao->dropBufferedAudioFunc = plugin->dropBufferedAudioFunc;
ao->closeDeviceFunc = plugin->closeDeviceFunc;
ao->sendMetdataFunc = plugin->sendMetdataFunc;
ao->open = 0;
ao->convertAudioFormat = 0;
ao->sameInAndOutFormats = 0;
ao->convBuffer = NULL;
ao->convBufferLen = 0;
memset(&ao->inAudioFormat, 0, sizeof(AudioFormat));
memset(&ao->outAudioFormat, 0, sizeof(AudioFormat));
memset(&ao->reqAudioFormat, 0, sizeof(AudioFormat));
memset(&ao->convState, 0, sizeof(ConvState));
if (format) {
ao->convertAudioFormat = 1;
if (0 != parseAudioConfig(&ao->reqAudioFormat, format)) {
FATAL("error parsing format at line %i\n", bp->line);
}
copyAudioFormat(&ao->outAudioFormat, &ao->reqAudioFormat);
}
if (plugin->initDriverFunc(ao, param) != 0)
return 0;
return 1;
}
int openAudioOutput(AudioOutput * audioOutput, AudioFormat * audioFormat)
{
int ret = 0;
if (audioOutput->open)
{
if (0==cmpAudioFormat(audioFormat, &audioOutput->inAudioFormat))
{
return 0;
}
}
copyAudioFormat(&audioOutput->inAudioFormat, audioFormat);
if (audioOutput->convertAudioFormat)
{
copyAudioFormat(&audioOutput->outAudioFormat,
&audioOutput->reqAudioFormat);
}
else
{
copyAudioFormat(&audioOutput->outAudioFormat,
&audioOutput->inAudioFormat);
if (audioOutput->open) closeAudioOutput(audioOutput);
}
if (!audioOutput->open)
{
ret = audioOutput->openDeviceFunc(audioOutput);
}
audioOutput->sameInAndOutFormats =
!cmpAudioFormat(&audioOutput->inAudioFormat,
&audioOutput->outAudioFormat);
return ret;
}
static void convertAudioFormat(AudioOutput * audioOutput, char **chunkArgPtr,
int *sizeArgPtr)
{
int size = pcm_sizeOfConvBuffer(&(audioOutput->inAudioFormat),
*sizeArgPtr,
&(audioOutput->outAudioFormat));
if (size > audioOutput->convBufferLen) {
audioOutput->convBuffer =
xrealloc(audioOutput->convBuffer, size);
audioOutput->convBufferLen = size;
}
*sizeArgPtr = pcm_convertAudioFormat(&(audioOutput->inAudioFormat),
*chunkArgPtr, *sizeArgPtr,
&(audioOutput->outAudioFormat),
audioOutput->convBuffer,
&audioOutput->convState);
*chunkArgPtr = audioOutput->convBuffer;
}
int playAudioOutput(AudioOutput * audioOutput, char *playChunk, int size)
{
int ret;
if (!audioOutput->open)
return -1;
if (!audioOutput->sameInAndOutFormats) {
convertAudioFormat(audioOutput, &playChunk, &size);
}
ret = audioOutput->playFunc(audioOutput, playChunk, size);
return ret;
}
void dropBufferedAudioOutput(AudioOutput * audioOutput)
{
if (audioOutput->open)
audioOutput->dropBufferedAudioFunc(audioOutput);
}
void closeAudioOutput(AudioOutput * audioOutput)
{
if (audioOutput->open)
audioOutput->closeDeviceFunc(audioOutput);
}
void finishAudioOutput(AudioOutput * audioOutput)
{
closeAudioOutput(audioOutput);
audioOutput->finishDriverFunc(audioOutput);
if (audioOutput->convBuffer)
free(audioOutput->convBuffer);
}
void sendMetadataToAudioOutput(AudioOutput * audioOutput, MpdTag * tag)
{
if (!audioOutput->sendMetdataFunc)
return;
audioOutput->sendMetdataFunc(audioOutput, tag);
}
#include "output_api.h"
#include "output_list.h"
void printAllOutputPluginTypes(FILE * fp)
{
ListNode *node = audioOutputPluginList->firstNode;
AudioOutputPlugin *plugin;
unsigned i;
const struct audio_output_plugin *plugin;
while (node) {
plugin = (AudioOutputPlugin *) node->data;
audio_output_plugins_for_each(plugin, i)
fprintf(fp, "%s ", plugin->name);
node = node->nextNode;
}
fprintf(fp, "\n");
fflush(fp);
}
......@@ -16,102 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AUDIO_OUTPUT_H
#define AUDIO_OUTPUT_H
#ifndef MPD_AUDIO_OUTPUT_H
#define MPD_AUDIO_OUTPUT_H
#include "../config.h"
#include "pcm_utils.h"
#include "mpd_types.h"
#include "audio.h"
#include "tag.h"
#include "conf.h"
#include "utils.h"
#define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) AudioOutputPlugin plugin;
typedef struct _AudioOutput AudioOutput;
typedef int (*AudioOutputTestDefaultDeviceFunc) ();
typedef int (*AudioOutputInitDriverFunc) (AudioOutput * audioOutput,
ConfigParam * param);
typedef void (*AudioOutputFinishDriverFunc) (AudioOutput * audioOutput);
typedef int (*AudioOutputOpenDeviceFunc) (AudioOutput * audioOutput);
typedef int (*AudioOutputPlayFunc) (AudioOutput * audioOutput,
char *playChunk, int size);
typedef void (*AudioOutputDropBufferedAudioFunc) (AudioOutput * audioOutput);
typedef void (*AudioOutputCloseDeviceFunc) (AudioOutput * audioOutput);
typedef void (*AudioOutputSendMetadataFunc) (AudioOutput * audioOutput,
MpdTag * tag);
struct _AudioOutput {
int open;
char *name;
char *type;
AudioOutputFinishDriverFunc finishDriverFunc;
AudioOutputOpenDeviceFunc openDeviceFunc;
AudioOutputPlayFunc playFunc;
AudioOutputDropBufferedAudioFunc dropBufferedAudioFunc;
AudioOutputCloseDeviceFunc closeDeviceFunc;
AudioOutputSendMetadataFunc sendMetdataFunc;
int convertAudioFormat;
AudioFormat inAudioFormat;
AudioFormat outAudioFormat;
AudioFormat reqAudioFormat;
ConvState convState;
char *convBuffer;
int convBufferLen;
int sameInAndOutFormats;
void *data;
};
typedef struct _AudioOutputPlugin {
char *name;
AudioOutputTestDefaultDeviceFunc testDefaultDeviceFunc;
AudioOutputInitDriverFunc initDriverFunc;
AudioOutputFinishDriverFunc finishDriverFunc;
AudioOutputOpenDeviceFunc openDeviceFunc;
AudioOutputPlayFunc playFunc;
AudioOutputDropBufferedAudioFunc dropBufferedAudioFunc;
AudioOutputCloseDeviceFunc closeDeviceFunc;
AudioOutputSendMetadataFunc sendMetdataFunc;
} AudioOutputPlugin;
void initAudioOutputPlugins(void);
void finishAudioOutputPlugins(void);
void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
int initAudioOutput(AudioOutput *, ConfigParam * param);
int openAudioOutput(AudioOutput * audioOutput, AudioFormat * audioFormat);
int playAudioOutput(AudioOutput * audioOutput, char *playChunk, int size);
void dropBufferedAudioOutput(AudioOutput * audioOutput);
void closeAudioOutput(AudioOutput * audioOutput);
void finishAudioOutput(AudioOutput * audioOutput);
int keepAudioOutputAlive(AudioOutput * audioOutput, int ms);
void sendMetadataToAudioOutput(AudioOutput * audioOutput, MpdTag * tag);
#include <stdio.h>
void printAllOutputPluginTypes(FILE * fp);
extern AudioOutputPlugin alsaPlugin;
extern AudioOutputPlugin aoPlugin;
extern AudioOutputPlugin ossPlugin;
extern AudioOutputPlugin osxPlugin;
extern AudioOutputPlugin pulsePlugin;
extern AudioOutputPlugin mvpPlugin;
extern AudioOutputPlugin shoutPlugin;
extern AudioOutputPlugin jackPlugin;
#endif
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* 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 "../audioOutput.h"
#include <stdlib.h>
#ifdef HAVE_PULSE
#include "../conf.h"
#include "../log.h"
#include <string.h>
#include <time.h>
#include <pulse/simple.h>
#include <pulse/error.h>
#define MPD_PULSE_NAME "mpd"
#define CONN_ATTEMPT_INTERVAL 60
typedef struct _PulseData {
pa_simple *s;
char *server;
char *sink;
int connAttempts;
time_t lastAttempt;
} PulseData;
static PulseData *newPulseData(void)
{
PulseData *ret;
ret = xmalloc(sizeof(PulseData));
ret->s = NULL;
ret->server = NULL;
ret->sink = NULL;
ret->connAttempts = 0;
ret->lastAttempt = 0;
return ret;
}
static void freePulseData(PulseData * pd)
{
if (pd->server)
free(pd->server);
if (pd->sink)
free(pd->sink);
free(pd);
}
static int pulse_initDriver(AudioOutput * audioOutput, ConfigParam * param)
{
BlockParam *server = NULL;
BlockParam *sink = NULL;
PulseData *pd;
if (param) {
server = getBlockParam(param, "server");
sink = getBlockParam(param, "sink");
}
pd = newPulseData();
pd->server = server ? xstrdup(server->value) : NULL;
pd->sink = sink ? xstrdup(sink->value) : NULL;
audioOutput->data = pd;
return 0;
}
static void pulse_finishDriver(AudioOutput * audioOutput)
{
freePulseData((PulseData *) audioOutput->data);
}
static int pulse_testDefault(void)
{
pa_simple *s;
pa_sample_spec ss;
int error;
ss.format = PA_SAMPLE_S16NE;
ss.rate = 44100;
ss.channels = 2;
s = pa_simple_new(NULL, MPD_PULSE_NAME, PA_STREAM_PLAYBACK, NULL,
MPD_PULSE_NAME, &ss, NULL, NULL, &error);
if (!s) {
WARNING("Cannot connect to default PulseAudio server: %s\n",
pa_strerror(error));
return -1;
}
pa_simple_free(s);
return 0;
}
static int pulse_openDevice(AudioOutput * audioOutput)
{
PulseData *pd;
AudioFormat *audioFormat;
pa_sample_spec ss;
time_t t;
int error;
t = time(NULL);
pd = audioOutput->data;
audioFormat = &audioOutput->outAudioFormat;
if (pd->connAttempts != 0 &&
(t - pd->lastAttempt) < CONN_ATTEMPT_INTERVAL)
return -1;
pd->connAttempts++;
pd->lastAttempt = t;
if (audioFormat->bits != 16) {
ERROR("PulseAudio doesn't support %i bit audio\n",
audioFormat->bits);
return -1;
}
ss.format = PA_SAMPLE_S16NE;
ss.rate = audioFormat->sampleRate;
ss.channels = audioFormat->channels;
pd->s = pa_simple_new(pd->server, MPD_PULSE_NAME, PA_STREAM_PLAYBACK,
pd->sink, audioOutput->name, &ss, NULL, NULL,
&error);
if (!pd->s) {
ERROR("Cannot connect to server in PulseAudio output "
"\"%s\" (attempt %i): %s\n", audioOutput->name,
pd->connAttempts, pa_strerror(error));
return -1;
}
pd->connAttempts = 0;
audioOutput->open = 1;
DEBUG("PulseAudio output \"%s\" connected and playing %i bit, %i "
"channel audio at %i Hz\n", audioOutput->name, audioFormat->bits,
audioFormat->channels, audioFormat->sampleRate);
return 0;
}
static void pulse_dropBufferedAudio(AudioOutput * audioOutput)
{
PulseData *pd;
int error;
pd = audioOutput->data;
if (pa_simple_flush(pd->s, &error) < 0)
WARNING("Flush failed in PulseAudio output \"%s\": %s\n",
audioOutput->name, pa_strerror(error));
}
static void pulse_closeDevice(AudioOutput * audioOutput)
{
PulseData *pd;
pd = audioOutput->data;
if (pd->s) {
pa_simple_drain(pd->s, NULL);
pa_simple_free(pd->s);
}
audioOutput->open = 0;
}
static int pulse_playAudio(AudioOutput * audioOutput, char *playChunk, int size)
{
PulseData *pd;
int error;
pd = audioOutput->data;
if (pa_simple_write(pd->s, playChunk, size, &error) < 0) {
ERROR("PulseAudio output \"%s\" disconnecting due to write "
"error: %s\n", audioOutput->name, pa_strerror(error));
pulse_closeDevice(audioOutput);
return -1;
}
return 0;
}
AudioOutputPlugin pulsePlugin = {
"pulse",
pulse_testDefault,
pulse_initDriver,
pulse_finishDriver,
pulse_openDevice,
pulse_playAudio,
pulse_dropBufferedAudio,
pulse_closeDevice,
NULL, /* sendMetadataFunc */
};
#else /* HAVE_PULSE */
DISABLED_AUDIO_OUTPUT_PLUGIN(pulsePlugin)
#endif /* HAVE_PULSE */
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* 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 MPD_AUDIO_FORMAT_H
#define MPD_AUDIO_FORMAT_H
#include <stdint.h>
#include <stdbool.h>
struct audio_format {
uint32_t sample_rate;
uint8_t bits;
uint8_t channels;
};
static inline void audio_format_clear(struct audio_format *af)
{
af->sample_rate = 0;
af->bits = 0;
af->channels = 0;
}
static inline bool audio_format_defined(const struct audio_format *af)
{
return af->sample_rate != 0;
}
static inline bool audio_format_equals(const struct audio_format *a,
const struct audio_format *b)
{
return a->sample_rate == b->sample_rate &&
a->bits == b->bits &&
a->channels == b->channels;
}
/**
* Returns the size of each (mono) sample in bytes.
*/
static inline unsigned audio_format_sample_size(const struct audio_format *af)
{
if (af->bits <= 8)
return 1;
else if (af->bits <= 16)
return 2;
else
return 4;
}
static inline unsigned
audio_format_frame_size(const struct audio_format *af)
{
return audio_format_sample_size(af) * af->channels;
}
static inline double audio_format_time_to_size(const struct audio_format *af)
{
return af->sample_rate * audio_format_frame_size(af);
}
static inline double audioFormatSizeToTime(const struct audio_format *af)
{
return 1.0 / audio_format_time_to_size(af);
}
#endif
......@@ -17,12 +17,7 @@
*/
#include "buffer2array.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "os_compat.h"
static inline
int
......@@ -79,48 +74,56 @@ int main()
int max;
b = strdup("lsinfo \"/some/dir/name \\\"test\\\"\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("/some/dir/name \"test\"", a[1]) );
assert( !a[2] );
b = strdup("lsinfo \"/some/dir/name \\\"test\\\" something else\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("/some/dir/name \"test\" something else", a[1]) );
assert( !a[2] );
b = strdup("lsinfo \"/some/dir\\\\name\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("/some/dir\\name", a[1]) );
assert( !a[2] );
b = strdup("lsinfo \"/some/dir name\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("/some/dir name", a[1]) );
assert( !a[2] );
b = strdup("lsinfo \"\\\"/some/dir\\\"\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("\"/some/dir\"", a[1]) );
assert( !a[2] );
b = strdup("lsinfo \"\\\"/some/dir\\\" x\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("\"/some/dir\" x", a[1]) );
assert( !a[2] );
b = strdup("lsinfo \"single quote\\'d from php magicquotes\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("single quote\'d from php magicquotes", a[1]) );
assert( !a[2] );
b = strdup("lsinfo \"double quote\\\"d from php magicquotes\"");
assert(b);
max = buffer2array(b, a, 4);
assert( !strcmp("lsinfo", a[0]) );
assert( !strcmp("double quote\"d from php magicquotes", a[1]) );
......
......@@ -16,10 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BUFFER_2_ARRAY_H
#define BUFFER_2_ARRAY_H
#include "../config.h"
#ifndef MPD_BUFFER_2_ARRAY_H
#define MPD_BUFFER_2_ARRAY_H
/* tokenizes up to max elements in buffer (a null-terminated string) and
* stores the result in array (which must be capable of holding up to
......
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* 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 "charConv.h"
#include "mpd_types.h"
#include "utf8.h"
#include "utils.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifdef HAVE_ICONV
#include <iconv.h>
static iconv_t char_conv_iconv;
#endif
static char *char_conv_to;
static char *char_conv_from;
static mpd_sint8 char_conv_same;
static mpd_sint8 char_conv_use_iconv;
/* 1 is to use latin1ToUtf8
0 is not to use latin1/utf8 converter
-1 is to use utf8ToLatin1*/
static mpd_sint8 char_conv_latin1ToUtf8;
#define BUFFER_SIZE 1024
static void closeCharSetConversion(void);
int setCharSetConversion(char *to, char *from)
{
if (char_conv_to && char_conv_from) {
if (char_conv_latin1ToUtf8 &&
!strcmp(from, char_conv_to) &&
!strcmp(to, char_conv_from)) {
char *swap = char_conv_from;
char_conv_from = char_conv_to;
char_conv_to = swap;
char_conv_latin1ToUtf8 *= -1;
return 0;
} else if (!strcmp(to, char_conv_to) &&
!strcmp(from,char_conv_from)) {
return 0;
}
}
closeCharSetConversion();
if (0 == strcmp(to, from)) {
char_conv_same = 1;
char_conv_to = xstrdup(to);
char_conv_from = xstrdup(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 = xstrdup(to);
char_conv_from = xstrdup(from);
return 0;
}
#ifdef HAVE_ICONV
if ((char_conv_iconv = iconv_open(to, from)) == (iconv_t) (-1))
return -1;
char_conv_to = xstrdup(to);
char_conv_from = xstrdup(from);
char_conv_use_iconv = 1;
return 0;
#endif
return -1;
}
char *convStrDup(char *string)
{
if (!char_conv_to)
return NULL;
if (char_conv_same)
return xstrdup(string);
#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 = xmalloc(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 == -1L && errno != E2BIG)) {
free(ret);
return NULL;
}
ret = xrealloc(ret, retlen + BUFFER_SIZE - outleft + 1);
memcpy(ret + retlen, buffer, BUFFER_SIZE - outleft);
retlen += BUFFER_SIZE - outleft;
ret[retlen] = '\0';
}
return ret;
}
#endif
switch (char_conv_latin1ToUtf8) {
case 1:
return latin1StrToUtf8Dup(string);
break;
case -1:
return utf8StrToLatin1Dup(string);
break;
}
return NULL;
}
static void closeCharSetConversion(void)
{
if (char_conv_to) {
#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;
}
}
This diff is collapsed. Click to expand it.
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* 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 MPD_CLIENT_H
#define MPD_CLIENT_H
#include "gcc.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdarg.h>
#include <sys/socket.h>
struct client;
void client_manager_init(void);
void client_manager_deinit(void);
int client_manager_io(void);
void client_manager_expire(void);
void client_new(int fd, const struct sockaddr *addr, int uid);
bool client_is_expired(const struct client *client);
/**
* returns the uid of the client process, or a negative value if the
* uid is unknown
*/
int client_get_uid(const struct client *client);
unsigned client_get_permission(const struct client *client);
void client_set_permission(struct client *client, unsigned permission);
/**
* Write a block of data to the client.
*/
void client_write(struct client *client, const char *data, size_t length);
/**
* Write a C string to the client.
*/
void client_puts(struct client *client, const char *s);
/**
* Write a printf-like formatted string to the client.
*/
void client_vprintf(struct client *client, const char *fmt, va_list args);
/**
* Write a printf-like formatted string to the client.
*/
mpd_fprintf void client_printf(struct client *client, const char *fmt, ...);
/**
* Adds the specified idle flags to all clients and immediately sends
* notifications to all waiting clients.
*/
void client_manager_idle_add(unsigned flags);
/**
* Checks whether the client has pending idle flags. If yes, they are
* sent immediately and "true" is returned". If no, it puts the
* client into waiting mode and returns false.
*/
bool client_idle_wait(struct client *client);
#endif
......@@ -16,35 +16,38 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMAND_H
#define COMMAND_H
#ifndef MPD_COMMAND_H
#define MPD_COMMAND_H
#include "../config.h"
#include "list.h"
#include "myfprintf.h"
#include "log.h"
#include "gcc.h"
#include "ack.h"
#include "sllist.h"
#include <unistd.h>
#include <stdio.h>
#include <glib.h>
#include <stdbool.h>
enum command_return {
COMMAND_RETURN_ERROR = -1,
COMMAND_RETURN_OK = 0,
COMMAND_RETURN_KILL = 10,
COMMAND_RETURN_CLOSE = 20,
};
#define COMMAND_RETURN_KILL 10
#define COMMAND_RETURN_CLOSE 20
#define COMMAND_MASTER_READY 30
struct client;
int processListOfCommands(int fd, int *permission, int *expired,
int listOK, struct strnode *list);
void command_init(void);
int processCommand(int fd, int *permission, char *commandString);
void command_finish(void);
void initCommands(void);
enum command_return
command_process_list(struct client *client,
bool list_ok, GSList *list);
void finishCommands(void);
enum command_return
command_process(struct client *client, char *commandString);
#define commandSuccess(fd) fdprintf(fd, "OK\n")
void command_success(struct client *client);
mpd_fprintf_ void commandError(int fd, int error, const char *fmt, ...);
mpd_fprintf_ void command_error(struct client *client, enum ack error,
const char *fmt, ...);
#endif
......@@ -20,11 +20,7 @@
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "os_compat.h"
#include "compress.h"
#include "utils.h"
......@@ -48,7 +44,7 @@ static struct {
int target;
int gainmax;
int gainsmooth;
int buckets;
unsigned buckets;
} prefs;
#ifdef USE_X
......@@ -56,9 +52,9 @@ static int mon_init;
#endif
void CompressCfg(int show_mon, int anticlip, int target, int gainmax,
int gainsmooth, int buckets)
int gainsmooth, unsigned buckets)
{
static int lastsize;
static unsigned lastsize;
prefs.show_mon = show_mon;
prefs.anticlip = anticlip;
......@@ -174,8 +170,8 @@ void CompressFree(void)
void CompressDo(void *data, unsigned int length)
{
int16_t *audio = (int16_t *)data, *ap;
int peak, pos;
int i;
int peak;
unsigned int i, pos;
int gr, gf, gn;
static int pn = -1;
#ifdef STATS
......@@ -358,7 +354,7 @@ void CompressDo(void *data, unsigned int length)
if (!pos)
pos = 1;
gr = ((gainTarget - gainCurrent) << 16)/pos;
gr = ((gainTarget - gainCurrent) << 16)/(int)pos;
/* Do the shiznit */
gf = gainCurrent << 16;
......
......@@ -20,8 +20,8 @@
*
*/
#ifndef COMPRESS_H
#define COMPRESS_H
#ifndef MPD_COMPRESS_H
#define MPD_COMPRESS_H
/* These are copied from the AudioCompress config.h, mainly because CompressDo
* needs GAINSHIFT defined. The rest are here so they can be used as defaults
......@@ -38,7 +38,7 @@ void CompressCfg(int monitor,
int target,
int maxgain,
int smooth,
int buckets);
unsigned buckets);
void CompressDo(void *data, unsigned int numSamples);
......
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* Copyright (C) 2008 Max Kellermann <max@duempel.org>
* 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 "condition.h"
#include "utils.h"
#include "log.h"
#include <sys/time.h>
#include <string.h>
void cond_init(struct condition *cond)
{
xpthread_mutex_init(&cond->mutex, NULL);
xpthread_cond_init(&cond->cond, NULL);
}
void cond_enter(struct condition *cond)
{
pthread_mutex_lock(&cond->mutex);
}
void cond_leave(struct condition *cond)
{
pthread_mutex_unlock(&cond->mutex);
}
void cond_wait(struct condition *cond)
{
pthread_cond_wait(&cond->cond, &cond->mutex);
}
static struct timespec * ts_timeout(struct timespec *ts, const long sec)
{
struct timeval tv;
gettimeofday(&tv, NULL);
ts->tv_sec = tv.tv_sec + sec;
ts->tv_nsec = tv.tv_usec * 1000;
return ts;
}
int cond_timedwait(struct condition *cond, const long sec)
{
struct timespec ts;
int ret = pthread_cond_timedwait(&cond->cond, &cond->mutex,
ts_timeout(&ts, sec));
if (!ret || ret == ETIMEDOUT)
return ret;
FATAL("cond_timedwait: %s\n", strerror(ret));
return ret;
}
int cond_signal_async(struct condition *cond)
{
if (!pthread_mutex_trylock(&cond->mutex)) {
pthread_cond_signal(&cond->cond);
pthread_mutex_unlock(&cond->mutex);
return 0;
}
return EBUSY;
}
void cond_signal_sync(struct condition *cond)
{
pthread_cond_signal(&cond->cond);
}
void cond_destroy(struct condition *cond)
{
xpthread_cond_destroy(&cond->cond);
xpthread_mutex_destroy(&cond->mutex);
}
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* Copyright (C) 2008 Max Kellermann <max@duempel.org>
* 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 MPD_CONDITION_H
#define MPD_CONDITION_H
#include <pthread.h>
struct condition {
pthread_mutex_t mutex;
pthread_cond_t cond;
};
void cond_init(struct condition *cond);
/**
* The thread which shall be notified by this object must call this
* function before any cond_wait() invocation. It locks the mutex.
*/
void cond_enter(struct condition *cond);
/**
* Neutralize cond_leave().
*/
void cond_leave(struct condition *cond);
/**
* Wait for a conditio. Return immediately if we have already
* been notified since we last returned from cond_wait().
*/
void cond_wait(struct condition *cond);
/**
* Wait for a condition with timeout
*
* @param sec number of seconds to wait for (subject to change)
*
* @return ETIMEDOUT if timed out, 0 if notification was received
*/
int cond_timedwait(struct condition *cond, const long sec);
/**
* Notify the thread there is a waiter. This function never blocks.
*
* @return EBUSY if it was unable to lock the mutex, 0 on success
*/
int cond_signal_async(struct condition *cond);
/**
* Notify the thread synchronously, i.e. wait until it can deliver
* the notification.
*/
void cond_signal_sync(struct condition *cond);
/**
* cond_destroy - destroy the cond and internal structures
*/
void cond_destroy(struct condition *cond);
#endif /* CONDITION_H */
......@@ -23,17 +23,10 @@
#include "utils.h"
#include "buffer2array.h"
#include "list.h"
#include "path.h"
#include "os_compat.h"
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <errno.h>
#define MAX_STRING_SIZE MAXPATHLEN+80
#define MAX_STRING_SIZE MPD_PATH_MAX+80
#define CONF_COMMENT '#'
#define CONF_BLOCK_BEGIN "{"
......@@ -50,6 +43,23 @@ typedef struct _configEntry {
static List *configEntriesList;
static int get_bool(const char *value)
{
const char **x;
static const char *t[] = { "yes", "true", "1", NULL };
static const char *f[] = { "no", "false", "0", NULL };
for (x = t; *x; x++) {
if (!strcasecmp(*x, value))
return 1;
}
for (x = f; *x; x++) {
if (!strcasecmp(*x, value))
return 0;
}
return CONF_BOOL_INVALID;
}
static ConfigParam *newConfigParam(char *value, int line)
{
ConfigParam *ret = xmalloc(sizeof(ConfigParam));
......@@ -111,7 +121,7 @@ static void freeConfigEntry(ConfigEntry * entry)
free(entry);
}
static void registerConfigParam(char *name, int repeatable, int block)
static void registerConfigParam(const char *name, int repeatable, int block)
{
ConfigEntry *entry;
......@@ -243,7 +253,7 @@ static ConfigParam *readConfigBlock(FILE * fp, int *count, char *string)
return ret;
}
void readConf(char *file)
void readConf(const char *file)
{
FILE *fp;
char string[MAX_STRING_SIZE + 1];
......@@ -311,7 +321,7 @@ void readConf(char *file)
fclose(fp);
}
ConfigParam *getNextConfigParam(char *name, ConfigParam * last)
ConfigParam *getNextConfigParam(const char *name, ConfigParam * last)
{
void *voidPtr;
ConfigEntry *entry;
......@@ -342,7 +352,7 @@ ConfigParam *getNextConfigParam(char *name, ConfigParam * last)
return param;
}
char *getConfigParamValue(char *name)
char *getConfigParamValue(const char *name)
{
ConfigParam *param = getConfigParam(name);
......@@ -352,22 +362,7 @@ char *getConfigParamValue(char *name)
return param->value;
}
int getBoolConfigParam(char *name)
{
ConfigParam *param;
param = getConfigParam(name);
if (!param) return -1;
if (strcmp("yes", param->value) == 0) return 1;
else if (strcmp("no", param->value) == 0) return 0;
ERROR("%s is not \"yes\" or \"no\" on line %i\n", name, param->line);
return -2;
}
BlockParam *getBlockParam(ConfigParam * param, char *name)
BlockParam *getBlockParam(ConfigParam * param, const char *name)
{
BlockParam *ret = NULL;
int i;
......@@ -386,7 +381,7 @@ BlockParam *getBlockParam(ConfigParam * param, char *name)
return ret;
}
ConfigParam *parseConfigFilePath(char *name, int force)
ConfigParam *parseConfigFilePath(const char *name, int force)
{
ConfigParam *param = getConfigParam(name);
char *path;
......@@ -397,55 +392,44 @@ ConfigParam *parseConfigFilePath(char *name, int force)
if (!param)
return NULL;
path = param->value;
path = parsePath(param->value);
if (!path)
FATAL("error parsing \"%s\" at line %i\n", name, param->line);
if (path[0] != '/' && path[0] != '~') {
FATAL("\"%s\" is not an absolute path at line %i\n",
param->value, param->line);
}
/* Parse ~ in path */
else if (path[0] == '~') {
struct passwd *pwd = NULL;
char *newPath;
int pos = 1;
if (path[1] == '/' || path[1] == '\0') {
ConfigParam *userParam = getConfigParam(CONF_USER);
if (userParam) {
pwd = getpwnam(userParam->value);
if (!pwd) {
FATAL("no such user %s at line %i\n",
userParam->value,
userParam->line);
}
} else {
uid_t uid = geteuid();
if ((pwd = getpwuid(uid)) == NULL) {
FATAL("problems getting passwd entry "
"for current user\n");
}
}
} else {
int foundSlash = 0;
char *ch = path + 1;
for (; *ch != '\0' && *ch != '/'; ch++) ;
if (*ch == '/')
foundSlash = 1;
*ch = '\0';
pos += ch - path - 1;
if ((pwd = getpwnam(path + 1)) == NULL) {
FATAL("user \"%s\" not found at line %i\n",
path + 1, param->line);
}
if (foundSlash)
*ch = '/';
}
newPath = xmalloc(strlen(pwd->pw_dir) + strlen(path + pos) + 1);
strcpy(newPath, pwd->pw_dir);
strcat(newPath, path + pos);
free(param->value);
param->value = newPath;
}
free(param->value);
param->value = path;
return param;
}
int getBoolConfigParam(const char *name, int force)
{
int ret;
ConfigParam *param = getConfigParam(name);
if (!param)
return CONF_BOOL_UNSET;
ret = get_bool(param->value);
if (force && ret == CONF_BOOL_INVALID)
FATAL("%s is not a boolean value (yes, true, 1) or "
"(no, false, 0) on line %i\n",
name, param->line);
return ret;
}
int getBoolBlockParam(ConfigParam *param, const char *name, int force)
{
int ret;
BlockParam *bp = getBlockParam(param, name);
if (!bp)
return CONF_BOOL_UNSET;
ret = get_bool(bp->value);
if (force && ret == CONF_BOOL_INVALID)
FATAL("%s is not a boolean value (yes, true, 1) or "
"(no, false, 0) on line %i\n", bp->value, bp->line);
return ret;
}
......@@ -16,10 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CONF_H
#define CONF_H
#include "../config.h"
#ifndef MPD_CONF_H
#define MPD_CONF_H
#define CONF_MUSIC_DIR "music_directory"
#define CONF_PLAYLIST_DIR "playlist_directory"
......@@ -64,6 +62,9 @@
#define CONF_SAVE_ABSOLUTE_PATHS "save_absolute_paths_in_playlists"
#define CONF_GAPLESS_MP3_PLAYBACK "gapless_mp3_playback"
#define CONF_BOOL_UNSET -1
#define CONF_BOOL_INVALID -2
typedef struct _BlockParam {
char *name;
char *value;
......@@ -80,20 +81,22 @@ typedef struct _ConfigParam {
void initConf(void);
void finishConf(void);
void readConf(char *file);
void readConf(const char *file);
/* don't free the returned value
set _last_ to NULL to get first entry */
ConfigParam *getNextConfigParam(char *name, ConfigParam * last);
ConfigParam *getNextConfigParam(const char *name, ConfigParam * last);
#define getConfigParam(name) getNextConfigParam(name, NULL)
char *getConfigParamValue(char *name);
char *getConfigParamValue(const char *name);
BlockParam *getBlockParam(ConfigParam * param, const char *name);
int getBoolConfigParam(char *name);
ConfigParam *parseConfigFilePath(const char *name, int force);
BlockParam *getBlockParam(ConfigParam * param, char *name);
int getBoolConfigParam(const char *name, int force);
ConfigParam *parseConfigFilePath(char *name, int force);
int getBoolBlockParam(ConfigParam *param, const char *name, int force);
#endif
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* Copyright (C) 2008 Max Kellermann <max@duempel.org>
* 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 "crossfade.h"
#include "audio.h"
#include "pcm_utils.h"
#include "pipe.h"
#include "audio_format.h"
#include "tag.h"
#include <assert.h>
#include <string.h>
unsigned cross_fade_calc(float duration, float total_time,
const struct audio_format *af,
unsigned max_chunks)
{
unsigned int chunks;
if (duration <= 0 || duration >= total_time ||
!isCurrentAudioFormat(af))
return 0;
assert(duration > 0);
assert(af->bits > 0);
assert(af->channels > 0);
assert(af->sample_rate > 0);
chunks = audio_format_time_to_size(af) / CHUNK_SIZE;
chunks = (chunks * duration + 0.5);
if (chunks > max_chunks)
chunks = max_chunks;
return chunks;
}
void cross_fade_apply(struct music_chunk *a, const struct music_chunk *b,
const struct audio_format *format,
unsigned int current_chunk, unsigned int num_chunks)
{
size_t size;
assert(current_chunk <= num_chunks);
if (a->tag == NULL && b->tag != NULL)
/* merge the tag into the destination chunk */
a->tag = tag_dup(b->tag);
size = b->length > a->length
? a->length
: b->length;
pcm_mix(a->data,
b->data,
size,
format,
((float)current_chunk) / num_chunks);
if (b->length > a->length) {
/* the second buffer is larger than the first one:
there is unmixed rest at the end. Copy it over.
The output buffer API guarantees that there is
enough room in a->data. */
memcpy(a->data + a->length,
b->data + a->length,
b->length - a->length);
a->length = b->length;
}
}
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* Copyright (C) 2008 Max Kellermann <max@duempel.org>
* 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 MPD_CROSSFADE_H
#define MPD_CROSSFADE_H
struct audio_format;
struct music_chunk;
unsigned cross_fade_calc(float duration, float total_time,
const struct audio_format *af,
unsigned max_chunks);
void cross_fade_apply(struct music_chunk *a, const struct music_chunk *b,
const struct audio_format *format,
unsigned int current_chunk, unsigned int num_chunks);
#endif
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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