Commit d691e256 authored by Led's avatar Led

0.10.3-rc1

parent e6c2faf0
ver 0.10.3 (2004/4/2)
1) Fix a segfault when a blanck line is sent from a client
2) Fix for loading playlists on platforms where char is unsigned
3) When pausing, release audio device after we say pause is successful (this makes pause appear to not lag)
4) When returning errors for unknown types by player, be sure to copy the filename
5) add --disable-alsa for disabling alsa mixer support
ver 0.10.2 (2004/3/25) ver 0.10.2 (2004/3/25)
1) Add suport for AAC 1) Add suport for AAC
2) Substitute '\n' with ' ' int tag info 2) Substitute '\n' with ' ' in tag info
3) Remove empty directories from db 3) Remove empty directories from db
4) Resume from current position in song when using state file 4) Resume from current position in song when using state file
5) Pause now closes the music device, and reopens it on resuming 5) Pause now closes the music device, and reopens it on resuming
6) Fix unnecessary big endian byte swapping 6) Fix unnecessary big endian byte swapping
7) If locale is "C" or "POSIX", then use ISO-8859-1 as the fs charset 7) If locale is "C" or "POSIX", then use ISO-8859-1 as the fs charset
8) Fix a bug where alsamixer wasn't detect volume changes 8) Fix a bug where alsa mixer wasn't detecting volume changes
9) For alsa and software mixer, show volume to be the same as it was set (even if its not the exact volume) 9) For alsa and software mixer, show volume to be the same as it was set (even if its not the exact volume)
10) Report bitrate for wave files 10) Report bitrate for wave files
11) Computer song length of CBR mp3's more accurately 11) Compute song length of CBR mp3's more accurately
ver 0.10.1 (2004/3/7) ver 0.10.1 (2004/3/7)
1) Check to see if we need to add "-lm" when linking mpd 1) Check to see if we need to add "-lm" when linking mpd
......
AUTOMAKE_OPTIONS = foreign 1.6 dist-bzip2 AUTOMAKE_OPTIONS = foreign 1.6
SUBDIRS = src doc SUBDIRS = src doc
docdir = $(prefix)/share/doc/$(PACKAGE) docdir = $(prefix)/share/doc/$(PACKAGE)
......
...@@ -106,7 +106,7 @@ VORBIS_LIBS = @VORBIS_LIBS@ ...@@ -106,7 +106,7 @@ VORBIS_LIBS = @VORBIS_LIBS@
am__include = @am__include@ am__include = @am__include@
am__quote = @am__quote@ am__quote = @am__quote@
install_sh = @install_sh@ install_sh = @install_sh@
AUTOMAKE_OPTIONS = foreign 1.6 dist-bzip2 AUTOMAKE_OPTIONS = foreign 1.6
SUBDIRS = src doc SUBDIRS = src doc
docdir = $(prefix)/share/doc/$(PACKAGE) docdir = $(prefix)/share/doc/$(PACKAGE)
...@@ -349,13 +349,8 @@ dist-gzip: distdir ...@@ -349,13 +349,8 @@ dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir) $(am__remove_distdir)
dist-bzip2: distdir
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist dist-all: distdir dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir) $(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then # This target untars the dist file and tries a VPATH configuration. Then
...@@ -470,13 +465,13 @@ uninstall-info: uninstall-info-recursive ...@@ -470,13 +465,13 @@ uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive dist dist-all \ clean-generic clean-libtool clean-recursive dist dist-all \
dist-bzip2 dist-gzip distcheck distclean distclean-generic \ dist-gzip distcheck distclean distclean-generic distclean-hdr \
distclean-hdr distclean-libtool distclean-recursive \ distclean-libtool distclean-recursive distclean-tags \
distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \ distcleancheck distdir dvi dvi-am dvi-recursive info info-am \
info info-am info-recursive install install-am install-data \ info-recursive install install-am install-data install-data-am \
install-data-am install-data-recursive install-docDATA \ install-data-recursive install-docDATA install-exec \
install-exec install-exec-am install-exec-recursive \ install-exec-am install-exec-recursive install-info \
install-info install-info-am install-info-recursive install-man \ install-info-am install-info-recursive install-man \
install-recursive install-strip installcheck installcheck-am \ install-recursive install-strip installcheck installcheck-am \
installdirs installdirs-am installdirs-recursive \ installdirs installdirs-am installdirs-recursive \
maintainer-clean maintainer-clean-generic \ maintainer-clean maintainer-clean-generic \
......
1) 24-bit pcm-tools (this may just wait since almost no one uses it)
2?) put software mixer settings in state file
3) Dealing with symlinks and new db:
a) id3 talbe: artist->album->song
song: key->title,
data->tag (add SongList of symlinks)
b) check for symlinks by comparing realpaths
c) when writing songs to db, put duplicate links
d) when reading db, check duplicate links, if duplicate link,
then just copy the tag.
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for mpd 0.10.2. # Generated by GNU Autoconf 2.57 for mpd 0.10.3.
# #
# Report bugs to <shank@mercury.chem.pitt.edu>. # Report bugs to <shank@mercury.chem.pitt.edu>.
# #
...@@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} ...@@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='mpd' PACKAGE_NAME='mpd'
PACKAGE_TARNAME='mpd' PACKAGE_TARNAME='mpd'
PACKAGE_VERSION='0.10.2' PACKAGE_VERSION='0.10.3'
PACKAGE_STRING='mpd 0.10.2' PACKAGE_STRING='mpd 0.10.3'
PACKAGE_BUGREPORT='shank@mercury.chem.pitt.edu' PACKAGE_BUGREPORT='shank@mercury.chem.pitt.edu'
# Factoring default headers for most tests. # Factoring default headers for most tests.
...@@ -939,7 +939,7 @@ if test "$ac_init_help" = "long"; then ...@@ -939,7 +939,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures mpd 0.10.2 to adapt to many kinds of systems. \`configure' configures mpd 0.10.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
...@@ -1005,7 +1005,7 @@ fi ...@@ -1005,7 +1005,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of mpd 0.10.2:";; short | recursive ) echo "Configuration of mpd 0.10.3:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
...@@ -1020,6 +1020,7 @@ Optional Features: ...@@ -1020,6 +1020,7 @@ Optional Features:
--disable-libtool-lock avoid locking (might break parallel builds) --disable-libtool-lock avoid locking (might break parallel builds)
--disable-iconv disable iconv support --disable-iconv disable iconv support
--disable-ipv6 disable IPv6 support --disable-ipv6 disable IPv6 support
--disable-alsa disable Alsa Mixer support
--disable-ogg disable ogg support --disable-ogg disable ogg support
--disable-flac disable flac support --disable-flac disable flac support
--disable-mp3 disable mp3 support --disable-mp3 disable mp3 support
...@@ -1141,7 +1142,7 @@ fi ...@@ -1141,7 +1142,7 @@ fi
test -n "$ac_init_help" && exit 0 test -n "$ac_init_help" && exit 0
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
mpd configure 0.10.2 mpd configure 0.10.3
generated by GNU Autoconf 2.57 generated by GNU Autoconf 2.57
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
...@@ -1156,7 +1157,7 @@ cat >&5 <<_ACEOF ...@@ -1156,7 +1157,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by mpd $as_me 0.10.2, which was It was created by mpd $as_me 0.10.3, which was
generated by GNU Autoconf 2.57. Invocation command line was generated by GNU Autoconf 2.57. Invocation command line was
$ $0 $@ $ $0 $@
...@@ -4676,7 +4677,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes ...@@ -4676,7 +4677,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in case $host in
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '#line 4679 "configure"' > conftest.$ac_ext echo '#line 4680 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
...@@ -5205,7 +5206,7 @@ chmod -w . ...@@ -5205,7 +5206,7 @@ chmod -w .
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no compiler_c_o=no
if { (eval echo configure:5208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then if { (eval echo configure:5209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings # So say no if there are warnings
if test -s out/conftest.err; then if test -s out/conftest.err; then
...@@ -6389,7 +6390,7 @@ linux-gnu*) ...@@ -6389,7 +6390,7 @@ linux-gnu*)
libsuff= libsuff=
case "$host_cpu" in case "$host_cpu" in
x86_64*|s390x*) x86_64*|s390x*)
echo '#line 6392 "configure"' > conftest.$ac_ext echo '#line 6393 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
...@@ -7061,7 +7062,7 @@ else ...@@ -7061,7 +7062,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7064 "configure" #line 7065 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -7159,7 +7160,7 @@ else ...@@ -7159,7 +7160,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 7162 "configure" #line 7163 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -7911,6 +7912,13 @@ if test "${enable_ipv6+set}" = set; then ...@@ -7911,6 +7912,13 @@ if test "${enable_ipv6+set}" = set; then
else else
enable_ipv6=yes enable_ipv6=yes
fi; fi;
# Check whether --enable-alsa or --disable-alsa was given.
if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa"
else
enable_alsa=yes
fi;
# Check whether --enable-ogg or --disable-ogg was given. # Check whether --enable-ogg or --disable-ogg was given.
if test "${enable_ogg+set}" = set; then if test "${enable_ogg+set}" = set; then
enableval="$enable_ogg" enableval="$enable_ogg"
...@@ -10832,9 +10840,10 @@ fi ...@@ -10832,9 +10840,10 @@ fi
echo "$as_me:$LINENO: checking for alsa" >&5 if test x$enable_alsa = xyes; then
echo "$as_me:$LINENO: checking for alsa" >&5
echo $ECHO_N "checking for alsa... $ECHO_C" >&6 echo $ECHO_N "checking for alsa... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure" #line $LINENO "configure"
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF
...@@ -10853,15 +10862,17 @@ _ACEOF ...@@ -10853,15 +10862,17 @@ _ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "AP_maGiC_VALUE" >/dev/null 2>&1; then $EGREP "AP_maGiC_VALUE" >/dev/null 2>&1; then
enable_alsa=yes enable_alsa=yes
echo "$as_me:$LINENO: result: yes" >&5 echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6 echo "${ECHO_T}yes" >&6
else else
echo "$as_me:$LINENO: result: no" >&5 enable_alsa=no
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6 echo "${ECHO_T}no" >&6
fi fi
rm -f conftest* rm -f conftest*
fi
if test x$enable_alsa = xyes; then if test x$enable_alsa = xyes; then
echo "$as_me:$LINENO: checking for main in -lasound" >&5 echo "$as_me:$LINENO: checking for main in -lasound" >&5
...@@ -13932,7 +13943,7 @@ _ASBOX ...@@ -13932,7 +13943,7 @@ _ASBOX
} >&5 } >&5
cat >&5 <<_CSEOF cat >&5 <<_CSEOF
This file was extended by mpd $as_me 0.10.2, which was This file was extended by mpd $as_me 0.10.3, which was
generated by GNU Autoconf 2.57. Invocation command line was generated by GNU Autoconf 2.57. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -13995,7 +14006,7 @@ _ACEOF ...@@ -13995,7 +14006,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\ ac_cs_version="\\
mpd config.status 0.10.2 mpd config.status 0.10.3
configured by $0, generated by GNU Autoconf 2.57, configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
......
...@@ -2,7 +2,7 @@ dnl AC_INIT(src/main.c) ...@@ -2,7 +2,7 @@ dnl AC_INIT(src/main.c)
dnl AM_INIT_AUTOMAKE(mpd, 0.10.0) dnl AM_INIT_AUTOMAKE(mpd, 0.10.0)
AC_PREREQ(2.52) AC_PREREQ(2.52)
AC_INIT(mpd, 0.10.2, shank@mercury.chem.pitt.edu) AC_INIT(mpd, 0.10.3, shank@mercury.chem.pitt.edu)
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
dnl MAD wants this stuff dnl MAD wants this stuff
...@@ -29,6 +29,7 @@ MPD_LIBS="" ...@@ -29,6 +29,7 @@ MPD_LIBS=""
AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support],,enable_iconv=yes) AC_ARG_ENABLE(iconv,[ --disable-iconv disable iconv support],,enable_iconv=yes)
AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support],,enable_ipv6=yes) AC_ARG_ENABLE(ipv6,[ --disable-ipv6 disable IPv6 support],,enable_ipv6=yes)
AC_ARG_ENABLE(alsa,[ --disable-alsa disable Alsa Mixer support],,enable_alsa=yes)
AC_ARG_ENABLE(ogg,[ --disable-ogg disable ogg support],,enable_ogg=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(flac,[ --disable-flac disable flac support],,enable_flac=yes)
AC_ARG_ENABLE(mp3,[ --disable-mp3 disable mp3 support],,enable_mp3=yes) AC_ARG_ENABLE(mp3,[ --disable-mp3 disable mp3 support],,enable_mp3=yes)
...@@ -93,20 +94,23 @@ fi ...@@ -93,20 +94,23 @@ fi
XIPH_PATH_AO(MPD_LIBS="$MPD_LIBS $AO_LIBS" MPD_CFLAGS="$MPD_CFLAGS $AO_CFLAGS",AC_MSG_ERROR(Must have libao installed!!!)) 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,enable_oss=yes,[AC_MSG_WARN(Soundcard headers not found -- disabling OSS mixer);enable_oss=no;AC_DEFINE(NO_OSS_MIXER,1,[Define to disable OSS mixer support])]) AC_CHECK_HEADER(sys/soundcard.h,enable_oss=yes,[AC_MSG_WARN(Soundcard headers not found -- disabling OSS mixer);enable_oss=no;AC_DEFINE(NO_OSS_MIXER,1,[Define to disable OSS mixer support])])
AC_MSG_CHECKING(for alsa) if test x$enable_alsa = xyes; then
AC_EGREP_CPP([AP_maGiC_VALUE], AC_MSG_CHECKING(for alsa)
[ AC_EGREP_CPP([AP_maGiC_VALUE],
[
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR) #if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
#if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=6) #if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=6)
AP_maGiC_VALUE AP_maGiC_VALUE
#endif #endif
#endif #endif
], ],
enable_alsa=yes enable_alsa=yes
AC_MSG_RESULT([yes]), AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]) enable_alsa=no
) AC_MSG_RESULT([no])
)
fi
if test x$enable_alsa = xyes; then if test x$enable_alsa = xyes; then
AC_CHECK_LIB(asound,main,[MPD_LIBS="$MPD_LIBS -lasound";AC_DEFINE(HAVE_ALSA,1,[Define if alsa support is present])],enable_alsa=no) AC_CHECK_LIB(asound,main,[MPD_LIBS="$MPD_LIBS -lasound";AC_DEFINE(HAVE_ALSA,1,[Define if alsa support is present])],enable_alsa=no)
......
...@@ -61,6 +61,12 @@ int buffer2array(char * origBuffer, char *** array) { ...@@ -61,6 +61,12 @@ int buffer2array(char * origBuffer, char *** array) {
} }
markArray[bufferLength] = '\0'; markArray[bufferLength] = '\0';
if(!count) {
free(buffer);
free(markArray);
return count;
}
beginArray = malloc(sizeof(int)*count); beginArray = malloc(sizeof(int)*count);
(*array) = malloc(sizeof(char *)*count); (*array) = malloc(sizeof(char *)*count);
...@@ -107,6 +113,8 @@ int buffer2array(char * origBuffer, char *** array) { ...@@ -107,6 +113,8 @@ int buffer2array(char * origBuffer, char *** array) {
void freeArgArray(char ** array, int argArrayLength) { void freeArgArray(char ** array, int argArrayLength) {
int i; int i;
if(argArrayLength==0) return;
for(i=0;i<argArrayLength;i++) { for(i=0;i<argArrayLength;i++) {
free(array[i]); free(array[i]);
} }
......
...@@ -116,6 +116,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc, ...@@ -116,6 +116,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
if(dc->start || dc->error!=DECODE_ERROR_NOERROR) { if(dc->start || dc->error!=DECODE_ERROR_NOERROR) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_FILE; pc->error = PLAYER_ERROR_FILE;
quitDecode(pc,dc); quitDecode(pc,dc);
return -1; return -1;
...@@ -123,6 +124,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc, ...@@ -123,6 +124,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
if(initAudio(af)<0) { if(initAudio(af)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_AUDIO; pc->error = PLAYER_ERROR_AUDIO;
quitDecode(pc,dc); quitDecode(pc,dc);
return -1; return -1;
...@@ -180,13 +182,11 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc, ...@@ -180,13 +182,11 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
} \ } \
if(pc->pause) { \ if(pc->pause) { \
pause = !pause; \ pause = !pause; \
if(pause) { \ if(pause) pc->state = PLAYER_STATE_PAUSE; \
finishAudio(); \
pc->state = PLAYER_STATE_PAUSE; \
} \
else { \ else { \
if(initAudio(NULL)<0) { \ if(initAudio(NULL)<0) { \
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); \ strncpy(pc->erroredFile,pc->file,MAXPATHLEN); \
pc->erroredFile[MAXPATHLEN] = '\0'; \
pc->error = PLAYER_ERROR_AUDIO; \ pc->error = PLAYER_ERROR_AUDIO; \
quitDecode(pc,dc); \ quitDecode(pc,dc); \
return; \ return; \
...@@ -195,6 +195,7 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc, ...@@ -195,6 +195,7 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
} \ } \
pc->pause = 0; \ pc->pause = 0; \
kill(getppid(),SIGUSR1); \ kill(getppid(),SIGUSR1); \
if(pause) finishAudio(); \
} \ } \
if(pc->seek) { \ if(pc->seek) { \
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \ pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
...@@ -223,6 +224,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af, ...@@ -223,6 +224,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
while(1) { while(1) {
if(dc->start) { if(dc->start) {
strncpy(dc->file,pc->file,MAXPATHLEN); strncpy(dc->file,pc->file,MAXPATHLEN);
dc->file[MAXPATHLEN] = '\0';
switch(pc->decodeType) { switch(pc->decodeType) {
#ifdef HAVE_MAD #ifdef HAVE_MAD
case DECODE_TYPE_MP3: case DECODE_TYPE_MP3:
...@@ -254,6 +256,9 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af, ...@@ -254,6 +256,9 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
#endif #endif
default: default:
ret = DECODE_ERROR_UNKTYPE; ret = DECODE_ERROR_UNKTYPE;
strncpy(pc->erroredFile,dc->file,
MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
} }
if(ret<0) { if(ret<0) {
dc->error = DECODE_ERROR_FILE; dc->error = DECODE_ERROR_FILE;
...@@ -275,6 +280,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af, ...@@ -275,6 +280,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
} }
else if(pid<0) { else if(pid<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_SYSTEM; pc->error = PLAYER_ERROR_SYSTEM;
return -1; return -1;
} }
......
...@@ -229,7 +229,8 @@ int interfaceReadInput(Interface * interface) { ...@@ -229,7 +229,8 @@ int interfaceReadInput(Interface * interface) {
argArrayLength = buffer2array(interface->buffer,&argArray); argArrayLength = buffer2array(interface->buffer,&argArray);
if(interface->commandList) { if(interface->commandList) {
if(strcmp(argArray[0],INTERFACE_LIST_MODE_END)==0) { if(argArrayLength==0);
else if(strcmp(argArray[0],INTERFACE_LIST_MODE_END)==0) {
ListNode * node = interface->commandList->firstNode; ListNode * node = interface->commandList->firstNode;
ret = 0; ret = 0;
...@@ -273,14 +274,21 @@ int interfaceReadInput(Interface * interface) { ...@@ -273,14 +274,21 @@ int interfaceReadInput(Interface * interface) {
} }
} }
else { else {
if(strcmp(argArray[0],INTERFACE_LIST_MODE_BEGIN)==0) { if(argArrayLength &&
strcmp(argArray[0],
INTERFACE_LIST_MODE_BEGIN)==0)
{
interface->commandList = makeList(free); interface->commandList = makeList(free);
interface->commandListSize = interface->commandListSize =
sizeof(List); sizeof(List);
ret = 1; ret = 1;
} }
else { else {
if(strcmp(argArray[0],INTERFACE_LIST_MODE_END)==0) { if(argArrayLength==0) ret = 0;
else if(strcmp(argArray[0],
INTERFACE_LIST_MODE_END)
==0)
{
myfprintf(interface->fp,"%s not in command list mode\n",COMMAND_RESPOND_ERROR); myfprintf(interface->fp,"%s not in command list mode\n",COMMAND_RESPOND_ERROR);
ret = -1; ret = -1;
} }
......
...@@ -155,58 +155,28 @@ int hasWaveSuffix(char * utf8file) { ...@@ -155,58 +155,28 @@ int hasWaveSuffix(char * utf8file) {
return hasSuffix(utf8file,"wav"); return hasSuffix(utf8file,"wav");
} }
int isWave(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasWaveSuffix(utf8file);
return 0;
}
int hasFlacSuffix(char * utf8file) { int hasFlacSuffix(char * utf8file) {
return hasSuffix(utf8file,"flac"); return hasSuffix(utf8file,"flac");
} }
int isFlac(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasFlacSuffix(utf8file);
return 0;
}
int hasOggSuffix(char * utf8file) { int hasOggSuffix(char * utf8file) {
return hasSuffix(utf8file,"ogg"); return hasSuffix(utf8file,"ogg");
} }
int isOgg(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasOggSuffix(utf8file);
return 0;
}
int hasAacSuffix(char * utf8file) { int hasAacSuffix(char * utf8file) {
return hasSuffix(utf8file,"aac"); return hasSuffix(utf8file,"aac");
} }
int isAac(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasAacSuffix(utf8file);
return 0;
}
int hasMp4Suffix(char * utf8file) { int hasMp4Suffix(char * utf8file) {
if(hasSuffix(utf8file,"mp4")) return 1; if(hasSuffix(utf8file,"mp4")) return 1;
if(hasSuffix(utf8file,"m4a")) return 1; if(hasSuffix(utf8file,"m4a")) return 1;
return 0; return 0;
} }
int isMp4(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasMp4Suffix(utf8file);
return 0;
}
int hasMp3Suffix(char * utf8file) { int hasMp3Suffix(char * utf8file) {
return hasSuffix(utf8file,"mp3"); return hasSuffix(utf8file,"mp3");
} }
int isMp3(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasMp3Suffix(utf8file);
return 0;
}
int isDir(char * utf8name, time_t * mtime) { int isDir(char * utf8name, time_t * mtime) {
struct stat st; struct stat st;
......
...@@ -26,23 +26,25 @@ ...@@ -26,23 +26,25 @@
int lsPlaylists(FILE * fp, char * utf8path); int lsPlaylists(FILE * fp, char * utf8path);
int isMp3(char * utf8file, time_t * mtime); int isFile(char * utf8file, time_t * mtime);
int isAac(char * utf8file, time_t * mtime); int isDir(char * utf8name, time_t * mtime);
int isMp4(char * utf8file, time_t * mtime); int isPlaylist(char * utf8file);
int isOgg(char * utf8file, time_t * mtime); int isMusic(char * utf8file, time_t * mtime);
int isFlac(char * utf8file, time_t * mtime); int hasWaveSuffix(char * utf8file);
int isWave(char * utf8file, time_t * mtime); int hasMp3Suffix(char * utf8file);
int isMusic(char * utf8file, time_t * mtime); int hasAacSuffix(char * utf8file);
int isDir(char * utf8name, time_t * mtime); int hasMp4Suffix(char * utf8file);
int isPlaylist(char * utf8file); int hasOggSuffix(char * utf8file);
int hasFlacSuffix(char * utf8file);
char * dupAndStripPlaylistSuffix(char * file); char * dupAndStripPlaylistSuffix(char * file);
......
...@@ -331,11 +331,15 @@ int main(int argc, char * argv[]) { ...@@ -331,11 +331,15 @@ int main(int argc, char * argv[]) {
initTables(); initTables();
initPlaylist(); initPlaylist();
if(!options.dbFile) { if(!options.dbFile) {
strncpy(directorydb,playlistDir,MAXPATHLEN); strncpy(directorydb,playlistDir,MAXPATHLEN);
directorydb[MAXPATHLEN] = '\0';
strncat(directorydb,"/.mpddb",MAXPATHLEN-strlen(playlistDir)); strncat(directorydb,"/.mpddb",MAXPATHLEN-strlen(playlistDir));
} }
else strncpy(directorydb,options.dbFile,MAXPATHLEN); else {
strncpy(directorydb,options.dbFile,MAXPATHLEN);
directorydb[MAXPATHLEN] = '\0';
}
if(options.createDB>0 || readDirectoryDB()<0) { if(options.createDB>0 || readDirectoryDB()<0) {
if(options.createDB<0) { if(options.createDB<0) {
ERROR("can't open db file and using \"--no-create-db\"" ERROR("can't open db file and using \"--no-create-db\""
......
...@@ -150,22 +150,22 @@ int playerInit() { ...@@ -150,22 +150,22 @@ int playerInit() {
} }
int playerGetDecodeType(char * utf8file) { int playerGetDecodeType(char * utf8file) {
if(0); if(!isFile(utf8file,NULL));
#ifdef HAVE_MAD #ifdef HAVE_MAD
if(isMp3(utf8file,NULL)) return DECODE_TYPE_MP3; else if(hasMp3Suffix(utf8file)) return DECODE_TYPE_MP3;
#endif #endif
#ifdef HAVE_OGG #ifdef HAVE_OGG
if(isOgg(utf8file,NULL)) return DECODE_TYPE_OGG; else if(hasOggSuffix(utf8file)) return DECODE_TYPE_OGG;
#endif #endif
#ifdef HAVE_FLAC #ifdef HAVE_FLAC
if(isFlac(utf8file,NULL)) return DECODE_TYPE_FLAC; else if(hasFlacSuffix(utf8file)) return DECODE_TYPE_FLAC;
#endif #endif
#ifdef HAVE_AUDIOFILE #ifdef HAVE_AUDIOFILE
if(isWave(utf8file,NULL)) return DECODE_TYPE_AUDIOFILE; else if(hasWaveSuffix(utf8file)) return DECODE_TYPE_AUDIOFILE;
#endif #endif
#ifdef HAVE_FAAD #ifdef HAVE_FAAD
if(isAac(utf8file,NULL)) return DECODE_TYPE_AAC; else if(hasAacSuffix(utf8file)) return DECODE_TYPE_AAC;
if(isMp4(utf8file,NULL)) return DECODE_TYPE_MP4; else if(hasMp4Suffix(utf8file)) return DECODE_TYPE_MP4;
#endif #endif
return -1; return -1;
} }
...@@ -182,6 +182,7 @@ int playerPlay(FILE * fp, char * utf8file) { ...@@ -182,6 +182,7 @@ int playerPlay(FILE * fp, char * utf8file) {
struct stat st; struct stat st;
if(stat(rmp2amp(utf8ToFsCharset(utf8file)),&st)<0) { if(stat(rmp2amp(utf8ToFsCharset(utf8file)),&st)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_FILENOTFOUND; pc->error = PLAYER_ERROR_FILENOTFOUND;
return 0; return 0;
} }
...@@ -190,12 +191,14 @@ int playerPlay(FILE * fp, char * utf8file) { ...@@ -190,12 +191,14 @@ int playerPlay(FILE * fp, char * utf8file) {
decodeType = playerGetDecodeType(utf8file); decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) { if(decodeType < 0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_UNKTYPE; pc->error = PLAYER_ERROR_UNKTYPE;
return 0; return 0;
} }
pc->decodeType = decodeType; pc->decodeType = decodeType;
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN); strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
pc->play = 1; pc->play = 1;
if(player_pid==0 && playerInit()<0) { if(player_pid==0 && playerInit()<0) {
...@@ -327,6 +330,7 @@ int queueSong(char * utf8file) { ...@@ -327,6 +330,7 @@ int queueSong(char * utf8file) {
if(pc->queueState==PLAYER_QUEUE_BLANK) { if(pc->queueState==PLAYER_QUEUE_BLANK) {
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN); strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
decodeType = playerGetDecodeType(utf8file); decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) return -1; if(decodeType < 0) return -1;
...@@ -393,6 +397,7 @@ int playerSeek(FILE * fp, char * utf8file, float time) { ...@@ -393,6 +397,7 @@ int playerSeek(FILE * fp, char * utf8file, float time) {
pc->decodeType = decodeType; pc->decodeType = decodeType;
strncpy(pc->file,file,MAXPATHLEN); strncpy(pc->file,file,MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
} }
if(pc->error==PLAYER_ERROR_NOERROR) { if(pc->error==PLAYER_ERROR_NOERROR) {
......
...@@ -51,6 +51,11 @@ void initPlayerData() { ...@@ -51,6 +51,11 @@ void initPlayerData() {
buffered_chunks = bufferSize/CHUNK_SIZE; buffered_chunks = bufferSize/CHUNK_SIZE;
if(buffered_chunks >= 1<<15) {
ERROR("buffer size \"%i\" is too big\n",bufferSize);
exit(-1);
}
perc = strtod((getConf())[CONF_BUFFER_BEFORE_PLAY],&test); perc = strtod((getConf())[CONF_BUFFER_BEFORE_PLAY],&test);
if(*test!='%' || perc<0 || perc>100) { if(*test!='%' || perc<0 || perc>100) {
ERROR("buffered before play \"%s\" is not a positive " ERROR("buffered before play \"%s\" is not a positive "
......
...@@ -37,10 +37,10 @@ typedef struct _Buffer { ...@@ -37,10 +37,10 @@ typedef struct _Buffer {
mpd_uint16 * chunkSize; mpd_uint16 * chunkSize;
mpd_uint16 * bitRate; mpd_uint16 * bitRate;
float * times; float * times;
int begin; mpd_sint16 begin;
int end; mpd_sint16 end;
int next; mpd_sint16 next;
int wrap; mpd_sint8 wrap;
float totalTime; float totalTime;
} Buffer; } Buffer;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "tag.h" #include "tag.h"
#include "conf.h" #include "conf.h"
#include "directory.h" #include "directory.h"
#include "stats.h"
#include "log.h" #include "log.h"
#include "path.h" #include "path.h"
#include "utils.h" #include "utils.h"
...@@ -642,13 +641,11 @@ int stopPlaylist(FILE * fp) { ...@@ -642,13 +641,11 @@ int stopPlaylist(FILE * fp) {
playlist.queued = -1; playlist.queued = -1;
playlist_state = PLAYLIST_STATE_STOP; playlist_state = PLAYLIST_STATE_STOP;
playlist_noGoToNext = 0; playlist_noGoToNext = 0;
/*stats.playTime+=getPlayerElapsedTime();*/
if(playlist.random) randomizeOrder(0,playlist.length-1); if(playlist.random) randomizeOrder(0,playlist.length-1);
return 0; return 0;
} }
int playPlaylistOrderNumber(FILE * fp, int orderNum) { int playPlaylistOrderNumber(FILE * fp, int orderNum) {
/*stats.songsPlayed++;*/
if(playerStop(fp)<0) return -1; if(playerStop(fp)<0) return -1;
...@@ -743,11 +740,9 @@ int nextSongInPlaylist(FILE * fp) { ...@@ -743,11 +740,9 @@ int nextSongInPlaylist(FILE * fp) {
playlist_stopOnError = 0; playlist_stopOnError = 0;
if(playlist.current<playlist.length-1) { if(playlist.current<playlist.length-1) {
/*stats.playTime+=getPlayerElapsedTime();*/
return playPlaylistOrderNumber(fp,playlist.current+1); return playPlaylistOrderNumber(fp,playlist.current+1);
} }
else if(playlist.length && playlist.repeat) { else if(playlist.length && playlist.repeat) {
/*stats.playTime+=getPlayerElapsedTime();*/
if(playlist.random) randomizeOrder(0,playlist.length-1); if(playlist.random) randomizeOrder(0,playlist.length-1);
return playPlaylistOrderNumber(fp,0); return playPlaylistOrderNumber(fp,0);
} }
...@@ -1103,6 +1098,7 @@ int loadPlaylist(FILE * fp, char * utf8file) { ...@@ -1103,6 +1098,7 @@ int loadPlaylist(FILE * fp, char * utf8file) {
char * parent = parentPath(temp); char * parent = parentPath(temp);
int parentlen = strlen(parent); int parentlen = strlen(parent);
char * erroredFile = NULL; char * erroredFile = NULL;
int tempInt;
strcpy(rfile,temp); strcpy(rfile,temp);
strcat(rfile,"."); strcat(rfile,".");
...@@ -1125,7 +1121,8 @@ int loadPlaylist(FILE * fp, char * utf8file) { ...@@ -1125,7 +1121,8 @@ int loadPlaylist(FILE * fp, char * utf8file) {
return -1; return -1;
} }
while((s[slength] = fgetc(fileP))!=EOF) { while((tempInt = fgetc(fileP))!=EOF) {
s[slength] = tempInt;
if(s[slength]=='\n' || s[slength]=='\0') { if(s[slength]=='\n' || s[slength]=='\0') {
s[slength] = '\0'; s[slength] = '\0';
if(strncmp(s,musicDir,strlen(musicDir))==0) { if(strncmp(s,musicDir,strlen(musicDir))==0) {
......
...@@ -57,32 +57,32 @@ Song * newSong(char * utf8file) { ...@@ -57,32 +57,32 @@ Song * newSong(char * utf8file) {
song->utf8file = strdup(utf8file); song->utf8file = strdup(utf8file);
if(0); if(!isFile(utf8file,&(song->mtime)));
#ifdef HAVE_OGG #ifdef HAVE_OGG
else if(isOgg(utf8file,&(song->mtime))) { else if(hasOggSuffix(utf8file)) {
song->tag = oggTagDup(utf8file); song->tag = oggTagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_FLAC #ifdef HAVE_FLAC
else if((isFlac(utf8file,&(song->mtime)))) { else if((hasFlacSuffix(utf8file))) {
song->tag = flacTagDup(utf8file); song->tag = flacTagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_MAD #ifdef HAVE_MAD
else if(isMp3(utf8file,&(song->mtime))) { else if(hasMp3Suffix(utf8file)) {
song->tag = mp3TagDup(utf8file); song->tag = mp3TagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_AUDIOFILE #ifdef HAVE_AUDIOFILE
else if(isWave(utf8file,&(song->mtime))) { else if(hasWaveSuffix(utf8file)) {
song->tag = audiofileTagDup(utf8file); song->tag = audiofileTagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_FAAD #ifdef HAVE_FAAD
else if(isAac(utf8file,&(song->mtime))) { else if(hasAacSuffix(utf8file)) {
song->tag = aacTagDup(utf8file); song->tag = aacTagDup(utf8file);
} }
else if(isMp4(utf8file,&(song->mtime))) { else if(hasMp4Suffix(utf8file)) {
song->tag = mp4TagDup(utf8file); song->tag = mp4TagDup(utf8file);
} }
#endif #endif
...@@ -227,32 +227,32 @@ int updateSongInfo(Song * song) { ...@@ -227,32 +227,32 @@ int updateSongInfo(Song * song) {
song->tag = NULL; song->tag = NULL;
if(0); if(!isFile(utf8file,&(song->mtime)));
#ifdef HAVE_OGG #ifdef HAVE_OGG
else if(isOgg(utf8file,&(song->mtime))) { else if(hasOggSuffix(utf8file)) {
song->tag = oggTagDup(utf8file); song->tag = oggTagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_FLAC #ifdef HAVE_FLAC
else if((isFlac(utf8file,&(song->mtime)))) { else if((hasFlacSuffix(utf8file))) {
song->tag = flacTagDup(utf8file); song->tag = flacTagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_MAD #ifdef HAVE_MAD
else if(isMp3(utf8file,&(song->mtime))) { else if(hasMp3Suffix(utf8file)) {
song->tag = mp3TagDup(utf8file); song->tag = mp3TagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_AUDIOFILE #ifdef HAVE_AUDIOFILE
else if(isWave(utf8file,&(song->mtime))) { else if(hasWaveSuffix(utf8file)) {
song->tag = audiofileTagDup(utf8file); song->tag = audiofileTagDup(utf8file);
} }
#endif #endif
#ifdef HAVE_FAAD #ifdef HAVE_FAAD
else if(isAac(utf8file,&(song->mtime))) { else if(hasAacSuffix(utf8file)) {
song->tag = aacTagDup(utf8file); song->tag = aacTagDup(utf8file);
} }
else if(isMp4(utf8file,&(song->mtime))) { else if(hasMp4Suffix(utf8file)) {
song->tag = mp4TagDup(utf8file); song->tag = mp4TagDup(utf8file);
} }
#endif #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