Commit 88831267 authored by Led's avatar Led

0.10.0-rc1

parent c3cb1cf2
......@@ -3,3 +3,4 @@ Developer -> tw-nym
wave File Support -> normalperson
setuid patch -> Nagilum
'next' and 'previous' patch -> Niklas Hofer
command.c cleanup -> mackstann
ver 0.10.0 (2004/3/3)
1) Use UTF-8 for all client communications
2) Crossfading support
3) Password Authentication (all in plaintext)
4) Software mixer
5) Buffer Size is configurable
6) Reduced Memory consumption (use directory tree for search and find)
7) Bitrate support for Flac
8) setvol command (deprecates volume command)
9) add command takes directories
10) Path's in config file now work with ~
11) Add samplerate,bits, and channels to status
12) Reenable playTime in stats display
13) Fix a segfault when doing: add ""
14) Fix a segfault with flac vorbis comments simply being "="
15) Fix a segfault/bug in queueNextSong with repeat+random
16) Fix a bug, where one process may segfault, and cause more processes to spawn w/o killing ones that lost their parent.
17) Fix a bug when the OSS device was unable to fetch the current volume,
it would close the device (when it maybe previously closed by the exact same code)
ver 0.9.4 (2004/1/21)
1) Fix a bug where updated tag info wasn't being detected
2) Set the default audio write size to 1024 bytes (should decrease cpu load a bit on some machines).
......
......@@ -25,6 +25,9 @@ libogg, libogg-devel, libvorbis, and libvorbis-devel).
Flac - http://flac.sf.net
For Flac support, you need Flac 1.1.0 or greater.
Audiofile - http://www.68k.org/~michael/audiofile/
For wave support.
Download
--------
......
SUBDIRS = src doc debian
SUBDIRS = src doc
docdir = $(prefix)/share/doc/$(PACKAGE)
doc_DATA = README UPGRADING
EXTRA_DIST = COPYING $(doc_DATA)
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -13,106 +13,133 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AO_CFLAGS = @AO_CFLAGS@
AO_LIBS = @AO_LIBS@
AR = @AR@
AS = @AS@
AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@
AUDIOFILE_CONFIG = @AUDIOFILE_CONFIG@
AUDIOFILE_LIBS = @AUDIOFILE_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
F77 = @F77@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
EXEEXT = @EXEEXT@
ID3_LIB = @ID3_LIB@
ID3_SUBDIR = @ID3_SUBDIR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAD_LIB = @MAD_LIB@
MAD_SUBDIR = @MAD_SUBDIR@
MAKEINFO = @MAKEINFO@
MPD_CFLAGS = @MPD_CFLAGS@
MPD_LIBS = @MPD_LIBS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
RC = @RC@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
SUBDIRS = src doc debian
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = src doc
docdir = $(prefix)/share/doc/$(PACKAGE)
doc_DATA = README UPGRADING
EXTRA_DIST = COPYING $(doc_DATA)
......@@ -124,14 +151,15 @@ DIST_SOURCES =
DATA = $(doc_DATA)
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
uninstall-info-recursive all-recursive install-data-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in TODO aclocal.m4 compile config.guess config.sub \
configure configure.in depcomp install-sh ltmain.sh missing \
mkinstalldirs
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL Makefile.am TODO aclocal.m4 compile \
config.guess config.sub configure configure.ac depcomp \
install-sh ltmain.sh missing mkinstalldirs
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
......@@ -139,7 +167,7 @@ all: all-recursive
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
......@@ -147,10 +175,10 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
$(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): configure.in
$(ACLOCAL_M4): configure.ac
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
mostlyclean-libtool:
......@@ -235,10 +263,17 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
......@@ -254,9 +289,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
......@@ -269,13 +310,28 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
......@@ -287,12 +343,19 @@ am__remove_distdir = \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
......@@ -345,12 +408,13 @@ distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
......@@ -358,23 +422,39 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
find $$dc_install_base -type f -print ; \
exit 1; } >&2 ) \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after distclean:" ; \
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
......@@ -403,7 +483,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
......@@ -414,6 +494,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
......@@ -437,33 +518,43 @@ installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-docDATA uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive dist dist-all \
dist-gzip distcheck distclean distclean-generic \
distclean-libtool distclean-recursive distclean-tags \
distcleancheck distdir dvi dvi-am dvi-recursive info info-am \
info-recursive install install-am install-data install-data-am \
install-data-recursive install-docDATA install-exec \
install-exec-am install-exec-recursive install-info \
install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive tags tags-recursive \
uninstall uninstall-am uninstall-docDATA uninstall-info-am \
uninstall-info-recursive uninstall-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive ctags \
ctags-recursive dist dist-all dist-gzip distcheck distclean \
distclean-generic distclean-libtool distclean-recursive \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am dvi-recursive info info-am info-recursive install \
install-am install-data install-data-am install-data-recursive \
install-docDATA install-exec install-exec-am \
install-exec-recursive install-info install-info-am \
install-info-recursive install-man install-recursive \
install-strip installcheck installcheck-am installdirs \
installdirs-am installdirs-recursive maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
tags-recursive uninstall uninstall-am uninstall-docDATA \
uninstall-info-am uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
......
0.10.0
------
1) store song times (possibly after playing)
2) possibly, crossfading
3) resample in software for sound cards that support a limited range of
sampling rate.
4) Password protection
1) 24-bit pcm-tools (this may just wait since almost no one uses it)
2?) put software mixer settings in state file
Music Player Daemon (MPD) - UPGRADING
Upgrading to 0.10.0
-------------------
All information is now stored in the db in UTF-8 format, and the character
set used for the filesystem is stored in the db. Thus, it is highly
recommended that you recreate the db. To do so, run mpd with the
"--create-db" command line option. Also, note that the filesystem
character set will be determined from your current locale settings.
If your locale settings are not the same as those used for the filesystem,
then use the config file parameter "filesystem_charset" to specify the
correct character set (this maybe neccessary if you create the db with root).
Upgrading to 0.9.3
------------------
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -28,14 +28,6 @@
# compile PROGRAM [ARGS]...
# `-o FOO.o' is removed from the args passed to the actual compile.
# 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
prog=$1
shift
......
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2004-01-05'
timestamp='2002-10-21'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
......@@ -98,18 +98,14 @@ trap 'exit 1' 1 2 15
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
# This shell variable is my proudest work .. or something. --bje
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
|| (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
dummy=$tmpdir/dummy ;
files="$dummy.c $dummy.o $dummy.rel $dummy" ;
trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
......@@ -117,13 +113,15 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
rm -f $files ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ;'
esac ;
unset files'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
......@@ -180,18 +178,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
......@@ -221,9 +208,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pegasos:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
......@@ -243,52 +227,68 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
fi
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
eval $set_cc_for_build
cat <<EOF >$dummy.s
.data
\$Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
.text
.globl main
.align 4
.ent main
main:
.frame \$30,16,\$26,0
ldgp \$29,0(\$27)
.prologue 1
.long 0x47e03d80 # implver \$0
lda \$2,-1
.long 0x47e20c21 # amask \$2,\$1
lda \$16,\$Lformat
mov \$0,\$17
not \$1,\$18
jsr \$26,printf
ldgp \$29,0(\$26)
mov 0,\$16
jsr \$26,exit
.end main
EOF
$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
if test "$?" = 0 ; then
case `$dummy` in
0-0)
UNAME_MACHINE="alpha"
;;
1-0)
UNAME_MACHINE="alphaev5"
;;
1-1)
UNAME_MACHINE="alphaev56"
;;
1-101)
UNAME_MACHINE="alphapca56"
;;
2-303)
UNAME_MACHINE="alphaev6"
;;
2-307)
UNAME_MACHINE="alphaev67"
;;
2-1307)
UNAME_MACHINE="alphaev68"
;;
3-1307)
UNAME_MACHINE="alphaev7"
;;
esac
fi
rm -f $dummy.s $dummy && rmdir $tmpdir
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha*:OpenVMS:*:*)
echo alpha-hp-vms
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
......@@ -310,9 +310,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
......@@ -330,9 +327,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
......@@ -445,7 +439,8 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
EOF
$CC_FOR_BUILD -o $dummy $dummy.c \
&& $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& exit 0
&& rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Motorola:PowerMAX_OS:*:*)
......@@ -454,7 +449,7 @@ EOF
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
Night_Hawk:*:*:PowerMAX_OS)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
......@@ -529,7 +524,8 @@ EOF
exit(0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
......@@ -628,20 +624,10 @@ EOF
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
rm -f $dummy.c $dummy && rmdir $tmpdir
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
# avoid double evaluation of $set_cc_for_build
test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
ia64:HP-UX:*:*)
......@@ -675,7 +661,8 @@ EOF
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
......@@ -733,26 +720,21 @@ EOF
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3D:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
*:UNICOS/mp:*:*)
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
......@@ -774,10 +756,8 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
# FreeBSD's kernel, but not the complete OS.
case ${LIBC} in gnu) kernel_only='k' ;; esac
echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
rm -f $dummy.c && rmdir $tmpdir
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
......@@ -788,17 +768,14 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;;
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
x86:Interix*:3*)
echo i386-pc-interix3
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
......@@ -810,22 +787,14 @@ EOF
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit 0 ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
......@@ -849,26 +818,8 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
rm -f $dummy.c && rmdir $tmpdir
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
......@@ -904,9 +855,6 @@ EOF
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
......@@ -964,11 +912,9 @@ EOF
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c && rmdir $tmpdir
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
......@@ -986,26 +932,6 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
......@@ -1040,6 +966,9 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
......@@ -1066,12 +995,9 @@ EOF
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit 0 ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
......@@ -1088,6 +1014,9 @@ EOF
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
......@@ -1169,11 +1098,7 @@ EOF
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
case `uname -p` in
*86) UNAME_PROCESSOR=i686 ;;
powerpc) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
......@@ -1186,7 +1111,7 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-?:NONSTOP_KERNEL:*:*)
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
......@@ -1209,6 +1134,11 @@ EOF
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit 0 ;;
......@@ -1227,11 +1157,11 @@ EOF
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
*:DRAGONFLY:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE}
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
esac
......@@ -1353,7 +1283,8 @@ main ()
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
rm -f $dummy.c $dummy && rmdir $tmpdir
# Apollos put the system type in the environment.
......
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2004-01-05'
timestamp='2002-09-05'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
......@@ -118,8 +118,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
......@@ -229,14 +228,13 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| c4x | clipper \
| clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| ip2k \
| m32r | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
......@@ -247,24 +245,21 @@ case $basic_machine in
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| msp430 \
| ns16k | ns32k \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| tahoe | thumb | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
......@@ -299,7 +294,7 @@ case $basic_machine in
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
| clipper-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
......@@ -307,7 +302,7 @@ case $basic_machine in
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| ip2k-* \
| m32r-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
......@@ -320,26 +315,21 @@ case $basic_machine in
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
| mipstx39 | mipstx39el \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
......@@ -377,9 +367,6 @@ case $basic_machine in
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
......@@ -732,10 +719,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
nv1)
basic_machine=nv1-cray
os=-unicosmp
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
......@@ -747,10 +730,6 @@ case $basic_machine in
basic_machine=or32-unknown
os=-coff
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
......@@ -782,24 +761,18 @@ case $basic_machine in
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2 | pentiumiii | pentium3)
pentiumii | pentium2)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
pentiumii-* | pentium2-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
......@@ -858,10 +831,6 @@ case $basic_machine in
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
......@@ -869,9 +838,6 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
......@@ -938,6 +904,10 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
t3d)
basic_machine=alpha-cray
os=-unicos
;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
......@@ -946,16 +916,12 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
tic4x | c4x*)
basic_machine=tic4x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tx39)
......@@ -971,10 +937,6 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
......@@ -1018,6 +980,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
windows32)
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
......@@ -1064,7 +1030,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
basic_machine=sh-unknown
;;
sh64)
......@@ -1143,19 +1109,18 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
......@@ -1167,10 +1132,8 @@ case $os in
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
os=-nto-qnx
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
......@@ -1179,9 +1142,6 @@ case $os in
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
......@@ -1194,9 +1154,6 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
......@@ -1218,9 +1175,6 @@ case $os in
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
......@@ -1243,9 +1197,6 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
......@@ -1276,12 +1227,6 @@ case $os in
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-none)
;;
*)
......@@ -1313,9 +1258,6 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
......@@ -1494,15 +1436,9 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
AC_INIT(src/main.c)
AM_INIT_AUTOMAKE(mpd, 0.9.5)
dnl AC_INIT(src/main.c)
dnl AM_INIT_AUTOMAKE(mpd, 0.10.0)
AC_PREREQ(2.52)
AC_INIT(mpd, 0.10.0, shank@mercury.chem.pitt.edu)
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
AC_PROG_CC
AC_PROG_INSTALL
......@@ -20,6 +24,7 @@ MPD_CFLAGS="-Wall"
MPD_LIBS=""
AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support],,enable_iconv=yes)
AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support],,enable_ipv6=yes)
AC_ARG_ENABLE(ogg,[ --disable-ogg disable ogg support],,enable_ogg=yes)
AC_ARG_ENABLE(flac,[ --disable-flac disable flac support],,enable_flac=yes)
AC_ARG_ENABLE(mp3,[ --disable-mp3 disable mp3 support],,enable_mp3=yes)
......@@ -36,9 +41,19 @@ AC_ARG_WITH(mad,[ --with-mad=PFX Prefix where libmad is installed (optional)]
AC_ARG_WITH(mad-libraries,[ --with-mad-libraries=DIR Directory where libmad library is installed (optional)], mad_libraries="$withval", mad_libraries="")
AC_ARG_WITH(mad-includes,[ --with-mad-includes=DIR Directory where mad header files are installed (optional)], mad_includes="$withval", mad_includes="")
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",)
AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
AC_CHECK_HEADER(langinfo.h,MPD_CFLAGS="$MPD_CFLAGS -DHAVE_LANGINFO",)
AC_CHECK_HEADER(locale.h,MPD_CFLAGS="$MPD_CFLAGS -DHAVE_LOCALE",)
if test x$enable_iconv = xyes; then
AC_CHECK_HEADER(iconv.h,MPD_CFLAGS="$MPD_CFLAGS -DHAVE_ICONV",enable_iconv=no)
if test x$enable_iconv = xyes; then
......@@ -46,9 +61,10 @@ if test x$enable_iconv = xyes; then
fi
fi
AC_MSG_CHECKING(for ipv6)
AC_EGREP_CPP([AP_maGiC_VALUE],
[
if test x$enable_ipv6 = xyes; then
AC_MSG_CHECKING(for ipv6)
AC_EGREP_CPP([AP_maGiC_VALUE],
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
......@@ -57,11 +73,12 @@ AC_EGREP_CPP([AP_maGiC_VALUE],
AP_maGiC_VALUE
#endif
#endif
],
MPD_CFLAGS="$MPD_CFLAGS -DHAVE_IPV6"
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
],
MPD_CFLAGS="$MPD_CFLAGS -DHAVE_IPV6"
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
)
fi
XIPH_PATH_AO(MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS",AC_MSG_ERROR(Must have libao installed!!!))
AC_CHECK_HEADER(sys/soundcard.h,,[MPD_CFLAGS="$MPD_CFLAGS -DNO_OSS_MIXER";AC_MSG_WARN(Soundcard headers not found -- disabling mixer)])
......@@ -256,4 +273,4 @@ if test x$enable_audiofile = xyes; then
[enable_audiofile=no;AC_MSG_WARN(You need audiofile -- disabling audiofile support)])
fi
AC_OUTPUT(debian/Makefile doc/Makefile src/Makefile Makefile )
AC_OUTPUT(doc/Makefile src/Makefile Makefile )
EXTRA_DIST = changelog compat control copyright dirs docs rules config \
init postinst postrm prerm templates conffiles
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
AMTAR = @AMTAR@
AO_CFLAGS = @AO_CFLAGS@
AO_LIBS = @AO_LIBS@
AR = @AR@
AS = @AS@
AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@
AUDIOFILE_CONFIG = @AUDIOFILE_CONFIG@
AUDIOFILE_LIBS = @AUDIOFILE_LIBS@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EGREP = @EGREP@
F77 = @F77@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
ID3_LIB = @ID3_LIB@
ID3_SUBDIR = @ID3_SUBDIR@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAD_LIB = @MAD_LIB@
MAD_SUBDIR = @MAD_SUBDIR@
MPD_CFLAGS = @MPD_CFLAGS@
MPD_LIBS = @MPD_LIBS@
OBJDUMP = @OBJDUMP@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
RC = @RC@
STRIP = @STRIP@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
EXTRA_DIST = changelog compat control copyright dirs docs rules config \
init postinst postrm prerm templates conffiles
subdir = debian
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign debian/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
tags: TAGS
TAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am install-info \
install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool uninstall uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
mpd (0.9.4-1) unstable; urgency=low
* Update to 0.9.4
-- Warren Dukes (aka shank) <shank@mercury.chem.pitt.edu> Tue, 20 Jan 2004 22:24:00 -0500
mpd (0.9.3-1) unstable; urgency=low
* Update to 0.9.3
* Switch to cdbs
* Use debconf for configure music_directory, playlist_directory, port
* Add /etc/mpd.conf and /etc/mpd/conf
* Add initd script
-- Warren Dukes (aka shank) <shank@mercury.chem.pitt.edu> Tue, 31 Oct 2003 18:16:00 -0400
mpd (0.9.2-1) unstable; urgency=low
* Update to 0.9.2
-- Warren Dukes (aka shank) <shank@mercury.chem.pitt.edu> Tue, 06 Oct 2003 22:04:00 -0400
mpd (0.9.1-1) unstable; urgency=low
* Update to 0.9.1
-- Warren Dukes <shank@mercury.chem.pitt.edu> Tue, 30 Sep 2003 09:09:00 -0400
mpd (0.9.0-1) unstable; urgency=low
* Update to 0.9.0
-- Warren Dukes <shank@mercury.chem.pitt.edu> Tue, 29 Sep 2003 19:39:00 -0400
mpd (0.8.7-1) unstable; urgency=low
* Update to 0.8.7
-- Warren Dukes <shank@mercury.chem.pitt.edu> Tue, 03 Sep 2003 22:39:00 -0400
mpd (0.8.6-1) unstable; urgency=low
* Update to 0.8.6
-- Warren Dukes <shank@mercury.chem.pitt.edu> Tue, 25 Aug 2003 20:35:00 -0400
mpd (0.8.5-1) unstable; urgency=low
* Update to 0.8.5
-- Warren Dukes <shank@mercury.chem.pitt.edu> Tue, 17 Aug 2003 22:50:00 -0400
mpd (0.8.4-1) unstable; urgency=low
* Update to 0.8.4
-- Warren Dukes <shank@mercury.chem.pitt.edu> Tue, 12 Aug 2003 19:35:00 -0400
mpd (0.8.3-1) unstable; urgency=low
* Update to 0.8.3
-- Warren Dukes <shank@mercury.chem.pitt.edu> Tue, 12 Aug 2003 19:35:00 -0400
mpd (0.8.2-1) unstable; urgency=low
* Initial Release.
-- Warren Dukes <shank@mercury.chem.pitt.edu> Fri, 25 Jul 2003 10:28:30 -0400
#!/bin/sh -e
# Source debconf library.
. /usr/share/debconf/confmodule
# Do you like debian?
db_input medium mpd/systemwide || true
db_go
db_get mpd/systemwide || true
if [ "$RET" = "true" ] ; then
db_input medium mpd/music_directory || true
db_go
db_input medium mpd/playlist_directory || true
db_go
db_input low mpd/port || true
db_go
fi
Source: mpd
Section: sound
Priority: optional
Maintainer: Warren Dukes (aka shank) <shank@mercury.chem.pitt.edu>
Build-Depends: debhelper (>> 4.0.0), libao-dev (>=0.8.3-1), libogg-dev, libvorbis-dev, libflac-dev (>=1.1.0-4), libmad0-dev, libid3tag0-dev, debconf, cdbs, libaudiofile-dev
Standards-Version: 3.5.8
Package: mpd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Music Player Daemon (MPD)
MPD is a server that allows remote access for playing
music (MP3, Ogg Vorbis, and Flac) and managing playlists. The design focus is
on integrating a computer into a stereo system that provides control for music
playback over a local network. Currently, it includes a Web interface, phpMp;
a command line tool, mpc; and a dock app, WMmp. The goals are to be easy to
install and use, to have minimal resource requirements, and to be stable and
flexible.
This package was debianized by Warren Dukes <shank@mercury.chem.pitt.edu> on
Fri, 25 Jul 2003 10:28:30 -0400.
It was downloaded from http://musicpd.sf.net
Upstream Author: Warren Dukes <shank@mercury.chem.pitt.edu>
This software is copyright (c) 2003 by Warren Dukes
You are free to distribute this software under the terms of
the GNU General Public License.
On Debian systems, the complete text of the GNU General Public
License can be found in the file `/usr/share/common-licenses/GPL'.
usr/bin
usr/share/man/man1
#! /bin/sh
set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/mpd
DBFILE=/var/run/mpd/mpddb
test -x $DAEMON || exit 0
case "$1" in
start)
if test -f $DBFILE; then
echo -n "Starting Music Player Daemon: mpd"
start-stop-daemon --start --quiet --exec $DAEMON
echo "."
else
echo "MPD db not found, run: $DAEMON --create-db."
fi
;;
stop)
echo -n "Stopping Music Player Daemon: mpd"
start-stop-daemon --stop --quiet --exec $DAEMON || echo -n " ... mpd not running"
echo "."
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/mpd {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
#!/bin/sh -e
# Source debconf library.
. /usr/share/debconf/confmodule
db_get mpd/systemwide || true
if [ "$RET" = "true" ] ; then
echo "# BEGIN - GENERTATED BY DEBCONF" > /etc/mpd.conf
db_get mpd/music_directory || true
echo "music_directory \"$RET\"" >> /etc/mpd.conf
db_get mpd/playlist_directory || true
echo "playlist_directory \"$RET\"" >> /etc/mpd.conf
db_get mpd/port || true
echo "port \"$RET\"" >> /etc/mpd.conf
echo "# END - GENERTATED BY DEBCONF" >> /etc/mpd.conf
echo "" >> /etc/mpd.conf
echo "# Rest included from /etc/mpd/conf" >> /etc/mpd.conf
cat /etc/mpd/conf >> /etc/mpd.conf
chmod 600 /etc/mpd.conf
groupadd mpd > /dev/null 2>&1 || true
useradd -M -g mpd -G mpd,audio mpd > /dev/null 2>&1 || true
mkdir -p /var/log/mpd
chown mpd.mpd /var/log/mpd
chmod 700 /var/log/mpd
mkdir -p /var/lib/mpd
chown mpd.mpd /var/lib/mpd
chmod 700 /var/lib/mpd
# Automatically added by dh_installinit
if [ -x "/etc/init.d/mpd" ]; then
update-rc.d mpd defaults >/dev/null
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d mpd start
else
/etc/init.d/mpd start
fi
fi
# End automatically added section
fi
#!/bin/sh -e
rm -r /var/log/mpd > /dev/null 2>&1 || true
rm -r /var/lib/mpd > /dev/null 2>&1 || true
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d mpd remove defaults >/dev/null
rm -rf /var/log/mpd
rm -rf /var/lib/mpd
rm -f /etc/mpd.conf
fi
# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
# End automatically added section
#!/bin/sh -e
# Automatically added by dh_installinit
if [ -x "/etc/init.d/mpd" ]; then
if [ -x /usr/sbin/invoke-rc.d ] ; then
invoke-rc.d mpd stop
else
/etc/init.d/mpd stop
fi
fi
# End automatically added section
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
binary-post-install/mpd::
mkdir -p debian/mpd/usr/share/doc/mpd/examples
cp doc/mpdconf.example debian/mpd/usr/share/doc/mpd/examples
mkdir -p debian/mpd/etc/mpd
echo "#see manpage for mpd for all config options" > debian/mpd/etc/mpd/conf
echo "log_file \"/var/log/mpd/mpd_log\"" >> debian/mpd/etc/mpd/conf
echo "error_file \"/var/log/mpd/mpd_errors\"" >> debian/mpd/etc/mpd/conf
echo "db_file \"/var/lib/mpd/mpddb\"" >> debian/mpd/etc/mpd/conf
echo "user \"mpd\"" >> debian/mpd/etc/mpd/conf
Template: mpd/systemwide
Type: boolean
Default: false
Description: Install system mpd service?
You can install mpd as a system daemon. This will create a mpd user and
config file (/etc/mpd.conf). The mpd service will be
started on boot.
Template: mpd/music_directory
Type: string
Default: /usr/share/mpd/music
Description: Music directory for MPD
Which directory do you want MPD to search in for music files?
Template: mpd/playlist_directory
Type: string
Default: /usr/share/mpd/playlists
Description: Music directory for MPD
Which directory do you want MPD to search in for music files?
Template: mpd/port
Type: string
Default: 2100
Description: Port MPD listens on
Which port number do you want MPD to listen on?
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
# 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
......@@ -172,19 +172,25 @@ sgi)
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
......@@ -192,6 +198,7 @@ aix)
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
......@@ -206,6 +213,44 @@ aix)
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
......@@ -240,8 +285,8 @@ tru64)
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
......@@ -254,7 +299,7 @@ tru64)
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o.
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
......@@ -265,9 +310,7 @@ dashmstdout)
shift
fi
# Remove `-o $object'. We will use -o /dev/null later,
# however we can't do the remplacement now because
# `-o $object' might simply not be used
# Remove `-o $object'.
IFS=" "
for arg
do
......@@ -287,7 +330,11 @@ dashmstdout)
done
test -z "$dashmflag" && dashmflag=-M
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
......@@ -306,6 +353,13 @@ dashXmstdout)
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
......@@ -318,7 +372,9 @@ makedepend)
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
-*)
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
......@@ -339,7 +395,7 @@ makedepend)
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout.
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
......@@ -381,7 +437,7 @@ cpp)
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
......
......@@ -20,11 +20,14 @@ These denote the end of command execution.
Commands:
---------
add <string file>
add the file _file_ to the playlist
add <string path>
add the file _path_ to the playlist (directories add recursively)
_path_ can also be a single file
increments playlist version by for each song added
clear
clears the current playlist
increments playlist version by 1
clearerror
clear the current error message in status
......@@ -33,8 +36,12 @@ clearerror
close
close the connection with the MPD
crossfade <int seconds>
sets crossfading between songs
delete <int song>
delete _song_ from playlist
increments playlist version by 1
find <string type> <string what>
finds songs in the db that are exactly _what_
......@@ -51,29 +58,38 @@ list <string type> <string arg1>
to list albums by a artist, where artist is specified with
arg1
listall <string directory>
lists all songs and directories in _directory_ (recursively)
_directory_ is optional
listall <string path>
lists all songs and directories in _path_ (recursively)
_path_ is optional and maybe a directory or path
listallinfo <string path>
same as listall command, except it also returns metadata info
in the same format as lsinfo
load <string name>
loads the playlist _name_.m3u from the playlist directory
ls <string directory>
list files in _directory_. _directory_ is optional.
NOTE: us this only for debugging, not meant to be used by a client.
instead use 'lsinfo'
increments playlist version by the number of songs added
lsinfo <string directory>
list contents of _directory_, from the db. _directory_ is optional
move <int from> <int to>
move song at _from_ to _to_ in the playlist
increments playlist version by 1
next
plays next song in playlist
pause
pause/resume playing
pause <bool pause>
toggle pause/resume playing
_pause_ is optional and should be 0 or 1
password <string password>
this is used for authentication with the server.
_password_ is simply the plaintext password
ping
does nothing but return "OK"
play <int song>
begin playing playlist at song number _song_, _song_ is optional
......@@ -108,8 +124,13 @@ seek <int song> <int time>
seeks to the position _time_ (in seconds) of entry _song_ in the
playlist
setvol <int vol>
set volume to _vol_
_vol_ the range of volume is 0-100
shuffle
shuffles the current playlist
increments playlist version by 1
stats
display stats
......@@ -117,9 +138,9 @@ stats
albums: number of albums
songs: number of songs
uptime: daemon uptime in seconds
db_playtime: sum of all song times in db
db_update: last db update in UNIX time
playtime: time length of music played
songs_played: total number of songs played
status
reports current status of player, and volume level.
......@@ -131,6 +152,8 @@ status
song: (current song playing/paused, playlist song number)
time: <int elapsed>:<time total> (of current playing/paused song)
bitrate: <int bitrate> (instantaneous bitrate in kbps)
xfade: <int seconds> (crossfade in seconds)
audio: <int sampleRate>:<int bits>:<int channels>
error: if there is an error, returns message here
stop
......@@ -138,12 +161,14 @@ stop
swap <int song1> <int song2>
swap positions of _song1_ and _song2_
increments playlist version by 1
update
searches mp3 directory for new music and removes old music from the db
volume <int change>
change volume by amount _change_
NOTE: volume command is deprecated, use setvol instead
COMMAND LIST
------------
......
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -13,110 +13,138 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AO_CFLAGS = @AO_CFLAGS@
AO_LIBS = @AO_LIBS@
AR = @AR@
AS = @AS@
AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@
AUDIOFILE_CONFIG = @AUDIOFILE_CONFIG@
AUDIOFILE_LIBS = @AUDIOFILE_LIBS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
F77 = @F77@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
EXEEXT = @EXEEXT@
ID3_LIB = @ID3_LIB@
ID3_SUBDIR = @ID3_SUBDIR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAD_LIB = @MAD_LIB@
MAD_SUBDIR = @MAD_SUBDIR@
MAKEINFO = @MAKEINFO@
MPD_CFLAGS = @MPD_CFLAGS@
MPD_LIBS = @MPD_LIBS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
RC = @RC@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
man_MANS = mpd.1
docdir = $(prefix)/share/doc/$(PACKAGE)
doc_DATA = COMMANDS
EXTRA_DIST = mpdconf.example $(man_MANS) $(doc_DATA)
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
DIST_SOURCES =
......@@ -125,11 +153,11 @@ NROFF = nroff
MANS = $(man_MANS)
DATA = $(doc_DATA)
DIST_COMMON = Makefile.am Makefile.in
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
......@@ -181,6 +209,10 @@ uninstall-man1:
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
......@@ -208,13 +240,22 @@ uninstall-docDATA:
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
......@@ -240,7 +281,6 @@ all-am: Makefile $(MANS) $(DATA)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(man1dir) $(DESTDIR)$(docdir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
......@@ -260,7 +300,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
......@@ -270,7 +310,7 @@ clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
......@@ -292,13 +332,21 @@ install-man: install-man1
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-docDATA uninstall-info-am uninstall-man
uninstall-man: uninstall-man1
......@@ -310,9 +358,9 @@ uninstall-man: uninstall-man1
install-info install-info-am install-man install-man1 \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool uninstall uninstall-am \
uninstall-docDATA uninstall-info-am uninstall-man \
uninstall-man1
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-docDATA uninstall-info-am \
uninstall-man uninstall-man1
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
......
......@@ -66,19 +66,44 @@ This specifies how verbose logs are. "default" is minimal logging, "secure" rep
This specifies where the db file will be stored. The file path should be an
absolute path. The default is ".mpddb" in the playlist directory.
.TP
.B state_file <file>
This specifies if a state file is used and where it is located. The file path should be an absolute path. The state of mpd will be saved to this file when mpd is terminated by a TERM signal or by the "kill" command.
.B filesystem_charset <charset>
This specifies the character set used for the filesystem. A list of supported
character sets can be obtained by running "iconv -l". The default is
determined from the locale when the db was originally created.
.TP
.B bind_to_address <ip address or hostname or any>
This specifies which address MPD binds to and listens on. The default is "any",
which binds to all available addresses.
.TP
.B user <user>
This specifies the user that mpd will run as, if set.
.TP
.B password <password@permissions>
This specifies a password for access to mpd. The format is
"password@permissions" where permissions is a comma delimmitted list composed
of "read","add","control", and/or "admin". "read" allows for reading of
the database, displaying the current playlist, and current status of mpd.
"add" allows for adding songs and loading playlists. "control" allows
for all other player and playlist manipulations. "admin" allows the db
to be updated and for the client to kill mpd. More than one password can
be specified. An example of a password is "somePassword@read,add".
.TP
.B default_permissions <permissions>
This specifies the permissions of a client that has not been authenticated using
a password. The format of permissions is specified n the description of the
"password" config paramter. If not passwords are specified, the default is
"read,add,control,admin", otherwise it is "" (no permissions).
.TP
.B state_file <file>
This specifies if a state file is used and where it is located. The file path should be an absolute path. The state of mpd will be saved to this file when mpd is terminated by a TERM signal or by the "kill" command.
.TP
.B connection_timeout <seconds>
If a client does not send any new data in this time period, the connection is closed. The default is 60 seconds.
.TP
.B max_connections <int>
This specifies the maximum number of clients that can be connected to MPD. The default is 5 connections.
.TP
.B mixer_type <oss or alsa>
.B mixer_type <oss, alsa, or software>
This specifies which mixer to use. The default is oss.
.TP
.B mixer_device <mixer dev>
......@@ -91,12 +116,11 @@ This specifies which mixer control to use (sometimes referred to as the "device"
.B max_playlist_length <int>
This specifies the maximum number of songs that can be in the playlist. The default is 4096 songs.
.TP
.B buffer_size <size in KB>
This specifies the size of the buffer that mpd uses. The default is 2048 kilobytes.
.B buffer_before play <0-100%>
This specifies the amount of buffer that will be filled before a song begins playing. The default is 25%.
.TP
.B stop_on_error <yes or no>
This specifies whether playback should stop or goto the next song when an error occurs. The default is no.
.TP
.B max_command_list_size <size in KB>
This specifies the maximum size a command list can be (in kilobytes). The default is 2048 kilobytes.
.TP
......@@ -109,23 +133,23 @@ This specifies the ao plug-in to use for audio output. Typical values for
Linux include "oss" and "alsa09". The default value is "default".
.TP
.B ao_driver_options <ao plug-in options>
This specifies the options to use for the selected ao_driver. For oss, the
This specifies the options to use for the selected ao_driver. For oss, the
only option available is "dsp". For alsa09, the available options are:
"dev", "buf_size", and "periods". Options are assigned using "=" and ";" is
used to separate options. An example for oss: "dsp=/dev/dsp". An example for
alsa09: "dev=hw:0,0;buf_size=4096". The default value is "".
.TP
.B audio_write_size <size in bytes>
This specifies how many bytes mpd writes to the audio device at once. The
default is 1024. This options is to work around a bug in older versions
of libao on sound cards with very small buffers.
.TP
.B save_absolute_paths_in_playlists <yes or no>
This specifies whether relative or absolute paths for song filenames are
used when saving playlists. The default value is "no".
.TP
.B bind_to_address <ip address or hostname or any>
This specifies which address MPD binds to and listens on. The default is "any",
which binds to all available addresses.
.SH EXAMPLES
.TP
Below is an example config file. (Note: '#' at the beginning of a line denotes
a comment. The '#' must be the first character/symbol on that line.)
Below is an example config file. (Note: '#' at the beginning of a line denotes a comment. The '#' must be the first character/symbol on that line.)
.br
.br
......@@ -133,56 +157,74 @@ a comment. The '#' must be the first character/symbol on that line.)
.br
port "2100"
.br
music_directory "/home/shank/mp3"
music_directory "~/mp3"
.br
playlist_directory "/home/shank/playlists"
playlist_directory "~/playlists"
.br
log_file "/home/shank/mpd.log"
log_file "~/mpd.log"
.br
error_file "/home/shank/mpd.error"
error_file "~/mpd.error"
.br
.br
# optional
.br
mixer_type "oss"
mixer_type "oss"
.br
mixer_device "/dev/mixer"
.br
#mixer_control "Pcm"
.br
# mixer_type is typically "oss", "alsa", or "software"
.br
mixer_device "/dev/mixer"
#mixer_type "alsa"
.br
#mixer_type "alsa"
#mixer_device "default"
.br
#mixer_device "default"
#mixer_control "PCM"
.br
#ao_driver "oss"
# ao_driver is typically "oss" or "alsa09"
.br
#ao_driver_options "dsp=/dev/dsp"
#ao_driver "oss"
.br
max_playlist_length "4096"
#ao_driver_options "dsp=/dev/dsp"
.br
buffer_before_play "25%"
#audio_write_size "1024"
.br
#db_file "/home/shank/playlists/.mpddb"
max_playlist_length "4096"
.br
#state_file "/home/shank/playlists/.mpdstate"
buffer_before_play "25%"
.br
#user "shank"
buffer_size "2048"
.br
connection_timeout "60"
#db_file "~/playlists/.mpddb"
.br
max_connections "5"
#state_file "~/playlists/.mpdstate"
.br
max_command_list_size "2048"
#user "shank"
.br
max_output_buffer_size "2048"
connection_timeout "60"
.br
max_connections "5"
.br
max_command_list_size "2048"
.br
max_output_buffer_size "2048"
.br
save_absolute_paths_in_playlists "no"
.br
# log_level can be "default", "secure", "verbose"
.br
log_level "default"
log_level "default"
.br
# when bind_to_address is set to "any", MPD binds all available addresses
.br
bind_to_address "any"
.br
#passwd "passwd@read,add,control,admin"
.br
# if bind_to_address is "any", MPD binds all addresses
#default_permissions "read,add,control,admin"
.br
bind_to_address "any"
#filesystem_charset "UTF-8"
.SH SEE ALSO
mpc(1)
# required
port "2100"
music_directory "/home/shank/mp3"
playlist_directory "/home/shank/playlists"
log_file "/home/shank/mpd.log"
error_file "/home/shank/mpd.error"
music_directory "~/mp3"
playlist_directory "~/playlists"
log_file "~/mpd.log"
error_file "~/mpd.error"
# optional
mixer_type "oss"
mixer_device "/dev/mixer"
#mixer_control "Pcm"
# mixer_type is typically "oss", "alsa", or "software"
#mixer_type "alsa"
#mixer_device "default"
#mixer_control "PCM"
# ao_driver is typically "oss" or "alsa09"
#ao_driver "oss"
#ao_driver_options "dsp=/dev/dsp"
#audio_write_size "1024"
max_playlist_length "4096"
buffer_before_play "25%"
#db_file "/home/shank/playlists/.mpddb"
#state_file "/home/shank/playlists/.mpdstate"
buffer_size "2048"
#db_file "~/playlists/.mpddb"
#state_file "~/playlists/.mpdstate"
#user "shank"
connection_timeout "60"
max_connections "5"
......@@ -28,3 +32,6 @@ save_absolute_paths_in_playlists "no"
log_level "default"
# when bind_to_address is set to "any", MPD binds all available addresses
bind_to_address "any"
#passwd "passwd@read,add,control,admin"
#default_permissions "read,add,control,admin"
#filesystem_charset "UTF-8"
......@@ -74,7 +74,7 @@ dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
-c) instcmd=$cpprog
shift
continue;;
......@@ -97,7 +97,7 @@ while [ x"$1" != x ]; do
shift
continue;;
-s) stripcmd="$stripprog"
-s) stripcmd=$stripprog
shift
continue;;
......@@ -124,7 +124,7 @@ done
if [ x"$src" = x ]
then
echo "install: no input file specified"
echo "$0: no input file specified" >&2
exit 1
else
:
......@@ -133,8 +133,8 @@ fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
if [ -d "$dst" ]; then
instcmd=:
chmodcmd=""
else
......@@ -143,20 +143,20 @@ if [ x"$dir_arg" != x ]; then
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "install: $src does not exist"
echo "$0: $src does not exist" >&2
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
echo "$0: no destination specified" >&2
exit 1
else
:
......@@ -165,16 +165,16 @@ else
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
if [ -d "$dst" ]
then
dst="$dst"/`basename $src`
dst=$dst/`basename "$src"`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
......@@ -183,69 +183,73 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
IFS="${IFS-$defaultIFS}"
oIFS="${IFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
pathcomp=$pathcomp$1
shift
if [ ! -d "${pathcomp}" ] ;
if [ ! -d "$pathcomp" ] ;
then
$mkdirprog "${pathcomp}"
$mkdirprog "$pathcomp"
else
:
fi
pathcomp="${pathcomp}/"
pathcomp=$pathcomp/
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
$doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
dstfile=`basename "$dst"`
else
dstfile=`basename $dst $transformbasename |
dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
dstfile=`basename "$dst"`
else
:
fi
# Make a temp file name in the proper directory.
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$#
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Move or copy the file name to the temp name
# Trap to clean up temp files at exit.
$doit $instcmd $src $dsttmp &&
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
trap "rm -f ${dsttmp}" 0 &&
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits
......@@ -253,17 +257,38 @@ else
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
exit 0
{
(exit 0); exit
}
This source diff could not be displayed because it is too large. You can view the blob instead.
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
......@@ -165,7 +165,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
......@@ -326,7 +326,7 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
......
......@@ -12,18 +12,29 @@ 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
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
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
......@@ -36,64 +47,65 @@ do
done
case $# in
0) exit 0 ;;
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 ;;
'')
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
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
# sh-indentation: 2
# End:
# mkinstalldirs ends here
......@@ -4,12 +4,12 @@ mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
song.h list.h directory.h tables.h utils.h path.h mp3_decode.h \
tag.h player.h listen.h conf.h ogg_decode.h volume.h flac_decode.h \
audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h \
char_conv.h audiofile_decode.h
audiofile_decode.h charConv.h permission.h mpd_types.h pcm_utils.h
mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
song.c list.c directory.c tables.c utils.c path.c mp3_decode.c \
tag.c player.c listen.c conf.c ogg_decode.c volume.c flac_decode.c \
audio.c playerData.c stats.c myfprintf.c sig_handlers.c decode.c log.c \
char_conv.c audiofile_decode.c $(mpd_headers)
audiofile_decode.c charConv.c permission.c pcm_utils.c $(mpd_headers)
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_LDADD = $(MPD_LIBS) $(ID3_LIB) $(MAD_LIB)
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -47,7 +47,7 @@ void initAudioDriver() {
audio_write_size = strtol((getConf())[CONF_AUDIO_WRITE_SIZE],&test,10);
if (*test!='\0') {
ERROR1("\"%s\" is not a valid write size",
ERROR("\"%s\" is not a valid write size",
(getConf())[CONF_AUDIO_WRITE_SIZE]);
exit(-1);
}
......@@ -60,14 +60,14 @@ void initAudioDriver() {
}
else if((audio_ao_driver_id =
ao_driver_id((getConf())[CONF_AO_DRIVER]))<0) {
ERROR1("\"%s\" is not a valid ao driver\n",
ERROR("\"%s\" is not a valid ao driver\n",
(getConf())[CONF_AO_DRIVER]);
exit(-1);
}
if((ai = ao_driver_info(audio_ao_driver_id))==NULL) {
ERROR0("problems getting ao_driver_info\n");
ERROR0("you may not have permission to the audio device\n");
ERROR("problems getting ao_driver_info\n");
ERROR("you may not have permission to the audio device\n");
exit(-1);
}
......@@ -79,7 +79,7 @@ void initAudioDriver() {
stk2 = NULL;
key = strtok_r(n1,"=",&stk2);
if(!key) {
ERROR1("problems parsing "
ERROR("problems parsing "
"ao_driver_options \"%s\"\n", n1);
exit(-1);
}
......@@ -91,14 +91,14 @@ void initAudioDriver() {
}
}
if(!found) {
ERROR2("\"%s\" is not an option for "
ERROR("\"%s\" is not an option for "
"\"%s\" ao driver\n",key,
ai->short_name);
exit(-1);
}*/
value = strtok_r(NULL,"",&stk2);
if(!value) {
ERROR1("problems parsing "
ERROR("problems parsing "
"ao_driver_options \"%s\"\n", n1);
exit(-1);
}
......@@ -115,56 +115,70 @@ void finishAudioDriver() {
ao_shutdown();
}
int isCurrentAudioFormat(AudioFormat * audioFormat) {
if(!audio_device) return 0;
if(audio_format.bits!=audioFormat->bits ||
audio_format.sampleRate!=audioFormat->sampleRate ||
audio_format.channels!=audioFormat->channels)
{
return 0;
}
return 1;
}
int initAudio(AudioFormat * audioFormat) {
ao_sample_format format;
if(audio_device) {
if(audio_format.bits!=audioFormat->bits ||
audio_format.sampleRate!=audioFormat->sampleRate ||
audio_format.channels!=audioFormat->channels) {
finishAudio();
}
if(audio_device && !isCurrentAudioFormat(audioFormat)) {
finishAudio();
}
if(!audio_device) {
format.bits = audioFormat->bits;
format.rate = audioFormat->sampleRate;
format.byte_format = AO_FMT_LITTLE;
format.byte_format = AO_FMT_NATIVE;
format.channels = audioFormat->channels;
audio_format.bits = format.bits;
audio_format.sampleRate = format.rate;
audio_format.channels = format.channels;
blockSignals();
audio_device = ao_open_live(audio_ao_driver_id, &format,
audio_ao_options);
if(audio_device==NULL) {
unblockSignals();
audioError();
return -1;
}
unblockSignals();
if(audio_device==NULL) return -1;
}
return 0;
}
void playAudio(char * playChunk, int size) {
int playAudio(char * playChunk, int size) {
int send;
assert(audio_device!=NULL);
if(audio_device==NULL) {
ERROR("trying to play w/ the audio device being open!\n");
return -1;
}
while(size>0) {
send = audio_write_size>size?size:audio_write_size;
ao_play(audio_device,playChunk,send);
if(ao_play(audio_device,playChunk,send)==0) {
audioError();
ERROR("closing audio device due to write error\n");
finishAudio();
return -1;
}
playChunk+=send;
size-=send;
}
return 0;
}
void finishAudio() {
......@@ -177,14 +191,14 @@ void finishAudio() {
}
void audioError() {
ERROR0("Error opening audio device\n");
ERROR("Error opening audio device\n");
if(errno==AO_ENOTLIVE) {
ERROR0("not a live ao device\n");
ERROR("not a live ao device\n");
}
else if(errno==AO_EOPENDEVICE) {
ERROR0("not able to open audio device\n");
ERROR("not able to open audio device\n");
}
else if(errno==AO_EBADOPTION) {
ERROR0("bad driver option\n");
ERROR("bad driver option\n");
}
}
......@@ -19,15 +19,17 @@
#ifndef AUDIO_H
#define AUDIO_H
#include "mpd_types.h"
#include <stdio.h>
#include <ao/ao.h>
#define AUDIO_AO_DRIVER_DEFAULT "default"
typedef struct _AudioFormat {
int channels;
int sampleRate;
int bits;
mpd_sint8 channels;
mpd_uint32 sampleRate;
mpd_sint8 bits;
} AudioFormat;
extern int audio_ao_driver_id;
......@@ -39,10 +41,12 @@ void finishAudioDriver();
int initAudio(AudioFormat * audioFormat);
void playAudio(char * playChunk,int size);
int playAudio(char * playChunk,int size);
void finishAudio();
void audioError();
int isCurrentAudioFormat(AudioFormat * audioFormat);
#endif
......@@ -21,10 +21,12 @@
#ifdef HAVE_AUDIOFILE
#include "audiofile_decode.h"
#include "command.h"
#include "utils.h"
#include "audio.h"
#include "log.h"
#include "pcm_utils.h"
#include <stdio.h>
#include <unistd.h>
......@@ -50,15 +52,17 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
{
int fs, frame_count;
AFfilehandle af_fp;
int bits;
af_fp = afOpenFile(dc->file,"r", NULL);
if(af_fp == AF_NULL_FILEHANDLE) {
ERROR1("failed to open %s\n",dc->file);
ERROR("failed to open %s\n",dc->file);
return -1;
}
afGetSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &af->bits);
af->sampleRate = (int)afGetRate(af_fp, AF_DEFAULT_TRACK);
afGetSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits);
af->bits = bits;
af->sampleRate = afGetRate(af_fp, AF_DEFAULT_TRACK);
af->channels = afGetChannels(af_fp,AF_DEFAULT_TRACK);
frame_count = afGetFrameCount(af_fp,AF_DEFAULT_TRACK);
......@@ -66,7 +70,7 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
cb->totalTime = ((float)frame_count/(float)af->sampleRate);
if (af->bits != 8 && af->bits != 16) {
ERROR2("Only 8 and 16-bit files are supported. %s is %i-bit\n",
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",
dc->file,af->bits);
afCloseFile(af_fp);
return -1;
......@@ -100,7 +104,12 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
if(dc->stop) break;
else if(dc->seek) continue;
memcpy(cb->chunks[cb->end],chunk,CHUNK_SIZE);
#ifdef WORDS_BIGENDIAN
pcm_changeBufferEndianness(chunk,CHUNK_SIZE,
af->bits);
#endif
memcpy(cb->chunks+cb->end*CHUNK_SIZE,chunk,
CHUNK_SIZE);
cb->chunkSize[cb->end] = CHUNK_SIZE;
current += ret;
......@@ -108,7 +117,7 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
++cb->end;
if(cb->end>=BUFFERED_CHUNKS) {
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
......
......@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "char_conv.h"
#include "charConv.h"
#include <stdlib.h>
#include <errno.h>
......@@ -54,16 +54,17 @@ int setCharSetConversion(char * to, char * from) {
char * convStrDup(char * string) {
#ifdef HAVE_ICONV
char buffer[BUFFER_SIZE];
int inleft = strlen(string);
size_t inleft = strlen(string);
char * ret;
int outleft;
int retlen = 0;
size_t outleft;
size_t retlen = 0;
size_t err;
char * bufferPtr;
if(!char_conv_to) return NULL;
ret = strdup("");
ret = malloc(1);
ret[0] = '\0';
while(inleft) {
bufferPtr = buffer;
......@@ -76,7 +77,7 @@ char * convStrDup(char * string) {
}
ret = realloc(ret,retlen+BUFFER_SIZE-outleft+1);
strncpy(&(ret[retlen]),buffer,BUFFER_SIZE-outleft);
memcpy(ret+retlen,buffer,BUFFER_SIZE-outleft);
retlen+=BUFFER_SIZE-outleft;
ret[retlen] = '\0';
}
......
......@@ -26,6 +26,10 @@
#include "path.h"
#include "stats.h"
#include "myfprintf.h"
#include "list.h"
#include "conf.h"
#include "permission.h"
#include "audio.h"
#include <stdlib.h>
#include <string.h>
......@@ -44,7 +48,6 @@
#define COMMAND_CLEAR "clear"
#define COMMAND_SAVE "save"
#define COMMAND_LOAD "load"
#define COMMAND_LS "ls"
#define COMMAND_LSINFO "lsinfo"
#define COMMAND_RM "rm"
#define COMMAND_PLAYLISTINFO "playlistinfo"
......@@ -63,6 +66,11 @@
#define COMMAND_MOVE "move"
#define COMMAND_SWAP "swap"
#define COMMAND_SEEK "seek"
#define COMMAND_LISTALLINFO "listallinfo"
#define COMMAND_PING "ping"
#define COMMAND_SETVOL "setvol"
#define COMMAND_PASSWORD "password"
#define COMMAND_CROSSFADE "crossfade"
#define COMMAND_STATUS_VOLUME "volume"
#define COMMAND_STATUS_STATE "state"
......@@ -74,17 +82,49 @@
#define COMMAND_STATUS_TIME "time"
#define COMMAND_STATUS_BITRATE "bitrate"
#define COMMAND_STATUS_ERROR "error"
#define COMMAND_STATUS_CROSSFADE "xfade"
#define COMMAND_STATUS_AUDIO "audio"
typedef int (* CommandHandlerFunction)(FILE *, unsigned int *, int, char **);
/* if min: -1 don't check args *
* if max: -1 no max args */
typedef struct _CommandEntry {
char * cmd;
char * cmd;
int min;
int max;
int (*handler)(FILE * fp, int argArrayLength, char ** argArray);
unsigned int reqPermission;
CommandHandlerFunction handler;
} CommandEntry;
int handlePlay(FILE * fp, int argArrayLength, char ** argArray) {
List * commandList;
CommandEntry * newCommandEntry() {
CommandEntry * cmd = malloc(sizeof(CommandEntry));
cmd->cmd = NULL;
cmd->min = 0;
cmd->max = 0;
cmd->handler = NULL;
cmd->reqPermission = 0;
return cmd;
}
void addCommand(char * name, unsigned int reqPermission, int minargs,
int maxargs, CommandHandlerFunction handler_func)
{
CommandEntry * cmd = newCommandEntry();
cmd->cmd = name;
cmd->min = minargs;
cmd->max = maxargs;
cmd->handler = handler_func;
cmd->reqPermission = reqPermission;
insertInList(commandList, cmd->cmd, cmd);
}
int handlePlay(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int song = -1;
char * test;
......@@ -98,15 +138,31 @@ int handlePlay(FILE * fp, int argArrayLength, char ** argArray) {
return playPlaylist(fp,song,1);
}
int handleStop(FILE * fp, int argArrayLength, char ** argArray) {
int handleStop(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return stopPlaylist(fp);
}
int handlePause(FILE * fp, int argArrayLength, char ** argArray) {
int handlePause(FILE * fp, unsigned int * permission,
int argArrayLength, char ** argArray)
{
if(argArrayLength==2) {
char * test;
int pause = strtol(argArray[1],&test,10);
if(*test!='\0' || (pause!=0 && pause!=1)) {
myfprintf(fp,"%s \%s\" is not 0 or 1\n",
COMMAND_RESPOND_ERROR,pause);
return -1;
}
return playerSetPause(fp,pause);
}
return playerPause(fp);
}
int commandStatus(FILE * fp,int argArrayLength, char ** argArray) {
int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
char * state = NULL;
playPlaylistIfPlayerStopped();
......@@ -127,12 +183,14 @@ int commandStatus(FILE * fp,int argArrayLength, char ** argArray) {
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_RANDOM,getPlaylistRandomStatus());
myfprintf(fp,"%s: %li\n",COMMAND_STATUS_PLAYLIST,getPlaylistVersion());
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_PLAYLIST_LENGTH,getPlaylistLength());
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_CROSSFADE,(int)getPlayerCrossFade());
myfprintf(fp,"%s: %s\n",COMMAND_STATUS_STATE,state);
if(getPlayerState()!=PLAYER_STATE_STOP) {
myfprintf(fp,"%s: %i\n",COMMAND_STATUS_SONG,getPlaylistCurrentSong());
myfprintf(fp,"%s: %i:%i\n",COMMAND_STATUS_TIME,getPlayerElapsedTime(),getPlayerTotalTime());
myfprintf(fp,"%s: %li\n",COMMAND_STATUS_BITRATE,getPlayerBitRate(),getPlayerTotalTime());
myfprintf(fp,"%s: %u:%i:%i\n",COMMAND_STATUS_AUDIO,getPlayerSampleRate(),getPlayerBits(),getPlayerChannels());
}
if(getPlayerError()!=PLAYER_ERROR_NOERROR) {
......@@ -144,19 +202,30 @@ int commandStatus(FILE * fp,int argArrayLength, char ** argArray) {
return 0;
}
int handleKill(FILE * fp, int argArrayLength, char ** argArray) {
int handleKill(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return COMMAND_RETURN_KILL;
}
int handleClose(FILE * fp, int argArrayLength, char ** argArray) {
int handleClose(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return COMMAND_RETURN_CLOSE;
}
int handleAdd(FILE * fp, int argArrayLength, char ** argArray) {
return addToPlaylist(fp,argArray[1]);
int handleAdd(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
char * directory = NULL;
if(argArrayLength == 2) directory = argArray[1];
return addAllIn(fp,directory);
}
int handleDelete(FILE * fp, int argArrayLength, char ** argArray) {
int handleDelete(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int song;
char * test;
......@@ -168,38 +237,39 @@ int handleDelete(FILE * fp, int argArrayLength, char ** argArray) {
return deleteFromPlaylist(fp,song);
}
int handlePlaylist(FILE * fp, int argArrayLength, char ** argArray) {
int handlePlaylist(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return showPlaylist(fp);
}
int handleShuffle(FILE * fp, int argArrayLength, char ** argArray) {
int handleShuffle(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return shufflePlaylist(fp);
}
int handleClear(FILE * fp, int argArrayLength, char ** argArray) {
int handleClear(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return clearPlaylist(fp);
}
int handleSave(FILE * fp, int argArrayLength, char ** argArray) {
int handleSave(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return savePlaylist(fp,argArray[1]);
}
int handleLoad(FILE * fp, int argArrayLength, char ** argArray) {
int handleLoad(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return loadPlaylist(fp,argArray[1]);
}
int handleLs(FILE * fp, int argArrayLength, char ** argArray) {
if(argArrayLength==1) {
if(ls(fp,NULL)<0) return -1;
else return lsPlaylists(fp,"");
}
else {
if(ls(fp,argArray[1])<0) return -1;
else return lsPlaylists(fp,argArray[1]);
}
}
int handleLsInfo(FILE * fp, int argArrayLength, char ** argArray) {
int handleLsInfo(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
if(argArrayLength==1) {
if(printDirectoryInfo(fp,NULL)<0) return -1;
else return lsPlaylists(fp,"");
......@@ -210,16 +280,20 @@ int handleLsInfo(FILE * fp, int argArrayLength, char ** argArray) {
}
}
int handleRm(FILE * fp, int argArrayLength, char ** argArray) {
int handleRm(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return deletePlaylist(fp,argArray[1]);
}
int handlePlaylistInfo(FILE * fp, int argArrayLength, char ** argArray) {
int handlePlaylistInfo(FILE * fp, unsigned int * permission,
int argArrayLength, char ** argArray)
{
int song = -1;
char * test;
if(argArrayLength == 2) {
song = strtol(argArray[1],&test,10);
if(argArrayLength == 2) {
song = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
return -1;
......@@ -228,34 +302,48 @@ int handlePlaylistInfo(FILE * fp, int argArrayLength, char ** argArray) {
return playlistInfo(fp,song);
}
int handleFind(FILE * fp, int argArrayLength, char ** argArray) {
return findAndPrintSongsInTable(fp,argArray[1],argArray[2]);
int handleFind(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return findSongsIn(fp,NULL,argArray[1],argArray[2]);
}
int handleSearch(FILE * fp, int argArrayLength, char ** argArray) {
return searchForSongsInTable(fp,argArray[1],argArray[2]);
int handleSearch(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return searchForSongsIn(fp,NULL,argArray[1],argArray[2]);
}
int handleUpdate(FILE * fp, int argArrayLength, char ** argArray) {
int handleUpdate(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return updateMp3Directory(fp);
}
int handleNext(FILE * fp, int argArrayLength, char ** argArray) {
int handleNext(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return nextSongInPlaylist(fp);
}
int handlePrevious(FILE * fp, int argArrayLength, char ** argArray) {
int handlePrevious(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return previousSongInPlaylist(fp);
}
int handleListAll(FILE * fp, int argArrayLength, char ** argArray) {
int handleListAll(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
char * directory = NULL;
if(argArrayLength==2) directory = argArray[1];
return printAllIn(fp,directory);
}
int handleVolume(FILE * fp, int argArrayLength, char ** argArray) {
int handleVolume(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int change;
char * test;
......@@ -264,10 +352,26 @@ int handleVolume(FILE * fp, int argArrayLength, char ** argArray) {
myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
return -1;
}
return changeVolumeLevel(fp,change);
return changeVolumeLevel(fp,change,1);
}
int handleRepeat(FILE * fp, int argArrayLength, char ** argArray) {
int handleSetVol(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int level;
char * test;
level = strtol(argArray[1],&test,10);
if(*test!='\0') {
myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
return -1;
}
return changeVolumeLevel(fp,level,0);
}
int handleRepeat(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int status;
char * test;
......@@ -279,7 +383,9 @@ int handleRepeat(FILE * fp, int argArrayLength, char ** argArray) {
return setPlaylistRepeatStatus(fp,status);
}
int handleRandom(FILE * fp, int argArrayLength, char ** argArray) {
int handleRandom(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int status;
char * test;
......@@ -291,24 +397,31 @@ int handleRandom(FILE * fp, int argArrayLength, char ** argArray) {
return setPlaylistRandomStatus(fp,status);
}
int handleStats(FILE * fp, int argArrayLength, char ** argArray) {
int handleStats(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return printStats(fp);
}
int handleClearError(FILE * fp, int argArrayLength, char ** argArray) {
int handleClearError(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
clearPlayerError();
return 0;
}
int handleList(FILE * fp, int argArrayLength, char ** argArray) {
int handleList(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
char * arg1 = NULL;
if(argArrayLength==3) arg1 = argArray[2];
return printAllKeysOfTable(fp,argArray[1],arg1);
}
int handleMove(FILE * fp, int argArrayLength, char ** argArray) {
int handleMove(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int from;
int to;
char * test;
......@@ -328,7 +441,9 @@ int handleMove(FILE * fp, int argArrayLength, char ** argArray) {
return moveSongInPlaylist(fp,from,to);
}
int handleSwap(FILE * fp, int argArrayLength, char ** argArray) {
int handleSwap(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int song1;
int song2;
char * test;
......@@ -348,7 +463,9 @@ int handleSwap(FILE * fp, int argArrayLength, char ** argArray) {
return swapSongsInPlaylist(fp,song1,song2);
}
int handleSeek(FILE * fp, int argArrayLength, char ** argArray) {
int handleSeek(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int song;
int time;
char * test;
......@@ -368,50 +485,109 @@ int handleSeek(FILE * fp, int argArrayLength, char ** argArray) {
return seekSongInPlaylist(fp,song,time);
}
/* call string, handlerFunc *
* int (*handler)(FILE * fp, int argArrayLength, char ** argArray); */
CommandEntry commandTable[] = {
{COMMAND_PLAY , 0, 1, handlePlay},
{COMMAND_STOP , 0, 0, handleStop},
{COMMAND_PAUSE , 0, 0, handlePause},
{COMMAND_STATUS , 0, 0, commandStatus},
{COMMAND_KILL , -1, -1, handleKill},
{COMMAND_CLOSE , -1, -1, handleClose},
{COMMAND_ADD , 1, 1, handleAdd},
{COMMAND_DELETE , 1, 1, handleDelete},
{COMMAND_PLAYLIST , 0, 0, handlePlaylist},
{COMMAND_SHUFFLE , 0, 0, handleShuffle},
{COMMAND_CLEAR , 0, 0, handleClear},
{COMMAND_SAVE , 1, 1, handleSave},
{COMMAND_LOAD , 1, 1, handleLoad},
{COMMAND_LS , 0, 1, handleLs},
{COMMAND_LSINFO , 0, 1, handleLsInfo},
{COMMAND_RM , 1, 1, handleRm},
{COMMAND_PLAYLISTINFO, 0, 1, handlePlaylistInfo},
{COMMAND_FIND , 2, 2, handleFind},
{COMMAND_SEARCH , 2, 2, handleSearch},
{COMMAND_UPDATE , 0, 0, handleUpdate},
{COMMAND_NEXT , 0, 0, handleNext},
{COMMAND_PREVIOUS , 0, 0, handlePrevious},
{COMMAND_LISTALL , 0, 1, handleListAll},
{COMMAND_VOLUME , 1, 1, handleVolume},
{COMMAND_REPEAT , 1, 1, handleRepeat},
{COMMAND_RANDOM , 1, 1, handleRandom},
{COMMAND_STATS , 0, 0, handleStats},
{COMMAND_CLEAR_ERROR , 0, 0, handleClearError},
{COMMAND_LIST , 1, 2, handleList},
{COMMAND_MOVE , 2, 2, handleMove},
{COMMAND_SWAP , 2, 2, handleSwap},
{COMMAND_SEEK , 2, 2, handleSeek}
};
const int nCommands = sizeof(commandTable) / sizeof(commandTable[0]);
int checkArgc(int index, FILE *fp, int argc, char** argArray) {
int min = commandTable[index].min + 1;
int max = commandTable[index].max + 1;
if (min == 0) return 0;
int handleListAllInfo(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
char * directory = NULL;
if(argArrayLength==2) directory = argArray[1];
return printInfoForAllIn(fp,directory);
}
int handlePing(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
return 0;
}
int handlePassword(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
if(getPermissionFromPassword(argArray[1],permission)<0) {
myfprintf(fp,"%s incorrect password\n",COMMAND_RESPOND_ERROR);
return -1;
}
return 0;
}
int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
int time;
char * test;
time = strtol(argArray[1],&test,10);
if(*test!='\0' || time<0) {
myfprintf(fp,"%s \"%s\" is not a integer >= 0\n",
COMMAND_RESPOND_ERROR,argArray[1]);
return -1;
}
setPlayerCrossFade(time);
return 0;
}
void initCommands() {
commandList = makeList(free);
addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay);
addCommand(COMMAND_STOP ,PERMISSION_CONTROL, 0, 0,handleStop);
addCommand(COMMAND_PAUSE ,PERMISSION_CONTROL, 0, 1,handlePause);
addCommand(COMMAND_STATUS ,PERMISSION_READ, 0, 0,commandStatus);
addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill);
addCommand(COMMAND_CLOSE ,0, -1,-1,handleClose);
addCommand(COMMAND_ADD ,PERMISSION_ADD, 0, 1,handleAdd);
addCommand(COMMAND_DELETE ,PERMISSION_CONTROL, 1, 1,handleDelete);
addCommand(COMMAND_PLAYLIST ,PERMISSION_READ, 0, 0,handlePlaylist);
addCommand(COMMAND_SHUFFLE ,PERMISSION_CONTROL, 0, 0,handleShuffle);
addCommand(COMMAND_CLEAR ,PERMISSION_CONTROL, 0, 0,handleClear);
addCommand(COMMAND_SAVE ,PERMISSION_CONTROL, 1, 1,handleSave);
addCommand(COMMAND_LOAD ,PERMISSION_ADD, 1, 1,handleLoad);
addCommand(COMMAND_LSINFO ,PERMISSION_READ, 0, 1,handleLsInfo);
addCommand(COMMAND_RM ,PERMISSION_CONTROL, 1, 1,handleRm);
addCommand(COMMAND_PLAYLISTINFO,PERMISSION_READ, 0, 1,handlePlaylistInfo);
addCommand(COMMAND_FIND ,PERMISSION_READ, 2, 2,handleFind);
addCommand(COMMAND_SEARCH ,PERMISSION_READ, 2, 2,handleSearch);
addCommand(COMMAND_UPDATE ,PERMISSION_ADMIN, 0, 0,handleUpdate);
addCommand(COMMAND_NEXT ,PERMISSION_CONTROL, 0, 0,handleNext);
addCommand(COMMAND_PREVIOUS ,PERMISSION_CONTROL, 0, 0,handlePrevious);
addCommand(COMMAND_LISTALL ,PERMISSION_READ, 0, 1,handleListAll);
addCommand(COMMAND_VOLUME ,PERMISSION_CONTROL, 1, 1,handleVolume);
addCommand(COMMAND_REPEAT ,PERMISSION_CONTROL, 1, 1,handleRepeat);
addCommand(COMMAND_RANDOM ,PERMISSION_CONTROL, 1, 1,handleRandom);
addCommand(COMMAND_STATS ,PERMISSION_READ, 0, 0,handleStats);
addCommand(COMMAND_CLEAR_ERROR ,PERMISSION_CONTROL, 0, 0,handleClearError);
addCommand(COMMAND_LIST ,PERMISSION_READ, 1, 2,handleList);
addCommand(COMMAND_MOVE ,PERMISSION_CONTROL, 2, 2,handleMove);
addCommand(COMMAND_SWAP ,PERMISSION_CONTROL, 2, 2,handleSwap);
addCommand(COMMAND_SEEK ,PERMISSION_CONTROL, 2, 2,handleSeek);
addCommand(COMMAND_LISTALLINFO ,PERMISSION_READ, 0, 1,handleListAllInfo);
addCommand(COMMAND_PING ,0, 0, 0,handlePing);
addCommand(COMMAND_SETVOL ,PERMISSION_CONTROL, 1, 1,handleSetVol);
addCommand(COMMAND_PASSWORD ,0, 1, 1,handlePassword);
addCommand(COMMAND_CROSSFADE ,PERMISSION_CONTROL, 1, 1,handleCrossfade);
sortList(commandList);
}
void finishCommands() {
freeList(commandList);
}
int checkArgcAndPermission(CommandEntry * cmd, FILE *fp,
unsigned int permission, int argc, char** argArray)
{
int min = cmd->min + 1;
int max = cmd->max + 1;
if (cmd->reqPermission != (permission & cmd->reqPermission)) {
myfprintf(fp,"%s You don't have permission for \"%s\"\n",COMMAND_RESPOND_ERROR,cmd->cmd);
return -1;
}
if (min == 0) return 0;
if (min == max && max != argc) {
myfprintf(fp,"%s Wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
......@@ -428,20 +604,24 @@ int checkArgc(int index, FILE *fp, int argc, char** argArray) {
else return 0;
}
int processCommand(FILE * fp, int argArrayLength, char ** argArray) {
int i = 0;
int processCommand(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray)
{
CommandEntry * cmd;
if(argArrayLength == 0) return 0;
for (i = 0; i < nCommands; i++) {
if (0 == strcmp(argArray[0],commandTable[i].cmd)) {
if (checkArgc(i,fp,argArrayLength,argArray)) return -1;
return commandTable[i].handler(fp, argArrayLength,
argArray);
}
if(!findInList(commandList, argArray[0],(void *)&cmd)) {
myfprintf(fp,"%s Unknown command \"%s\"\n",COMMAND_RESPOND_ERROR,
argArray[0]);
return -1;
}
myfprintf(fp,"%s Unknown command \"%s\"\n",COMMAND_RESPOND_ERROR,
argArray[0]);
return -1;
if(checkArgcAndPermission(cmd, fp, *permission, argArrayLength,
argArray) < 0)
{
return -1;
}
return cmd->handler(fp, permission, argArrayLength, argArray);
}
......@@ -27,6 +27,11 @@
#define COMMAND_RESPOND_ERROR "ACK"
#define COMMAND_RESPOND_OK "OK"
int processCommand(FILE * fp, int argArrayLength, char ** argArray);
int processCommand(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray);
void initCommands();
void finishCommands();
#endif
......@@ -29,14 +29,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#define MAX_STRING_SIZE MAXPATHLEN+80
#define CONF_COMMENT '#'
#define CONF_NUMBER_OF_PARAMS 23
#define CONF_NUMBER_OF_PATHS 6
#define CONF_NUMBER_OF_REQUIRED 5
#define CONF_NUMBER_OF_PARAMS 27
#define CONF_NUMBER_OF_PATHS 6
#define CONF_NUMBER_OF_REQUIRED 5
#define CONF_NUMBER_OF_ALLOW_CATS 1
#define CONF_CONNECTION_TIMEOUT_DEFAULT "60"
#define CONF_MAX_CONNECTIONS_DEFAULT "5"
......@@ -51,6 +55,7 @@
#define CONF_USER_DEFAULT ""
#define CONF_LOG_LEVEL_DEFAULT "default"
#define CONF_AUDIO_WRITE_SIZE_DEFAULT "1024"
#define CONF_BUFFER_SIZE_DEFAULT "2048"
#ifndef NO_OSS_MIXER
#define CONF_MIXER_TYPE_DEFAULT VOLUME_MIXER_OSS
#define CONF_MIXER_DEVICE_DEFAULT ""
......@@ -64,50 +69,6 @@
#endif
#endif
char * conf_strings[CONF_NUMBER_OF_PARAMS] = {
"port",
"music_directory",
"playlist_directory",
"log_file",
"error_file",
"connection_timeout",
"mixer_device",
"max_connections",
"max_playlist_length",
"buffer_before_play",
"max_command_list_size",
"max_output_buffer_size",
"ao_driver",
"ao_driver_options",
"save_absolute_paths_in_playlists",
"bind_to_address",
"mixer_type",
"state_file",
"user",
"db_file",
"log_level",
"mixer_control",
"audio_write_size"
};
int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = {
CONF_MUSIC_DIRECTORY,
CONF_PLAYLIST_DIRECTORY,
CONF_LOG_FILE,
CONF_ERROR_FILE,
CONF_STATE_FILE,
CONF_DB_FILE
};
int conf_required[CONF_NUMBER_OF_REQUIRED] = {
CONF_MUSIC_DIRECTORY,
CONF_PLAYLIST_DIRECTORY,
CONF_LOG_FILE,
CONF_ERROR_FILE,
CONF_PORT
};
char * conf_params[CONF_NUMBER_OF_PARAMS];
void initConf() {
......@@ -131,17 +92,74 @@ void initConf() {
conf_params[CONF_USER] = strdup(CONF_USER_DEFAULT);
conf_params[CONF_LOG_LEVEL] = strdup(CONF_LOG_LEVEL_DEFAULT);
conf_params[CONF_AUDIO_WRITE_SIZE] = strdup(CONF_AUDIO_WRITE_SIZE_DEFAULT);
conf_params[CONF_BUFFER_SIZE] = strdup(CONF_BUFFER_SIZE_DEFAULT);
}
char ** readConf(char * file) {
char * conf_strings[CONF_NUMBER_OF_PARAMS] = {
"port",
"music_directory",
"playlist_directory",
"log_file",
"error_file",
"connection_timeout",
"mixer_device",
"max_connections",
"max_playlist_length",
"buffer_before_play",
"max_command_list_size",
"max_output_buffer_size",
"ao_driver",
"ao_driver_options",
"save_absolute_paths_in_playlists",
"bind_to_address",
"mixer_type",
"state_file",
"user",
"db_file",
"log_level",
"mixer_control",
"audio_write_size",
"filesystem_charset",
"password",
"default_permissions",
"buffer_size"
};
int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = {
CONF_MUSIC_DIRECTORY,
CONF_PLAYLIST_DIRECTORY,
CONF_LOG_FILE,
CONF_ERROR_FILE,
CONF_STATE_FILE,
CONF_DB_FILE
};
int conf_required[CONF_NUMBER_OF_REQUIRED] = {
CONF_MUSIC_DIRECTORY,
CONF_PLAYLIST_DIRECTORY,
CONF_LOG_FILE,
CONF_ERROR_FILE,
CONF_PORT
};
short conf_allowCat[CONF_NUMBER_OF_ALLOW_CATS] = {
CONF_PASSWORD
};
FILE * fp;
char string[MAX_STRING_SIZE+1];
char ** array;
int i;
int numberOfArgs;
short allowCat[CONF_NUMBER_OF_PARAMS];
for(i=0;i<CONF_NUMBER_OF_PARAMS;i++) allowCat[i] = 0;
for(i=0;i<CONF_NUMBER_OF_ALLOW_CATS;i++) allowCat[conf_allowCat[i]] = 1;
if(!(fp=fopen(file,"r"))) {
ERROR1("problems opening file %s for reading\n",file);
ERROR("problems opening file %s for reading\n",file);
exit(-1);
}
......@@ -150,19 +168,30 @@ char ** readConf(char * file) {
numberOfArgs = buffer2array(string,&array);
if(numberOfArgs==0) continue;
if(2!=numberOfArgs) {
ERROR1("need two args in conf at: %s\n",string);
ERROR("need two args in conf at: %s\n",string);
exit(-1);
}
i = 0;
while(i<CONF_NUMBER_OF_PARAMS && 0!=strcmp(conf_strings[i],array[0])) i++;
if(i>=CONF_NUMBER_OF_PARAMS) {
ERROR1("unrecognized line in conf: %s\n",string);
ERROR("unrecognized line in conf: %s\n",string);
exit(-1);
}
if(conf_params[i]!=NULL) {
free(conf_params[i]);
if(allowCat[i]) {
conf_params[i] = realloc(conf_params[i],
strlen(conf_params[i])+
strlen(CONF_CAT_CHAR)+
strlen(array[1])+1);
strcat(conf_params[i],CONF_CAT_CHAR);
strcat(conf_params[i],array[1]);
}
else {
free(conf_params[i]);
conf_params[i] = strdup(array[1]);
}
}
conf_params[i] = strdup(array[1]);
else conf_params[i] = strdup(array[1]);
free(array[0]);
free(array[1]);
free(array);
......@@ -172,7 +201,7 @@ char ** readConf(char * file) {
for(i=0;i<CONF_NUMBER_OF_REQUIRED;i++) {
if(conf_params[conf_required[i]] == NULL) {
ERROR1("%s is unassigned in conf file\n",
ERROR("%s is unassigned in conf file\n",
conf_strings[conf_required[i]]);
exit(-1);
}
......@@ -180,11 +209,57 @@ char ** readConf(char * file) {
for(i=0;i<CONF_NUMBER_OF_PATHS;i++) {
if(conf_params[conf_absolutePaths[i]] &&
conf_params[conf_absolutePaths[i]][0]!='/') {
ERROR1("\"%s\" is not an absolute path\n",
conf_params[conf_absolutePaths[i]][0]!='/' &&
conf_params[conf_absolutePaths[i]][0]!='~')
{
ERROR("\"%s\" is not an absolute path\n",
conf_params[conf_absolutePaths[i]]);
exit(-1);
}
/* Parse ~ in path */
else if(conf_params[conf_absolutePaths[i]] &&
conf_params[conf_absolutePaths[i]][0]=='~')
{
struct passwd * pwd = NULL;
char * path;
int pos = 1;
if(conf_params[conf_absolutePaths[i]][1]=='/' ||
conf_params[conf_absolutePaths[i]][1]=='\0')
{
uid_t uid = geteuid();
if((pwd = getpwuid(uid)) == NULL) {
ERROR("problems getting passwd entry "
"for current user\n");
exit(-1);
}
}
else {
int foundSlash = 0;
char * ch = &(
conf_params[conf_absolutePaths[i]][1]);
for(;*ch!='\0' && *ch!='/';ch++);
if(*ch=='/') foundSlash = 1;
* ch = '\0';
pos+= ch-
&(conf_params[
conf_absolutePaths[i]][1]);
if((pwd = getpwnam(&(conf_params[
conf_absolutePaths[i]][1]))) == NULL)
{
ERROR("user \"%s\" not found\n",
&(conf_params[
conf_absolutePaths[i]][1]));
exit(-1);
}
if(foundSlash) *ch = '/';
}
path = malloc(strlen(pwd->pw_dir)+strlen(
&(conf_params[conf_absolutePaths[i]][pos]))+1);
strcpy(path,pwd->pw_dir);
strcat(path,&(conf_params[conf_absolutePaths[i]][pos]));
free(conf_params[conf_absolutePaths[i]]);
conf_params[conf_absolutePaths[i]] = path;
}
}
return conf_params;
......@@ -193,22 +268,3 @@ char ** readConf(char * file) {
char ** getConf() {
return conf_params;
}
void writeConf(char * file) {
int i;
FILE * fp;
if(!(fp=fopen(file,"w"))) {
ERROR1("problems open file %s for writing\n",file);
exit(-1);
}
for(i=0;i<CONF_NUMBER_OF_PARAMS;i++) {
if(conf_params[i]) {
myfprintf(fp,"%s \"%s\"\n",conf_strings[i],
conf_params[i]);
}
}
fclose(fp);
}
......@@ -42,6 +42,12 @@
#define CONF_LOG_LEVEL 20
#define CONF_MIXER_CONTROL 21
#define CONF_AUDIO_WRITE_SIZE 22
#define CONF_FS_CHARSET 23
#define CONF_PASSWORD 24
#define CONF_DEFAULT_PERMISSIONS 25
#define CONF_BUFFER_SIZE 26
#define CONF_CAT_CHAR "\n"
/* do not free the return value, it is a static variable */
char ** readConf(char * file);
......
......@@ -17,11 +17,15 @@
*/
#include "decode.h"
#include "player.h"
#include "playerData.h"
#include "utils.h"
#include "pcm_utils.h"
#include "audio.h"
#include "path.h"
#include "log.h"
#ifdef HAVE_MAD
#include "mp3_decode.h"
#endif
......@@ -34,8 +38,6 @@
#ifdef HAVE_AUDIOFILE
#include "audiofile_decode.h"
#endif
#include "path.h"
#include "log.h"
#include <signal.h>
#include <sys/types.h>
......@@ -45,31 +47,37 @@
#include <unistd.h>
#include <string.h>
int decode_pid = 0;
#define FADE_CHUNKS 1024
int * decode_pid = NULL;
void decodeSigHandler(int sig) {
if(sig==SIGCHLD) {
int status;
if(decode_pid==wait3(&status,WNOHANG,NULL)) {
if(decode_pid && *decode_pid==wait3(&status,WNOHANG,NULL)) {
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR1("decode process died from a "
ERROR("decode process died from a "
"non-TERM signal: %i\n",
WTERMSIG(status));
}
decode_pid = 0;
*decode_pid = 0;
}
}
else if(sig==SIGTERM) {
int pid = decode_pid;
if(pid>0) kill(pid,SIGTERM);
if(decode_pid) {
int pid = *decode_pid;
if(pid>0) kill(pid,SIGTERM);
}
exit(0);
}
}
void stopDecode(DecoderControl * dc) {
if(decode_pid>0 && (dc->start || dc->state==DECODE_STATE_DECODE)) {
if(decode_pid && *decode_pid>0 &&
(dc->start || dc->state==DECODE_STATE_DECODE))
{
dc->stop = 1;
while(decode_pid>0 && dc->stop) usleep(10);
while(decode_pid && *decode_pid>0 && dc->stop) usleep(10);
}
}
......@@ -82,20 +90,39 @@ void quitDecode(PlayerControl * pc, DecoderControl * dc) {
kill(getppid(),SIGUSR1);
}
int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
int chunks;
if(pc->crossFade<=0) return 0;
chunks = (af->sampleRate*af->bits*af->channels/8.0/CHUNK_SIZE);
chunks = (chunks*pc->crossFade+0.5);
if(chunks>(buffered_chunks-buffered_before_play)) {
chunks = buffered_chunks-buffered_before_play;
}
if(chunks<0) chunks = 0;
return chunks;
}
int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
Buffer * cb)
{
while(decode_pid>0 && dc->start) usleep(10);
while(decode_pid && *decode_pid>0 && dc->start) usleep(10);
if(dc->start || dc->error!=DECODE_ERROR_NOERROR) {
strcpy(pc->erroredFile,pc->file);
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
printf("error: %i, start: %i, decode_pid: %i\n",dc->error,
dc->start,*decode_pid);
pc->error = PLAYER_ERROR_FILE;
quitDecode(pc,dc);
return -1;
}
if(initAudio(af)<0) {
strcpy(pc->erroredFile,pc->file);
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->error = PLAYER_ERROR_AUDIO;
quitDecode(pc,dc);
return -1;
......@@ -103,6 +130,9 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
pc->elapsedTime = 0;
pc->bitRate = 0;
pc->sampleRate = af->sampleRate;
pc->bits = af->bits;
pc->channels = af->channels;
pc->totalTime = cb->totalTime;
return 0;
......@@ -111,7 +141,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
Buffer * cb)
{
if(decode_pid>0) {
if(decode_pid && *decode_pid>0) {
cb->next = -1;
if(dc->state!=DECODE_STATE_DECODE || dc->error ||
strcmp(dc->file,pc->file)!=0)
......@@ -123,7 +153,7 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
dc->error = 0;
waitOnDecode(pc,af,dc,cb);
}
if(decode_pid>0 && dc->state==DECODE_STATE_DECODE) {
if(*decode_pid>0 && dc->state==DECODE_STATE_DECODE) {
dc->seekWhere = pc->seekWhere > pc->totalTime-1 ?
pc->totalTime-1 : pc->seekWhere;
dc->seekWhere = 1 > dc->seekWhere ? 1 : dc->seekWhere;
......@@ -131,7 +161,7 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
dc->seek = 1;
pc->elapsedTime = dc->seekWhere;
pc->bitRate = 0;
while(decode_pid>0 && dc->seek) usleep(10);
while(*decode_pid>0 && dc->seek) usleep(10);
}
}
pc->seek = 0;
......@@ -154,24 +184,30 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
kill(getppid(),SIGUSR1); \
} \
if(pc->seek) { \
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
decodeSeek(pc,af,dc,cb); \
pc->beginTime = pc->elapsedTime; \
doCrossFade = 0; \
nextChunk = -1; \
bbp = 0; \
} \
if(pc->stop) { \
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
quitDecode(pc,dc); \
return; \
}
int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
DecoderControl * dc) {
decode_pid = fork();
decode_pid = &(pc->decode_pid);
int pid = fork();
if(decode_pid==0) {
if(pid==0) {
/* CHILD */
while(1) {
if(dc->start) {
strcpy(dc->file,pc->file);
strncpy(dc->file,pc->file,MAXPATHLEN);
switch(pc->decodeType) {
#ifdef HAVE_MAD
case DECODE_TYPE_MP3:
......@@ -213,11 +249,12 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
exit(0);
/* END OF CHILD */
}
else if(decode_pid<0) {
strcpy(pc->erroredFile,pc->file);
else if(pid<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->error = PLAYER_ERROR_SYSTEM;
return -1;
}
else *decode_pid = pid;
return 0;
}
......@@ -245,7 +282,7 @@ void decode() {
dc->start = 1;
cb->next = -1;
if(decode_pid<=0) {
if(decode_pid==NULL || *decode_pid<=0) {
if(decoderInit(pc,cb,af,dc)<0) return;
}
......@@ -255,6 +292,11 @@ void decode() {
int pause = 0;
int quit = 0;
int bbp = buffered_before_play;
int doCrossFade = 0;
int crossFadeChunks = 0;
int fadePosition;
int nextChunk = -1;
int test;
memset(silence,0,CHUNK_SIZE);
......@@ -262,9 +304,10 @@ void decode() {
pc->state = PLAYER_STATE_PLAY;
pc->play = 0;
pc->beginTime = pc->elapsedTime;
kill(getppid(),SIGUSR1);
while(decode_pid>0 && !cb->wrap && cb->end-cb->begin<bbp &&
while(*decode_pid>0 && !cb->wrap && cb->end-cb->begin<bbp &&
dc->state==DECODE_STATE_DECODE)
{
processDecodeInput();
......@@ -283,23 +326,111 @@ void decode() {
pc->queueState = PLAYER_QUEUE_DECODE;
kill(getppid(),SIGUSR1);
}
if(cb->next>=0 && doCrossFade==0 && !dc->start) {
nextChunk = -1;
if(isCurrentAudioFormat(af)) {
doCrossFade = 1;
crossFadeChunks =
calculateCrossFadeChunks(pc,af);
if(!crossFadeChunks ||
pc->crossFade>=cb->totalTime)
{
doCrossFade = -1;
}
}
else doCrossFade = -1;
}
if(pause) {
playAudio(silence,CHUNK_SIZE);
if(playAudio(silence,CHUNK_SIZE)<0) quit = 1;
}
else if((cb->begin!=cb->end || cb->wrap) &&
cb->begin!=cb->next)
{
if(doCrossFade==1 && cb->next>=0 &&
((cb->next>cb->begin &&
(fadePosition=cb->next-cb->begin)
<=crossFadeChunks) ||
(cb->begin>cb->next &&
(fadePosition=cb->next-cb->begin+
buffered_chunks)<=crossFadeChunks)))
{
if(nextChunk<0) {
crossFadeChunks = fadePosition;
}
nextChunk = cb->begin+crossFadeChunks;
test = cb->end;
if(cb->wrap) test+=buffered_chunks;
if(nextChunk<test) {
if(nextChunk>=buffered_chunks)
{
nextChunk-=
buffered_chunks;
}
pcm_mix(cb->chunks+cb->begin*
CHUNK_SIZE,
cb->chunks+nextChunk*
CHUNK_SIZE,
cb->chunkSize[
cb->begin],
cb->chunkSize[
nextChunk],
af,
((float)fadePosition)/
crossFadeChunks);
if(cb->chunkSize[nextChunk]>
cb->chunkSize[cb->begin]
)
{
cb->chunkSize[cb->begin]
= cb->chunkSize
[nextChunk];
}
}
else {
if(dc->state==DECODE_STATE_STOP)
{
doCrossFade = -1;
}
else {
usleep(10);
continue;
}
}
}
pc->elapsedTime = cb->times[cb->begin];
pc->bitRate = cb->bitRate[cb->begin];
playAudio(cb->chunks[cb->begin],
cb->chunkSize[cb->begin]);
pcm_volumeChange(cb->chunks+cb->begin*
CHUNK_SIZE,
cb->chunkSize[cb->begin],
af,
pc->softwareVolume);
if(playAudio(cb->chunks+cb->begin*CHUNK_SIZE,
cb->chunkSize[cb->begin])<0)
{
quit = 1;
}
cb->begin++;
if(cb->begin>=BUFFERED_CHUNKS) {
if(cb->begin>=buffered_chunks) {
cb->begin = 0;
cb->wrap = 0;
}
}
else if(cb->next==cb->begin) {
pc->totalPlayTime+= pc->elapsedTime-
pc->beginTime;
if(doCrossFade==1 && nextChunk>=0) {
nextChunk = cb->begin+crossFadeChunks;
test = cb->end;
if(cb->wrap) test+=buffered_chunks;
if(nextChunk<test) {
if(nextChunk>=buffered_chunks)
{
nextChunk-=
buffered_chunks;
}
cb->begin = nextChunk;
}
}
while(pc->queueState==PLAYER_QUEUE_DECODE ||
pc->queueLockState==PLAYER_QUEUE_LOCKED)
{
......@@ -317,11 +448,15 @@ void decode() {
else {
cb->next = -1;
if(waitOnDecode(pc,af,dc,cb)<0) return;
nextChunk = -1;
doCrossFade = 0;
crossFadeChunks = 0;
pc->queueState = PLAYER_QUEUE_EMPTY;
kill(getppid(),SIGUSR1);
}
pc->beginTime = cb->times[cb->begin];
}
else if(decode_pid<=0 ||
else if(*decode_pid<=0 ||
(dc->state==DECODE_STATE_STOP && !dc->start))
{
quit = 1;
......@@ -330,6 +465,7 @@ void decode() {
else usleep(10);
}
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
quitDecode(pc,dc);
/* END OF PARENT */
......
......@@ -25,6 +25,8 @@
#include "path.h"
#include "log.h"
#include "playlist.h"
#include "conf.h"
#include "stats.h"
#include <string.h>
#include <sys/types.h>
......@@ -38,11 +40,20 @@
#define DIRECTORY_MTIME "mtime: "
#define DIRECTORY_BEGIN "begin: "
#define DIRECTORY_END "end: "
#define DIRECTORY_INFO_BEGIN "info_begin"
#define DIRECTORY_INFO_END "info_end"
#define DIRECTORY_MPD_VERSION "mpd_version: "
#define DIRECTORY_FS_CHARSET "fs_charset: "
#define DIRECTORY_SEARCH_ALBUM "album"
#define DIRECTORY_SEARCH_ARTIST "artist"
#define DIRECTORY_SEARCH_TITLE "title"
#define DIRECTORY_SEARCH_FILENAME "filename"
typedef List DirectoryList;
typedef struct _Directory {
char * name;
char * utf8name;
DirectoryList * subDirectories;
struct _Directory * parentDirectory;
SongList * songs;
......@@ -72,8 +83,8 @@ Directory * newDirectory(Directory * parentDirectory, char * dirname, time_t mti
directory = malloc(sizeof(Directory));
if(dirname!=NULL) directory->name = strdup(dirname);
else directory->name = NULL;
if(dirname!=NULL) directory->utf8name = strdup(dirname);
else directory->utf8name = NULL;
directory->parentDirectory = parentDirectory;
directory->subDirectories = newDirectoryList();
directory->songs = newSongList();
......@@ -88,7 +99,7 @@ void freeDirectory(Directory * directory) {
removeSongsFromTables(directory->songs);
deleteSongsFromPlaylist(directory->songs);
freeSongList(directory->songs);
if(directory->name) free(directory->name);
if(directory->utf8name) free(directory->utf8name);
free(directory);
}
......@@ -117,11 +128,11 @@ int updateInDirectory(Directory * directory, char * shortname, char * name) {
if((mtime = isMusic(name))) {
if(0==findInList(directory->songs,shortname,&song)) {
LOG1("adding %s\n",name);
LOG("adding %s\n",name);
addToDirectory(directory,shortname,name);
}
else if(mtime>((Song *)song)->mtime) {
LOG1("updating %s\n",name);
LOG("updating %s\n",name);
updateSongInfo((Song *)song);
}
}
......@@ -139,10 +150,11 @@ int removeDeletedFromDirectory(Directory * directory) {
DIR * dir;
char cwd[2];
struct dirent * ent;
char s[MAXPATHLEN+1];
char * dirname = directory->name;
char * dirname = directory->utf8name;
List * entList = makeList(free);
void * name;
char * s;
char * utf8;
ListNode * node;
ListNode * tmpNode;
......@@ -150,18 +162,20 @@ int removeDeletedFromDirectory(Directory * directory) {
cwd[1] = '\0';
if(dirname==NULL) dirname=cwd;
if((dir = opendir(rmp2amp(dirname)))==NULL) return -1;
if((dir = opendir(rmp2amp(utf8ToFsCharset(dirname))))==NULL) return -1;
while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
if(directory->name) {
sprintf(s,"%s/%s",directory->name,ent->d_name);
}
else {
strcpy(s,ent->d_name);
utf8 = strdup(fsCharsetToUtf8(ent->d_name));
if(directory->utf8name) {
s = malloc(strlen(directory->utf8name)+strlen(utf8)+2);
sprintf(s,"%s/%s",directory->utf8name,utf8);
}
name = strdup(s);
insertInList(entList,ent->d_name,name);
else s= strdup(utf8);
insertInList(entList,fsCharsetToUtf8(ent->d_name),s);
free(utf8);
}
closedir(dir);
......@@ -203,8 +217,9 @@ int updateDirectory(Directory * directory) {
DIR * dir;
char cwd[2];
struct dirent * ent;
char s[MAXPATHLEN+1];
char * dirname = directory->name;
char * s;
char * utf8;
char * dirname = directory->utf8name;
cwd[0] = '.';
cwd[1] = '\0';
......@@ -212,22 +227,26 @@ int updateDirectory(Directory * directory) {
removeDeletedFromDirectory(directory);
if((dir = opendir(rmp2amp(dirname)))==NULL) return -1;
if((dir = opendir(rmp2amp(utf8ToFsCharset(dirname))))==NULL) return -1;
while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
if(directory->name) {
sprintf(s,"%s/%s",directory->name,ent->d_name);
}
else {
strcpy(s,ent->d_name);
utf8 = strdup(fsCharsetToUtf8(ent->d_name));
if(directory->utf8name) {
s = malloc(strlen(directory->utf8name)+strlen(utf8)+2);
sprintf(s,"%s/%s",directory->utf8name,utf8);
}
updateInDirectory(directory,ent->d_name,s);
else s = strdup(utf8);
updateInDirectory(directory,utf8,s);
free(utf8);
free(s);
}
closedir(dir);
if(directory->name) directory->mtime = isDir(directory->name);
if(directory->utf8name) directory->mtime = isDir(directory->utf8name);
return 0;
}
......@@ -236,25 +255,33 @@ int exploreDirectory(Directory * directory) {
DIR * dir;
char cwd[2];
struct dirent * ent;
char s[MAXPATHLEN+1];
char * dirname = directory->name;
char * s;
char * utf8;
char * dirname = directory->utf8name;
cwd[0] = '.';
cwd[1] = '\0';
if(dirname==NULL) dirname=cwd;
if((dir = opendir(rmp2amp(dirname)))==NULL) return -1;
DEBUG("explore: attempting to opendir: %s\n",dirname);
if((dir = opendir(rmp2amp(utf8ToFsCharset(dirname))))==NULL) return -1;
LOG1("explore: %s\n",dirname);
LOG("explore: %s\n",dirname);
while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
if(directory->name) {
sprintf(s,"%s/%s",directory->name,ent->d_name);
}
else {
strcpy(s,ent->d_name);
utf8 = strdup(fsCharsetToUtf8(ent->d_name));
DEBUG("explore: found: %s (%s)\n",ent->d_name,utf8);
if(directory->utf8name) {
s = malloc(strlen(directory->utf8name)+strlen(utf8)+2);
sprintf(s,"%s/%s",directory->utf8name,utf8);
}
addToDirectory(directory,ent->d_name,s);
else s = strdup(utf8);
addToDirectory(directory,utf8,s);
free(utf8);
free(s);
}
closedir(dir);
......@@ -262,7 +289,9 @@ int exploreDirectory(Directory * directory) {
return 0;
}
int addSubDirectoryToDirectory(Directory * directory, char * shortname, char * name) {
int addSubDirectoryToDirectory(Directory * directory, char * shortname,
char * name)
{
Directory * subDirectory = newDirectory(directory,name,-1);
insertInList(directory->subDirectories,shortname,subDirectory);
......@@ -283,6 +312,8 @@ int addToDirectory(Directory * directory, char * shortname, char * name) {
return 0;
}
DEBUG("addToDirectory: %s is not a directory or music\n",name);
return -1;
}
......@@ -337,7 +368,7 @@ int printDirectoryList(FILE * fp, DirectoryList * directoryList) {
while(node!=NULL) {
directory = (Directory *)node->data;
myfprintf(fp,"%s%s\n",DIRECTORY_DIR,directory->name);
myfprintf(fp,"%s%s\n",DIRECTORY_DIR,directory->utf8name);
node = node->nextNode;
}
......@@ -362,7 +393,9 @@ void writeDirectoryInfo(FILE * fp, Directory * directory) {
ListNode * node = (directory->subDirectories)->firstNode;
Directory * subDirectory;
if(directory->name) myfprintf(fp,"%s%s\n",DIRECTORY_BEGIN,directory->name);
if(directory->utf8name) {
myfprintf(fp,"%s%s\n",DIRECTORY_BEGIN,directory->utf8name);
}
while(node!=NULL) {
subDirectory = (Directory *)node->data;
......@@ -374,12 +407,14 @@ void writeDirectoryInfo(FILE * fp, Directory * directory) {
writeSongInfoFromList(fp,directory->songs);
if(directory->name) myfprintf(fp,"%s%s\n",DIRECTORY_END,directory->name);
if(directory->utf8name) {
myfprintf(fp,"%s%s\n",DIRECTORY_END,directory->utf8name);
}
}
void readDirectoryInfo(FILE * fp,Directory * directory) {
char buffer[MAXPATHLEN+1024];
int bufferSize = MAXPATHLEN+1024;
char buffer[MAXPATHLEN*2];
int bufferSize = MAXPATHLEN*2;
char * key;
Directory * subDirectory;
char * name;
......@@ -389,21 +424,21 @@ void readDirectoryInfo(FILE * fp,Directory * directory) {
if(0==strncmp(DIRECTORY_DIR,buffer,strlen(DIRECTORY_DIR))) {
key = strdup(&(buffer[strlen(DIRECTORY_DIR)]));
if(myFgets(buffer,bufferSize,fp)<0) {
ERROR0("Error reading db\n");
ERROR("Error reading db\n");
exit(-1);
}
if(strncmp(DIRECTORY_MTIME,buffer,strlen(DIRECTORY_MTIME))) {
ERROR0("Error reading db\n");
ERROR1("%s\n",buffer);
ERROR("Error reading db\n");
ERROR("%s\n",buffer);
exit(-1);
}
mtime = atoi(&(buffer[strlen(DIRECTORY_BEGIN)]));
if(myFgets(buffer,bufferSize,fp)<0) {
ERROR0("Error reading db\n");
ERROR("Error reading db\n");
exit(-1);
}
if(strncmp(DIRECTORY_BEGIN,buffer,strlen(DIRECTORY_BEGIN))) {
ERROR0("Error reading db\n");
ERROR("Error reading db\n");
exit(-1);
}
name = strdup(&(buffer[strlen(DIRECTORY_BEGIN)]));
......@@ -417,7 +452,7 @@ void readDirectoryInfo(FILE * fp,Directory * directory) {
readSongInfoIntoList(fp,directory->songs);
}
else {
ERROR1("Unknown line in db: %s\n",buffer);
ERROR("Unknown line in db: %s\n",buffer);
exit(-1);
}
}
......@@ -441,9 +476,17 @@ int writeDirectoryDB() {
FILE * fp;
sortDirectory(mp3rootDirectory);
stats.numberOfSongs = countSongsIn(stderr,NULL);
stats.dbPlayTime = sumSongTimesIn(stderr,NULL);
while(!(fp=fopen(directorydb,"w")) && errno==EINTR);
if(!fp) return -1;
myfprintf(fp,"%s\n",DIRECTORY_INFO_BEGIN);
myfprintf(fp,"%s%s\n",DIRECTORY_MPD_VERSION,VERSION);
myfprintf(fp,"%s%s\n",DIRECTORY_FS_CHARSET,getFsCharset());
myfprintf(fp,"%s\n",DIRECTORY_INFO_END);
writeDirectoryInfo(fp,mp3rootDirectory);
while(fclose(fp) && errno==EINTR);
......@@ -456,23 +499,92 @@ int readDirectoryDB() {
mp3rootDirectory = newDirectory(NULL,NULL,0);
while(!(fp=fopen(directorydb,"r")) && errno==EINTR);
if(!fp) return -1;
/* get initial info */
{
char buffer[100];
int bufferSize = 100;
int foundFsCharset = 0;
int foundVersion = 0;
if(myFgets(buffer,bufferSize,fp)<0) {
ERROR("Error reading db\n");
exit(-1);
}
if(0==strcmp(DIRECTORY_INFO_BEGIN,buffer)) {
while(myFgets(buffer,bufferSize,fp) &&
0!=strcmp(DIRECTORY_INFO_END,buffer))
{
if(0==strncmp(DIRECTORY_MPD_VERSION,buffer,
strlen(DIRECTORY_MPD_VERSION)))
{
if(foundVersion) {
ERROR("already found "
"version in db\n");
exit(-1);
}
foundVersion = 1;
}
else if(0==strncmp(DIRECTORY_FS_CHARSET,buffer,
strlen(DIRECTORY_FS_CHARSET)))
{
char * fsCharset;
if(foundFsCharset) {
ERROR("already found "
"fs charset in db\n");
exit(-1);
}
foundFsCharset = 1;
fsCharset = &(buffer[strlen(
DIRECTORY_FS_CHARSET)]);
if(getConf()[CONF_FS_CHARSET] &&
strcmp(fsCharset,
getFsCharset()))
{
ERROR("Using \"%s\" for the "
"filesystem charset "
"instead of \"%s\"\n",
fsCharset,
getFsCharset());
ERROR("maybe you need to "
"recreate the db?\n");
setFsCharset(fsCharset);
}
}
else {
ERROR("unknown line in db info: %s\n",
buffer);
}
}
}
else {
ERROR("db info not found in db file\n");
ERROR("you should recreate the db using --create-db\n");
fseek(fp,0,SEEK_SET);
}
}
readDirectoryInfo(fp,mp3rootDirectory);
while(fclose(fp) && errno==EINTR);
sortDirectory(mp3rootDirectory);
stats.numberOfSongs = countSongsIn(stderr,NULL);
stats.dbPlayTime = sumSongTimesIn(stderr,NULL);
return 0;
}
int updateMp3Directory(FILE * fp) {
if(updateDirectory(mp3rootDirectory)<0) {
ERROR0("problems updating music db\n");
ERROR("problems updating music db\n");
myfprintf(fp,"%s problems updating music db\n",COMMAND_RESPOND_ERROR);
return -1;
}
if(writeDirectoryDB()<0) {
ERROR1("problems writing music db file, \"%s\"\n",directorydb);
ERROR("problems writing music db file, \"%s\"\n",directorydb);
myfprintf(fp,"%s problems writing music db\n",COMMAND_RESPOND_ERROR);
return -1;
}
......@@ -480,60 +592,238 @@ int updateMp3Directory(FILE * fp) {
return 0;
}
void printAllInSubDirectory(FILE * fp, Directory * directory) {
ListNode * node = directory->songs->firstNode;
Song * song;
Directory * dir;
myfprintf(fp,"directory: %s\n",directory->name);
while(node!=NULL) {
song = (Song *)node->data;
myfprintf(fp,"file: %s\n",song->file);
node = node->nextNode;
}
node = directory->subDirectories->firstNode;
while(node!=NULL) {
dir = (Directory *)node->data;
printAllInSubDirectory(fp,dir);
node = node->nextNode;
}
int traverseAllInSubDirectory(FILE * fp, Directory * directory,
int (*forEachSong)(FILE *, Song *, void *),
int (*forEachDir)(FILE *, Directory *, void *),
void * data)
{
ListNode * node = directory->songs->firstNode;
Song * song;
Directory * dir;
int errFlag = 0;
if(forEachDir) {
errFlag = forEachDir(fp,directory,data);
if(errFlag) return errFlag;
}
if(forEachSong) {
while(node!=NULL && !errFlag) {
song = (Song *)node->data;
errFlag = forEachSong(fp,song,data);
node = node->nextNode;
}
if(errFlag) return errFlag;
}
node = directory->subDirectories->firstNode;
while(node!=NULL && !errFlag) {
dir = (Directory *)node->data;
errFlag = traverseAllInSubDirectory(fp,dir,forEachSong,
forEachDir,data);
node = node->nextNode;
}
return errFlag;
}
int printAllIn(FILE * fp, char * name) {
int traverseAllIn(FILE * fp, char * name,
int (*forEachSong)(FILE *, Song *, void *),
int (*forEachDir)(FILE *, Directory *, void *),
void * data) {
Directory * directory;
if((directory = getDirectory(name))==NULL) {
Song * song;
if((song = getSong(name))) {
myfprintf(fp,"file: %s\n",song->file);
return 0;
if((song = getSong(name)) && forEachSong) {
return forEachSong(fp, song, data);
}
myfprintf(fp,"%s: directory or file not found\n",COMMAND_RESPOND_ERROR);
return -1;
}
printAllInSubDirectory(fp,directory);
return traverseAllInSubDirectory(fp,directory,forEachSong,forEachDir,
data);
}
int countSongsInDirectory(FILE * fp, Directory * directory, void * data) {
int * count = (int *)data;
*count+=directory->songs->numberOfNodes;
return 0;
}
int printDirectoryInDirectory(FILE * fp, Directory * directory, void * data) {
if(directory->utf8name) {
myfprintf(fp,"directory: %s\n",directory->utf8name);
}
return 0;
}
int printSongInDirectory(FILE * fp, Song * song, void * data) {
myfprintf(fp,"file: %s\n",song->utf8file);
return 0;
}
int searchForAlbumInDirectory(FILE * fp, Song * song, void * string) {
if(song->tag && song->tag->album) {
char * dup = strDupToUpper(song->tag->album);
if(strstr(dup,(char *)string)) printSongInfo(fp,song);
free(dup);
}
return 0;
}
int searchForArtistInDirectory(FILE * fp, Song * song, void * string) {
if(song->tag && song->tag->artist) {
char * dup = strDupToUpper(song->tag->artist);
if(strstr(dup,(char *)string)) printSongInfo(fp,song);
free(dup);
}
return 0;
}
int searchForTitleInDirectory(FILE * fp, Song * song, void * string) {
if(song->tag && song->tag->title) {
char * dup = strDupToUpper(song->tag->title);
if(strstr(dup,(char *)string)) printSongInfo(fp,song);
free(dup);
}
return 0;
}
int searchForFilenameInDirectory(FILE * fp, Song * song, void * string) {
char * dup = strDupToUpper(song->utf8file);
if(strstr(dup,(char *)string)) printSongInfo(fp,song);
free(dup);
return 0;
}
int searchForSongsIn(FILE * fp, char * name, char * item, char * string) {
char * dup = strDupToUpper(string);
int ret = -1;
if(strcmp(item,DIRECTORY_SEARCH_ALBUM)==0) {
ret = traverseAllIn(fp,name,searchForAlbumInDirectory,NULL,
(void *)dup);
}
else if(strcmp(item,DIRECTORY_SEARCH_ARTIST)==0) {
ret = traverseAllIn(fp,name,searchForArtistInDirectory,NULL,
(void *)dup);
}
else if(strcmp(item,DIRECTORY_SEARCH_TITLE)==0) {
ret = traverseAllIn(fp,name,searchForTitleInDirectory,NULL,
(void *)dup);
}
else if(strcmp(item,DIRECTORY_SEARCH_FILENAME)==0) {
ret = traverseAllIn(fp,name,searchForFilenameInDirectory,NULL,
(void *)dup);
}
else myfprintf(fp,"%s unknown table\n",COMMAND_RESPOND_ERROR);
free(dup);
return ret;
}
int findAlbumInDirectory(FILE * fp, Song * song, void * string) {
if(song->tag && song->tag->album &&
strcmp((char *)string,song->tag->album)==0)
{
printSongInfo(fp,song);
}
return 0;
}
int findArtistInDirectory(FILE * fp, Song * song, void * string) {
if(song->tag && song->tag->artist &&
strcmp((char *)string,song->tag->artist)==0)
{
printSongInfo(fp,song);
}
return 0;
}
int findSongsIn(FILE * fp, char * name, char * item, char * string) {
if(strcmp(item,DIRECTORY_SEARCH_ALBUM)==0) {
return traverseAllIn(fp,name,findAlbumInDirectory,NULL,
(void *)string);
}
else if(strcmp(item,DIRECTORY_SEARCH_ARTIST)==0) {
return traverseAllIn(fp,name,findArtistInDirectory,NULL,
(void *)string);
}
myfprintf(fp,"%s unknown table\n",COMMAND_RESPOND_ERROR);
return -1;
}
int printAllIn(FILE * fp, char * name) {
return traverseAllIn(fp,name,printSongInDirectory,
printDirectoryInDirectory,NULL);
}
int directoryAddSongToPlaylist(FILE * fp, Song * song, void * data) {
return addSongToPlaylist(fp,song);
}
int addAllIn(FILE * fp, char * name) {
return traverseAllIn(fp,name,directoryAddSongToPlaylist,NULL,NULL);
}
int directoryPrintSongInfo(FILE * fp, Song * song, void * data) {
return printSongInfo(fp,song);
}
int sumSongTime(FILE * fp, Song * song, void * data) {
unsigned long * time = (unsigned long *)data;
if(song->tag && song->tag->time>=0) *time+=song->tag->time;
return 0;
}
int printInfoForAllIn(FILE * fp, char * name) {
return traverseAllIn(fp,name,directoryPrintSongInfo,NULL,NULL);
}
int countSongsIn(FILE * fp, char * name) {
int count = 0;
void * ptr = (void *)&count;
traverseAllIn(fp,name,NULL,countSongsInDirectory,ptr);
return count;
}
unsigned long sumSongTimesIn(FILE * fp, char * name) {
unsigned long dbPlayTime = 0;
void * ptr = (void *)&dbPlayTime;
traverseAllIn(fp,name,sumSongTime,NULL,ptr);
return dbPlayTime;
}
void initMp3Directory() {
mp3rootDirectory = newDirectory(NULL,NULL,0);
exploreDirectory(mp3rootDirectory);
sortDirectory(mp3rootDirectory);
}
Song * getSong(char * file) {
void * song;
Directory * directory;
char * shortname = NULL;
char * dir = NULL;
char * dup = strdup(file);
char * shortname = dup;
char * c = strtok(dup,"/");
DEBUG("get song: %s\n",file);
while(c) {
shortname = c;
c = strtok(NULL,"/");
......
......@@ -40,6 +40,18 @@ int updateMp3Directory(FILE * fp);
int printAllIn(FILE * fp, char * name);
int addAllIn(FILE * fp, char * name);
int printInfoForAllIn(FILE * fp, char * name);
int searchForSongsIn(FILE * fp, char * name, char * item, char * string);
int findSongsIn(FILE * fp, char * name, char * item, char * string);
int countSongsIn(FILE * fp, char * name);
unsigned long sumSongTimesIn(FILE * fp, char * name);
Song * getSong(char * file);
time_t getDbModTime();
......
......@@ -21,6 +21,7 @@
#include "utils.h"
#include "log.h"
#include "pcm_utils.h"
#include <stdio.h>
#include <string.h>
......@@ -32,6 +33,8 @@ typedef struct {
unsigned char chunk[CHUNK_SIZE];
int chunk_length;
float time;
int bitRate;
FLAC__uint64 position;
Buffer * cb;
AudioFormat * af;
DecoderControl * dc;
......@@ -56,6 +59,8 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
data.chunk_length = 0;
data.time = 0;
data.position = 0;
data.bitRate = 0;
data.cb = cb;
data.af = af;
data.dc = dc;
......@@ -69,7 +74,7 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
status&=FLAC__file_decoder_set_error_callback(flacDec,flacError);
status&=FLAC__file_decoder_set_client_data(flacDec, (void *)&data);
if(!status) {
ERROR1("flac problem before init(): %s\n",file);
ERROR("flac problem before init(): %s\n",file);
flacPrintErroredState(FLAC__file_decoder_get_state(flacDec),file);
FLAC__file_decoder_delete(flacDec);
return;
......@@ -77,13 +82,13 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
if(FLAC__file_decoder_init(flacDec)!=
FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
{
ERROR1("flac problem doing init(): %s\n",file);
ERROR("flac problem doing init(): %s\n",file);
flacPrintErroredState(FLAC__file_decoder_get_state(flacDec),file);
FLAC__file_decoder_delete(flacDec);
return;
}
if(!FLAC__file_decoder_process_until_end_of_metadata(flacDec)) {
ERROR1("flac problem reading metadata: %s\n",file);
ERROR("flac problem reading metadata: %s\n",file);
flacPrintErroredState(FLAC__file_decoder_get_state(flacDec),file);
FLAC__file_decoder_delete(flacDec);
return;
......@@ -105,6 +110,7 @@ void flacPlayFile(char *file, Buffer * cb, AudioFormat * af,
{
data.time = ((float)sampleToSeek)/
af->sampleRate;
data.position = 0;
}
dc->seek = 0;
}
......@@ -126,41 +132,41 @@ void flacError(const FLAC__FileDecoder *dec, FLAC__StreamDecoderErrorStatus stat
switch(status) {
case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
ERROR1("flac lost sync: %s\n",data->file);
ERROR("flac lost sync: %s\n",data->file);
break;
case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
ERROR1("bad header %s\n",data->file);
ERROR("bad header %s\n",data->file);
break;
case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
ERROR1("crc mismatch %s\n",data->file);
ERROR("crc mismatch %s\n",data->file);
break;
default:
ERROR1("unknow flac error %s\n",data->file);
ERROR("unknow flac error %s\n",data->file);
}
}
void flacPrintErroredState(FLAC__FileDecoderState state, char * file) {
switch(state) {
case FLAC__FILE_DECODER_ERROR_OPENING_FILE:
ERROR1("error opening flac: %s\n",file);
ERROR("error opening flac: %s\n",file);
break;
case FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR:
ERROR0("flac allocation error\n");
ERROR("flac allocation error\n");
break;
case FLAC__FILE_DECODER_SEEK_ERROR:
ERROR1("flac seek error: %s\n",file);
ERROR("flac seek error: %s\n",file);
break;
case FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR:
ERROR1("flac seekable stream error: %s\n",file);
ERROR("flac seekable stream error: %s\n",file);
break;
case FLAC__FILE_DECODER_ALREADY_INITIALIZED:
ERROR1("flac decoder already initilaized: %s\n",file);
ERROR("flac decoder already initilaized: %s\n",file);
break;
case FLAC__FILE_DECODER_INVALID_CALLBACK:
ERROR0("invalid flac callback\n");
ERROR("invalid flac callback\n");
break;
case FLAC__FILE_DECODER_UNINITIALIZED:
ERROR1("flac decoder uninitialized: %s\n",file);
ERROR("flac decoder uninitialized: %s\n",file);
break;
case FLAC__FILE_DECODER_OK:
case FLAC__FILE_DECODER_END_OF_FILE:
......@@ -181,13 +187,17 @@ int flacSendChunk(FlacData * data) {
if(data->dc->stop) return -1;
if(data->dc->seek) return 0;
memcpy(data->cb->chunks[data->cb->end],data->chunk,CHUNK_SIZE);
#ifdef WORDS_BIGENDIAN
pcm_changeBufferEndianness(chunk,CHUNK_SIZE,data->af->bits);
#endif
memcpy(data->cb->chunks+data->cb->end*CHUNK_SIZE,data->chunk,
CHUNK_SIZE);
data->cb->chunkSize[data->cb->end] = data->chunk_length;
data->cb->times[data->cb->end] = data->time;
data->cb->bitRate[data->cb->end] = 0;
data->cb->bitRate[data->cb->end] = data->bitRate;
data->cb->end++;
if(data->cb->end>=BUFFERED_CHUNKS) {
if(data->cb->end>=buffered_chunks) {
data->cb->end = 0;
data->cb->wrap = 1;
}
......@@ -197,13 +207,23 @@ int flacSendChunk(FlacData * data) {
FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__FileDecoder *dec, const FLAC__Frame *frame, const FLAC__int32 * const buf[], void * vdata) {
FlacData * data = (FlacData *)vdata;
uint_32 samples = frame->header.blocksize;
uint_16 u16;
FLAC__uint32 samples = frame->header.blocksize;
FLAC__uint16 u16;
unsigned char * uc;
int c_samp, c_chan, d_samp;
int i;
float timeChange;
FLAC__uint64 newPosition = 0;
data->time+=((float)samples)/frame->header.sample_rate;
timeChange = ((float)samples)/frame->header.sample_rate;
data->time+= timeChange;
FLAC__file_decoder_get_decode_position(dec,&newPosition);
if(data->position) {
data->bitRate = ((newPosition-data->position)*8.0/timeChange)
/1024+0.5;
}
data->position = newPosition;
for(c_samp = d_samp = 0; c_samp < frame->header.blocksize; c_samp++) {
for(c_chan = 0; c_chan < frame->header.channels;
......@@ -264,7 +284,7 @@ int flac_getAudioFormatAndTime(char * file, AudioFormat * format, float * time)
int flac_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
if(flac_getAudioFormatAndTime(dc->file,af,&(cb->totalTime))<0) {
ERROR1("\"%s\" doesn't seem to be a flac\n",dc->file);
ERROR("\"%s\" doesn't seem to be a flac\n",dc->file);
return -1;
}
......
......@@ -25,6 +25,7 @@
#include "listen.h"
#include "sig_handlers.h"
#include "playlist.h"
#include "permission.h"
#include <unistd.h>
#include <stdio.h>
......@@ -58,6 +59,7 @@ typedef struct _Interface {
int fd; /* file descriptor */
FILE * fp; /* file pointer */
int open; /* open/used */
unsigned int permission;
time_t lastTime;
List * commandList; /* for when in list mode */
unsigned long long commandListSize; /* mem commandList consumes */
......@@ -98,6 +100,8 @@ void openInterface(Interface * interface, int fd) {
interface->outputBufferSize = 0;
interface->outBuflen = 0;
interface->permission = getDefaultPermissions();
interface->outBufSize = INTERFACE_DEFAULT_OUT_BUFFER_SIZE;
#ifdef SO_SNDBUF
{
......@@ -107,10 +111,10 @@ void openInterface(Interface * interface, int fd) {
if(getsockopt(interface->fd,SOL_SOCKET,SO_SNDBUF,
(char *)&getSize,&sockOptLen) < 0)
{
DEBUG0("problem getting sockets send buffer size\n");
DEBUG("problem getting sockets send buffer size\n");
}
else if(getSize<=0) {
DEBUG0("sockets send buffer size is not positive\n");
DEBUG("sockets send buffer size is not positive\n");
}
else interface->outBufSize = getSize;
}
......@@ -136,7 +140,7 @@ void closeInterface(Interface * interface) {
free(interface->outBuffer);
SECURE1("interface %i: closed\n",interface->num);
SECURE("interface %i: closed\n",interface->num);
}
void openAInterface(int fd, struct sockaddr * addr) {
......@@ -145,33 +149,47 @@ void openAInterface(int fd, struct sockaddr * addr) {
for(i=0;i<interface_max_connections && interfaces[i].open;i++);
if(i==interface_max_connections) {
ERROR0("Max Connections Reached!\n");
ERROR("Max Connections Reached!\n");
while(close(fd) && errno==EINTR);
}
else {
SECURE1("interface %i: opened from ",i);
SECURE("interface %i: opened from ",i);
switch(addr->sa_family) {
case AF_INET:
SECURE1("%s\n",inet_ntoa(
{
char * host = inet_ntoa(
((struct sockaddr_in *)addr)->
sin_addr));
sin_addr);
if(host) {
SECURE("%s\n",host);
}
else {
SECURE("error getting ipv4 address\n");
}
}
break;
#ifdef HAVE_IPV6
case AF_INET6:
{
char host[INET6_ADDRSTRLEN+1];
memset(host,0,INET6_ADDRSTRLEN+1);
SECURE1("%s\n",inet_ntop(AF_INET6,(void *)
if(inet_ntop(AF_INET6,(void *)
&(((struct sockaddr_in6 *)addr)->
sin6_addr),host,INET6_ADDRSTRLEN));
sin6_addr),host,INET6_ADDRSTRLEN))
{
SECURE("%s\n",host);
}
else {
SECURE("error getting ipv6 address\n");
}
}
break;
#endif
case AF_UNIX:
SECURE0("local connection\n");
SECURE("local connection\n");
break;
default:
SECURE0("unknown\n");
SECURE("unknown\n");
}
openInterface(&(interfaces[i]),fd);
}
......@@ -198,7 +216,7 @@ int interfaceReadInput(Interface * interface) {
}
unblockSignals();
if(interface->bufferLength>=INTERFACE_MAX_BUFFER_LENGTH) {
ERROR1("interface %i: buffer overflow\n",
ERROR("interface %i: buffer overflow\n",
interface->num);
closeInterface(interface);
}
......@@ -219,9 +237,9 @@ int interfaceReadInput(Interface * interface) {
char ** argArray;
int argArrayLength;
argArrayLength = buffer2array((char *)node->data,&argArray);
DEBUG2("interface %i: process command \"%s\"\n",interface->num,node->data);
ret = processCommand(interface->fp,argArrayLength,argArray);
DEBUG2("interface %i: command returned %i\n",interface->num,ret);
DEBUG("interface %i: process command \"%s\"\n",interface->num,node->data);
ret = processCommand(interface->fp,&(interface->permission),argArrayLength,argArray);
DEBUG("interface %i: command returned %i\n",interface->num,ret);
freeArgArray(argArray,argArrayLength);
node = node->nextNode;
if(ret!=0 ||
......@@ -245,7 +263,7 @@ int interfaceReadInput(Interface * interface) {
interface->commandListSize+=sizeof(ListNode);
interface->commandListSize+=strlen(interface->buffer)+1;
if(interface->commandListSize>interface_max_command_list_size) {
ERROR3("interface %i: command list size (%lli) is larger than the max (%lli)\n",interface->num,interface->commandListSize,interface_max_command_list_size);
ERROR("interface %i: command list size (%lli) is larger than the max (%lli)\n",interface->num,interface->commandListSize,interface_max_command_list_size);
closeInterface(interface);
}
......@@ -267,9 +285,9 @@ int interfaceReadInput(Interface * interface) {
ret = -1;
}
else {
DEBUG2("interface %i: process command \"%s\"\n",interface->num,interface->buffer);
ret = processCommand(interface->fp,argArrayLength,argArray);
DEBUG2("interface %i: command returned %i\n",interface->num,ret);
DEBUG("interface %i: process command \"%s\"\n",interface->num,interface->buffer);
ret = processCommand(interface->fp,&(interface->permission),argArrayLength,argArray);
DEBUG("interface %i: command returned %i\n",interface->num,ret);
}
if(ret==0) {
myfprintf(interface->fp,"%s\n",COMMAND_RESPOND_OK);
......@@ -390,25 +408,25 @@ void initInterfaces() {
interface_timeout = strtol((getConf())[CONF_CONNECTION_TIMEOUT],&test,10);
if(*test!='\0' || interface_timeout<=0) {
ERROR1("connection timeout \"%s\" is not a positive integer\n",(getConf())[CONF_CONNECTION_TIMEOUT]);
ERROR("connection timeout \"%s\" is not a positive integer\n",(getConf())[CONF_CONNECTION_TIMEOUT]);
exit(-1);
}
interface_max_connections = strtol((getConf())[CONF_MAX_CONNECTIONS],&test,10);
if(*test!='\0' || interface_max_connections<=0) {
ERROR1("max connections \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_CONNECTIONS]);
ERROR("max connections \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_CONNECTIONS]);
exit(-1);
}
interface_max_command_list_size = strtoll((getConf())[CONF_MAX_COMMAND_LIST_SIZE],&test,10);
if(*test!='\0' || interface_max_command_list_size<=0) {
ERROR1("max command list size \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_COMMAND_LIST_SIZE]);
ERROR("max command list size \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_COMMAND_LIST_SIZE]);
exit(-1);
}
interface_max_output_buffer_size = strtoll((getConf())[CONF_MAX_OUTPUT_BUFFER_SIZE],&test,10);
if(*test!='\0' || interface_max_output_buffer_size<=0) {
ERROR1("max output buffer size \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_OUTPUT_BUFFER_SIZE]);
ERROR("max output buffer size \"%s\" is not a positive integer\n",(getConf())[CONF_MAX_OUTPUT_BUFFER_SIZE]);
exit(-1);
}
......@@ -446,7 +464,7 @@ void closeOldInterfaces() {
for(i=0;i<interface_max_connections;i++) {
if(interfaces[i].open && (interfaces[i].expired || (time(NULL)-interfaces[i].lastTime>interface_timeout))) {
DEBUG1("interface %i: timeout\n",i);
DEBUG("interface %i: timeout\n",i);
closeInterface(&(interfaces[i]));
}
}
......@@ -485,13 +503,13 @@ void flushInterfaceBuffer(Interface * interface) {
}
if(!interface->bufferList->firstNode) {
DEBUG1("interface %i: buffer empty\n",interface->num);
DEBUG("interface %i: buffer empty\n",interface->num);
freeList(interface->bufferList);
interface->bufferList = NULL;
}
else if(ret<0 && errno!=EAGAIN && errno!=EINTR) {
/* cause interface to close */
DEBUG1("interface %i: problems flushing buffer\n",
DEBUG("interface %i: problems flushing buffer\n",
interface->num);
freeList(interface->bufferList);
interface->bufferList = NULL;
......@@ -559,7 +577,7 @@ void printInterfaceOutBuffer(Interface * interface) {
if(interface->outputBufferSize>
interface_max_output_buffer_size)
{
ERROR3("interface %i: output buffer size (%lli) is "
ERROR("interface %i: output buffer size (%lli) is "
"larger than the max (%lli)\n",
interface->num,
interface->outputBufferSize,
......@@ -591,7 +609,7 @@ void printInterfaceOutBuffer(Interface * interface) {
(void *)buffer);
}
else {
DEBUG1("interface %i: problems writing\n",
DEBUG("interface %i: problems writing\n",
interface->num);
interface->expired = 1;
return;
......@@ -607,7 +625,7 @@ void printInterfaceOutBuffer(Interface * interface) {
}
/* if we needed to create buffer, initialize bufferSize info */
if(interface->bufferList) {
DEBUG1("interface %i: buffer created\n",interface->num);
DEBUG("interface %i: buffer created\n",interface->num);
interface->outputBufferSize = sizeof(List);
interface->outputBufferSize+=sizeof(ListNode);
interface->outputBufferSize+=strlen(
......
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -13,85 +13,113 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CXX = @CXX@
CXXCPP = @CXXCPP@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUG_FALSE = @DEBUG_FALSE@
DEBUG_TRUE = @DEBUG_TRUE@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
F77 = @F77@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
EXEEXT = @EXEEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
OBJDUMP = @OBJDUMP@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
RC = @RC@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS =
......@@ -108,9 +136,9 @@ version_info = $(version_current):$(version_revision):$(version_age)
EXTRA_DIST = genre.dat.sed \
CHANGES COPYRIGHT CREDITS README TODO VERSION
@DEBUG_FALSE@debug =
@DEBUG_TRUE@debug = debug.c debug.h
@DEBUG_FALSE@debug =
libid3tag_la_SOURCES = version.c ucs4.c latin1.c utf16.c utf8.c \
parse.c render.c field.c frametype.c compat.c \
......@@ -137,6 +165,12 @@ CONFIG_CLEAN_FILES = libid3tag.list
LTLIBRARIES = $(noinst_LTLIBRARIES)
libid3tag_la_LIBADD =
am__libid3tag_la_SOURCES_DIST = version.c ucs4.c latin1.c utf16.c utf8.c \
parse.c render.c field.c frametype.c compat.c genre.c frame.c \
crc.c util.c tag.c file.c version.h ucs4.h latin1.h utf16.h \
utf8.h parse.h render.h field.h frametype.h compat.h genre.h \
frame.h crc.h util.h tag.h file.h id3tag.h global.h genre.dat \
debug.c debug.h
@DEBUG_TRUE@am__objects_1 = debug.lo
@DEBUG_FALSE@am__objects_1 =
am_libid3tag_la_OBJECTS = version.lo ucs4.lo latin1.lo utf16.lo utf8.lo \
......@@ -144,11 +178,7 @@ am_libid3tag_la_OBJECTS = version.lo ucs4.lo latin1.lo utf16.lo utf8.lo \
frame.lo crc.lo util.lo tag.lo file.lo $(am__objects_1)
libid3tag_la_OBJECTS = $(am_libid3tag_la_OBJECTS)
DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/../../depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/compat.Plo ./$(DEPDIR)/crc.Plo \
......@@ -167,20 +197,21 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(libid3tag_la_SOURCES) $(EXTRA_libid3tag_la_SOURCES)
DIST_SOURCES = $(am__libid3tag_la_SOURCES_DIST) \
$(EXTRA_libid3tag_la_SOURCES)
HEADERS = $(noinst_HEADERS)
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
uninstall-info-recursive all-recursive install-data-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README $(noinst_HEADERS) ../../config.guess \
../../config.sub ../../depcomp ../../install-sh ../../ltmain.sh \
../../missing ../../mkinstalldirs COPYING INSTALL Makefile.am \
Makefile.in TODO aclocal.m4 config.h.in configure configure.ac \
libid3tag.list.in
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \
$(srcdir)/configure ../../config.guess ../../config.sub \
../../depcomp ../../install-sh ../../ltmain.sh ../../missing \
../../mkinstalldirs COPYING INSTALL Makefile.am TODO aclocal.m4 \
config.h.in configure configure.ac libid3tag.list.in
DIST_SUBDIRS = $(SUBDIRS)
SOURCES = $(libid3tag_la_SOURCES) $(EXTRA_libid3tag_la_SOURCES)
......@@ -229,7 +260,7 @@ clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test -z "$dir" && dir=.; \
test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
......@@ -260,27 +291,38 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `cygpath -w $<`
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.c.lo:
@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
CCDEPMODE = @CCDEPMODE@
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
mostlyclean-libtool:
-rm -f *.lo
......@@ -346,10 +388,17 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
......@@ -365,9 +414,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
......@@ -380,13 +435,28 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
......@@ -398,13 +468,20 @@ am__remove_distdir = \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkinstalldirs) $(distdir)/. $(distdir)/../..
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
......@@ -457,12 +534,13 @@ distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
......@@ -470,32 +548,50 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
find $$dc_install_base -type f -print ; \
exit 1; } >&2 ) \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after distclean:" ; \
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
......@@ -514,7 +610,7 @@ mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
......@@ -527,9 +623,10 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
......@@ -551,7 +648,9 @@ installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
......@@ -559,26 +658,35 @@ mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-noinstLTLIBRARIES \
clean-recursive dist dist-all dist-gzip distcheck distclean \
distclean-compile distclean-depend distclean-generic \
clean-recursive ctags ctags-recursive dist dist-all dist-gzip \
distcheck distclean distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-recursive \
distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \
info info-am info-recursive install install-am install-data \
install-data-am install-data-recursive install-exec \
install-exec-am install-exec-recursive install-info \
install-info-am install-info-recursive install-man \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am dvi-recursive info info-am info-recursive install \
install-am install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
tags tags-recursive uninstall uninstall-am uninstall-info-am \
pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
tags-recursive uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* C code produced by gperf version 3.0.1 */
/* C code produced by gperf version 2.7.2 */
/* Command-line: gperf -tCcTonD -K id -N id3_compat_lookup -s -3 -k '*' compat.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
#line 1 "compat.gperf"
/*
* libid3tag - ID3 tag manipulation library
* Copyright (C) 2000-2003 Underbit Technologies, Inc.
......@@ -80,9 +50,9 @@ static id3_compat_func_t translate_TCON;
#define TOTAL_KEYWORDS 73
#define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 4
#define MIN_HASH_VALUE 6
#define MAX_HASH_VALUE 127
/* maximum key range = 122, duplicates = 0 */
#define MIN_HASH_VALUE 1
#define MAX_HASH_VALUE 84
/* maximum key range = 84, duplicates = 10 */
#ifdef __GNUC__
__inline
......@@ -98,46 +68,44 @@ hash (str, len)
{
static const unsigned char asso_values[] =
{
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 64,
58, 20, 15, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 10, 18, 3, 6, 1,
47, 0, 128, 42, 62, 30, 31, 0, 19, 52,
10, 24, 8, 30, 5, 3, 30, 8, 25, 47,
3, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 22,
21, 27, 26, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 9, 3, 0, 27, 16,
6, 30, 85, 15, 85, 22, 2, 15, 4, 1,
0, 30, 13, 17, 22, 0, 24, 5, 31, 25,
15, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 85
};
register int hval = 0;
switch (len)
{
default:
case 4:
hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
hval += asso_values[(unsigned char)str[2]];
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]+1];
/*FALLTHROUGH*/
hval += asso_values[(unsigned char)str[1]];
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
......@@ -155,166 +123,95 @@ id3_compat_lookup (str, len)
{
static const struct id3_compat wordlist[] =
{
#line 97 "compat.gperf"
{"TLE", EQ(TLEN) /* Length */},
#line 68 "compat.gperf"
{"ETC", EQ(ETCO) /* Event timing codes */},
#line 126 "compat.gperf"
{"ULT", EQ(USLT) /* Unsynchronised lyric/text transcription */},
#line 123 "compat.gperf"
{"TYE", OBSOLETE /* Year [obsolete] */},
#line 92 "compat.gperf"
{"TFT", EQ(TFLT) /* File type */},
#line 84 "compat.gperf"
{"TCM", EQ(TCOM) /* Composer */},
#line 66 "compat.gperf"
{"EQU", OBSOLETE /* Equalization [obsolete] */},
#line 63 "compat.gperf"
{"POP", EQ(POPM) /* Popularimeter */},
{"WCP", EQ(WCOP) /* Copyright/legal information */},
{"WPB", EQ(WPUB) /* Publishers official webpage */},
{"BUF", EQ(RBUF) /* Recommended buffer size */},
{"PIC", EQ(APIC) /* Attached picture */},
{"COM", EQ(COMM) /* Comments */},
#line 130 "compat.gperf"
{"IPL", EQ(TIPL) /* Involved people list */},
{"MLL", EQ(MLLT) /* MPEG location lookup table */},
{"WAF", EQ(WOAF) /* Official audio file webpage */},
{"WCM", EQ(WCOM) /* Commercial information */},
#line 96 "compat.gperf"
{"TLA", EQ(TLAN) /* Language(s) */},
#line 88 "compat.gperf"
{"TDA", OBSOLETE /* Date [obsolete] */},
#line 124 "compat.gperf"
{"TYER", OBSOLETE /* Year [obsolete] */},
#line 83 "compat.gperf"
{"UFI", EQ(UFID) /* Unique file identifier */},
{"CRA", EQ(AENC) /* Audio encryption */},
{"TCO", TX(TCON) /* Content type */},
{"ULT", EQ(USLT) /* Unsynchronised lyric/text transcription */},
{"TOL", EQ(TOLY) /* Original lyricist(s)/text writer(s) */},
{"TBP", EQ(TBPM) /* BPM (beats per minute) */},
#line 87 "compat.gperf"
{"TPB", EQ(TPUB) /* Publisher */},
{"CNT", EQ(PCNT) /* Play counter */},
{"TCON", TX(TCON) /* Content type */},
{"WAR", EQ(WOAR) /* Official artist/performer webpage */},
{"LNK", EQ(LINK) /* Linked information */},
{"CRM", OBSOLETE /* Encrypted meta frame [obsolete] */},
{"TOF", EQ(TOFN) /* Original filename */},
{"MCI", EQ(MCDI) /* Music CD identifier */},
{"TPA", EQ(TPOS) /* Part of a set */},
{"WAS", EQ(WOAS) /* Official audio source webpage */},
{"TOA", EQ(TOPE) /* Original artist(s)/performer(s) */},
{"TAL", EQ(TALB) /* Album/movie/show title */},
{"TLA", EQ(TLAN) /* Language(s) */},
{"IPLS", EQ(TIPL) /* Involved people list */},
{"TCR", EQ(TCOP) /* Copyright message */},
#line 104 "compat.gperf"
{"TOT", EQ(TOAL) /* Original album/movie/show title */},
#line 89 "compat.gperf"
{"TDAT", OBSOLETE /* Date [obsolete] */},
#line 67 "compat.gperf"
{"EQUA", OBSOLETE /* Equalization [obsolete] */},
#line 102 "compat.gperf"
{"TRC", EQ(TSRC) /* ISRC (international standard recording code) */},
{"TOR", EQ(TDOR) /* Original release year [obsolete] */},
#line 131 "compat.gperf"
{"WCP", EQ(WCOP) /* Copyright/legal information */},
#line 99 "compat.gperf"
{"TOA", EQ(TOPE) /* Original artist(s)/performer(s) */},
#line 78 "compat.gperf"
{"RVA", OBSOLETE /* Relative volume adjustment [obsolete] */},
#line 120 "compat.gperf"
{"TT3", EQ(TIT3) /* Subtitle/description refinement */},
#line 98 "compat.gperf"
{"TMT", EQ(TMED) /* Media type */},
#line 76 "compat.gperf"
{"POP", EQ(POPM) /* Popularimeter */},
#line 74 "compat.gperf"
{"MLL", EQ(MLLT) /* MPEG location lookup table */},
#line 79 "compat.gperf"
{"RVAD", OBSOLETE /* Relative volume adjustment [obsolete] */},
#line 65 "compat.gperf"
{"CRM", OBSOLETE /* Encrypted meta frame [obsolete] */},
#line 128 "compat.gperf"
{"WAR", EQ(WOAR) /* Official artist/performer webpage */},
#line 80 "compat.gperf"
{"SLT", EQ(SYLT) /* Synchronised lyric/text */},
#line 81 "compat.gperf"
{"TCM", EQ(TCOM) /* Composer */},
{"ETC", EQ(ETCO) /* Event timing codes */},
{"STC", EQ(SYTC) /* Synchronised tempo codes */},
#line 95 "compat.gperf"
{"TKE", EQ(TKEY) /* Initial key */},
#line 111 "compat.gperf"
{"TRC", EQ(TSRC) /* ISRC (international standard recording code) */},
#line 109 "compat.gperf"
{"TPA", EQ(TPOS) /* Part of a set */},
#line 117 "compat.gperf"
{"TSS", EQ(TSSE) /* Software/hardware and settings used for encoding */},
#line 112 "compat.gperf"
{"TRD", OBSOLETE /* Recording dates [obsolete] */},
#line 64 "compat.gperf"
{"CRA", EQ(AENC) /* Audio encryption */},
#line 108 "compat.gperf"
{"TLE", EQ(TLEN) /* Length */},
{"SLT", EQ(SYLT) /* Synchronised lyric/text */},
{"TEN", EQ(TENC) /* Encoded by */},
{"TP2", EQ(TPE2) /* Band/orchestra/accompaniment */},
{"TP1", EQ(TPE1) /* Lead performer(s)/soloist(s) */},
{"TOT", EQ(TOAL) /* Original album/movie/show title */},
{"EQU", OBSOLETE /* Equalization [obsolete] */},
{"RVA", OBSOLETE /* Relative volume adjustment [obsolete] */},
{"GEO", EQ(GEOB) /* General encapsulated object */},
{"TP4", EQ(TPE4) /* Interpreted, remixed, or otherwise modified by */},
#line 125 "compat.gperf"
{"UFI", EQ(UFID) /* Unique file identifier */},
#line 101 "compat.gperf"
{"TOL", EQ(TOLY) /* Original lyricist(s)/text writer(s) */},
#line 110 "compat.gperf"
{"TPB", EQ(TPUB) /* Publisher */},
#line 73 "compat.gperf"
{"MCI", EQ(MCDI) /* Music CD identifier */},
#line 107 "compat.gperf"
{"TP3", EQ(TPE3) /* Conductor/performer refinement */},
#line 132 "compat.gperf"
{"WPB", EQ(WPUB) /* Publishers official webpage */},
#line 113 "compat.gperf"
{"TRDA", OBSOLETE /* Recording dates [obsolete] */},
#line 115 "compat.gperf"
{"TFT", EQ(TFLT) /* File type */},
{"TIM", OBSOLETE /* Time [obsolete] */},
{"REV", EQ(RVRB) /* Reverb */},
{"TSI", OBSOLETE /* Size [obsolete] */},
#line 90 "compat.gperf"
{"TDY", EQ(TDLY) /* Playlist delay */},
#line 82 "compat.gperf"
{"TAL", EQ(TALB) /* Album/movie/show title */},
#line 116 "compat.gperf"
{"TSIZ", OBSOLETE /* Size [obsolete] */},
#line 129 "compat.gperf"
{"WAS", EQ(WOAS) /* Official audio source webpage */},
#line 121 "compat.gperf"
{"TXT", EQ(TEXT) /* Lyricist/text writer */},
#line 62 "compat.gperf"
{"CNT", EQ(PCNT) /* Play counter */},
#line 100 "compat.gperf"
{"TOF", EQ(TOFN) /* Original filename */},
#line 85 "compat.gperf"
{"TCO", TX(TCON) /* Content type */},
#line 114 "compat.gperf"
{"EQUA", OBSOLETE /* Equalization [obsolete] */},
{"TSS", EQ(TSSE) /* Software/hardware and settings used for encoding */},
{"TRK", EQ(TRCK) /* Track number/position in set */},
#line 119 "compat.gperf"
{"TT2", EQ(TIT2) /* Title/songname/content description */},
#line 93 "compat.gperf"
{"TIM", OBSOLETE /* Time [obsolete] */},
#line 94 "compat.gperf"
{"TIME", OBSOLETE /* Time [obsolete] */},
#line 103 "compat.gperf"
{"TDA", OBSOLETE /* Date [obsolete] */},
{"TMT", EQ(TMED) /* Media type */},
{"TKE", EQ(TKEY) /* Initial key */},
{"TORY", EQ(TDOR) /* Original release year [obsolete] */},
#line 91 "compat.gperf"
{"TEN", EQ(TENC) /* Encoded by */},
#line 118 "compat.gperf"
{"TRD", OBSOLETE /* Recording dates [obsolete] */},
{"TYE", OBSOLETE /* Year [obsolete] */},
{"TT2", EQ(TIT2) /* Title/songname/content description */},
{"TT1", EQ(TIT1) /* Content group description */},
#line 127 "compat.gperf"
{"WAF", EQ(WOAF) /* Official audio file webpage */},
#line 75 "compat.gperf"
{"PIC", EQ(APIC) /* Attached picture */},
#line 122 "compat.gperf"
{"TXX", EQ(TXXX) /* User defined text information frame */},
#line 133 "compat.gperf"
{"WXX", EQ(WXXX) /* User defined URL link frame */},
#line 86 "compat.gperf"
{"TCON", TX(TCON) /* Content type */},
#line 77 "compat.gperf"
{"REV", EQ(RVRB) /* Reverb */},
#line 106 "compat.gperf"
{"TP2", EQ(TPE2) /* Band/orchestra/accompaniment */},
#line 105 "compat.gperf"
{"TP1", EQ(TPE1) /* Lead performer(s)/soloist(s) */},
#line 61 "compat.gperf"
{"BUF", EQ(RBUF) /* Recommended buffer size */},
#line 70 "compat.gperf"
{"IPL", EQ(TIPL) /* Involved people list */},
#line 69 "compat.gperf"
{"GEO", EQ(GEOB) /* General encapsulated object */},
#line 72 "compat.gperf"
{"LNK", EQ(LINK) /* Linked information */},
#line 71 "compat.gperf"
{"IPLS", EQ(TIPL) /* Involved people list */}
{"TIME", OBSOLETE /* Time [obsolete] */},
{"TSIZ", OBSOLETE /* Size [obsolete] */},
{"TT3", EQ(TIT3) /* Subtitle/description refinement */},
{"TRDA", OBSOLETE /* Recording dates [obsolete] */},
{"RVAD", OBSOLETE /* Relative volume adjustment [obsolete] */},
{"TDY", EQ(TDLY) /* Playlist delay */},
{"TXT", EQ(TEXT) /* Lyricist/text writer */},
{"TYER", OBSOLETE /* Year [obsolete] */},
{"TDAT", OBSOLETE /* Date [obsolete] */},
{"TXX", EQ(TXXX) /* User defined text information frame */}
};
static const short lookup[] =
{
-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
-1, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, -1, -1, 50, -1, 51, 52, -1, 53, 54, 55, 56, -1,
57, 58, 59, 60, -1, 61, -1, 62, -1, -1, 63, -1, 64, -1,
-1, 65, -1, 66, -1, -1, -1, -1, -1, 67, -1, 68, -1, 69,
-1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 72
-1, 0, -1, -53, -2, 1, -49, -2,
2, 3, -1, -46, -2, -43, -2, 4,
5, 6, -1, 7, -163, 10, 11, 12,
13, -161, 17, -159, -77, 22, 23, -80,
26, -85, 29, -87, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, -155, 44,
45, 46, 47, -1, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59,
-1, 60, 61, 62, 63, 64, -1, -151,
-1, 67, 68, 69, 70, -8, -2, -1,
71, -31, -2, -1, 72, -55, -2, -59,
-3, -65, -2
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
......@@ -332,12 +229,25 @@ id3_compat_lookup (str, len)
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[index];
}
else if (index < -TOTAL_KEYWORDS)
{
register int offset = - 1 - TOTAL_KEYWORDS - index;
register const struct id3_compat *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
register const struct id3_compat *wordendptr = wordptr + -lookup[offset + 1];
while (wordptr < wordendptr)
{
register const char *s = wordptr->id;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return wordptr;
wordptr++;
}
}
}
}
return 0;
}
#line 134 "compat.gperf"
static
int translate_TCON(struct id3_frame *frame, char const *oldid,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* C code produced by gperf version 3.0.1 */
/* C code produced by gperf version 2.7.2 */
/* Command-line: gperf -tCcTonD -K id -N id3_frametype_lookup -s -3 -k '*' frametype.gperf */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
#endif
#line 1 "frametype.gperf"
/*
* libid3tag - ID3 tag manipulation library
* Copyright (C) 2000-2003 Underbit Technologies, Inc.
......@@ -303,9 +273,9 @@ FRAMETYPE(obsolete, unknown, OBSOLETE, "Obsolete frame");
#define TOTAL_KEYWORDS 84
#define MIN_WORD_LENGTH 4
#define MAX_WORD_LENGTH 4
#define MIN_HASH_VALUE 7
#define MAX_HASH_VALUE 155
/* maximum key range = 149, duplicates = 0 */
#define MIN_HASH_VALUE 0
#define MAX_HASH_VALUE 111
/* maximum key range = 112, duplicates = 12 */
#ifdef __GNUC__
__inline
......@@ -321,34 +291,49 @@ hash (str, len)
{
static const unsigned char asso_values[] =
{
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
43, 4, 47, 49, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 31, 53, 3, 15, 3,
24, 25, 10, 52, 69, 34, 23, 30, 1, 5,
10, 62, 20, 0, 28, 28, 22, 19, 47, 3,
10, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 156
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 20,
18, 2, 25, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 19, 26, 1, 28, 15,
9, 31, 112, 0, 112, 29, 3, 0, 10, 0,
30, 0, 8, 5, 0, 29, 31, 24, 29, 24,
30, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112
};
return asso_values[(unsigned char)str[3]+1] + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]];
register int hval = 0;
switch (len)
{
default:
case 4:
hval += asso_values[(unsigned char)str[3]];
case 3:
hval += asso_values[(unsigned char)str[2]];
case 2:
hval += asso_values[(unsigned char)str[1]];
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval;
}
#ifdef __GNUC__
......@@ -361,190 +346,108 @@ id3_frametype_lookup (str, len)
{
static const struct id3_frametype wordlist[] =
{
#line 282 "frametype.gperf"
{"ENCR", FRAME(ENCR), PRESERVE, "Encryption method registration"},
#line 292 "frametype.gperf"
{"POPM", FRAME(POPM), PRESERVE, "Popularimeter"},
#line 351 "frametype.gperf"
{"WCOM", FRAME(url), PRESERVE, "Commercial information"},
#line 298 "frametype.gperf"
{"SEEK", FRAME(SEEK), DISCARD, "Seek frame"},
#line 349 "frametype.gperf"
{"USER", FRAME(USER), PRESERVE, "Terms of use"},
#line 285 "frametype.gperf"
{"GEOB", FRAME(GEOB), PRESERVE, "General encapsulated object"},
#line 304 "frametype.gperf"
{"TMOO", FRAME(text), PRESERVE, "Mood"},
{"TCOM", FRAME(text), PRESERVE, "Composer"},
#line 281 "frametype.gperf"
{"COMR", FRAME(COMR), PRESERVE, "Commercial frame"},
#line 280 "frametype.gperf"
{"COMM", FRAME(COMM), PRESERVE, "Comments"},
#line 305 "frametype.gperf"
{"TIT3", FRAME(text), PRESERVE, "Subtitle/description refinement"},
{"TMCL", FRAME(text), PRESERVE, "Musician credits list"},
{"TSOT", FRAME(text), PRESERVE, "Title sort order"},
{"MLLT", FRAME(MLLT), DISCARD, "MPEG location lookup table"},
{"COMR", FRAME(COMR), PRESERVE, "Commercial frame"},
{"TSST", FRAME(text), PRESERVE, "Set subtitle"},
{"TCON", FRAME(text), PRESERVE, "Content type"},
#line 291 "frametype.gperf"
{"PCNT", FRAME(PCNT), PRESERVE, "Play counter"},
#line 293 "frametype.gperf"
{"POSS", FRAME(POSS), DISCARD, "Position synchronisation frame"},
#line 284 "frametype.gperf"
{"TFLT", FRAME(text), PRESERVE, "File type"},
{"TRSO", FRAME(text), PRESERVE, "Internet radio station owner"},
{"TSRC", FRAME(text), PRESERVE, "ISRC (international standard recording code)"},
{"ETCO", FRAME(ETCO), DISCARD, "Event timing codes"},
#line 332 "frametype.gperf"
{"TPE2", FRAME(text), PRESERVE, "Band/orchestra/accompaniment"},
#line 301 "frametype.gperf"
{"SYTC", FRAME(SYTC), DISCARD, "Synchronised tempo codes"},
#line 313 "frametype.gperf"
{"TENC", FRAME(text), DISCARD, "Encoded by"},
#line 309 "frametype.gperf"
{"TDOR", FRAME(text), PRESERVE, "Original release time"},
#line 290 "frametype.gperf"
{"OWNE", FRAME(OWNE), PRESERVE, "Ownership frame"},
#line 277 "frametype.gperf"
{"AENC", FRAME(AENC), DISCARD, "Audio encryption"},
#line 307 "frametype.gperf"
{"TDEN", FRAME(text), PRESERVE, "Encoding time"},
#line 345 "frametype.gperf"
{"TSSE", FRAME(text), PRESERVE, "Software/hardware and settings used for encoding"},
#line 339 "frametype.gperf"
{"TIT2", FRAME(text), PRESERVE, "Title/songname/content description"},
{"TOFN", FRAME(text), PRESERVE, "Original filename"},
{"TIT1", FRAME(text), PRESERVE, "Content group description"},
{"TOAL", FRAME(text), PRESERVE, "Original album/movie/show title"},
{"TRSN", FRAME(text), PRESERVE, "Internet radio station name"},
#line 300 "frametype.gperf"
{"TSOA", FRAME(text), PRESERVE, "Album sort order"},
{"TSSE", FRAME(text), PRESERVE, "Software/hardware and settings used for encoding"},
{"WCOM", FRAME(url), PRESERVE, "Commercial information"},
{"TENC", FRAME(text), DISCARD, "Encoded by"},
{"TOLY", FRAME(text), PRESERVE, "Original lyricist(s)/text writer(s)"},
{"TLEN", FRAME(text), DISCARD, "Length"},
{"MCDI", FRAME(MCDI), PRESERVE, "Music CD identifier"},
{"SYTC", FRAME(SYTC), DISCARD, "Synchronised tempo codes"},
{"TCOP", FRAME(text), PRESERVE, "Copyright message"},
{"SYLT", FRAME(SYLT), DISCARD, "Synchronised lyric/text"},
#line 354 "frametype.gperf"
{"WOAR", FRAME(url), PRESERVE, "Official artist/performer webpage"},
#line 346 "frametype.gperf"
{"TSST", FRAME(text), PRESERVE, "Set subtitle"},
#line 330 "frametype.gperf"
{"TLAN", FRAME(text), PRESERVE, "Language(s)"},
{"TIPL", FRAME(text), PRESERVE, "Involved people list"},
{"ENCR", FRAME(ENCR), PRESERVE, "Encryption method registration"},
{"TOWN", FRAME(text), PRESERVE, "File owner/licensee"},
#line 340 "frametype.gperf"
{"TRSO", FRAME(text), PRESERVE, "Internet radio station owner"},
#line 322 "frametype.gperf"
{"TLEN", FRAME(text), DISCARD, "Length"},
#line 358 "frametype.gperf"
{"WPUB", FRAME(url), PRESERVE, "Publishers official webpage"},
#line 343 "frametype.gperf"
{"TSOT", FRAME(text), PRESERVE, "Title sort order"},
#line 327 "frametype.gperf"
{"TOFN", FRAME(text), PRESERVE, "Original filename"},
#line 344 "frametype.gperf"
{"TSRC", FRAME(text), PRESERVE, "ISRC (international standard recording code)"},
#line 324 "frametype.gperf"
{"TMED", FRAME(text), PRESERVE, "Media type"},
#line 297 "frametype.gperf"
{"RVRB", FRAME(RVRB), PRESERVE, "Reverb"},
#line 328 "frametype.gperf"
{"TOLY", FRAME(text), PRESERVE, "Original lyricist(s)/text writer(s)"},
#line 329 "frametype.gperf"
{"TOPE", FRAME(text), PRESERVE, "Original artist(s)/performer(s)"},
#line 336 "frametype.gperf"
{"TPRO", FRAME(text), PRESERVE, "Produced notice"},
#line 337 "frametype.gperf"
{"TPUB", FRAME(text), PRESERVE, "Publisher"},
#line 357 "frametype.gperf"
{"WPAY", FRAME(url), PRESERVE, "Payment"},
#line 335 "frametype.gperf"
{"TPOS", FRAME(text), PRESERVE, "Part of a set"},
#line 356 "frametype.gperf"
{"WORS", FRAME(url), PRESERVE, "Official Internet radio station homepage"},
#line 325 "frametype.gperf"
{"TMOO", FRAME(text), PRESERVE, "Mood"},
#line 338 "frametype.gperf"
{"TRCK", FRAME(text), PRESERVE, "Track number/position in set"},
#line 320 "frametype.gperf"
{"TKEY", FRAME(text), PRESERVE, "Initial key"},
#line 308 "frametype.gperf"
{"TDLY", FRAME(text), PRESERVE, "Playlist delay"},
#line 296 "frametype.gperf"
{"RVA2", FRAME(RVA2), DISCARD, "Relative volume adjustment (2)"},
#line 310 "frametype.gperf"
{"TSOP", FRAME(text), PRESERVE, "Performer sort order"},
{"TDOR", FRAME(text), PRESERVE, "Original release time"},
{"TDRC", FRAME(text), PRESERVE, "Recording time"},
#line 350 "frametype.gperf"
{"WORS", FRAME(url), PRESERVE, "Official Internet radio station homepage"},
{"USLT", FRAME(USLT), PRESERVE, "Unsynchronised lyric/text transcription"},
#line 353 "frametype.gperf"
{"WOAF", FRAME(url), PRESERVE, "Official audio file webpage"},
#line 312 "frametype.gperf"
{"TDTG", FRAME(text), PRESERVE, "Tagging time"},
#line 299 "frametype.gperf"
{"TRCK", FRAME(text), PRESERVE, "Track number/position in set"},
{"TPRO", FRAME(text), PRESERVE, "Produced notice"},
{"TDRL", FRAME(text), PRESERVE, "Release time"},
{"POSS", FRAME(POSS), DISCARD, "Position synchronisation frame"},
{"PCNT", FRAME(PCNT), PRESERVE, "Play counter"},
{"LINK", FRAME(LINK), PRESERVE, "Linked information"},
{"TMED", FRAME(text), PRESERVE, "Media type"},
{"TEXT", FRAME(text), PRESERVE, "Lyricist/text writer"},
{"TOPE", FRAME(text), PRESERVE, "Original artist(s)/performer(s)"},
{"AENC", FRAME(AENC), DISCARD, "Audio encryption"},
{"SIGN", FRAME(SIGN), PRESERVE, "Signature frame"},
#line 355 "frametype.gperf"
{"TPE3", FRAME(text), PRESERVE, "Conductor/performer refinement"},
{"WOAS", FRAME(url), PRESERVE, "Official audio source webpage"},
#line 331 "frametype.gperf"
{"TPE1", FRAME(text), PRESERVE, "Lead performer(s)/soloist(s)"},
#line 302 "frametype.gperf"
{"TALB", FRAME(text), PRESERVE, "Album/movie/show title"},
#line 341 "frametype.gperf"
{"TSOA", FRAME(text), PRESERVE, "Album sort order"},
#line 321 "frametype.gperf"
{"TLAN", FRAME(text), PRESERVE, "Language(s)"},
#line 333 "frametype.gperf"
{"TPE3", FRAME(text), PRESERVE, "Conductor/performer refinement"},
#line 352 "frametype.gperf"
{"OWNE", FRAME(OWNE), PRESERVE, "Ownership frame"},
{"APIC", FRAME(APIC), PRESERVE, "Attached picture"},
{"WOAR", FRAME(url), PRESERVE, "Official artist/performer webpage"},
{"WOAF", FRAME(url), PRESERVE, "Official audio file webpage"},
{"TDEN", FRAME(text), PRESERVE, "Encoding time"},
{"ASPI", FRAME(ASPI), DISCARD, "Audio seek point index"},
{"WCOP", FRAME(url), PRESERVE, "Copyright/legal information"},
#line 334 "frametype.gperf"
{"TPE4", FRAME(text), PRESERVE, "Interpreted, remixed, or otherwise modified by"},
#line 323 "frametype.gperf"
{"TMCL", FRAME(text), PRESERVE, "Musician credits list"},
#line 303 "frametype.gperf"
{"TDLY", FRAME(text), PRESERVE, "Playlist delay"},
{"TBPM", FRAME(text), PRESERVE, "BPM (beats per minute)"},
#line 311 "frametype.gperf"
{"TDRL", FRAME(text), PRESERVE, "Release time"},
#line 326 "frametype.gperf"
{"TOAL", FRAME(text), PRESERVE, "Original album/movie/show title"},
#line 342 "frametype.gperf"
{"TSOP", FRAME(text), PRESERVE, "Performer sort order"},
#line 363 "frametype.gperf"
{"USER", FRAME(USER), PRESERVE, "Terms of use"},
{"TDTG", FRAME(text), PRESERVE, "Tagging time"},
{"POPM", FRAME(POPM), PRESERVE, "Popularimeter"},
{"ZOBS", FRAME(ZOBS), OBSOLETE, "Obsolete frame"},
#line 283 "frametype.gperf"
{"EQU2", FRAME(EQU2), DISCARD, "Equalisation (2)"},
#line 306 "frametype.gperf"
{"TCOP", FRAME(text), PRESERVE, "Copyright message"},
#line 287 "frametype.gperf"
{"LINK", FRAME(LINK), PRESERVE, "Linked information"},
#line 286 "frametype.gperf"
{"TPE2", FRAME(text), PRESERVE, "Band/orchestra/accompaniment"},
{"SEEK", FRAME(SEEK), DISCARD, "Seek frame"},
{"TPE1", FRAME(text), PRESERVE, "Lead performer(s)/soloist(s)"},
{"UFID", FRAME(UFID), PRESERVE, "Unique file identifier"},
{"GRID", FRAME(GRID), PRESERVE, "Group identification registration"},
#line 294 "frametype.gperf"
{"TKEY", FRAME(text), PRESERVE, "Initial key"},
{"PRIV", FRAME(PRIV), PRESERVE, "Private frame"},
#line 315 "frametype.gperf"
{"TFLT", FRAME(text), PRESERVE, "File type"},
#line 289 "frametype.gperf"
{"MLLT", FRAME(MLLT), DISCARD, "MPEG location lookup table"},
#line 314 "frametype.gperf"
{"TEXT", FRAME(text), PRESERVE, "Lyricist/text writer"},
#line 348 "frametype.gperf"
{"UFID", FRAME(UFID), PRESERVE, "Unique file identifier"},
#line 278 "frametype.gperf"
{"APIC", FRAME(APIC), PRESERVE, "Attached picture"},
#line 279 "frametype.gperf"
{"ASPI", FRAME(ASPI), DISCARD, "Audio seek point index"},
#line 318 "frametype.gperf"
{"TIT2", FRAME(text), PRESERVE, "Title/songname/content description"},
#line 359 "frametype.gperf"
{"WXXX", FRAME(WXXX), PRESERVE, "User defined URL link frame"},
#line 288 "frametype.gperf"
{"MCDI", FRAME(MCDI), PRESERVE, "Music CD identifier"},
#line 316 "frametype.gperf"
{"TIPL", FRAME(text), PRESERVE, "Involved people list"},
#line 347 "frametype.gperf"
{"TXXX", FRAME(TXXX), PRESERVE, "User defined text information frame"},
#line 295 "frametype.gperf"
{"TPE4", FRAME(text), PRESERVE, "Interpreted, remixed, or otherwise modified by"},
{"GEOB", FRAME(GEOB), PRESERVE, "General encapsulated object"},
{"RBUF", FRAME(RBUF), PRESERVE, "Recommended buffer size"},
#line 317 "frametype.gperf"
{"TIT1", FRAME(text), PRESERVE, "Content group description"},
#line 319 "frametype.gperf"
{"TIT3", FRAME(text), PRESERVE, "Subtitle/description refinement"}
{"RVRB", FRAME(RVRB), PRESERVE, "Reverb"},
{"RVA2", FRAME(RVA2), DISCARD, "Relative volume adjustment (2)"},
{"TPUB", FRAME(text), PRESERVE, "Publisher"},
{"TXXX", FRAME(TXXX), PRESERVE, "User defined text information frame"},
{"WPAY", FRAME(url), PRESERVE, "Payment"},
{"WPUB", FRAME(url), PRESERVE, "Publishers official webpage"},
{"WXXX", FRAME(WXXX), PRESERVE, "User defined URL link frame"}
};
static const short lookup[] =
{
-1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1,
2, 3, -1, 4, -1, -1, -1, -1, 5, 6, 7, 8, -1, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, -1, 70, 71, -1, 72, 73, 74, -1, 75, -1,
76, -1, -1, -1, 77, 78, -1, -1, 79, -1, -1, -1, -1, 80,
81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1,
-1, 83
0, -92, 3, -1, 4, 5, 6, -83,
-2, 7, 8, 9, 10, 11, 12, -1,
13, -1, 14, 15, 16, -1, 17, 18,
19, -183, 22, 23, 24, 25, 26, 27,
-179, 30, -177, -175, 35, -173, -168, 41,
42, 43, 44, 45, 46, -166, 49, 50,
-164, 53, 54, 55, 56, 57, 58, -162,
61, 62, -1, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, -1,
-159, 77, -9, -2, 78, -25, -2, -33,
-2, -37, -2, -45, -2, 79, -1, 80,
-48, -3, -51, -2, -53, -2, -56, -2,
-1, 81, -64, -2, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 82, -1, 83
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
......@@ -562,6 +465,21 @@ id3_frametype_lookup (str, len)
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return &wordlist[index];
}
else if (index < -TOTAL_KEYWORDS)
{
register int offset = - 1 - TOTAL_KEYWORDS - index;
register const struct id3_frametype *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
register const struct id3_frametype *wordendptr = wordptr + -lookup[offset + 1];
while (wordptr < wordendptr)
{
register const char *s = wordptr->id;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
return wordptr;
wordptr++;
}
}
}
}
return 0;
......
# Makefile.in generated by automake 1.6.3 from Makefile.am.
# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
......@@ -13,90 +13,116 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PATH_SEPARATOR = @PATH_SEPARATOR@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
ASO = @ASO@
ASO_OBJS = @ASO_OBJS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
F77 = @F77@
EXEEXT = @EXEEXT@
FPM = @FPM@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
OBJDUMP = @OBJDUMP@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
RC = @RC@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS =
......@@ -167,11 +193,7 @@ minimad_OBJECTS = $(am_minimad_OBJECTS)
minimad_DEPENDENCIES = libmad.la
minimad_LDFLAGS =
DEFS = @DEFS@
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/../../depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bit.Plo ./$(DEPDIR)/decoder.Plo \
......@@ -190,21 +212,21 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
DIST_SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) \
$(minimad_SOURCES)
HEADERS = $(noinst_HEADERS)
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
uninstall-info-recursive all-recursive install-data-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README $(noinst_HEADERS) ../../config.guess \
../../config.sub ../../depcomp ../../install-sh ../../ltmain.sh \
../../missing ../../mkinstalldirs COPYING INSTALL Makefile.am \
Makefile.in TODO aclocal.m4 config.h.in configure configure.ac \
libmad.list.in
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \
$(srcdir)/configure ../../config.guess ../../config.sub \
../../depcomp ../../install-sh ../../ltmain.sh ../../missing \
../../mkinstalldirs COPYING INSTALL Makefile.am TODO aclocal.m4 \
config.h.in configure configure.ac libmad.list.in
DIST_SUBDIRS = $(SUBDIRS)
SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) $(minimad_SOURCES)
......@@ -253,7 +275,7 @@ clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test -z "$dir" && dir=.; \
test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
......@@ -282,36 +304,47 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.S.o:
$(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.S.obj:
$(CCASCOMPILE) -c `cygpath -w $<`
$(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.S.lo:
$(LTCCASCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.c.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(COMPILE) -c `cygpath -w $<`
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.c.lo:
@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
CCDEPMODE = @CCDEPMODE@
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
mostlyclean-libtool:
-rm -f *.lo
......@@ -377,10 +410,17 @@ tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
......@@ -396,9 +436,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
......@@ -411,13 +457,28 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
......@@ -429,13 +490,20 @@ am__remove_distdir = \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkinstalldirs) $(distdir)/. $(distdir)/../..
@list='$(DISTFILES)'; for file in $$list; do \
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
......@@ -488,12 +556,13 @@ distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
......@@ -501,32 +570,50 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
find $$dc_install_base -type f -print ; \
exit 1; } >&2 ) \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after distclean:" ; \
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
......@@ -546,7 +633,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
......@@ -559,9 +646,10 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
......@@ -583,7 +671,9 @@ installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
......@@ -591,26 +681,35 @@ mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-noinstLTLIBRARIES \
clean-recursive dist dist-all dist-gzip distcheck distclean \
distclean-compile distclean-depend distclean-generic \
clean-recursive ctags ctags-recursive dist dist-all dist-gzip \
distcheck distclean distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-recursive \
distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \
info info-am info-recursive install install-am install-data \
install-data-am install-data-recursive install-exec \
install-exec-am install-exec-recursive install-info \
install-info-am install-info-recursive install-man \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am dvi-recursive info info-am info-recursive install \
install-am install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
tags tags-recursive uninstall uninstall-am uninstall-info-am \
pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
tags-recursive uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -24,12 +24,12 @@
extern "C" {
# endif
# define FPM_INTEL
# define FPM_DEFAULT
# define SIZEOF_INT 4
# define SIZEOF_LONG 4
# define SIZEOF_LONG 8
# define SIZEOF_LONG_LONG 8
......
......@@ -88,7 +88,7 @@ int establish(unsigned short port) {
else {
struct hostent * he;
if(!(he = gethostbyname((getConf())[CONF_BIND_TO_ADDRESS]))) {
ERROR1("can't lookup host \"%s\"\n",
ERROR("can't lookup host \"%s\"\n",
(getConf())[CONF_BIND_TO_ADDRESS]);
exit(-1);
}
......@@ -96,7 +96,7 @@ int establish(unsigned short port) {
#ifdef HAVE_IPV6
case AF_INET6:
if(!ipv6Supported()) {
ERROR1("no IPv6 support, but a IPv6 address "
ERROR("no IPv6 support, but a IPv6 address "
"found for \"%s\"\n",
(getConf())[CONF_BIND_TO_ADDRESS]);
exit(-1);
......@@ -114,7 +114,7 @@ int establish(unsigned short port) {
addrlen = sizeof(struct sockaddr_in);
break;
default:
ERROR1("address type for \"%s\" is not IPv4 or IPv6\n",
ERROR("address type for \"%s\" is not IPv4 or IPv6\n",
(getConf())[CONF_BIND_TO_ADDRESS]);
exit(-1);
}
......@@ -133,12 +133,12 @@ int establish(unsigned short port) {
pf = PF_UNIX;
break;
default:
ERROR1("unknown address family: %i\n",addrp->sa_family);
ERROR("unknown address family: %i\n",addrp->sa_family);
return -1;
}
if((sock = socket(pf,SOCK_STREAM,0)) < 0) {
ERROR0("socket < 0\n");
ERROR("socket < 0\n");
return -1;
}
......@@ -146,12 +146,12 @@ int establish(unsigned short port) {
sizeof(allowReuse))<0)
{
close(sock);
ERROR0("problems setsockopt'ing\n");
ERROR("problems setsockopt'ing\n");
return -1;
}
if(bind(sock,addrp,addrlen)<0) {
ERROR1("unable to bind port %i, maybe MPD is still running?\n",
ERROR("unable to bind port %i, maybe MPD is still running?\n",
port);
close(sock);
return -1;
......@@ -159,7 +159,7 @@ int establish(unsigned short port) {
if(listen(sock,5)<0) {
close(sock);
ERROR0("problems listen'ing\n");
ERROR("problems listen'ing\n");
return -1;
}
......@@ -182,5 +182,5 @@ void getConnections(int sock) {
((fd = accept(sock,&sockAddr,&socklen)) >= 0)) {
openAInterface(fd,&sockAddr);
}
else if(fd<0) ERROR0("Problems accept()'ing\n");
else if(fd<0) ERROR("Problems accept()'ing\n");
}
......@@ -35,5 +35,5 @@ void initLog() {
else if(strcmp(getConf()[CONF_LOG_LEVEL],"verbose")==0) {
if(logLevel<LOG_LEVEL_DEBUG) logLevel = LOG_LEVEL_DEBUG;
}
else ERROR1("unknown log level \"%s\"\n",getConf()[CONF_LOG_LEVEL]);
else ERROR("unknown log level \"%s\"\n",getConf()[CONF_LOG_LEVEL]);
}
......@@ -27,21 +27,16 @@
extern int logLevel;
#define ERROR0(x) myfprintf(stderr,x);
#define ERROR1(x,a) myfprintf(stderr,x,a);
#define ERROR2(x,a,b) myfprintf(stderr,x,a,b);
#define ERROR3(x,a,b,c) myfprintf(stderr,x,a,b,c);
#define ERROR(x, arg...) myfprintf(stderr, x , ##arg)
#define LOG0(x) myfprintf(stdout,x);
#define LOG1(x,a) myfprintf(stdout,x,a);
#define LOG(x, arg...) myfprintf(stdout, x , ##arg)
#define SECURE0(x) if(logLevel>=LOG_LEVEL_SECURE) myfprintf(stdout,x);
#define SECURE1(x,a) if(logLevel>=LOG_LEVEL_SECURE) myfprintf(stdout,x,a);
#define SECURE2(x,a,b) if(logLevel>=LOG_LEVEL_SECURE) myfprintf(stdout,x,a,b);
#define SECURE(x, arg...) if(logLevel>=LOG_LEVEL_SECURE) \
myfprintf(stdout, x , ##arg)
#define DEBUG0(x) if(logLevel>=LOG_LEVEL_DEBUG) myfprintf(stdout,x);
#define DEBUG1(x,a) if(logLevel>=LOG_LEVEL_DEBUG) myfprintf(stdout,x,a);
#define DEBUG2(x,a,b) if(logLevel>=LOG_LEVEL_DEBUG) myfprintf(stdout,x,a,b);
#define DEBUG(x, arg...) if(logLevel>=LOG_LEVEL_DEBUG) \
myfprintf(stdout, x , ##arg)
void initLog();
......
......@@ -32,7 +32,7 @@
#include <stdlib.h>
char * dupAndStripPlaylistSuffix(char * file) {
int size = strlen(file)-strlen(PLAYLIST_FILE_SUFFIX)-1;
size_t size = strlen(file)-strlen(PLAYLIST_FILE_SUFFIX)-1;
char * ret = malloc(size+1);
strncpy(ret,file,size);
......@@ -41,45 +41,7 @@ char * dupAndStripPlaylistSuffix(char * file) {
return ret;
}
int ls(FILE * fp, char * dirname) {
DIR * dir;
char cwd[2];
char c;
struct stat st;
struct dirent * ent;
char s[MAXPATHLEN+1];
cwd[0] = '.';
cwd[1] = '\0';
if(dirname==NULL) dirname=cwd;
if((dir = opendir(rmp2amp(dirname)))==NULL) {
myfprintf(fp,"%s problems opening directory\n",COMMAND_RESPOND_ERROR);
return -1;
}
while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
sprintf(s,"%s/%s/%s",musicDir,dirname,ent->d_name);
if(stat(s,&st)==0) {
c = 0;
if(S_ISDIR(st.st_mode)) c = 'd';
else if(isMusic(s)) c = 'm';
if(c && dirname==cwd) {
myfprintf(fp,"%c \"%s\"\n",c,ent->d_name);
}
else if(c) {
myfprintf(fp,"%c \"%s/%s\"\n",c,dirname,ent->d_name);
}
}
}
closedir(dir);
return 0;
}
int lsPlaylists(FILE * fp, char * path) {
int lsPlaylists(FILE * fp, char * utf8path) {
DIR * dir;
struct stat st;
struct dirent * ent;
......@@ -87,15 +49,17 @@ int lsPlaylists(FILE * fp, char * path) {
char s[MAXPATHLEN+1];
List * list = NULL;
ListNode * node = NULL;
char * path = strdup(utf8ToFsCharset(utf8path));
char * actualPath = rpp2app(path);
int actlen = strlen(actualPath)+1;
int maxlen = MAXPATHLEN-actlen;
int suflen = strlen(PLAYLIST_FILE_SUFFIX)+1;
int suff;
if(actlen>MAXPATHLEN-1) return 0;
if((dir = opendir(actualPath))==NULL) return 0;
if(actlen>MAXPATHLEN-1 || (dir = opendir(actualPath))==NULL) {
free(path);
return 0;
}
s[MAXPATHLEN] = '\0';
strcpy(s,actualPath);
......@@ -114,7 +78,8 @@ int lsPlaylists(FILE * fp, char * path) {
if(list==NULL) list = makeList(NULL);
dup = strdup(ent->d_name);
dup[suff] = '\0';
insertInList(list,dup,NULL);
insertInList(list,
fsCharsetToUtf8(dup),NULL);
free(dup);
}
}
......@@ -122,12 +87,13 @@ int lsPlaylists(FILE * fp, char * path) {
}
closedir(dir);
free(path);
if(list) {
sortList(list);
dup = malloc(strlen(path)+2);
strcpy(dup,path);
dup = malloc(strlen(utf8path)+2);
strcpy(dup,utf8path);
while(dup[strlen(dup)-1]=='/') dup[strlen(dup)-1] = '\0';
if(strlen(dup)) strcat(dup,"/");
......@@ -144,27 +110,28 @@ int lsPlaylists(FILE * fp, char * path) {
return 0;
}
time_t isMusic(char * file) {
time_t isMusic(char * utf8file) {
time_t ret = 0;
#ifdef HAVE_OGG
if((ret = isOgg(file))) return ret;
if((ret = isOgg(utf8file))) return ret;
#endif
#ifdef HAVE_FLAC
if((ret = isFlac(file))) return ret;
if((ret = isFlac(utf8file))) return ret;
#endif
#ifdef HAVE_MAD
if((ret = isMp3(file))) return ret;
if((ret = isMp3(utf8file))) return ret;
#endif
#ifdef HAVE_AUDIOFILE
if((ret = isWave(file))) return ret;
if((ret = isWave(utf8file))) return ret;
#endif
return ret;
}
time_t isPlaylist(char * file) {
time_t isPlaylist(char * utf8file) {
struct stat st;
char * file = utf8ToFsCharset(utf8file);
char * actualFile = file;
char * temp = NULL;
......@@ -192,8 +159,9 @@ time_t isPlaylist(char * file) {
return 0;
}
time_t isWave(char * file) {
time_t isWave(char * utf8file) {
struct stat st;
char * file = utf8ToFsCharset(utf8file);
char * actualFile = file;
if(actualFile[0]!='/') actualFile = rmp2amp(file);
......@@ -219,8 +187,9 @@ time_t isWave(char * file) {
return 0;
}
time_t isFlac(char * file) {
time_t isFlac(char * utf8file) {
struct stat st;
char * file = utf8ToFsCharset(utf8file);
char * actualFile = file;
if(actualFile[0]!='/') actualFile = rmp2amp(file);
......@@ -246,8 +215,9 @@ time_t isFlac(char * file) {
return 0;
}
time_t isOgg(char * file) {
time_t isOgg(char * utf8file) {
struct stat st;
char * file = utf8ToFsCharset(utf8file);
char * actualFile = file;
if(actualFile[0]!='/') actualFile = rmp2amp(file);
......@@ -273,8 +243,9 @@ time_t isOgg(char * file) {
return 0;
}
time_t isMp3(char * file) {
time_t isMp3(char * utf8file) {
struct stat st;
char * file = utf8ToFsCharset(utf8file);
char * actualFile = file;
if(actualFile[0]!='/') actualFile = rmp2amp(file);
......@@ -300,12 +271,16 @@ time_t isMp3(char * file) {
return 0;
}
time_t isDir(char * name) {
time_t isDir(char * utf8name) {
struct stat st;
if(stat(rmp2amp(name),&st)==0) {
if(stat(rmp2amp(utf8ToFsCharset(utf8name)),&st)==0) {
if(S_ISDIR(st.st_mode)) return st.st_mtime;
}
else {
DEBUG("isDir: unable to stat: %s (%s)\n",utf8name,
rmp2amp(utf8ToFsCharset(utf8name)));
}
return 0;
}
......@@ -22,23 +22,21 @@
#include <stdio.h>
#include <time.h>
int ls(FILE * fp, char * dir);
int lsPlaylists(FILE * fp, char * utf8path);
int lsPlaylists(FILE * fp, char * path);
time_t isMp3(char * utf8file);
time_t isMp3(char * file);
time_t isOgg(char * utf8file);
time_t isOgg(char * file);
time_t isFlac(char * utf8file);
time_t isFlac(char * file);
time_t isWave(char * utf8file);
time_t isWave(char * file);
time_t isMusic(char * utf8file);
time_t isMusic(char * file);
time_t isDir(char * utf8name);
time_t isDir(char * name);
time_t isPlaylist(char * file);
time_t isPlaylist(char * utf8file);
char * dupAndStripPlaylistSuffix(char * file);
......
......@@ -31,9 +31,10 @@
#include "audio.h"
#include "volume.h"
#include "log.h"
#include "permission.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
......@@ -42,411 +43,419 @@
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
#include <unistd.h>
#define SYSTEM_CONFIG_FILE_LOCATION "/etc/mpd.conf"
#define USER_CONFIG_FILE_LOCATION "/.mpdconf"
typedef struct _Options {
char * portStr;
char * musicDirArg;
char * playlistDirArg;
char * logFile;
char * errorFile;
char * usr;
char * dbFile;
int daemon;
int createDB;
char * portStr;
char * musicDirArg;
char * playlistDirArg;
char * logFile;
char * errorFile;
char * usr;
char * dbFile;
int daemon;
int createDB;
} Options;
void usage(char * argv[]) {
ERROR0("usage:\n");
ERROR1(" %s [options] <port> <music dir> <playlist dir> <log file> <error file>\n",argv[0]);
ERROR1(" %s [options] <conf file>\n",argv[0]);
ERROR3(" %s [options] (searches for ~%s then %s)\n",
argv[0],USER_CONFIG_FILE_LOCATION,
SYSTEM_CONFIG_FILE_LOCATION);
ERROR0("\n");
ERROR0("options:\n");
ERROR0(" --help this usage statement\n");
ERROR0(" --no-daemon don't detach from console\n");
ERROR0(" --create-db force (re)creation database\n");
ERROR0(" --no-create-db don't create database\n");
ERROR0(" --verbose verbose logging\n");
ERROR0(" --version prints version information\n");
ERROR("usage:\n");
ERROR(" %s [options] <port> <music dir> <playlist dir> <log file> <error file>\n",argv[0]);
ERROR(" %s [options] <conf file>\n",argv[0]);
ERROR(" %s [options] (searches for ~%s then %s)\n",
argv[0],USER_CONFIG_FILE_LOCATION,
SYSTEM_CONFIG_FILE_LOCATION);
ERROR("\n");
ERROR("options:\n");
ERROR(" --help this usage statement\n");
ERROR(" --no-daemon don't detach from console\n");
ERROR(" --create-db force (re)creation database\n");
ERROR(" --no-create-db don't create database\n");
ERROR(" --verbose verbose logging\n");
ERROR(" --version prints version information\n");
}
void version() {
ERROR1("mpd (MPD: Music Player Daemon) %s\n",VERSION);
ERROR0("\n");
ERROR0("Copyright (C) 2003 Warren Dukes <shank@mercury.chem.pitt.edu>\n");
ERROR0("This is free software; see the source for copying conditions. There is NO\n");
ERROR0("warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
ERROR("mpd (MPD: Music Player Daemon) %s\n",VERSION);
ERROR("\n");
ERROR("Copyright (C) 2003 Warren Dukes <shank@mercury.chem.pitt.edu>\n");
ERROR("This is free software; see the source for copying conditions. There is NO\n");
ERROR("warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
}
void parseOptions(int argc, char ** argv, Options * options) {
int argcLeft = argc;
options->usr = NULL;
options->daemon = 1;
options->createDB = 0;
options->dbFile = NULL;
if(argc>1) {
int i = 1;
while(i<argc) {
if(strncmp(argv[i],"--",2)==0) {
if(strcmp(argv[i],"--help")==0) {
usage(argv);
exit(0);
}
else if(strcmp(argv[i],"--no-daemon")==0) {
options->daemon = 0;
argcLeft--;
}
else if(strcmp(argv[i],"--create-db")==0) {
options->createDB = 1;
argcLeft--;
}
else if(strcmp(argv[i],"--no-create-db")==0) {
options->createDB = -1;
argcLeft--;
}
else if(strcmp(argv[i],"--verbose")==0) {
logLevel = LOG_LEVEL_DEBUG;
argcLeft--;
}
else if(strcmp(argv[i],"--version")==0) {
version();
exit(0);
}
else {
myfprintf(stderr,"unknown command line option: %s\n",argv[i]);
exit(-1);
}
}
else break;
i++;
}
}
if(argcLeft==6) {
options->portStr = argv[argc-5];
options->musicDirArg = argv[argc-4];
options->playlistDirArg = argv[argc-3];
options->logFile = argv[argc-2];
options->errorFile = argv[argc-1];
return;
}
else if(argcLeft<=2) {
char ** conf = NULL;
if(argcLeft==2) conf = readConf(argv[argc-1]);
if(argcLeft==1) {
FILE * fp;
char * homedir = getenv("HOME");
char userfile[MAXPATHLEN+1] = "";
if(homedir && (strlen(homedir)+
strlen(USER_CONFIG_FILE_LOCATION)) <
MAXPATHLEN) {
strcpy(userfile,homedir);
strcat(userfile,USER_CONFIG_FILE_LOCATION);
}
if(strlen(userfile) && (fp=fopen(userfile,"r"))) {
fclose(fp);
conf = readConf(userfile);
}
else if((fp=fopen(SYSTEM_CONFIG_FILE_LOCATION,"r"))) {
fclose(fp);
conf = readConf(SYSTEM_CONFIG_FILE_LOCATION);
}
}
if(conf) {
options->portStr = conf[CONF_PORT];
options->musicDirArg = conf[CONF_MUSIC_DIRECTORY];
options->playlistDirArg = conf[CONF_PLAYLIST_DIRECTORY];
options->logFile = conf[CONF_LOG_FILE];
options->errorFile = conf[CONF_ERROR_FILE];
options->usr = conf[CONF_USER];
if(conf[CONF_DB_FILE]) {
options->dbFile = conf[CONF_DB_FILE];
}
return;
}
}
usage(argv);
exit(-1);
int argcLeft = argc;
options->usr = NULL;
options->daemon = 1;
options->createDB = 0;
options->dbFile = NULL;
if(argc>1) {
int i = 1;
while(i<argc) {
if(strncmp(argv[i],"--",2)==0) {
if(strcmp(argv[i],"--help")==0) {
usage(argv);
exit(0);
}
else if(strcmp(argv[i],"--no-daemon")==0) {
options->daemon = 0;
argcLeft--;
}
else if(strcmp(argv[i],"--create-db")==0) {
options->createDB = 1;
argcLeft--;
}
else if(strcmp(argv[i],"--no-create-db")==0) {
options->createDB = -1;
argcLeft--;
}
else if(strcmp(argv[i],"--verbose")==0) {
logLevel = LOG_LEVEL_DEBUG;
argcLeft--;
}
else if(strcmp(argv[i],"--version")==0) {
version();
exit(0);
}
else {
myfprintf(stderr,"unknown command line option: %s\n",argv[i]);
exit(-1);
}
}
else break;
i++;
}
}
if(argcLeft==6) {
options->portStr = argv[argc-5];
options->musicDirArg = argv[argc-4];
options->playlistDirArg = argv[argc-3];
options->logFile = argv[argc-2];
options->errorFile = argv[argc-1];
return;
}
else if(argcLeft<=2) {
char ** conf = NULL;
if(argcLeft==2) conf = readConf(argv[argc-1]);
if(argcLeft==1) {
FILE * fp;
char * homedir = getenv("HOME");
char userfile[MAXPATHLEN+1] = "";
if(homedir && (strlen(homedir)+
strlen(USER_CONFIG_FILE_LOCATION)) <
MAXPATHLEN) {
strcpy(userfile,homedir);
strcat(userfile,USER_CONFIG_FILE_LOCATION);
}
if(strlen(userfile) && (fp=fopen(userfile,"r"))) {
fclose(fp);
conf = readConf(userfile);
}
else if((fp=fopen(SYSTEM_CONFIG_FILE_LOCATION,"r"))) {
fclose(fp);
conf = readConf(SYSTEM_CONFIG_FILE_LOCATION);
}
}
if(conf) {
options->portStr = conf[CONF_PORT];
options->musicDirArg = conf[CONF_MUSIC_DIRECTORY];
options->playlistDirArg = conf[CONF_PLAYLIST_DIRECTORY];
options->logFile = conf[CONF_LOG_FILE];
options->errorFile = conf[CONF_ERROR_FILE];
options->usr = conf[CONF_USER];
if(conf[CONF_DB_FILE]) {
options->dbFile = conf[CONF_DB_FILE];
}
return;
}
}
usage(argv);
exit(-1);
}
int main(int argc, char * argv[]) {
int port, uid, gid;
struct stat st;
FILE * out;
FILE * err;
Options options;
int i;
for(i=0;i<FD_SETSIZE;i++) {
switch(i) {
case STDIN_FILENO:
case STDOUT_FILENO:
case STDERR_FILENO:
break;
default:
close(i);
}
}
initConf();
parseOptions(argc,argv,&options);
initLog();
if((port = atoi(options.portStr))<0) {
ERROR0("problem with port number\n");
return -1;
}
if((listenSocket = establish(port))<0) {
ERROR0("error binding port\n");
return -1;
}
/*
int port, uid, gid;
struct stat st;
FILE * out;
FILE * err;
Options options;
int i;
for(i=0;i<FD_SETSIZE;i++) {
switch(i) {
case STDIN_FILENO:
case STDOUT_FILENO:
case STDERR_FILENO:
break;
default:
close(i);
}
}
initConf();
parseOptions(argc,argv,&options);
initStats();
initLog();
if((port = atoi(options.portStr))<0) {
ERROR("problem with port number\n");
return -1;
}
if((listenSocket = establish(port))<0) {
ERROR("error binding port\n");
return -1;
}
/*
* lose privileges as early as possible
*/
*/
/* change uid */
if (options.usr && strlen(options.usr)) {
/* change uid */
if (options.usr && strlen(options.usr)) {
#ifdef _BSD_SOURCE
gid_t gid_list[NGROUPS_MAX];
gid_t gid_list[NGROUPS_MAX];
#endif
/* get uid */
struct passwd * userpwd;
if ((userpwd = getpwnam(options.usr)) == NULL) {
ERROR1("no such user: %s\n", options.usr);
return -1;
}
uid = userpwd->pw_uid;
gid = userpwd->pw_gid;
if(setgid(gid) == -1) {
ERROR2("cannot setgid of user %s: %s\n", options.usr,
strerror(errno));
return -1;
}
/* get uid */
struct passwd * userpwd;
if ((userpwd = getpwnam(options.usr)) == NULL) {
ERROR("no such user: %s\n", options.usr);
return -1;
}
uid = userpwd->pw_uid;
gid = userpwd->pw_gid;
if(setgid(gid) == -1) {
ERROR("cannot setgid of user %s: %s\n", options.usr,
strerror(errno));
return -1;
}
#ifdef _BSD_SOURCE
/* init suplementary groups
* (must be done before we change our uid)
*/
if (initgroups(options.usr, gid) == -1) {
ERROR2("cannot init suplementary groups "
"of user %s: %s\n", options.usr,
strerror(errno));
}
else if(getgroups(NGROUPS_MAX, gid_list) == -1) {
ERROR2("cannot get groups "
"of user %s: %s\n", options.usr,
strerror(errno));
return -1;
}
else if(setgroups(NGROUPS_MAX, gid_list) == -1) {
ERROR2("cannot set groups "
"of user %s: %s\n", options.usr,
strerror(errno));
return -1;
}
/* init suplementary groups
* (must be done before we change our uid)
*/
if (initgroups(options.usr, gid) == -1) {
ERROR("cannot init suplementary groups "
"of user %s: %s\n", options.usr,
strerror(errno));
}
else if(getgroups(NGROUPS_MAX, gid_list) == -1) {
ERROR("cannot get groups "
"of user %s: %s\n", options.usr,
strerror(errno));
return -1;
}
else if(setgroups(NGROUPS_MAX, gid_list) == -1) {
ERROR("cannot set groups "
"of user %s: %s\n", options.usr,
strerror(errno));
return -1;
}
#endif
/* set uid */
if (setuid(uid) == -1) {
ERROR2("cannot change to uid of user "
"%s: %s\n", options.usr,
strerror(errno));
return -1;
}
}
if(NULL==(out=fopen(options.logFile,"a"))) {
ERROR1("problem opening file \"%s\" for writing\n",
options.logFile);
return -1;
}
if(NULL==(err=fopen(options.errorFile,"a"))) {
ERROR1("problem opening file \"%s\" for writing\n",
options.errorFile);
return -1;
}
if(options.playlistDirArg[0]=='/') {
strcpy(playlistDir,options.playlistDirArg);
}
else {
getcwd(playlistDir,MAXPATHLEN-strlen(options.playlistDirArg)-1);
if(playlistDir[strlen(playlistDir)-1]!='/') {
strcat(playlistDir,"/");
}
strcat(playlistDir,options.playlistDirArg);
}
if(playlistDir[strlen(playlistDir)-1]!='/') {
strcat(playlistDir,"/");
}
if((stat(playlistDir,&st))<0) {
ERROR1("problem stat'ing \"%s\"\n",options.playlistDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
ERROR1("\"%s\" is not a directory\n",options.playlistDirArg);
return -1;
}
if(options.musicDirArg[0]=='/') {
strcpy(musicDir,options.musicDirArg);
}
else {
getcwd(musicDir,MAXPATHLEN-strlen(options.musicDirArg)-1);
if(musicDir[strlen(musicDir)-1]!='/') strcat(musicDir,"/");
strcat(musicDir,options.musicDirArg);
}
if(musicDir[strlen(musicDir)-1]!='/') strcat(musicDir,"/");
if((stat(musicDir,&st))<0) {
ERROR1("problem stat'ing \"%s\"\n",options.musicDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
ERROR1("\"%s\" is not a directory\n",options.musicDirArg);
return -1;
}
initTables();
if(!options.dbFile) {
strncpy(directorydb,playlistDir,MAXPATHLEN);
strncat(directorydb,"/.mpddb",MAXPATHLEN-strlen(playlistDir));
}
else strncpy(directorydb,options.dbFile,MAXPATHLEN);
if(options.createDB || readDirectoryDB()<0) {
if(options.createDB<0) {
ERROR0("can't open db file and using \"--no-create-db\""
" command line option\n");
exit(-1);
}
initMp3Directory();
if(writeDirectoryDB()<0) {
ERROR0("problem opening db for reading or writing\n");
exit(-1);
}
}
initAudioDriver();
initVolume();
initPlayerData();
initInterfaces();
initStats();
initPlaylist();
close(STDIN_FILENO);
if(options.daemon) {
int pid;
fflush(NULL);
pid = fork();
if(pid>0) _exit(0);
else if(pid<0) {
ERROR0("problems fork'ing for daemon!\n");
exit(-1);
}
if(chdir("/")<0) {
ERROR0("problems changing to root directory\n");
exit(-1);
}
if(setsid()<0) {
ERROR0("problems setsid'ing\n");
exit(-1);
}
if(close(STDOUT_FILENO)) {
fprintf(err,"problems closing stdout : %s\n",
strerror(errno));
exit(-1);
}
if(close(STDERR_FILENO)) {
fprintf(err,"problems closing stderr : %s\n",
strerror(errno));
exit(-1);
}
if(dup2(fileno(out),STDOUT_FILENO)<0) {
fprintf(err,"problems dup2 stdout : %s\n",
strerror(errno));
exit(-1);
}
if(dup2(fileno(err),STDERR_FILENO)<0) {
fprintf(err,"problems dup2 stderr : %s\n",
strerror(errno));
exit(-1);
}
myfprintfStdLogMode(out,err);
fflush(NULL);
pid = fork();
if(pid>0) _exit(0);
else if(pid<0) {
ERROR0("problems fork'ing for daemon!\n");
exit(-1);
}
}
else {
fclose(out);
fclose(err);
}
/* lets redirect stdin to dev null as a work around for libao bug */
{
int fd = open("/dev/null",O_RDONLY);
if(fd<0) {
ERROR1("not able to open /dev/null to redirect stdin: "
"%s\n",strerror(errno));
exit(-1);
}
if(dup2(fd,STDIN_FILENO)<0) {
ERROR1("problems dup2's stdin for redirection: "
"%s\n",strerror(errno));
exit(-1);
}
}
openVolumeDevice();
initSigHandlers();
readPlaylistState();
while(COMMAND_RETURN_KILL!=doIOForInterfaces()) {
syncPlayerAndPlaylist();
closeOldInterfaces();
}
finishSigHandlers();
savePlaylistState();
playerKill();
freeAllInterfaces();
close(listenSocket);
closeMp3Directory();
closeTables();
finishPlaylist();
freePlayerData();
finishAudioDriver();
finishVolume();
return 0;
/* set uid */
if (setuid(uid) == -1) {
ERROR("cannot change to uid of user "
"%s: %s\n", options.usr,
strerror(errno));
return -1;
}
}
if(NULL==(out=fopen(options.logFile,"a"))) {
ERROR("problem opening file \"%s\" for writing\n",
options.logFile);
return -1;
}
if(NULL==(err=fopen(options.errorFile,"a"))) {
ERROR("problem opening file \"%s\" for writing\n",
options.errorFile);
return -1;
}
initPaths();
initPermissions();
if(options.playlistDirArg[0]=='/') {
strcpy(playlistDir,options.playlistDirArg);
}
else {
getcwd(playlistDir,MAXPATHLEN-strlen(options.playlistDirArg)-1);
if(playlistDir[strlen(playlistDir)-1]!='/') {
strcat(playlistDir,"/");
}
strcat(playlistDir,options.playlistDirArg);
}
if(playlistDir[strlen(playlistDir)-1]!='/') {
strcat(playlistDir,"/");
}
if((stat(playlistDir,&st))<0) {
ERROR("problem stat'ing \"%s\"\n",options.playlistDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
ERROR("\"%s\" is not a directory\n",options.playlistDirArg);
return -1;
}
if(options.musicDirArg[0]=='/') {
strcpy(musicDir,options.musicDirArg);
}
else {
getcwd(musicDir,MAXPATHLEN-strlen(options.musicDirArg)-1);
if(musicDir[strlen(musicDir)-1]!='/') strcat(musicDir,"/");
strcat(musicDir,options.musicDirArg);
}
if(musicDir[strlen(musicDir)-1]!='/') strcat(musicDir,"/");
if((stat(musicDir,&st))<0) {
ERROR("problem stat'ing \"%s\"\n",options.musicDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
ERROR("\"%s\" is not a directory\n",options.musicDirArg);
return -1;
}
initTables();
if(!options.dbFile) {
strncpy(directorydb,playlistDir,MAXPATHLEN);
strncat(directorydb,"/.mpddb",MAXPATHLEN-strlen(playlistDir));
}
else strncpy(directorydb,options.dbFile,MAXPATHLEN);
if(options.createDB>0 || readDirectoryDB()<0) {
if(options.createDB<0) {
ERROR("can't open db file and using \"--no-create-db\""
" command line option\n");
exit(-1);
}
initMp3Directory();
if(writeDirectoryDB()<0) {
ERROR("problem opening db for reading or writing\n");
exit(-1);
}
}
initCommands();
initAudioDriver();
initPlayerData();
initVolume();
initInterfaces();
initPlaylist();
close(STDIN_FILENO);
if(options.daemon) {
int pid;
fflush(NULL);
pid = fork();
if(pid>0) _exit(0);
else if(pid<0) {
ERROR("problems fork'ing for daemon!\n");
exit(-1);
}
if(chdir("/")<0) {
ERROR("problems changing to root directory\n");
exit(-1);
}
if(setsid()<0) {
ERROR("problems setsid'ing\n");
exit(-1);
}
if(close(STDOUT_FILENO)) {
fprintf(err,"problems closing stdout : %s\n",
strerror(errno));
exit(-1);
}
if(close(STDERR_FILENO)) {
fprintf(err,"problems closing stderr : %s\n",
strerror(errno));
exit(-1);
}
if(dup2(fileno(out),STDOUT_FILENO)<0) {
fprintf(err,"problems dup2 stdout : %s\n",
strerror(errno));
exit(-1);
}
if(dup2(fileno(err),STDERR_FILENO)<0) {
fprintf(err,"problems dup2 stderr : %s\n",
strerror(errno));
exit(-1);
}
myfprintfStdLogMode(out,err);
fflush(NULL);
pid = fork();
if(pid>0) _exit(0);
else if(pid<0) {
ERROR("problems fork'ing for daemon!\n");
exit(-1);
}
}
else {
fclose(out);
fclose(err);
}
/* lets redirect stdin to dev null as a work around for libao bug */
{
int fd = open("/dev/null",O_RDONLY);
if(fd<0) {
ERROR("not able to open /dev/null to redirect stdin: "
"%s\n",strerror(errno));
exit(-1);
}
if(dup2(fd,STDIN_FILENO)<0) {
ERROR("problems dup2's stdin for redirection: "
"%s\n",strerror(errno));
exit(-1);
}
}
openVolumeDevice();
initSigHandlers();
readPlaylistState();
while(COMMAND_RETURN_KILL!=doIOForInterfaces()) {
syncPlayerAndPlaylist();
closeOldInterfaces();
}
finishSigHandlers();
savePlaylistState();
playerKill();
freeAllInterfaces();
close(listenSocket);
closeMp3Directory();
closeTables();
finishPlaylist();
freePlayerData();
finishAudioDriver();
finishVolume();
finishPaths();
finishPermissions();
finishCommands();
return 0;
}
......@@ -19,6 +19,7 @@
#ifdef HAVE_MAD
#include "mp3_decode.h"
#include "pcm_utils.h"
#ifdef USE_MPD_MAD
#include "libmad/mad.h"
#else
......@@ -184,7 +185,7 @@ int decodeNextFrameHeader(mp3DecodeData * data) {
if((data->stream).error==MAD_ERROR_BUFLEN) return DECODE_CONT;
else
{
ERROR1("unrecoverable frame level error "
ERROR("unrecoverable frame level error "
"(%s).\n",
mad_stream_errorstr(&data->stream));
data->flush = 0;
......@@ -208,7 +209,7 @@ int decodeNextFrame(mp3DecodeData * data) {
if((data->stream).error==MAD_ERROR_BUFLEN) return DECODE_CONT;
else
{
ERROR1("unrecoverable frame level error "
ERROR("unrecoverable frame level error "
"(%s).\n",
mad_stream_errorstr(&data->stream));
data->flush = 0;
......@@ -344,7 +345,7 @@ int getMp3TotalTime(char * file) {
int openMp3(char * file, mp3DecodeData * data) {
if((data->fp = fopen(file,"r"))<=0) {
ERROR1("problems opening \"%s\"\n",file);
ERROR("problems opening \"%s\"\n",file);
return -1;
}
initMp3DecodeData(data);
......@@ -364,13 +365,16 @@ int mp3ChildSendData(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
if(dc->seek) return 0;
/* be sure to remove this! */
memcpy(cb->chunks[cb->end],data->outputBuffer,CHUNK_SIZE);
#ifdef WORDS_BIGENDIAN
pcm_changeBufferEndianness(data->outputBuffer,CHUNK_SIZE,16);
#endif
memcpy(cb->chunks+cb->end*CHUNK_SIZE,data->outputBuffer,CHUNK_SIZE);
cb->chunkSize[cb->end] = data->outputPtr-data->outputBuffer;
cb->bitRate[cb->end] = data->bitRate/1000;
cb->times[cb->end] = data->elapsedTime;
cb->end++;
if(cb->end>=BUFFERED_CHUNKS) {
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
......@@ -475,9 +479,9 @@ void initAudioFormatFromMp3DecodeData(mp3DecodeData * data, AudioFormat * af) {
int mp3_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
mp3DecodeData data;
if(openMp3(dc->file,&data) < 0) {
ERROR0("Input does not appear to be a mp3 bit stream.\n");
ERROR("Input does not appear to be a mp3 bit stream.\n");
return -1;
}
......
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MPD_TYPES_H
#define MPD_TYPES_H
typedef unsigned char mpd_uint8;
typedef signed char mpd_sint8;
#if SIZEOF_SHORT == 2
typedef unsigned short mpd_uint16;
typedef signed short mpd_sint16;
#elif SIZEOF_INT == 2
typedef unsigned int mpd_uint16;
typedef signed int mpd_sint16;
#endif
#if SIZEOF_INT == 4
typedef unsigned int mpd_uint32;
typedef signed int mpd_sint32;
#elif SIZEOF_LONG == 4
typedef unsigned long mpd_uint32;
typedef signed long mpd_sint32;
#endif
#endif
......@@ -18,10 +18,12 @@
#ifdef HAVE_OGG
#include "ogg_decode.h"
#include "command.h"
#include "utils.h"
#include "audio.h"
#include "log.h"
#include "pcm_utils.h"
#include <stdio.h>
#include <unistd.h>
......@@ -35,12 +37,12 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
FILE * oggfp;
if(!(oggfp = fopen(dc->file,"r"))) {
ERROR0("failed to open ogg\n");
ERROR("failed to open ogg\n");
return -1;
}
if(ov_open(oggfp, &vf, NULL, 0) < 0) {
ERROR0("Input does not appear to be an Ogg bit stream.\n");
ERROR("Input does not appear to be an Ogg bit stream.\n");
fclose(oggfp);
return -1;
}
......@@ -82,7 +84,12 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
}
if(dc->stop) break;
else if(dc->seek) continue;
memcpy(cb->chunks[cb->end],chunk,CHUNK_SIZE);
#ifdef WORDS_BIGENDIAN
pcm_changeBufferEndianness(chunk,CHUNK_SIZE,
af->bits);
#endif
memcpy(cb->chunks+cb->end*CHUNK_SIZE,
chunk,CHUNK_SIZE);
cb->chunkSize[cb->end] = ret;
cb->times[cb->end] = ov_time_tell(&vf);
if((test = ov_bitrate_instant(&vf))>0) {
......@@ -90,7 +97,7 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
}
cb->bitRate[cb->end] = bitRate;
cb->end++;
if(cb->end>=BUFFERED_CHUNKS) {
if(cb->end>=buffered_chunks) {
cb->end = 0;
cb->wrap = 1;
}
......
......@@ -17,18 +17,124 @@
*/
#include "path.h"
#include "log.h"
#include "charConv.h"
#include "conf.h"
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO
#include <locale.h>
#include <langinfo.h>
#endif
#endif
char musicDir[MAXPATHLEN+1];
char playlistDir[MAXPATHLEN+1];
char * fsCharset = NULL;
char * pathConvCharset(char * to, char * from, char * str, char * ret) {
if(ret) {
free(ret);
ret = NULL;
}
if(setCharSetConversion(to,from)==0) {
ret = convStrDup(str);
}
if(!ret) ret = strdup(str);
return ret;
}
char * fsCharsetToUtf8(char * str) {
static char * ret = NULL;
return ret = pathConvCharset("UTF-8",fsCharset,str,ret);
}
char * utf8ToFsCharset(char * str) {
static char * ret = NULL;
return ret = pathConvCharset(fsCharset,"UTF-8",str,ret);
}
void setFsCharset(char * charset) {
if(fsCharset) free(fsCharset);
fsCharset = strdup(charset);
DEBUG("setFsCharset: fs charset is: %s\n",fsCharset);
if(setCharSetConversion("UTF-8",fsCharset)!=0) {
ERROR("fs charset conversion problem: "
"not able to convert from \"%s\" to \"%s\"\n",
fsCharset,"UTF-8");
}
if(setCharSetConversion(fsCharset,"UTF-8")!=0) {
ERROR("fs charset conversion problem: "
"not able to convert from \"%s\" to \"%s\"\n",
"UTF-8",fsCharset);
}
}
char * getFsCharset() {
return fsCharset;
}
void initPaths() {
#ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO
char * originalLocale;
#endif
#endif
char * charset = NULL;
if(getConf()[CONF_FS_CHARSET]) {
charset = strdup(getConf()[CONF_FS_CHARSET]);
}
#ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO
else if((originalLocale = setlocale(LC_ALL,""))) {
char * temp;
if((temp = nl_langinfo(CODESET))) {
charset = strdup(temp);
}
else ERROR("problems getting charset for locale\n");
if(!setlocale(LC_ALL,originalLocale)) {
ERROR("problems resetting locale with setlocale()\n");
}
}
#endif
#endif
else ERROR("problems getting locale with setlocale()\n");
if(charset) {
setFsCharset(charset);
free(charset);
}
else {
ERROR("setting filesystem charset to UTF-8\n");
setFsCharset("UTF-8");
}
}
void finishPaths() {
free(fsCharset);
fsCharset = NULL;
}
char * rmp2amp(char * relativePath) {
static char absolutePath[MAXPATHLEN+1];
memset(absolutePath,0,MAXPATHLEN+1);
strcpy(absolutePath,musicDir);
strncpy(absolutePath,musicDir,MAXPATHLEN);
strncat(absolutePath,relativePath,MAXPATHLEN-strlen(musicDir));
return absolutePath;
......@@ -39,7 +145,7 @@ char * rpp2app(char * relativePath) {
memset(absolutePath,0,MAXPATHLEN+1);
strcpy(absolutePath,playlistDir);
strncpy(absolutePath,playlistDir,MAXPATHLEN);
strncat(absolutePath,relativePath,MAXPATHLEN-strlen(musicDir));
return absolutePath;
......
......@@ -24,6 +24,18 @@
extern char musicDir[MAXPATHLEN+1];
extern char playlistDir[MAXPATHLEN+1];
void initPaths();
void finishPaths();
char * utf8ToFsCharset(char * str);
char * fsCharsetToUtf8(char * str);
void setFsCharset(char * charset);
char * getFsCharset();
/* relative music path to absolute music path
* char * passed is a static variable, so don't free it
*/
......
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pcm_utils.h"
#include "mpd_types.h"
#include "log.h"
#include <string.h>
#include <math.h>
void pcm_changeBufferEndianness(char * buffer, int bufferSize, int bits) {
char temp;
switch(bits) {
case 16:
while(bufferSize) {
temp = *buffer;
*buffer = *(buffer+1);
*(buffer+1) = temp;
bufferSize-=2;
}
break;
}
}
void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
int volume)
{
mpd_sint32 temp32;
mpd_sint8 * buffer8 = (mpd_sint8 *)buffer;
mpd_sint16 * buffer16 = (mpd_sint16 *)buffer;
if(volume>=100) return;
if(volume<=0) {
memset(buffer,0,bufferSize);
return;
}
switch(format->bits) {
case 16:
while(bufferSize>0) {
temp32 = *buffer16;
temp32*= volume;
temp32/=100;
*buffer16 = temp32>32767 ? 32767 :
(temp32<-32768 ? -32768 : temp32);
buffer16++;
bufferSize-=2;
}
break;
case 8:
while(bufferSize>0) {
temp32 = *buffer8;
temp32*= volume;
temp32/=100;
*buffer8 = temp32>127 ? 127 :
(temp32<-128 ? -128 : temp32);
buffer8++;
bufferSize--;
}
break;
default:
ERROR("%i bits not supported by pcm_volumeChange!\n",
format->bits);
exit(-1);
}
}
void pcm_add(char * buffer1, char * buffer2, size_t bufferSize1,
size_t bufferSize2, AudioFormat * format)
{
mpd_sint32 temp32;
mpd_sint8 * buffer8_1 = (mpd_sint8 *)buffer1;
mpd_sint8 * buffer8_2 = (mpd_sint8 *)buffer2;
mpd_sint16 * buffer16_1 = (mpd_sint16 *)buffer1;
mpd_sint16 * buffer16_2 = (mpd_sint16 *)buffer2;
switch(format->bits) {
case 16:
while(bufferSize1>0 && bufferSize2>0) {
temp32 = *buffer16_1;
temp32+= *buffer16_2;
*buffer16_1 = temp32>32767 ? 32767 :
(temp32<-32768 ? -32768 : temp32);
buffer16_1++;
buffer16_2++;
bufferSize1-=2;
bufferSize2-=2;
}
if(bufferSize2>0) memcpy(buffer8_1,buffer8_2,bufferSize2);
break;
case 8:
while(bufferSize1>0 && bufferSize2>0) {
temp32 = *buffer8_1;
temp32+= *buffer8_2;
*buffer8_1 = temp32>127 ? 127 :
(temp32<-128 ? -128 : temp32);
buffer8_1++;
buffer8_2++;
bufferSize1--;
bufferSize2--;
}
if(bufferSize2>0) memcpy(buffer8_1,buffer8_2,bufferSize2);
break;
default:
ERROR("%i bits not supported by pcm_add!\n",format->bits);
exit(-1);
}
}
void pcm_mix(char * buffer1, char * buffer2, size_t bufferSize1,
size_t bufferSize2, AudioFormat * format, float portion1)
{
float s = sin(M_PI_2*portion1);
s*=s;
pcm_volumeChange(buffer1,bufferSize1,format,(int)(s*100));
pcm_volumeChange(buffer2,bufferSize2,format,(int)((1-s)*100));
pcm_add(buffer1,buffer2,bufferSize1,bufferSize2,format);
}
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PCM_UTILS_H
#define PMC_UTILS_H
#include "audio.h"
#include <stdlib.h>
void pcm_changeBufferEndianness(char * buffer, int bufferSize, int bits);
void pcm_volumeChange(char * buffer, int bufferSize, AudioFormat * format,
int volume);
void pcm_mix(char * buffer1, char * buffer2, size_t bufferSize1,
size_t bufferSize2, AudioFormat * format, float portion1);
#endif
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "permission.h"
#include "conf.h"
#include "list.h"
#include "log.h"
#include <string.h>
#define PERMISSION_PASSWORD_CHAR "@"
#define PERMISSION_SEPERATOR ","
#define PERMISSION_READ_STRING "read"
#define PERMISSION_ADD_STRING "add"
#define PERMISSION_CONTROL_STRING "control"
#define PERMISSION_ADMIN_STRING "admin"
List * permission_passwords;
unsigned int permission_default;
unsigned int parsePermissions(char * string) {
unsigned int permission = 0;
char * temp;
char * tok;
if(!string) return 0;
temp = strtok_r(string,PERMISSION_SEPERATOR,&tok);
while(temp) {
if(strcmp(temp,PERMISSION_READ_STRING)==0) {
permission |= PERMISSION_READ;
}
else if(strcmp(temp,PERMISSION_ADD_STRING)==0) {
permission |= PERMISSION_ADD;
}
else if(strcmp(temp,PERMISSION_CONTROL_STRING)==0) {
permission |= PERMISSION_CONTROL;
}
else if(strcmp(temp,PERMISSION_ADMIN_STRING)==0) {
permission |= PERMISSION_ADMIN;
}
else {
ERROR("uknown permission \"%s\"\n",temp);
exit(-1);
}
temp = strtok_r(NULL,PERMISSION_SEPERATOR,&tok);
}
return permission;
}
void initPermissions() {
permission_passwords = makeList(free);
char * passwordSets;
char * nextSet;
char * temp;
char * cp1;
char * cp2;
char * password;
unsigned int * permission;
permission_default = PERMISSION_READ | PERMISSION_ADD |
PERMISSION_CONTROL | PERMISSION_ADMIN;
if(getConf()[CONF_DEFAULT_PERMISSIONS]) {
permission_default = parsePermissions(
getConf()[CONF_DEFAULT_PERMISSIONS]);
}
if(!getConf()[CONF_PASSWORD]) return;
if(!getConf()[CONF_DEFAULT_PERMISSIONS]) permission_default = 0;
passwordSets = strdup(getConf()[CONF_PASSWORD]);
nextSet = strtok_r(passwordSets,CONF_CAT_CHAR,&cp1);
while(nextSet && strlen(nextSet)) {
if(!strstr(nextSet,PERMISSION_PASSWORD_CHAR)) {
ERROR("\"%s\" not found in password string \"%s\"\n",
PERMISSION_PASSWORD_CHAR,
nextSet);
exit(-1);
}
if(!(temp = strtok_r(nextSet,PERMISSION_PASSWORD_CHAR,&cp2))) {
ERROR("something weird just happend in permission.c\n");
exit(-1);
}
password = temp;
permission = malloc(sizeof(unsigned int));
*permission = parsePermissions(strtok_r(NULL,"",&cp2));
insertInList(permission_passwords,password,permission);
nextSet = strtok_r(NULL,CONF_CAT_CHAR,&cp1);
}
sortList(permission_passwords);
free(passwordSets);
}
int getPermissionFromPassword(char * password, unsigned int * permission) {
void * foundPermission;
if(findInList(permission_passwords,password,&foundPermission)) {
*permission = *((unsigned int *)foundPermission);
return 0;
}
return -1;
}
void finishPermissions() {
freeList(permission_passwords);
}
unsigned int getDefaultPermissions() {
return permission_default;
}
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PERMISSION_H
#define PERMISSION_H
#define PERMISSION_READ 1
#define PERMISSION_ADD 2
#define PERMISSION_CONTROL 4
#define PERMISSION_ADMIN 8
void initPermissions();
int getPermissionFromPassword(char * password, unsigned int * permission);
void finishPermissions();
unsigned int getDefaultPermissions();
#endif
......@@ -30,7 +30,7 @@
#include "directory.h"
#include "volume.h"
#include "playerData.h"
#include "char_conv.h"
#include "permission.h"
#include <stdio.h>
#include <sys/types.h>
......@@ -44,13 +44,12 @@
#include <errno.h>
#include <fcntl.h>
#define MAX_BUFFER_LENGTH 1024
#define INPUT_BUFFER_SIZE 2*MAXPATHLEN
int player_pid = 0;
int player_termSent = 0;
void resetPlayer() {
int pid;
player_pid = 0;
player_termSent = 0;
getPlayerData()->playerControl.stop = 0;
......@@ -59,21 +58,37 @@ void resetPlayer() {
getPlayerData()->playerControl.lockQueue = 0;
getPlayerData()->playerControl.unlockQueue = 0;
getPlayerData()->playerControl.state = PLAYER_STATE_STOP;
getPlayerData()->playerControl.state = PLAYER_QUEUE_UNLOCKED;
getPlayerData()->playerControl.queueState = PLAYER_QUEUE_UNLOCKED;
getPlayerData()->playerControl.seek = 0;
/* kill decode process if it got left running */
pid = getPlayerData()->playerControl.decode_pid;
if(pid>0) kill(pid,SIGTERM);
getPlayerData()->playerControl.decode_pid = 0;
}
void player_sigHandler(int signal) {
if(signal==SIGCHLD) {
int status;
if(player_pid==wait3(&status,WNOHANG,NULL)) {
int pid = wait3(&status,WNOHANG,NULL);
if(player_pid==pid) {
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR1("player process died from a "
ERROR("player process died from a "
"non-TERM signal: %i\n",
WTERMSIG(status));
}
resetPlayer();
}
else if(pid==getPlayerData()->playerControl.decode_pid &&
player_pid<=0)
{
if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
ERROR("(caught by master parent) "
"decode process died from a "
"non-TERM signal: %i\n",
WTERMSIG(status));
}
getPlayerData()->playerControl.decode_pid = 0;
}
}
}
......@@ -97,8 +112,10 @@ int playerInit() {
freeAllInterfaces();
closeMp3Directory();
closeTables();
finishPaths();
finishPermissions();
finishCommands();
finishVolume();
closeCharSetConversion();
while(1) {
if(pc->play) decode();
......@@ -123,7 +140,7 @@ int playerInit() {
exit(0);
}
else if(player_pid<0) {
ERROR0("player Problems fork()'ing\n");
ERROR("player Problems fork()'ing\n");
player_pid = 0;
return -1;
......@@ -132,7 +149,7 @@ int playerInit() {
return 0;
}
int playerPlay(FILE * fp, char * file) {
int playerPlay(FILE * fp, char * utf8file) {
PlayerControl * pc = &(getPlayerData()->playerControl);
if(fp==NULL) fp = stderr;
......@@ -140,8 +157,8 @@ int playerPlay(FILE * fp, char * file) {
{
struct stat st;
if(stat(rmp2amp(file),&st)<0) {
strcpy(pc->erroredFile,pc->file);
if(stat(rmp2amp(utf8ToFsCharset(utf8file)),&st)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->error = PLAYER_ERROR_FILENOTFOUND;
return 0;
}
......@@ -149,24 +166,24 @@ int playerPlay(FILE * fp, char * file) {
if(0);
#ifdef HAVE_MAD
else if(isMp3(file)) pc->decodeType = DECODE_TYPE_MP3;
else if(isMp3(utf8file)) pc->decodeType = DECODE_TYPE_MP3;
#endif
#ifdef HAVE_OGG
else if(isOgg(file)) pc->decodeType = DECODE_TYPE_OGG;
else if(isOgg(utf8file)) pc->decodeType = DECODE_TYPE_OGG;
#endif
#ifdef HAVE_FLAC
else if(isFlac(file)) pc->decodeType = DECODE_TYPE_FLAC;
else if(isFlac(utf8file)) pc->decodeType = DECODE_TYPE_FLAC;
#endif
#ifdef HAVE_AUDIOFILE
else if(isWave(file)) pc->decodeType = DECODE_TYPE_AUDIOFILE;
else if(isWave(utf8file)) pc->decodeType = DECODE_TYPE_AUDIOFILE;
#endif
else {
strcpy(pc->erroredFile,pc->file);
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->error = PLAYER_ERROR_UNKTYPE;
return 0;
}
strcpy(pc->file,rmp2amp(file));
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->play = 1;
if(player_pid==0 && playerInit()<0) {
......@@ -216,6 +233,23 @@ int playerPause(FILE * fp) {
return 0;
}
int playerSetPause(FILE * fp, int pause) {
PlayerControl * pc = &(getPlayerData()->playerControl);
if(player_pid<=0) return 0;
switch(pc->state) {
case PLAYER_STATE_PLAY:
if(pause) playerPause(fp);
break;
case PLAYER_STATE_PAUSE:
if(!pause) playerPause(fp);
break;
}
return 0;
}
int getPlayerElapsedTime() {
return (int)(getPlayerData()->playerControl.elapsedTime+0.5);
}
......@@ -275,24 +309,26 @@ void playerCloseAudio() {
}
}
int queueSong(char * file) {
int queueSong(char * utf8file) {
PlayerControl * pc = &(getPlayerData()->playerControl);
if(pc->queueState==PLAYER_QUEUE_BLANK) {
strcpy(pc->file,rmp2amp(file));
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
if(0);
#ifdef HAVE_MAD
else if(isMp3(file)) pc->decodeType = DECODE_TYPE_MP3;
else if(isMp3(utf8file)) pc->decodeType = DECODE_TYPE_MP3;
#endif
#ifdef HAVE_OGG
else if(isOgg(file)) pc->decodeType = DECODE_TYPE_OGG;
else if(isOgg(utf8file)) pc->decodeType = DECODE_TYPE_OGG;
#endif
#ifdef HAVE_FLAC
else if(isFlac(file)) pc->decodeType = DECODE_TYPE_FLAC;
else if(isFlac(utf8file)) pc->decodeType = DECODE_TYPE_FLAC;
#endif
#ifdef HAVE_AUDIOFILE
else if(isWave(file)) pc->decodeType = DECODE_TYPE_AUDIOFILE;
else if(isWave(utf8file)) {
pc->decodeType = DECODE_TYPE_AUDIOFILE;
}
#endif
else return -1;
pc->queueState = PLAYER_QUEUE_FULL;
......@@ -334,8 +370,9 @@ void playerQueueUnlock() {
}
}
int playerSeek(FILE * fp, char * file, float time) {
int playerSeek(FILE * fp, char * utf8file, float time) {
PlayerControl * pc = &(getPlayerData()->playerControl);
char * file;
if(pc->state==PLAYER_STATE_STOP) {
myfprintf(fp,"%s player not currently playing\n",
......@@ -343,7 +380,8 @@ int playerSeek(FILE * fp, char * file, float time) {
return -1;
}
if(strcmp(pc->file,rmp2amp(file))!=0) strcpy(pc->file,rmp2amp(file));
file = rmp2amp(utf8ToFsCharset(utf8file));
if(strcmp(pc->file,file)!=0) strncpy(pc->file,file,MAXPATHLEN);
/*if(playerStop(fp)<0) return -1;
if(playerPlay(stderr,file)<0) return -1;*/
/*}*/
......@@ -356,3 +394,59 @@ int playerSeek(FILE * fp, char * file, float time) {
return 0;
}
float getPlayerCrossFade() {
PlayerControl * pc = &(getPlayerData()->playerControl);
return pc->crossFade;
}
void setPlayerCrossFade(float crossFadeInSeconds) {
if(crossFadeInSeconds<0) crossFadeInSeconds = 0;
PlayerControl * pc = &(getPlayerData()->playerControl);
pc->crossFade = crossFadeInSeconds;
}
void setPlayerSoftwareVolume(int volume) {
volume = (volume>100) ? 100 : (volume<0 ? 0 : volume);
PlayerControl * pc = &(getPlayerData()->playerControl);
pc->softwareVolume = volume;
}
int getPlayerSoftwareVolume() {
PlayerControl * pc = &(getPlayerData()->playerControl);
return pc->softwareVolume;
}
double getPlayerTotalPlayTime() {
PlayerControl * pc = &(getPlayerData()->playerControl);
if(pc->state==PLAYER_STATE_STOP) {
return pc->totalPlayTime;
}
return pc->totalPlayTime+pc->elapsedTime-pc->beginTime;
}
unsigned int getPlayerSampleRate() {
PlayerControl * pc = &(getPlayerData()->playerControl);
return pc->sampleRate;
}
int getPlayerBits() {
PlayerControl * pc = &(getPlayerData()->playerControl);
return pc->bits;
}
int getPlayerChannels() {
PlayerControl * pc = &(getPlayerData()->playerControl);
return pc->channels;
}
......@@ -19,6 +19,8 @@
#ifndef PLAYER_H
#define PLAYER_H
#include "mpd_types.h"
#include <stdio.h>
#include <sys/param.h>
......@@ -47,29 +49,39 @@
#define PLAYER_QUEUE_LOCKED 1
typedef struct _PlayerControl {
int decodeType;
int stop;
int play;
int pause;
int state;
int closeAudio;
int error;
unsigned long bitRate;
mpd_sint8 decodeType;
mpd_sint8 stop;
mpd_sint8 play;
mpd_sint8 pause;
mpd_sint8 state;
mpd_sint8 closeAudio;
mpd_sint8 error;
mpd_uint16 bitRate;
mpd_sint8 bits;
mpd_sint8 channels;
mpd_uint32 sampleRate;
float beginTime;
float totalTime;
float elapsedTime;
char file[MAXPATHLEN+1];
char erroredFile[MAXPATHLEN+1];
int queueState;
int queueLockState;
int lockQueue;
int unlockQueue;
int seek;
mpd_sint8 queueState;
mpd_sint8 queueLockState;
mpd_sint8 lockQueue;
mpd_sint8 unlockQueue;
mpd_sint8 seek;
double seekWhere;
float crossFade;
mpd_sint8 softwareVolume;
double totalPlayTime;
int decode_pid;
} PlayerControl;
void player_sigHandler(int signal);
int playerPlay(FILE * fp, char * file);
int playerPlay(FILE * fp, char * utf8file);
int playerSetPause(FILE * fp, int pause);
int playerPause(FILE * fp);
......@@ -97,7 +109,7 @@ int getPlayerError();
int playerInit();
int queueSong(char * file);
int queueSong(char * utf8file);
int getPlayerQueueState();
......@@ -107,6 +119,22 @@ void playerQueueLock();
void playerQueueUnlock();
int playerSeek(FILE * fp, char * file, float time);
int playerSeek(FILE * fp, char * utf8file, float time);
void setPlayerCrossFade(float crossFadeInSeconds);
float getPlayerCrossFade();
int getPlayerSoftwareVolume();
void setPlayerSoftwareVolume(int volume);
double getPlayerTotalPlayTime();
unsigned int getPlayerSampleRate();
int getPlayerBits();
int getPlayerChannels();
#endif
......@@ -25,8 +25,10 @@
#include <sys/shm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int buffered_before_play;
int buffered_chunks;
PlayerData * playerData_pd;
......@@ -34,33 +36,63 @@ void initPlayerData() {
float perc;
char * test;
int shmid;
int crossfade = 0;
size_t bufferSize;
size_t allocationSize;
Buffer * buffer;
bufferSize = strtol(getConf()[CONF_BUFFER_SIZE],&test,10);
if(*test!='\0' || bufferSize<=0) {
ERROR("buffer size \"%s\" is not a positive integer\n",
getConf()[CONF_BUFFER_SIZE]);
exit(-1);
}
bufferSize*=1024;
buffered_chunks = bufferSize/CHUNK_SIZE;
perc = strtod((getConf())[CONF_BUFFER_BEFORE_PLAY],&test);
if(*test!='%' || perc<0 || perc>100) {
ERROR1("buffered before play \"%s\" is not a positive "
ERROR("buffered before play \"%s\" is not a positive "
"percentage and less than 100 percent\n",
(getConf())[CONF_BUFFER_BEFORE_PLAY]);
exit(-1);
}
buffered_before_play = (perc/100)*BUFFERED_CHUNKS;
if(buffered_before_play>BUFFERED_CHUNKS) {
buffered_before_play = BUFFERED_CHUNKS;
buffered_before_play = (perc/100)*buffered_chunks;
if(buffered_before_play>buffered_chunks) {
buffered_before_play = buffered_chunks;
}
else if(buffered_before_play<0) buffered_before_play = 0;
if((shmid = shmget(IPC_PRIVATE,sizeof(PlayerData),IPC_CREAT|0600))<0) {
ERROR0("problems shmget'ing\n");
allocationSize = buffered_chunks*CHUNK_SIZE; /*actual buffer*/
allocationSize+= buffered_chunks*sizeof(float); /*for times*/
allocationSize+= buffered_chunks*sizeof(mpd_sint16); /*for chunkSize*/
allocationSize+= buffered_chunks*sizeof(mpd_sint16); /*for bitRate*/
allocationSize+= sizeof(PlayerData); /*for playerData struct*/
if((shmid = shmget(IPC_PRIVATE,allocationSize,IPC_CREAT|0600))<0) {
ERROR("problems shmget'ing\n");
exit(-1);
}
if((playerData_pd = shmat(shmid,NULL,0))<0) {
ERROR0("problems shmat'ing\n");
ERROR("problems shmat'ing\n");
exit(-1);
}
if (shmctl(shmid, IPC_RMID, 0)<0) {
ERROR0("problems shmctl'ing\n");
ERROR("problems shmctl'ing\n");
exit(-1);
}
buffer = &(playerData_pd->buffer);
buffer->chunks = ((char *)playerData_pd)+sizeof(PlayerData);
buffer->chunkSize = (mpd_uint16 *)(((char *)buffer->chunks)+
buffered_chunks*CHUNK_SIZE);
buffer->bitRate = (mpd_uint16 *)(((char *)buffer->chunkSize)+
buffered_chunks*sizeof(mpd_sint16));
buffer->times = (float *)(((char *)buffer->bitRate)+
buffered_chunks*sizeof(mpd_sint16));
playerData_pd->playerControl.stop = 0;
playerData_pd->playerControl.pause = 0;
playerData_pd->playerControl.play = 0;
......@@ -71,14 +103,19 @@ void initPlayerData() {
playerData_pd->playerControl.queueState = PLAYER_QUEUE_BLANK;
playerData_pd->playerControl.queueLockState = PLAYER_QUEUE_UNLOCKED;
playerData_pd->playerControl.seek = 0;
playerData_pd->playerControl.file[0] = '\0';
memset(playerData_pd->playerControl.file,0,MAXPATHLEN+1);
memset(playerData_pd->playerControl.erroredFile,0,MAXPATHLEN+1);
playerData_pd->playerControl.crossFade = crossfade;
playerData_pd->playerControl.softwareVolume = 100;
playerData_pd->playerControl.totalPlayTime = 0;
playerData_pd->playerControl.decode_pid = 0;
playerData_pd->decoderControl.stop = 0;
playerData_pd->decoderControl.start = 0;
playerData_pd->decoderControl.state = DECODE_STATE_STOP;
playerData_pd->decoderControl.seek = 0;
playerData_pd->decoderControl.error = DECODE_ERROR_NOERROR;
playerData_pd->decoderControl.file[0] = '\0';
memset(playerData_pd->decoderControl.file,0,MAXPATHLEN+1);
}
PlayerData * getPlayerData() {
......
......@@ -22,17 +22,18 @@
#include "audio.h"
#include "player.h"
#include "decode.h"
#include "mpd_types.h"
#define CHUNK_SIZE 1024
#define BUFFERED_CHUNKS 2048 /* 2 MB of buffer */
extern int buffered_before_play;
extern int buffered_chunks;
typedef struct _Buffer {
char chunks[BUFFERED_CHUNKS][CHUNK_SIZE];
uint_16 chunkSize[BUFFERED_CHUNKS];
uint_16 bitRate[BUFFERED_CHUNKS];
float times[BUFFERED_CHUNKS];
char * chunks;
mpd_uint16 * chunkSize;
mpd_uint16 * bitRate;
float * times;
int begin;
int end;
int next;
......@@ -50,6 +51,7 @@ typedef struct _PlayerData {
void initPlayerData();
PlayerData * getPlayerData();
Buffer * getBuffer();
void freePlayerData();
......
......@@ -51,6 +51,7 @@
#define PLAYLIST_STATE_FILE_REPEAT "repeat: "
#define PLAYLIST_STATE_FILE_CURRENT "current: "
#define PLAYLIST_STATE_FILE_TIME "time: "
#define PLAYLIST_STATE_FILE_CROSSFADE "crossfade: "
#define PLAYLIST_STATE_FILE_PLAYLIST_BEGIN "playlist_begin"
#define PLAYLIST_STATE_FILE_PLAYLIST_END "playlist_end"
......@@ -106,7 +107,7 @@ void initPlaylist() {
playlist_max_length = strtol((getConf())[CONF_MAX_PLAYLIST_LENGTH],&test,10);
if(*test!='\0') {
ERROR1("max playlist length \"%s\" is not an integer\n",
ERROR("max playlist length \"%s\" is not an integer\n",
(getConf())[CONF_MAX_PLAYLIST_LENGTH]);
exit(-1);
}
......@@ -120,7 +121,7 @@ void initPlaylist() {
playlist_saveAbsolutePaths = 0;
}
else {
ERROR1("save_absolute_paths_in_playlist \"%s\" is not yes or "
ERROR("save_absolute_paths_in_playlist \"%s\" is not yes or "
"no\n",
(getConf())[CONF_SAVE_ABSOLUTE_PATHS_IN_PLAYLISTS]);
exit(-1);
......@@ -129,7 +130,7 @@ void initPlaylist() {
playlist.songs = malloc(sizeof(Song *)*playlist_max_length);
playlist.order = malloc(sizeof(Song *)*playlist_max_length);
memset(playlist.songs,(int)NULL,sizeof(char *)*playlist_max_length);
memset(playlist.songs,0,sizeof(char *)*playlist_max_length);
srand(time(NULL));
......@@ -166,7 +167,7 @@ int showPlaylist(FILE * fp) {
int i;
for(i=0;i<playlist.length;i++) {
myfprintf(fp,"%i:%s\n",i,(playlist.songs[i])->file);
myfprintf(fp,"%i:%s\n",i,(playlist.songs[i])->utf8file);
}
return 0;
......@@ -179,7 +180,7 @@ void savePlaylistState() {
blockTermSignal();
while(!(fp = fopen(playlist_stateFile,"w")) && errno==EINTR);
if(!fp) {
ERROR1("problems opening state file \"%s\" for "
ERROR("problems opening state file \"%s\" for "
"writing\n",playlist_stateFile);
return;
}
......@@ -205,8 +206,12 @@ void savePlaylistState() {
myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_STATE_STOP);
break;
}
myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_RANDOM,playlist.random);
myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_REPEAT,playlist.repeat);
myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_RANDOM,
playlist.random);
myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_REPEAT,
playlist.repeat);
myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_CROSSFADE,
(int)(getPlayerCrossFade()));
myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_PLAYLIST_BEGIN);
showPlaylist(fp);
myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_PLAYLIST_END);
......@@ -223,13 +228,13 @@ void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current,
int song;
if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) {
ERROR1("error parsing state file \"%s\"\n",playlist_stateFile);
ERROR("error parsing state file \"%s\"\n",playlist_stateFile);
exit(-1);
}
while(strcmp(buffer,PLAYLIST_STATE_FILE_PLAYLIST_END)) {
song = atoi(strtok(buffer,":"));
if(!(temp = strtok(NULL,""))) {
ERROR1("error parsing state file \"%s\"\n",
ERROR("error parsing state file \"%s\"\n",
playlist_stateFile);
exit(-1);
}
......@@ -244,7 +249,7 @@ void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current,
}
}
if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) {
ERROR1("error parsing state file \"%s\"\n",
ERROR("error parsing state file \"%s\"\n",
playlist_stateFile);
exit(-1);
}
......@@ -262,14 +267,14 @@ void readPlaylistState() {
if(stat(playlist_stateFile,&st)<0) return;
if(!S_ISREG(st.st_mode)) {
ERROR1("state file \"%s\" is not a regular "
ERROR("state file \"%s\" is not a regular "
"file\n",playlist_stateFile);
exit(-1);
}
fp = fopen(playlist_stateFile,"r");
if(!fp) {
ERROR1("problems opening state file \"%s\" for "
ERROR("problems opening state file \"%s\" for "
"reading\n",playlist_stateFile);
exit(-1);
}
......@@ -302,6 +307,11 @@ void readPlaylistState() {
}
else setPlaylistRepeatStatus(stderr,0);
}
else if(strncmp(buffer,PLAYLIST_STATE_FILE_CROSSFADE,
strlen(PLAYLIST_STATE_FILE_CROSSFADE))==0) {
setPlayerCrossFade(atoi(&(buffer[strlen(
PLAYLIST_STATE_FILE_CROSSFADE)])));
}
else if(strncmp(buffer,PLAYLIST_STATE_FILE_RANDOM,
strlen(PLAYLIST_STATE_FILE_RANDOM))==0) {
if(strcmp(&(buffer
......@@ -315,7 +325,7 @@ void readPlaylistState() {
strlen(PLAYLIST_STATE_FILE_CURRENT))==0) {
if(strlen(buffer)==
strlen(PLAYLIST_STATE_FILE_CURRENT)) {
ERROR1("error parsing state "
ERROR("error parsing state "
"file \"%s\"\n",
playlist_stateFile);
exit(-1);
......@@ -353,7 +363,7 @@ int playlistInfo(FILE * fp,int song) {
}
for(i=begin;i<end;i++) {
myfprintf(fp,"file: %s\n",(playlist.songs[i])->file);
myfprintf(fp,"file: %s\n",(playlist.songs[i])->utf8file);
if((tag = (playlist.songs[i])->tag)) {
printMpdTag(fp,tag);
}
......@@ -373,27 +383,27 @@ void swapSongs(int song1, int song2) {
void queueNextSongInPlaylist() {
if(playlist.current<playlist.length-1) {
playlist.queued = playlist.current+1;
DEBUG2("playlist: queue song %i:\"%s\"\n",
DEBUG("playlist: queue song %i:\"%s\"\n",
playlist.queued,
playlist.songs[playlist.order[
playlist.queued]]->file);
playlist.queued]]->utf8file);
if(queueSong(playlist.songs[playlist.order[
playlist.queued]]->file)<0) {
playlist.queued]]->utf8file)<0) {
playlist.queued = -1;
playlist_queueError = 1;
}
}
else if(playlist.length && playlist.repeat) {
if(playlist.length>1 && playlist.random) {
randomizeOrder(0,playlist.length);
randomizeOrder(0,playlist.length-1);
}
playlist.queued = 0;
DEBUG2("playlist: queue song %i:\"%s\"\n",
DEBUG("playlist: queue song %i:\"%s\"\n",
playlist.queued,
playlist.songs[playlist.order[
playlist.queued]]->file);
playlist.queued]]->utf8file);
if(queueSong(playlist.songs[playlist.order[
playlist.queued]]->file)<0) {
playlist.queued]]->utf8file)<0) {
playlist.queued = -1;
playlist_queueError = 1;
}
......@@ -411,7 +421,7 @@ void syncPlaylistWithQueue(int queue) {
else if(getPlayerQueueState()==PLAYER_QUEUE_EMPTY) {
setQueueState(PLAYER_QUEUE_BLANK);
if(playlist.queued>=0) {
DEBUG0("playlist: now playing queued song\n");
DEBUG("playlist: now playing queued song\n");
playlist.current = playlist.queued;
}
playlist.queued = -1;
......@@ -435,11 +445,11 @@ void clearPlayerQueue() {
playlist.queued = -1;
switch(getPlayerQueueState()) {
case PLAYER_QUEUE_FULL:
DEBUG0("playlist: dequeue song\n");
DEBUG("playlist: dequeue song\n");
setQueueState(PLAYER_QUEUE_BLANK);
break;
case PLAYER_QUEUE_PLAY:
DEBUG0("playlist: stop decoding queued song\n");
DEBUG("playlist: stop decoding queued song\n");
setQueueState(PLAYER_QUEUE_STOP);
break;
}
......@@ -447,6 +457,8 @@ void clearPlayerQueue() {
int addToPlaylist(FILE * fp, char * file) {
Song * song;
DEBUG("add to playlist: %s\n",file);
if(!(song = getSong(file))) {
myfprintf(fp,"%s \"%s\" is not in the music db\n",COMMAND_RESPOND_ERROR,file);
......@@ -478,7 +490,7 @@ int addSongToPlaylist(FILE * fp, Song * song) {
int swap;
int start;
if(playlist_state==PLAYLIST_STATE_STOP) start = 0;
else if(playlist.queued>0) start = playlist.queued+1;
else if(playlist.queued>=0) start = playlist.queued+1;
else start = playlist.current+1;
swap = rand()%(playlist.length-start);
swap+=start;
......@@ -633,7 +645,7 @@ void deleteSongsFromPlaylist(SongList * songList) {
}
int stopPlaylist(FILE * fp) {
DEBUG0("playlist: stop\n");
DEBUG("playlist: stop\n");
if(playerStop(fp)<0) return -1;
playerCloseAudio();
playlist.queued = -1;
......@@ -655,10 +667,12 @@ int playPlaylistOrderNumber(FILE * fp, int orderNum) {
playlist_queueError = 0;
playlist.current = orderNum;
DEBUG2("playlist: play %i:\"%s\"\n",orderNum,
(playlist.songs[playlist.order[orderNum]])->file);
DEBUG("playlist: play %i:\"%s\"\n",orderNum,
(playlist.songs[playlist.order[orderNum]])->utf8file);
if(playerPlay(fp,(playlist.songs[playlist.order[orderNum]])->file)<0) {
if(playerPlay(fp,(playlist.songs[playlist.order[orderNum]])->
utf8file)<0)
{
stopPlaylist(fp);
return -1;
}
......@@ -699,7 +713,7 @@ int playPlaylist(FILE * fp, int song, int stopOnError) {
}
swapOrder(i,playlist.current);
i = playlist.current;
//}
/*}*/
}
playlist_stopOnError = stopOnError;
......@@ -720,6 +734,8 @@ int currentSongInPlaylist(FILE * fp) {
playlist_stopOnError = 0;
syncPlaylistWithQueue(0);
if(playlist.current<playlist.length) {
return playPlaylistOrderNumber(fp,playlist.current);
}
......@@ -731,6 +747,8 @@ int currentSongInPlaylist(FILE * fp) {
int nextSongInPlaylist(FILE * fp) {
if(playlist_state!=PLAYLIST_STATE_PLAY) return 0;
syncPlaylistWithQueue(0);
playlist_stopOnError = 0;
if(playlist.current<playlist.length-1) {
......@@ -898,9 +916,10 @@ void randomizeOrder(int start,int end) {
int i;
int ri;
DEBUG2("playlist: randomize from %i to %i\n",start,end);
DEBUG("playlist: randomize from %i to %i\n",start,end);
blockTermSignal();
if(playlist_state==PLAYLIST_STATE_PLAY) {
if(playlist.queued>=start && playlist.queued<=end) {
lockPlaylistInteraction();
......@@ -946,6 +965,8 @@ int setPlaylistRandomStatus(FILE * fp, int status) {
int previousSongInPlaylist(FILE * fp) {
if(playlist_state!=PLAYLIST_STATE_PLAY) return 0;
syncPlaylistWithQueue(0);
if (getPlayerElapsedTime()>PLAYLIST_PREV_UNLESS_ELAPSED) {
return playPlaylistOrderNumber(fp,playlist.current);
}
......@@ -998,7 +1019,8 @@ int shufflePlaylist(FILE * fp) {
return 0;
}
int deletePlaylist(FILE * fp, char * file) {
int deletePlaylist(FILE * fp, char * utf8file) {
char * file = utf8ToFsCharset(utf8file);
char * rfile = malloc(strlen(file)+strlen(".")+
strlen(PLAYLIST_FILE_SUFFIX)+1);
char * actualFile;
......@@ -1011,7 +1033,7 @@ int deletePlaylist(FILE * fp, char * file) {
else {
free(rfile);
myfprintf(fp,"%s playlist \"%s\" not found\n",
COMMAND_RESPOND_ERROR,file);
COMMAND_RESPOND_ERROR,utf8file);
return -1;
}
......@@ -1023,20 +1045,23 @@ int deletePlaylist(FILE * fp, char * file) {
return 0;
}
int savePlaylist(FILE * fp, char * file) {
int savePlaylist(FILE * fp, char * utf8file) {
FILE * fileP;
int i;
struct stat st;
char * file;
char * rfile;
char * actualFile;
if(strstr(file,"/")) {
if(strstr(utf8file,"/")) {
myfprintf(fp,"%s cannot save \"%s\", saving playlists to "
"subdirectories is not supported\n",
COMMAND_RESPOND_ERROR,file);
COMMAND_RESPOND_ERROR,utf8file);
return -1;
}
file = strdup(utf8ToFsCharset(utf8file));
rfile = malloc(strlen(file)+strlen(".")+
strlen(PLAYLIST_FILE_SUFFIX)+1);
......@@ -1044,12 +1069,14 @@ int savePlaylist(FILE * fp, char * file) {
strcat(rfile,".");
strcat(rfile,PLAYLIST_FILE_SUFFIX);
free(file);
actualFile = rpp2app(rfile);
free(rfile);
if(0==stat(actualFile,&st)) {
myfprintf(fp,"%s A file or directory already exists with the name \"%s\"\n",COMMAND_RESPOND_ERROR,file);
myfprintf(fp,"%s A file or directory already exists with the name \"%s\"\n",COMMAND_RESPOND_ERROR,utf8file);
return -1;
}
......@@ -1063,9 +1090,10 @@ int savePlaylist(FILE * fp, char * file) {
for(i=0;i<playlist.length;i++) {
if(playlist_saveAbsolutePaths) {
myfprintf(fileP,"%s%s\n",musicDir,
(playlist.songs[i])->file);
utf8ToFsCharset((playlist.songs[i])->utf8file));
}
else myfprintf(fileP,"%s\n",(playlist.songs[i])->file);
else myfprintf(fileP,"%s\n",
utf8ToFsCharset((playlist.songs[i])->utf8file));
}
while(fclose(fileP) && errno==EINTR);
......@@ -1073,33 +1101,36 @@ int savePlaylist(FILE * fp, char * file) {
return 0;
}
int loadPlaylist(FILE * fp, char * file) {
int loadPlaylist(FILE * fp, char * utf8file) {
FILE * fileP;
char s[MAXPATHLEN+1];
char s[MAXPATHLEN*1];
int slength = 0;
char * rfile = malloc(strlen(file)+strlen(".")+
char * temp = strdup(utf8ToFsCharset(utf8file));
char * rfile = malloc(strlen(temp)+strlen(".")+
strlen(PLAYLIST_FILE_SUFFIX)+1);
char * actualFile;
char * parent = parentPath(file);
char * parent = parentPath(temp);
int parentlen = strlen(parent);
char * erroredFile = NULL;
strcpy(rfile,file);
strcpy(rfile,temp);
strcat(rfile,".");
strcat(rfile,PLAYLIST_FILE_SUFFIX);
free(temp);
if((actualFile = rpp2app(rfile)) && isPlaylist(actualFile)) free(rfile);
else {
free(rfile);
myfprintf(fp,"%s playlist \"%s\" not found\n",
COMMAND_RESPOND_ERROR,file);
COMMAND_RESPOND_ERROR,utf8file);
return -1;
}
while(!(fileP = fopen(actualFile,"r")) && errno==EINTR);
if(fileP==NULL) {
myfprintf(fp,"%s Problems opening file \"%s\"\n",
COMMAND_RESPOND_ERROR,file);
COMMAND_RESPOND_ERROR,utf8file);
return -1;
}
......@@ -1110,7 +1141,7 @@ int loadPlaylist(FILE * fp, char * file) {
strcpy(s,&(s[strlen(musicDir)]));
}
else if(parentlen) {
char * temp = strdup(s);
temp = strdup(s);
memset(s,0,MAXPATHLEN+1);
strcpy(s,parent);
strncat(s,"/",MAXPATHLEN-parentlen);
......@@ -1125,10 +1156,15 @@ int loadPlaylist(FILE * fp, char * file) {
free(temp);
}
slength = 0;
if(s[0]==PLAYLIST_COMMENT && !getSong(s)) continue;
if((addToPlaylist(stderr,s))<0) {
if(!erroredFile) erroredFile = strdup(s);
temp = strdup(fsCharsetToUtf8(s));
if(s[0]==PLAYLIST_COMMENT && !getSong(temp)) {
free(temp);
continue;
}
if((addToPlaylist(stderr,temp))<0) {
if(!erroredFile) erroredFile = strdup(temp);
}
free(temp);
}
else if(slength==MAXPATHLEN) {
s[slength] = '\0';
......@@ -1196,5 +1232,5 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
else if(playPlaylistOrderNumber(fp,i)<0) return -1;
if(playlist.current!=i) if(playPlaylistOrderNumber(fp,i)<0) return -1;
return playerSeek(fp,playlist.songs[playlist.order[i]]->file,time);
return playerSeek(fp,playlist.songs[playlist.order[i]]->utf8file,time);
}
......@@ -61,9 +61,9 @@ int previousSongInPlaylist(FILE * fp);
int shufflePlaylist(FILE * fp);
int savePlaylist(FILE * fp, char * file);
int savePlaylist(FILE * fp, char * utf8file);
int deletePlaylist(FILE * fp, char * file);
int deletePlaylist(FILE * fp, char * utf8file);
void deleteASongFromPlaylist(Song * song);
......@@ -73,7 +73,7 @@ int moveSongInPlaylist(FILE * fp, int from, int to);
int swapSongsInPlaylist(FILE * fp, int song1, int song2);
int loadPlaylist(FILE * fp, char * file);
int loadPlaylist(FILE * fp, char * utf8file);
int getPlaylistRepeatStatus();
......
......@@ -36,33 +36,31 @@
#include <stdlib.h>
#include <string.h>
char musicDir[MAXPATHLEN+1];
Song * newSong(char * file) {
Song * newSong(char * utf8file) {
Song * song = malloc(sizeof(Song));
song->file = strdup(file);
song->utf8file = strdup(utf8file);
#ifdef HAVE_OGG
if((song->mtime = isOgg(file))) {
song->tag = oggTagDup(file);
if((song->mtime = isOgg(utf8file))) {
song->tag = oggTagDup(utf8file);
return song;
}
#endif
#ifdef HAVE_FLAC
if((song->mtime = isFlac(file))) {
song->tag = flacTagDup(file);
if((song->mtime = isFlac(utf8file))) {
song->tag = flacTagDup(utf8file);
return song;
}
#endif
#ifdef HAVE_MAD
if((song->mtime = isMp3(file))) {
song->tag = mp3TagDup(file);
if((song->mtime = isMp3(utf8file))) {
song->tag = mp3TagDup(utf8file);
return song;
}
#endif
#ifdef HAVE_AUDIOFILE
if((song->mtime = isWave(file))) {
song->tag = audiofileTagDup(file);
if((song->mtime = isWave(utf8file))) {
song->tag = audiofileTagDup(utf8file);
return song;
}
#endif
......@@ -70,7 +68,7 @@ Song * newSong(char * file) {
}
void freeSong(Song * song) {
free(song->file);
free(song->utf8file);
if(song->tag) freeMpdTag(song->tag);
free(song);
}
......@@ -79,11 +77,11 @@ SongList * newSongList() {
return makeList((ListFreeDataFunc *)freeSong);
}
Song * addSongToList(SongList * list, char * key, char * file) {
Song * addSongToList(SongList * list, char * key, char * utf8file) {
Song * song;
if(isMusic(file)) {
song = newSong(file);
if(isMusic(utf8file)) {
song = newSong(utf8file);
}
else {
return NULL;
......@@ -99,7 +97,7 @@ void freeSongList(SongList * list) {
}
int printSongInfo(FILE * fp, Song * song) {
myfprintf(fp,"%s%s\n",SONG_FILE,song->file);
myfprintf(fp,"%s%s\n",SONG_FILE,song->utf8file);
if(song->tag) printMpdTag(fp,song->tag);
......@@ -148,14 +146,14 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
key = strdup(&(buffer[strlen(SONG_KEY)]));
song = malloc(sizeof(Song));
song->tag = NULL;
song->file = NULL;
song->utf8file = NULL;
}
else if(0==strncmp(SONG_FILE,buffer,strlen(SONG_FILE))) {
if(!song || song->file) {
ERROR0("Problems reading song info\n");
if(!song || song->utf8file) {
ERROR("Problems reading song info\n");
exit(-1);
}
song->file = strdup(&(buffer[strlen(SONG_FILE)]));
song->utf8file = strdup(&(buffer[strlen(SONG_FILE)]));
}
else if(0==strncmp(SONG_ARTIST,buffer,strlen(SONG_ARTIST))) {
if(!song->tag) song->tag = newMpdTag();
......@@ -181,7 +179,7 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
song->mtime = atoi(&(buffer[strlen(SONG_TITLE)]));
}
else {
ERROR1("unknown line in db: %s\n",buffer);
ERROR("unknown line in db: %s\n",buffer);
exit(-1);
}
}
......@@ -196,26 +194,26 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
int updateSongInfo(Song * song) {
if(song->tag) freeMpdTag(song->tag);
#ifdef HAVE_MAD
if((song->mtime = isMp3(song->file))) {
song->tag = mp3TagDup(song->file);
if((song->mtime = isMp3(song->utf8file))) {
song->tag = mp3TagDup(song->utf8file);
return 0;
}
#endif
#ifdef HAVE_OGG
if((song->mtime = isOgg(song->file))) {
song->tag = oggTagDup(song->file);
if((song->mtime = isOgg(song->utf8file))) {
song->tag = oggTagDup(song->utf8file);
return 0;
}
#endif
#ifdef HAVE_FLAC
if((song->mtime = isFlac(song->file))) {
song->tag = flacTagDup(song->file);
if((song->mtime = isFlac(song->utf8file))) {
song->tag = flacTagDup(song->utf8file);
return 0;
}
#endif
#ifdef HAVE_AUDIOFILE
if((song->mtime = isWave(song->file))) {
song->tag = audiofileTagDup(song->file);
if((song->mtime = isWave(song->utf8file))) {
song->tag = audiofileTagDup(song->utf8file);
return 0;
}
#endif
......@@ -225,7 +223,7 @@ int updateSongInfo(Song * song) {
Song * songDup(Song * song) {
Song * ret = malloc(sizeof(Song));
ret->file = strdup(song->file);
ret->utf8file = strdup(song->utf8file);
ret->mtime = song->mtime;
ret->tag = mpdTagDup(song->tag);
......
......@@ -29,14 +29,14 @@
#include "list.h"
typedef struct _Song {
char * file;
char * utf8file;
MpdTag * tag;
time_t mtime;
} Song;
typedef List SongList;
Song * newSong(char * file);
Song * newSong(char * utf8file);
void freeSong(Song *);
......@@ -44,7 +44,7 @@ SongList * newSongList();
void freeSongList(SongList * list);
Song * addSongToList(SongList * list, char * key, char * file);
Song * addSongToList(SongList * list, char * key, char * utf8file);
int printSongInfo(FILE * fp, Song * song);
......
......@@ -17,10 +17,12 @@
*/
#include "stats.h"
#include "command.h"
#include "tables.h"
#include "directory.h"
#include "myfprintf.h"
#include "player.h"
#include <time.h>
......@@ -28,6 +30,7 @@ Stats stats;
void initStats() {
stats.daemonStart = time(NULL);
stats.numberOfSongs = 0;
/*stats.playTime = 0;
stats.songsPlayed = 0;*/
}
......@@ -35,10 +38,11 @@ void initStats() {
int printStats(FILE * fp) {
myfprintf(fp,"artists: %li\n",numberOfArtists());
myfprintf(fp,"albums: %li\n",numberOfAlbums());
myfprintf(fp,"songs: %li\n",numberOfSongs());
myfprintf(fp,"songs: %i\n",stats.numberOfSongs);
myfprintf(fp,"uptime: %li\n",time(NULL)-stats.daemonStart);
/*myfprintf(fp,"playtime: %li\n",stats.playTime);
myfprintf(fp,"songs_played: %li\n",stats.songsPlayed);*/
myfprintf(fp,"playtime: %li\n",(long)(getPlayerTotalPlayTime()+0.5));
myfprintf(fp,"db_playtime: %li\n",stats.dbPlayTime);
/*myfprintf(fp,"songs_played: %li\n",stats.songsPlayed);*/
myfprintf(fp,"db_update: %li\n",getDbModTime());
return 0;
}
......@@ -23,6 +23,8 @@
typedef struct _Stats {
unsigned long daemonStart;
int numberOfSongs;
unsigned long dbPlayTime;
/*unsigned long playTime;
unsigned long songsPlayed;*/
} Stats;
......
......@@ -25,58 +25,50 @@
#include <string.h>
#define TABLES_ALBUM "album"
#define TABLES_ARTIST "artist"
#define TABLES_TITLE "title"
#define TABLES_FILENAME "filename"
#define TABLES_ALBUM "album"
List * albumTable;
List * artistTable;
List * songTable;
typedef struct _ArtistData {
SongList * songs;
SongList * albums;
int songs;
List * albums;
} ArtistData;
ArtistData * newArtistData() {
ArtistData * ad = malloc(sizeof(ArtistData));
ad->songs = makeList(NULL);
ad->albums = makeList(freeList);
ad->songs = 0;
ad->albums = makeList(free);
return ad;
}
void freeArtistData(ArtistData * ad) {
freeList(ad->songs);
freeList(ad->albums);
}
void initTables() {
albumTable = makeList(freeList);
albumTable = makeList(free);
artistTable = makeList((ListFreeDataFunc *)freeArtistData);
songTable = makeList(NULL);
}
void closeTables() {
freeList(albumTable);
freeList(artistTable);
freeList(songTable);
}
void addSongToSomeAlbumTable(List * table, Song * song) {
void * album;
void * songs;
if(!song->tag) return;
if(!song->tag->album || !strlen(song->tag->album)) return;
if(findInList(table,song->tag->album,&album)) {
insertInList((SongList *)album,song->file,song);
}
else {
album = makeList(NULL);
insertInList(table,song->tag->album,album);
insertInList(album,song->file,song);
if(!findInList(table,song->tag->album,&songs)) {
songs = malloc(sizeof(int));
*((int *)songs) = 0;
insertInList(table,song->tag->album,songs);
}
(*((int *)songs))++;
}
void addSongToAlbumTable(Song * song) {
......@@ -91,181 +83,23 @@ void addSongToArtistTable(Song * song) {
artist = newArtistData();
insertInList(artistTable,song->tag->artist,artist);
}
insertInList(((ArtistData *)artist)->songs,song->file,song);
addSongToSomeAlbumTable(((ArtistData *)artist)->albums,
song);
}
void addSongToSongTable(Song * song) {
insertInList(songTable,song->file,song);
((ArtistData *)artist)->songs++;
addSongToSomeAlbumTable(((ArtistData *)artist)->albums,song);
}
void addSongToTables(Song * song) {
addSongToAlbumTable(song);
addSongToArtistTable(song);
addSongToSongTable(song);
}
int findAndPrintSongsInAlbumTable(FILE * fp,char * find) {
void * album;
if(!findInList(albumTable,find,&album)) {
myfprintf(fp,"%s album not found\n",COMMAND_RESPOND_ERROR);
return -1;
}
return printSongInfoFromList(fp,(SongList *)album);
}
int findAndPrintSongsInArtistTable(FILE * fp,char * find) {
void * artist;
if(!findInList(artistTable,find,&artist)) {
myfprintf(fp,"%s artist not found\n",COMMAND_RESPOND_ERROR);
return -1;
}
return printSongInfoFromList(fp,((ArtistData *)artist)->songs);
}
int findAndPrintSongsInTable(FILE * fp, char * table, char * find) {
if(strcmp(table,TABLES_ALBUM)==0) {
return findAndPrintSongsInAlbumTable(fp,find);
}
else if(strcmp(table,TABLES_ARTIST)==0) {
return findAndPrintSongsInArtistTable(fp,find);
}
myfprintf(fp,"%s unknown table\n",COMMAND_RESPOND_ERROR);
return -1;
}
int searchForSongsInAlbumTable(FILE * fp,char * search) {
SongList * album;
ListNode * node = albumTable->firstNode;
char * dup;
char * dupSearch = strDupToUpper(search);
while(node) {
dup = strDupToUpper(node->key);
if(strstr(dup,dupSearch)) {
album = (SongList *)node->data;
if(printSongInfoFromList(fp,album)<0) {
free(dup);
free(dupSearch);
return -1;
}
}
free(dup);
node = node->nextNode;
}
free(dupSearch);
return 0;
}
int searchForSongsInArtistTable(FILE * fp,char * search) {
ArtistData * artist;
ListNode * node = artistTable->firstNode;
char * dup;
char * dupSearch = strDupToUpper(search);
while(node) {
dup = strDupToUpper(node->key);
if(strstr(dup,dupSearch)) {
artist = (ArtistData *)node->data;
if(printSongInfoFromList(fp,artist->songs)<0) {
free(dup);
free(dupSearch);
return -1;
}
}
free(dup);
node = node->nextNode;
}
free(dupSearch);
return 0;
}
int searchForSongsInSongTableByTitle(FILE * fp,char * search) {
Song * song;
ListNode * node = songTable->firstNode;
char * dup;
char * dupSearch = strDupToUpper(search);
while(node) {
song = (Song *)node->data;
if(song->tag && song->tag->title && strlen(song->tag->title)) {
dup = strDupToUpper(song->tag->title);
if(strstr(dup,dupSearch)) {
if(printSongInfo(fp,song)<0) {
free(dup);
free(dupSearch);
return -1;
}
}
free(dup);
}
node = node->nextNode;
}
free(dupSearch);
return 0;
}
int searchForSongsInSongTableByFilename(FILE * fp,char * search) {
Song * song;
ListNode * node = songTable->firstNode;
char * dup;
char * dupSearch = strDupToUpper(search);
while(node) {
song = (Song *)node->data;
dup = strDupToUpper(song->file);
if(strstr(dup,dupSearch)) {
if(printSongInfo(fp,song)<0) {
free(dup);
free(dupSearch);
return -1;
}
}
free(dup);
node = node->nextNode;
}
free(dupSearch);
return 0;
}
int searchForSongsInTable(FILE * fp, char * table, char * search) {
if(strcmp(table,TABLES_ALBUM)==0) {
return searchForSongsInAlbumTable(fp,search);
}
else if(strcmp(table,TABLES_ARTIST)==0) {
return searchForSongsInArtistTable(fp,search);
}
else if(strcmp(table,TABLES_TITLE)==0) {
return searchForSongsInSongTableByTitle(fp,search);
}
else if(strcmp(table,TABLES_FILENAME)==0) {
return searchForSongsInSongTableByFilename(fp,search);
}
myfprintf(fp,"%s unknown table\n",COMMAND_RESPOND_ERROR);
return -1;
}
void removeSongFromSomeAlbumTable(List * table, Song * song) {
void * album;
void * songs;
if(!song->tag) return;
if(!song->tag->album || !strlen(song->tag->album)) return;
if(findInList(table,song->tag->album,&album)) {
deleteFromList((SongList *)album,song->file);
if(((SongList *)album)->numberOfNodes==0) {
if(findInList(table,song->tag->album,&songs)) {
(*((int *)songs))--;
if(*((int *)songs)<=0) {
deleteFromList(table,song->tag->album);
}
}
......@@ -281,23 +115,18 @@ void removeSongFromArtistTable(Song * song) {
if(!song->tag) return;
if(!song->tag->artist || !strlen(song->tag->artist)) return;
if(findInList(artistTable,song->tag->artist,&artist)) {
deleteFromList(((ArtistData *)artist)->songs,song->file);
removeSongFromSomeAlbumTable(((ArtistData *)artist)->albums,
song);
if(((ArtistData *)artist)->songs->numberOfNodes==0) {
((ArtistData*)artist)->songs--;
if(((ArtistData *)artist)->songs<=0) {
deleteFromList(artistTable,song->tag->artist);
}
}
}
void removeSongFromSongTable(Song * song) {
deleteFromList(songTable,song->file);
}
void removeASongFromTables(Song * song) {
removeSongFromAlbumTable(song);
removeSongFromArtistTable(song);
removeSongFromSongTable(song);
}
void removeSongsFromTables(SongList * songList) {
......@@ -311,21 +140,8 @@ void removeSongsFromTables(SongList * songList) {
}
}
int printAllSongsInSongTable(FILE * fp) {
Song * song;
ListNode * node = songTable->firstNode;
while(node) {
song = (Song *)node->data;
myfprintf(fp,"file: %s\n",song->file);
node = node->nextNode;
}
return 0;
}
unsigned long numberOfSongs() {
return songTable->numberOfNodes;
return 0;
}
unsigned long numberOfArtists() {
......@@ -336,14 +152,6 @@ unsigned long numberOfAlbums() {
return albumTable->numberOfNodes;
}
Song * getSongFromSongTable(char * file) {
void * song;
if(!findInList(songTable,file,&song)) return NULL;
return song;
}
int printAllArtists(FILE * fp) {
ListNode * node = artistTable->firstNode;
......
......@@ -28,24 +28,16 @@ void closeTables();
void addSongToTables(Song * song);
int findAndPrintSongsInTable(FILE * fp, char * table, char * find);
int searchForSongsInTable(FILE * fp, char * table, char * find);
void removeSongsFromTables(SongList * songList);
void removeASongFromTables(Song * song);
int printAllSongsInSongTable(FILE * fp);
unsigned long numberOfSongs();
unsigned long numberOfArtists();
unsigned long numberOfAlbums();
Song * getSongFromSongTable(char * file);
int printAllKeysOfTable(FILE * fp, char * table, char * arg1);
#endif
......@@ -22,7 +22,6 @@
#include "sig_handlers.h"
#include "mp3_decode.h"
#include "audiofile_decode.h"
#include "char_conv.h"
#include <sys/stat.h>
#include <stdlib.h>
......@@ -57,7 +56,7 @@ void printMpdTag(FILE * fp, MpdTag * tag) {
char * getID3Info(struct id3_tag * tag, char * id) {
struct id3_frame const * frame;
id3_ucs4_t const * ucs4;
id3_latin1_t * latin1;
id3_utf8_t * utf8;
union id3_field const * field;
unsigned int nstrings;
......@@ -71,14 +70,14 @@ char * getID3Info(struct id3_tag * tag, char * id) {
ucs4 = id3_field_getstrings(field,0);
assert(ucs4);
latin1 = id3_ucs4_latin1duplicate(ucs4);
if(!latin1) return NULL;
utf8 = id3_ucs4_utf8duplicate(ucs4);
if(!utf8) return NULL;
return latin1;
return utf8;
}
#endif
MpdTag * id3Dup(char * filename) {
MpdTag * id3Dup(char * utf8filename) {
MpdTag * ret = NULL;
#ifdef HAVE_ID3TAG
struct id3_file * file;
......@@ -86,7 +85,8 @@ MpdTag * id3Dup(char * filename) {
char * str;
blockSignals();
file = id3_file_open(rmp2amp(filename),ID3_FILE_MODE_READONLY);
file = id3_file_open(rmp2amp(utf8ToFsCharset(utf8filename)),
ID3_FILE_MODE_READONLY);
if(!file) {
unblockSignals();
return NULL;
......@@ -131,9 +131,9 @@ MpdTag * id3Dup(char * filename) {
}
#ifdef HAVE_AUDIOFILE
MpdTag * audiofileTagDup(char * file) {
MpdTag * audiofileTagDup(char * utf8file) {
MpdTag * ret = NULL;
int time = getAudiofileTotalTime(rmp2amp(file));
int time = getAudiofileTotalTime(rmp2amp(utf8ToFsCharset(utf8file)));
if (time>=0) {
if(!ret) ret = newMpdTag();
......@@ -145,13 +145,13 @@ MpdTag * audiofileTagDup(char * file) {
#endif
#ifdef HAVE_MAD
MpdTag * mp3TagDup(char * file) {
MpdTag * mp3TagDup(char * utf8file) {
MpdTag * ret = NULL;
int time;
ret = id3Dup(file);
ret = id3Dup(utf8file);
time = getMp3TotalTime(rmp2amp(file));
time = getMp3TotalTime(rmp2amp(utf8ToFsCharset(utf8file)));
if(time>=0) {
if(!ret) ret = newMpdTag();
......@@ -163,7 +163,7 @@ MpdTag * mp3TagDup(char * file) {
#endif
#ifdef HAVE_OGG
MpdTag * oggTagDup(char * file) {
MpdTag * oggTagDup(char * utf8file) {
MpdTag * ret = NULL;
FILE * fp;
OggVorbis_File vf;
......@@ -172,9 +172,8 @@ MpdTag * oggTagDup(char * file) {
char * s1;
char * s2;
setCharSetConversion("LATIN1","UTF-8");
while(!(fp = fopen(rmp2amp(file),"r")) && errno==EINTR);
while(!(fp = fopen(rmp2amp(utf8ToFsCharset(utf8file)),"r"))
&& errno==EINTR);
if(!fp) return NULL;
blockSignals();
if(ov_open(fp,&vf,NULL,0)<0) {
......@@ -192,33 +191,26 @@ MpdTag * oggTagDup(char * file) {
temp = strdup(*comments);
++comments;
if(!(s1 = strtok(temp,"="))) continue;
s2 = strtok(NULL,"=");
if(0==strcasecmp(s1,"artist")) {
if(!ret->artist && s2) {
if(!(ret->artist = convStrDup(s2))) {
ret->artist = strdup(s2);
}
s2 = strtok(NULL,"");
if(!s1 || !s2);
else if(0==strcasecmp(s1,"artist")) {
if(!ret->artist) {
ret->artist = strdup(s2);
}
}
else if(0==strcasecmp(s1,"title")) {
if(!ret->title && s2) {
if(!(ret->title = convStrDup(s2))) {
ret->title = strdup(s2);
}
if(!ret->title) {
ret->title = strdup(s2);
}
}
else if(0==strcasecmp(s1,"album")) {
if(!ret->album && s2) {
if(!(ret->album = convStrDup(s2))) {
ret->album = strdup(s2);
}
if(!ret->album) {
ret->album = strdup(s2);
}
}
else if(0==strcasecmp(s1,"tracknumber")) {
if(!ret->track && s2) {
if(!(ret->track = convStrDup(s2))) {
ret->track = strdup(s2);
}
if(!ret->track) {
ret->track = strdup(s2);
}
}
free(temp);
......@@ -232,7 +224,7 @@ MpdTag * oggTagDup(char * file) {
#endif
#ifdef HAVE_FLAC
MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) {
MpdTag * ret = NULL;
FLAC__Metadata_SimpleIterator * it;
FLAC__StreamMetadata * block = NULL;
......@@ -243,7 +235,7 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
blockSignals();
it = FLAC__metadata_simple_iterator_new();
if(!FLAC__metadata_simple_iterator_init(it,rmp2amp(file),1,0)) {
if(!FLAC__metadata_simple_iterator_init(it,rmp2amp(utf8ToFsCharset(utf8file)),1,0)) {
FLAC__metadata_simple_iterator_delete(it);
unblockSignals();
return ret;
......@@ -255,8 +247,6 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
if(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
char * dup;
setCharSetConversion("LATIN1","UTF-8");
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"artist");
if(offset>=0) {
*vorbisCommentFound = 1;
......@@ -267,10 +257,7 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
if((ret->artist = convStrDup(dup))) {
free(dup);
}
else ret->artist = dup;
ret->artist = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"album");
......@@ -283,10 +270,7 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
if((ret->album = convStrDup(dup))) {
free(dup);
}
else ret->album = dup;
ret->album = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"title");
......@@ -299,10 +283,7 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
if((ret->title = convStrDup(dup))) {
free(dup);
}
else ret->title = dup;
ret->title = dup;
}
}
offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"tracknumber");
......@@ -315,10 +296,7 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
dup = malloc(len+1);
memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
dup[len] = '\0';
if((ret->track = convStrDup(dup))) {
free(dup);
}
else ret->track = dup;
ret->track = dup;
}
}
}
......@@ -337,14 +315,14 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
return ret;
}
MpdTag * flacTagDup(char * file) {
MpdTag * flacTagDup(char * utf8file) {
MpdTag * ret = NULL;
int foundVorbisComment = 0;
ret = flacMetadataDup(file,&foundVorbisComment);
ret = flacMetadataDup(utf8file,&foundVorbisComment);
if(!ret) return NULL;
if(!foundVorbisComment) {
MpdTag * temp = id3Dup(file);
MpdTag * temp = id3Dup(utf8file);
if(temp) {
temp->time = ret->time;
freeMpdTag(ret);
......
......@@ -34,19 +34,19 @@ MpdTag * newMpdTag();
void freeMpdTag(MpdTag * tag);
#ifdef HAVE_MAD
MpdTag * mp3TagDup(char * file);
MpdTag * mp3TagDup(char * utf8file);
#endif
#ifdef HAVE_OGG
MpdTag * oggTagDup(char * file);
MpdTag * oggTagDup(char * utf8file);
#endif
#ifdef HAVE_FLAC
MpdTag * flacTagDup(char * file);
MpdTag * flacTagDup(char * utf8file);
#endif
#ifdef HAVE_AUDIOFILE
MpdTag * audiofileTagDup(char * file);
MpdTag * audiofileTagDup(char * utf8file);
#endif
void printMpdTag(FILE * fp, MpdTag * tag);
......
......@@ -16,10 +16,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "volume.h"
#include "command.h"
#include "conf.h"
#include "log.h"
#include "player.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
......@@ -33,15 +36,15 @@
#include <alsa/asoundlib.h>
#endif
#define VOLUME_MIXER_TYPE_NULL 0
#define VOLUME_MIXER_TYPE_OSS 1
#define VOLUME_MIXER_TYPE_ALSA 2
#define VOLUME_MIXER_TYPE_SOFTWARE 0
#define VOLUME_MIXER_TYPE_OSS 1
#define VOLUME_MIXER_TYPE_ALSA 2
#define VOLUME_MIXER_NULL_DEFAULT ""
#define VOLUME_MIXER_SOFTWARE_DEFAULT ""
#define VOLUME_MIXER_OSS_DEFAULT "/dev/mixer"
#define VOLUME_MIXER_ALSA_DEFAULT "default"
int volume_mixerType = VOLUME_MIXER_TYPE_NULL;
int volume_mixerType = VOLUME_MIXER_TYPE_SOFTWARE;
char * volume_mixerDevice;
#ifndef NO_OSS_MIXER
......@@ -61,7 +64,7 @@ int prepOssMixer(char * device) {
int devmask = 0;
if((volume_ossFd = open(device,O_RDONLY))<0) {
ERROR1("unable to open oss mixer \"%s\"\n",device);
ERROR("unable to open oss mixer \"%s\"\n",device);
return -1;
}
......@@ -71,7 +74,7 @@ int prepOssMixer(char * device) {
int i,j;
if(ioctl(volume_ossFd,SOUND_MIXER_READ_DEVMASK,&devmask)<0) {
ERROR0("errors getting read_devmask for oss mixer\n");
ERROR("errors getting read_devmask for oss mixer\n");
close(volume_ossFd);
return -1;
}
......@@ -89,13 +92,13 @@ int prepOssMixer(char * device) {
}
if(i>=SOUND_MIXER_NRDEVICES) {
ERROR1("mixer control \"%s\" not found\n",
ERROR("mixer control \"%s\" not found\n",
getConf()[CONF_MIXER_CONTROL]);
close(volume_ossFd);
return -1;
}
else if(!( ( 1 << i ) & devmask )) {
ERROR1("mixer control \"%s\" not usable\n",
ERROR("mixer control \"%s\" not usable\n",
getConf()[CONF_MIXER_CONTROL]);
close(volume_ossFd);
return -1;
......@@ -115,8 +118,7 @@ int getOssVolumeLevel() {
int left, right, level;
if(ioctl(volume_ossFd,MIXER_READ(volume_ossControl),&level) < 0) {
while(close(volume_ossFd)<0 && errno==EINTR);
ERROR0("unable to read volume\n");
ERROR("unable to read volume\n");
return -1;
}
......@@ -124,24 +126,28 @@ int getOssVolumeLevel() {
right = (level & 0xff00) >> 8;
if(left!=right) {
ERROR2("volume for left and right is not the same, \"%i\" and "
ERROR("volume for left and right is not the same, \"%i\" and "
"\"%i\"\n",left,right);
}
return left;
}
int changeOssVolumeLevel(FILE * fp, int change) {
int changeOssVolumeLevel(FILE * fp, int change, int rel) {
int current;
int new;
int level;
if((current = getOssVolumeLevel()) < 0) {
myfprintf(fp,"%s problem getting current volume\n",COMMAND_RESPOND_ERROR);
return -1;
}
if (rel) {
if((current = getOssVolumeLevel()) < 0) {
myfprintf(fp,"%s problem getting current volume\n",
COMMAND_RESPOND_ERROR);
return -1;
}
new = current+change;
new = current+change;
}
else new = change;
if(new<0) new = 0;
else if(new>100) new = 100;
......@@ -163,27 +169,27 @@ int prepAlsaMixer(char * card) {
snd_mixer_elem_t * elem;
if((err = snd_mixer_open(&volume_alsaMixerHandle,0))<0) {
ERROR1("problems opening alsa mixer: %s\n",snd_strerror(err));
ERROR("problems opening alsa mixer: %s\n",snd_strerror(err));
return -1;
}
if((err = snd_mixer_attach(volume_alsaMixerHandle,card))<0) {
snd_mixer_close(volume_alsaMixerHandle);
ERROR1("problems problems attaching alsa mixer: %s\n",
ERROR("problems problems attaching alsa mixer: %s\n",
snd_strerror(err));
return -1;
}
if((err = snd_mixer_selem_register(volume_alsaMixerHandle,NULL,NULL))<0) {
snd_mixer_close(volume_alsaMixerHandle);
ERROR1("problems snd_mixer_selem_register'ing: %s\n",
ERROR("problems snd_mixer_selem_register'ing: %s\n",
snd_strerror(err));
return -1;
}
if((err = snd_mixer_load(volume_alsaMixerHandle))<0) {
snd_mixer_close(volume_alsaMixerHandle);
ERROR1("problems snd_mixer_selem_register'ing: %s\n",
ERROR("problems snd_mixer_selem_register'ing: %s\n",
snd_strerror(err));
return -1;
}
......@@ -241,7 +247,7 @@ int getAlsaVolumeLevel() {
if((err = snd_mixer_selem_get_playback_volume(volume_alsaElem,
SND_MIXER_SCHN_FRONT_LEFT,&level))<0) {
ERROR1("problems getting alsa volume: %s\n",snd_strerror(err));
ERROR("problems getting alsa volume: %s\n",snd_strerror(err));
return -1;
}
......@@ -252,7 +258,7 @@ int getAlsaVolumeLevel() {
return ret;
}
int changeAlsaVolumeLevel(FILE * fp, int change) {
int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
float vol;
long level;
long max = volume_alsaMax;
......@@ -263,12 +269,16 @@ int changeAlsaVolumeLevel(FILE * fp, int change) {
SND_MIXER_SCHN_FRONT_LEFT,&level))<0) {
myfprintf(fp,"%s problems getting volume\n",
COMMAND_RESPOND_ERROR);
ERROR1("problems getting alsa volume: %s\n",snd_strerror(err));
ERROR("problems getting alsa volume: %s\n",snd_strerror(err));
return -1;
}
vol = 100.0*(((float)(level-min))/(max-min));
vol+=change;
if (rel) {
vol = 100.0*(((float)(level-min))/(max-min));
vol+=change;
}
else
vol = change;
level = (long)(((vol/100.0)*(max-min)+min)+0.5);
level = level>max?max:level;
......@@ -278,7 +288,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change) {
volume_alsaElem,level))<0) {
myfprintf(fp,"%s problems setting volume\n",
COMMAND_RESPOND_ERROR);
ERROR1("problems setting alsa volume: %s\n",snd_strerror(err));
ERROR("problems setting alsa volume: %s\n",snd_strerror(err));
return -1;
}
......@@ -330,12 +340,12 @@ void initVolume() {
volume_mixerDevice = VOLUME_MIXER_OSS_DEFAULT;
}
#endif
else if(strcmp((getConf())[CONF_MIXER_TYPE],VOLUME_MIXER_NULL)==0) {
volume_mixerType = VOLUME_MIXER_TYPE_NULL;
volume_mixerDevice = VOLUME_MIXER_NULL_DEFAULT;
else if(strcmp((getConf())[CONF_MIXER_TYPE],VOLUME_MIXER_SOFTWARE)==0) {
volume_mixerType = VOLUME_MIXER_TYPE_SOFTWARE;
volume_mixerDevice = VOLUME_MIXER_SOFTWARE_DEFAULT;
}
else {
ERROR1("unknown mixer type: %s\n",(getConf())[CONF_MIXER_TYPE]);
ERROR("unknown mixer type: %s\n",(getConf())[CONF_MIXER_TYPE]);
exit(-1);
}
if(strlen((getConf())[CONF_MIXER_DEVICE])) {
......@@ -345,11 +355,15 @@ void initVolume() {
void openVolumeDevice() {
if(prepMixer(volume_mixerDevice)<0) {
ERROR0("volume support will be disabled\n");
volume_mixerType = VOLUME_MIXER_TYPE_NULL;
ERROR("using software volume\n");
volume_mixerType = VOLUME_MIXER_TYPE_SOFTWARE;
}
}
int getSoftwareVolume() {
return 50*log((getPlayerSoftwareVolume()*(M_E*M_E-1)/100.0)+1)+0.5;
}
int getVolumeLevel() {
switch(volume_mixerType) {
#ifdef HAVE_ALSA
......@@ -360,21 +374,40 @@ int getVolumeLevel() {
case VOLUME_MIXER_TYPE_OSS:
return getOssVolumeLevel();
#endif
case VOLUME_MIXER_TYPE_SOFTWARE:
return getSoftwareVolume();
default:
return -1;
}
}
int changeVolumeLevel(FILE * fp, int change) {
int changeSoftwareVolume(FILE * fp, int change, int rel) {
int new = change;
if(rel) new+=getSoftwareVolume();
if(new>100) new = 100;
else if(new<0) new = 0;
new = 100.0*(exp(new/50.0)-1)/(M_E*M_E-1)+0.5;
setPlayerSoftwareVolume(new);
return 0;
}
int changeVolumeLevel(FILE * fp, int change, int rel) {
switch(volume_mixerType) {
#ifdef HAVE_ALSA
case VOLUME_MIXER_TYPE_ALSA:
return changeAlsaVolumeLevel(fp,change);
return changeAlsaVolumeLevel(fp,change,rel);
#endif
#ifndef NO_OSS_MIXER
case VOLUME_MIXER_TYPE_OSS:
return changeOssVolumeLevel(fp,change);
return changeOssVolumeLevel(fp,change,rel);
#endif
case VOLUME_MIXER_TYPE_SOFTWARE:
return changeSoftwareVolume(fp,change,rel);
default:
myfprintf(fp,"%s no volume support!\n",COMMAND_RESPOND_ERROR);
return -1;
......
......@@ -23,7 +23,7 @@
#define VOLUME_MIXER_OSS "oss"
#define VOLUME_MIXER_ALSA "alsa"
#define VOLUME_MIXER_NULL "null"
#define VOLUME_MIXER_SOFTWARE "software"
void initVolume();
......@@ -33,6 +33,6 @@ void finishVolume();
int getVolumeLevel();
int changeVolumeLevel(FILE * fp, int change);
int changeVolumeLevel(FILE * fp, int change, int rel);
#endif
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