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)
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
4) Resume from current position in song when using state file
5) Pause now closes the music device, and reopens it on resuming
6) Fix unnecessary big endian byte swapping
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)
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)
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
docdir = $(prefix)/share/doc/$(PACKAGE)
......
......@@ -106,7 +106,7 @@ VORBIS_LIBS = @VORBIS_LIBS@
am__include = @am__include@
am__quote = @am__quote@
install_sh = @install_sh@
AUTOMAKE_OPTIONS = foreign 1.6 dist-bzip2
AUTOMAKE_OPTIONS = foreign 1.6
SUBDIRS = src doc
docdir = $(prefix)/share/doc/$(PACKAGE)
......@@ -349,13 +349,8 @@ dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
......@@ -470,13 +465,13 @@ 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-bzip2 dist-gzip distcheck distclean 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-docDATA \
install-exec install-exec-am install-exec-recursive \
install-info install-info-am install-info-recursive install-man \
dist-gzip distcheck distclean 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-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 \
......
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
# 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>.
#
......@@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='mpd'
PACKAGE_TARNAME='mpd'
PACKAGE_VERSION='0.10.2'
PACKAGE_STRING='mpd 0.10.2'
PACKAGE_VERSION='0.10.3'
PACKAGE_STRING='mpd 0.10.3'
PACKAGE_BUGREPORT='shank@mercury.chem.pitt.edu'
# Factoring default headers for most tests.
......@@ -939,7 +939,7 @@ if test "$ac_init_help" = "long"; then
# 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.
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]...
......@@ -1005,7 +1005,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of mpd 0.10.2:";;
short | recursive ) echo "Configuration of mpd 0.10.3:";;
esac
cat <<\_ACEOF
......@@ -1020,6 +1020,7 @@ Optional Features:
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-iconv disable iconv support
--disable-ipv6 disable IPv6 support
--disable-alsa disable Alsa Mixer support
--disable-ogg disable ogg support
--disable-flac disable flac support
--disable-mp3 disable mp3 support
......@@ -1141,7 +1142,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
mpd configure 0.10.2
mpd configure 0.10.3
generated by GNU Autoconf 2.57
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
......@@ -1156,7 +1157,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
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
$ $0 $@
......@@ -4676,7 +4677,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# 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
(eval $ac_compile) 2>&5
ac_status=$?
......@@ -5205,7 +5206,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
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
# So say no if there are warnings
if test -s out/conftest.err; then
......@@ -6389,7 +6390,7 @@ linux-gnu*)
libsuff=
case "$host_cpu" in
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
(eval $ac_compile) 2>&5
ac_status=$?
......@@ -7061,7 +7062,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7064 "configure"
#line 7065 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -7159,7 +7160,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7162 "configure"
#line 7163 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -7911,6 +7912,13 @@ if test "${enable_ipv6+set}" = set; then
else
enable_ipv6=yes
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.
if test "${enable_ogg+set}" = set; then
enableval="$enable_ogg"
......@@ -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
cat >conftest.$ac_ext <<_ACEOF
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
......@@ -10853,15 +10862,17 @@ _ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "AP_maGiC_VALUE" >/dev/null 2>&1; then
enable_alsa=yes
echo "$as_me:$LINENO: result: yes" >&5
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:$LINENO: result: no" >&5
enable_alsa=no
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
rm -f conftest*
fi
if test x$enable_alsa = xyes; then
echo "$as_me:$LINENO: checking for main in -lasound" >&5
......@@ -13932,7 +13943,7 @@ _ASBOX
} >&5
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
CONFIG_FILES = $CONFIG_FILES
......@@ -13995,7 +14006,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
mpd config.status 0.10.2
mpd config.status 0.10.3
configured by $0, generated by GNU Autoconf 2.57,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
......
......@@ -2,7 +2,7 @@ dnl AC_INIT(src/main.c)
dnl AM_INIT_AUTOMAKE(mpd, 0.10.0)
AC_PREREQ(2.52)
AC_INIT(mpd, 0.10.2, shank@mercury.chem.pitt.edu)
AC_INIT(mpd, 0.10.3, shank@mercury.chem.pitt.edu)
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
dnl MAD wants this stuff
......@@ -29,6 +29,7 @@ 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(alsa,[ --disable-alsa disable Alsa Mixer support],,enable_alsa=yes)
AC_ARG_ENABLE(ogg,[ --disable-ogg disable ogg support],,enable_ogg=yes)
AC_ARG_ENABLE(flac,[ --disable-flac disable flac support],,enable_flac=yes)
AC_ARG_ENABLE(mp3,[ --disable-mp3 disable mp3 support],,enable_mp3=yes)
......@@ -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!!!))
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)
AC_EGREP_CPP([AP_maGiC_VALUE],
[
if test x$enable_alsa = xyes; then
AC_MSG_CHECKING(for alsa)
AC_EGREP_CPP([AP_maGiC_VALUE],
[
#include <alsa/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
#if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=6)
AP_maGiC_VALUE
#endif
#endif
],
enable_alsa=yes
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
)
],
enable_alsa=yes
AC_MSG_RESULT([yes]),
enable_alsa=no
AC_MSG_RESULT([no])
)
fi
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)
......
......@@ -61,6 +61,12 @@ int buffer2array(char * origBuffer, char *** array) {
}
markArray[bufferLength] = '\0';
if(!count) {
free(buffer);
free(markArray);
return count;
}
beginArray = malloc(sizeof(int)*count);
(*array) = malloc(sizeof(char *)*count);
......@@ -107,6 +113,8 @@ int buffer2array(char * origBuffer, char *** array) {
void freeArgArray(char ** array, int argArrayLength) {
int i;
if(argArrayLength==0) return;
for(i=0;i<argArrayLength;i++) {
free(array[i]);
}
......
......@@ -116,6 +116,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
if(dc->start || dc->error!=DECODE_ERROR_NOERROR) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_FILE;
quitDecode(pc,dc);
return -1;
......@@ -123,6 +124,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
if(initAudio(af)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_AUDIO;
quitDecode(pc,dc);
return -1;
......@@ -180,13 +182,11 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
} \
if(pc->pause) { \
pause = !pause; \
if(pause) { \
finishAudio(); \
pc->state = PLAYER_STATE_PAUSE; \
} \
if(pause) pc->state = PLAYER_STATE_PAUSE; \
else { \
if(initAudio(NULL)<0) { \
strncpy(pc->erroredFile,pc->file,MAXPATHLEN); \
pc->erroredFile[MAXPATHLEN] = '\0'; \
pc->error = PLAYER_ERROR_AUDIO; \
quitDecode(pc,dc); \
return; \
......@@ -195,6 +195,7 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
} \
pc->pause = 0; \
kill(getppid(),SIGUSR1); \
if(pause) finishAudio(); \
} \
if(pc->seek) { \
pc->totalPlayTime+= pc->elapsedTime-pc->beginTime; \
......@@ -223,6 +224,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
while(1) {
if(dc->start) {
strncpy(dc->file,pc->file,MAXPATHLEN);
dc->file[MAXPATHLEN] = '\0';
switch(pc->decodeType) {
#ifdef HAVE_MAD
case DECODE_TYPE_MP3:
......@@ -254,6 +256,9 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
#endif
default:
ret = DECODE_ERROR_UNKTYPE;
strncpy(pc->erroredFile,dc->file,
MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
}
if(ret<0) {
dc->error = DECODE_ERROR_FILE;
......@@ -275,6 +280,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
}
else if(pid<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_SYSTEM;
return -1;
}
......
......@@ -229,7 +229,8 @@ int interfaceReadInput(Interface * interface) {
argArrayLength = buffer2array(interface->buffer,&argArray);
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;
ret = 0;
......@@ -273,14 +274,21 @@ int interfaceReadInput(Interface * interface) {
}
}
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->commandListSize =
sizeof(List);
ret = 1;
}
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);
ret = -1;
}
......
......@@ -155,58 +155,28 @@ int hasWaveSuffix(char * utf8file) {
return hasSuffix(utf8file,"wav");
}
int isWave(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasWaveSuffix(utf8file);
return 0;
}
int hasFlacSuffix(char * utf8file) {
return hasSuffix(utf8file,"flac");
}
int isFlac(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasFlacSuffix(utf8file);
return 0;
}
int hasOggSuffix(char * utf8file) {
return hasSuffix(utf8file,"ogg");
}
int isOgg(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasOggSuffix(utf8file);
return 0;
}
int hasAacSuffix(char * utf8file) {
return hasSuffix(utf8file,"aac");
}
int isAac(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasAacSuffix(utf8file);
return 0;
}
int hasMp4Suffix(char * utf8file) {
if(hasSuffix(utf8file,"mp4")) return 1;
if(hasSuffix(utf8file,"m4a")) return 1;
return 0;
}
int isMp4(char * utf8file, time_t * mtime) {
if(isFile(utf8file,mtime)) return hasMp4Suffix(utf8file);
return 0;
}
int hasMp3Suffix(char * utf8file) {
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) {
struct stat st;
......
......@@ -26,23 +26,25 @@
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);
......
......@@ -331,11 +331,15 @@ int main(int argc, char * argv[]) {
initTables();
initPlaylist();
if(!options.dbFile) {
if(!options.dbFile) {
strncpy(directorydb,playlistDir,MAXPATHLEN);
directorydb[MAXPATHLEN] = '\0';
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) {
ERROR("can't open db file and using \"--no-create-db\""
......
......@@ -150,22 +150,22 @@ int playerInit() {
}
int playerGetDecodeType(char * utf8file) {
if(0);
if(!isFile(utf8file,NULL));
#ifdef HAVE_MAD
if(isMp3(utf8file,NULL)) return DECODE_TYPE_MP3;
else if(hasMp3Suffix(utf8file)) return DECODE_TYPE_MP3;
#endif
#ifdef HAVE_OGG
if(isOgg(utf8file,NULL)) return DECODE_TYPE_OGG;
else if(hasOggSuffix(utf8file)) return DECODE_TYPE_OGG;
#endif
#ifdef HAVE_FLAC
if(isFlac(utf8file,NULL)) return DECODE_TYPE_FLAC;
else if(hasFlacSuffix(utf8file)) return DECODE_TYPE_FLAC;
#endif
#ifdef HAVE_AUDIOFILE
if(isWave(utf8file,NULL)) return DECODE_TYPE_AUDIOFILE;
else if(hasWaveSuffix(utf8file)) return DECODE_TYPE_AUDIOFILE;
#endif
#ifdef HAVE_FAAD
if(isAac(utf8file,NULL)) return DECODE_TYPE_AAC;
if(isMp4(utf8file,NULL)) return DECODE_TYPE_MP4;
else if(hasAacSuffix(utf8file)) return DECODE_TYPE_AAC;
else if(hasMp4Suffix(utf8file)) return DECODE_TYPE_MP4;
#endif
return -1;
}
......@@ -182,6 +182,7 @@ int playerPlay(FILE * fp, char * utf8file) {
struct stat st;
if(stat(rmp2amp(utf8ToFsCharset(utf8file)),&st)<0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_FILENOTFOUND;
return 0;
}
......@@ -190,12 +191,14 @@ int playerPlay(FILE * fp, char * utf8file) {
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) {
strncpy(pc->erroredFile,pc->file,MAXPATHLEN);
pc->erroredFile[MAXPATHLEN] = '\0';
pc->error = PLAYER_ERROR_UNKTYPE;
return 0;
}
pc->decodeType = decodeType;
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
pc->play = 1;
if(player_pid==0 && playerInit()<0) {
......@@ -327,6 +330,7 @@ int queueSong(char * utf8file) {
if(pc->queueState==PLAYER_QUEUE_BLANK) {
strncpy(pc->file,rmp2amp(utf8ToFsCharset(utf8file)),MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
decodeType = playerGetDecodeType(utf8file);
if(decodeType < 0) return -1;
......@@ -393,6 +397,7 @@ int playerSeek(FILE * fp, char * utf8file, float time) {
pc->decodeType = decodeType;
strncpy(pc->file,file,MAXPATHLEN);
pc->file[MAXPATHLEN] = '\0';
}
if(pc->error==PLAYER_ERROR_NOERROR) {
......
......@@ -51,6 +51,11 @@ void initPlayerData() {
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);
if(*test!='%' || perc<0 || perc>100) {
ERROR("buffered before play \"%s\" is not a positive "
......
......@@ -37,10 +37,10 @@ typedef struct _Buffer {
mpd_uint16 * chunkSize;
mpd_uint16 * bitRate;
float * times;
int begin;
int end;
int next;
int wrap;
mpd_sint16 begin;
mpd_sint16 end;
mpd_sint16 next;
mpd_sint8 wrap;
float totalTime;
} Buffer;
......
......@@ -23,7 +23,6 @@
#include "tag.h"
#include "conf.h"
#include "directory.h"
#include "stats.h"
#include "log.h"
#include "path.h"
#include "utils.h"
......@@ -642,13 +641,11 @@ int stopPlaylist(FILE * fp) {
playlist.queued = -1;
playlist_state = PLAYLIST_STATE_STOP;
playlist_noGoToNext = 0;
/*stats.playTime+=getPlayerElapsedTime();*/
if(playlist.random) randomizeOrder(0,playlist.length-1);
return 0;
}
int playPlaylistOrderNumber(FILE * fp, int orderNum) {
/*stats.songsPlayed++;*/
if(playerStop(fp)<0) return -1;
......@@ -743,11 +740,9 @@ int nextSongInPlaylist(FILE * fp) {
playlist_stopOnError = 0;
if(playlist.current<playlist.length-1) {
/*stats.playTime+=getPlayerElapsedTime();*/
return playPlaylistOrderNumber(fp,playlist.current+1);
}
else if(playlist.length && playlist.repeat) {
/*stats.playTime+=getPlayerElapsedTime();*/
if(playlist.random) randomizeOrder(0,playlist.length-1);
return playPlaylistOrderNumber(fp,0);
}
......@@ -1103,6 +1098,7 @@ int loadPlaylist(FILE * fp, char * utf8file) {
char * parent = parentPath(temp);
int parentlen = strlen(parent);
char * erroredFile = NULL;
int tempInt;
strcpy(rfile,temp);
strcat(rfile,".");
......@@ -1125,7 +1121,8 @@ int loadPlaylist(FILE * fp, char * utf8file) {
return -1;
}
while((s[slength] = fgetc(fileP))!=EOF) {
while((tempInt = fgetc(fileP))!=EOF) {
s[slength] = tempInt;
if(s[slength]=='\n' || s[slength]=='\0') {
s[slength] = '\0';
if(strncmp(s,musicDir,strlen(musicDir))==0) {
......
......@@ -57,32 +57,32 @@ Song * newSong(char * utf8file) {
song->utf8file = strdup(utf8file);
if(0);
if(!isFile(utf8file,&(song->mtime)));
#ifdef HAVE_OGG
else if(isOgg(utf8file,&(song->mtime))) {
else if(hasOggSuffix(utf8file)) {
song->tag = oggTagDup(utf8file);
}
#endif
#ifdef HAVE_FLAC
else if((isFlac(utf8file,&(song->mtime)))) {
else if((hasFlacSuffix(utf8file))) {
song->tag = flacTagDup(utf8file);
}
#endif
#ifdef HAVE_MAD
else if(isMp3(utf8file,&(song->mtime))) {
else if(hasMp3Suffix(utf8file)) {
song->tag = mp3TagDup(utf8file);
}
#endif
#ifdef HAVE_AUDIOFILE
else if(isWave(utf8file,&(song->mtime))) {
else if(hasWaveSuffix(utf8file)) {
song->tag = audiofileTagDup(utf8file);
}
#endif
#ifdef HAVE_FAAD
else if(isAac(utf8file,&(song->mtime))) {
else if(hasAacSuffix(utf8file)) {
song->tag = aacTagDup(utf8file);
}
else if(isMp4(utf8file,&(song->mtime))) {
else if(hasMp4Suffix(utf8file)) {
song->tag = mp4TagDup(utf8file);
}
#endif
......@@ -227,32 +227,32 @@ int updateSongInfo(Song * song) {
song->tag = NULL;
if(0);
if(!isFile(utf8file,&(song->mtime)));
#ifdef HAVE_OGG
else if(isOgg(utf8file,&(song->mtime))) {
else if(hasOggSuffix(utf8file)) {
song->tag = oggTagDup(utf8file);
}
#endif
#ifdef HAVE_FLAC
else if((isFlac(utf8file,&(song->mtime)))) {
else if((hasFlacSuffix(utf8file))) {
song->tag = flacTagDup(utf8file);
}
#endif
#ifdef HAVE_MAD
else if(isMp3(utf8file,&(song->mtime))) {
else if(hasMp3Suffix(utf8file)) {
song->tag = mp3TagDup(utf8file);
}
#endif
#ifdef HAVE_AUDIOFILE
else if(isWave(utf8file,&(song->mtime))) {
else if(hasWaveSuffix(utf8file)) {
song->tag = audiofileTagDup(utf8file);
}
#endif
#ifdef HAVE_FAAD
else if(isAac(utf8file,&(song->mtime))) {
else if(hasAacSuffix(utf8file)) {
song->tag = aacTagDup(utf8file);
}
else if(isMp4(utf8file,&(song->mtime))) {
else if(hasMp4Suffix(utf8file)) {
song->tag = mp4TagDup(utf8file);
}
#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