Commit 7473f7ea authored by Led's avatar Led

0.11.5-rc1

parent 3e4ef6c7
ver 0.11.5 (2004/11/1a
1) New id3v1_ecnoding config option to configure the id3v1 tag encoding (patch from dottemag)
2) Strip '\r' from m3u playlists (thank you windows)
3) Use random() instead of rand() for playlist randomizing
4) Fix a bug trying skipping some commented lines in m3u playlist files
5) Fix a bug when fetching metadata from streams that may cause certain weirdnesses
6) Fix a bug where replaygain preamp was used on files w/o replaygain tags
7) Fix a busy loop when trying to prebuffer a nonexistant or missing stream
8) Fix a bug in forgetting to remove leading ' ' in content-type for http streams
9) Check for ice-name in http headers
10) Be sure the strip all '\n' chars in tags
11) Set $HOME env variable when setuid'ing, this should fix the /root/.mcop errors triggered by arts/libao
ver 0.11.4 (2004/7/26)
1) Fixed a segfault when decoding mp3's with corrupt id3v2 tags
2) Fixed a memory leak when encountering id3v2 tags in mp3 decoder
......
......@@ -11,7 +11,7 @@
and peak's to compute the the scale for files missing
replaygain tags (make this a config file option)
*) Optimize read() on cleints
*) Optimize read() on clients
*) Add libshout && vorbis encoding support
......
......@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2003-06-17'
timestamp='2004-01-24'
# 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
......@@ -136,13 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
## for Red Hat Linux
if test -f /etc/redhat-release ; then
VENDOR=redhat ;
else
VENDOR= ;
fi
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
......@@ -228,6 +221,9 @@ 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 ;;
......@@ -314,6 +310,9 @@ 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;;
......@@ -406,6 +405,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
......@@ -741,7 +743,7 @@ EOF
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
*:UNICOS/mp:*:*)
echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
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'`
......@@ -749,6 +751,11 @@ EOF
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 ;;
......@@ -758,7 +765,7 @@ EOF
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
*:FreeBSD:*:*)
# Determine whether the default compiler uses glibc.
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
......@@ -770,7 +777,10 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$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}
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
......@@ -803,8 +813,13 @@ 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 ;;
......@@ -815,7 +830,7 @@ EOF
echo cris-axis-linux-gnu
exit 0 ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
......@@ -859,10 +874,10 @@ EOF
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
echo powerpc-${VENDOR:-unknown}-linux-gnu
echo powerpc-unknown-linux-gnu
exit 0 ;;
ppc64:Linux:*:*)
echo powerpc64-${VENDOR:-unknown}-linux-gnu
echo powerpc64-unknown-linux-gnu
exit 0 ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
......@@ -890,7 +905,7 @@ EOF
echo hppa64-unknown-linux-gnu
exit 0 ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu
echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
......@@ -902,7 +917,7 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
x86_64:Linux:*:*)
echo x86_64-${VENDOR:-unknown}-linux-gnu
echo x86_64-unknown-linux-gnu
exit 0 ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
......@@ -952,9 +967,12 @@ EOF
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
i*86:DYNIX/ptx:4*:*)
......@@ -982,6 +1000,9 @@ EOF
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 ;;
......@@ -1053,7 +1074,7 @@ EOF
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.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)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
......@@ -1168,7 +1189,7 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
......@@ -1212,6 +1233,9 @@ EOF
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit 0 ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
......
......@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2003-06-18'
timestamp='2004-01-05'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
......@@ -118,7 +118,8 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
......@@ -228,13 +229,14 @@ 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 \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k \
| ip2k | iq2000 \
| m32r | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
......@@ -247,6 +249,7 @@ case $basic_machine in
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
......@@ -257,7 +260,6 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| s390 | s390x \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
......@@ -305,7 +307,7 @@ case $basic_machine in
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* \
| ip2k-* | iq2000-* \
| m32r-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
......@@ -320,6 +322,7 @@ case $basic_machine in
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
......@@ -330,7 +333,6 @@ case $basic_machine in
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| s390-* | s390x-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
......@@ -378,6 +380,12 @@ case $basic_machine in
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
......@@ -742,6 +750,10 @@ 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
......@@ -833,6 +845,12 @@ case $basic_machine in
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
......@@ -956,6 +974,10 @@ 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
......@@ -1124,19 +1146,19 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -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* | -uxpv* | -beos* | -mpeix* | -udk* \
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -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*)
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
......@@ -1160,6 +1182,9 @@ 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|'`
;;
......@@ -1172,6 +1197,9 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
......@@ -1193,6 +1221,9 @@ case $os in
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
......@@ -1215,6 +1246,9 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
......@@ -1282,9 +1316,9 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
......@@ -1463,9 +1497,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
......
......@@ -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.11.4, shank@mercury.chem.pitt.edu)
AC_INIT(mpd, 0.11.5, shank@mercury.chem.pitt.edu)
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
dnl MAD wants this stuff
......
......@@ -77,6 +77,10 @@ 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 id3v1_encoding <charset>
This specifies the character set used for the ID3v1 tags. Supported characters
sets also can be obtained from the iconv. By default ISO8859-1 is used.
.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.
......
......@@ -39,7 +39,7 @@ static ao_device * audio_device = NULL;
static AudioFormat * audio_configFormat = NULL;
static void copyAudioFormat(AudioFormat * dest, AudioFormat * src) {
void copyAudioFormat(AudioFormat * dest, AudioFormat * src) {
dest->sampleRate = src->sampleRate;
dest->bits = src->bits;
dest->channels = src->channels;
......
......@@ -22,6 +22,7 @@
#include "../config.h"
#include "mpd_types.h"
#include "tag.h"
#include <stdio.h>
......@@ -33,6 +34,8 @@ typedef struct _AudioFormat {
volatile mpd_sint8 bits;
} AudioFormat;
void copyAudioFormat(AudioFormat * dest, AudioFormat * src);
void getOutputAudioFormat(AudioFormat * inFormat, AudioFormat * outFormat);
void initAudioConfig();
......@@ -56,4 +59,3 @@ void audioError();
int isCurrentAudioFormat(AudioFormat * audioFormat);
#endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
......@@ -37,7 +37,7 @@
#define CONF_COMMENT '#'
#define CONF_NUMBER_OF_PARAMS 34
#define CONF_NUMBER_OF_PARAMS 35
#define CONF_NUMBER_OF_PATHS 6
#define CONF_NUMBER_OF_REQUIRED 5
#define CONF_NUMBER_OF_ALLOW_CATS 1
......@@ -130,7 +130,8 @@ char ** readConf(char * file) {
"http_proxy_port",
"http_proxy_user",
"http_proxy_password",
"replaygain_preamp"
"replaygain_preamp",
"id3v1_encoding"
};
int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = {
......@@ -160,6 +161,7 @@ char ** readConf(char * file) {
int i;
int numberOfArgs;
short allowCat[CONF_NUMBER_OF_PARAMS];
int count = 0;
for(i=0;i<CONF_NUMBER_OF_PARAMS;i++) allowCat[i] = 0;
......@@ -171,19 +173,22 @@ char ** readConf(char * file) {
}
while(myFgets(string,sizeof(string),fp)) {
count++;
if(string[0]==CONF_COMMENT) continue;
numberOfArgs = buffer2array(string,&array);
if(numberOfArgs==0) continue;
if(2!=numberOfArgs) {
ERROR("improperly formated config line: %s\n",string);
ERROR("improperly formated config file at line %i: %s\n",count,string);
exit(EXIT_FAILURE);
}
i = 0;
while(i<CONF_NUMBER_OF_PARAMS && 0!=strcmp(conf_strings[i],array[0])) i++;
if(i>=CONF_NUMBER_OF_PARAMS) {
ERROR("unrecognized line in conf: %s\n",string);
ERROR("unrecognized paramater in conf at line %i: %s\n",count,string);
exit(EXIT_FAILURE);
}
if(conf_params[i]!=NULL) {
if(allowCat[i]) {
conf_params[i] = realloc(conf_params[i],
......
......@@ -55,6 +55,7 @@
#define CONF_HTTP_PROXY_USER 31
#define CONF_HTTP_PROXY_PASSWORD 32
#define CONF_REPLAYGAIN_PREAMP 33
#define CONF_ID3V1_ENCODING 34
#define CONF_CAT_CHAR "\n"
......
......@@ -115,7 +115,7 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) {
MAXPATHLEN); \
pc->erroredUrl[MAXPATHLEN] = '\0'; \
pc->error = PLAYER_ERROR_AUDIO; \
ERROR("problems opeing audio device while playing \"%s\"", pc->utf8url); \
ERROR("problems opening audio device while playing \"%s\"", pc->utf8url); \
quitDecode(pc,dc); \
return; \
} \
......@@ -157,7 +157,6 @@ int waitOnDecode(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
}
pc->totalTime = pc->fileTime;
pc->elapsedTime = 0;
pc->bitRate = 0;
pc->sampleRate = 0;
pc->bits = 0;
......@@ -228,7 +227,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
MAXPATHLEN); \
pc->erroredUrl[MAXPATHLEN] = '\0'; \
pc->error = PLAYER_ERROR_AUDIO; \
ERROR("problems opeing audio device while playing \"%s\"", pc->utf8url); \
ERROR("problems opening audio device while playing \"%s\"", pc->utf8url); \
quitDecode(pc,dc); \
return; \
} \
......@@ -286,7 +285,11 @@ void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) {
dc->start = 0;
while(!inputStreamAtEOF(&inStream) && bufferInputStream(&inStream) < 0
&& !dc->stop);
&& !dc->stop)
{
/* sleep so we don't consume 100% of the cpu */
my_usleep(1000);
}
if(dc->stop) {
dc->state = DECODE_STATE_STOP;
......@@ -461,6 +464,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
if(waitOnDecode(pc,dc,cb,&decodeWaitedOn)<0) return;
pc->elapsedTime = 0;
pc->state = PLAYER_STATE_PLAY;
pc->play = 0;
kill(getppid(),SIGUSR1);
......
......@@ -277,7 +277,7 @@ void flacError(const FLAC__SeekableStreamDecoder *dec,
ERROR("crc mismatch %s\n", data->path);
break;
default:
ERROR("unknow flac error %s\n", data->path);
ERROR("unknown flac error %s\n", data->path);
}
}
......@@ -298,7 +298,7 @@ void flacPrintErroredState(FLAC__SeekableStreamDecoderState state,
ERROR("flac seekable stream error: %s\n",file);
break;
case FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED:
ERROR("flac decoder already initilaized: %s\n",file);
ERROR("flac decoder already initialized: %s\n",file);
break;
case FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK:
ERROR("invalid flac callback\n");
......@@ -352,16 +352,16 @@ void flacParseReplayGain(const FLAC__StreamMetadata *block, FlacData * data) {
}
if(!found || state == REPLAYGAIN_TRACK) {
if(flacFindVorbisCommentFloat(block,"replaygain_track_gain",
&gain))
{
found = flacFindVorbisCommentFloat(block,
"replaygain_track_gain", &gain);
if(found) {
peak = 0.0;
flacFindVorbisCommentFloat(block,
"replaygain_track_peak",&peak);
}
}
data->replayGainScale = computeReplayGainScale(gain,peak);
if(found) data->replayGainScale = computeReplayGainScale(gain,peak);
}
void flacMetadata(const FLAC__SeekableStreamDecoder *dec,
......
......@@ -157,12 +157,16 @@ float ogg_getReplayGainScale(char ** comments) {
if(albumGainFound) {
return computeReplayGainScale(albumGain,albumPeak);
}
return computeReplayGainScale(trackGain,trackPeak);
else if(trackGainFound) {
return computeReplayGainScale(trackGain,trackPeak);
}
case REPLAYGAIN_TRACK:
if(trackGainFound) {
return computeReplayGainScale(trackGain,trackPeak);
}
return computeReplayGainScale(albumGain,albumPeak);
else if(albumGainFound) {
return computeReplayGainScale(albumGain,albumPeak);
}
}
return 1.0;
......
......@@ -570,7 +570,9 @@ static int getHTTPHello(InputStream * inStream) {
else if(0 == strncmp(cur, "\r\nicy-metaint:", 14)) {
data->icyMetaint = atoi(cur+14);
}
else if(0 == strncmp(cur, "\r\nicy-name:", 11)) {
else if(0 == strncmp(cur, "\r\nicy-name:", 11) ||
0 == strncmp(cur, "\r\nice-name:", 11))
{
int incr = 11;
char * temp = strstr(cur+incr,"\r\n");
if(!temp) break;
......@@ -601,7 +603,7 @@ static int getHTTPHello(InputStream * inStream) {
*temp = '\0';
if(inStream->mime) free(inStream->mime);
while(*(incr+cur) == ' ') incr++;
inStream->mime = strdup(cur+15);
inStream->mime = strdup(cur+incr);
*temp = '\r';
}
......
......@@ -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
......
......@@ -229,21 +229,14 @@ void establishListen(Options * options) {
void changeToUser(Options * options) {
if (options->usr && strlen(options->usr)) {
int uid, gid;
#ifdef _BSD_SOURCE
gid_t gid_list[NGROUPS_MAX];
#endif
/* get uid */
struct passwd * userpwd;
if ((userpwd = getpwnam(options->usr)) == NULL) {
ERROR("no such user: %s\n", options->usr);
exit(EXIT_FAILURE);
}
uid = userpwd->pw_uid;
gid = userpwd->pw_gid;
if(setgid(gid) == -1) {
if(setgid(userpwd->pw_gid) == -1) {
ERROR("cannot setgid of user %s: %s\n", options->usr,
strerror(errno));
exit(EXIT_FAILURE);
......@@ -253,33 +246,24 @@ void changeToUser(Options * options) {
/* 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 "
if (initgroups(options->usr, userpwd->pw_gid) == -1) {
WARNING("cannot init suplementary groups "
"of user %s: %s\n", options->usr,
strerror(errno));
exit(EXIT_FAILURE);
}
else if(setgroups(NGROUPS_MAX, gid_list) == -1) {
ERROR("cannot set groups "
"of user %s: %s\n", options->usr,
strerror(errno));
exit(EXIT_FAILURE);
}
#endif
/* set uid */
if (setuid(uid) == -1) {
if (setuid(userpwd->pw_uid) == -1) {
ERROR("cannot change to uid of user "
"%s: %s\n", options->usr,
strerror(errno));
exit(EXIT_FAILURE);
}
if(userpwd->pw_dir) {
setenv("HOME", userpwd->pw_dir, 1);
}
}
}
......
......@@ -38,7 +38,7 @@ void initMetadataChunk(MetadataChunk * chunk) {
MpdTag * metadataChunkToMpdTagDup(MetadataChunk * chunk) {
MpdTag * ret = newMpdTag();
chunk->buffer[METADATA_BUFFER_LENGTH] = '\0';
chunk->buffer[METADATA_BUFFER_LENGTH-1] = '\0';
dupElementToTag(ret->name, chunk->name);
dupElementToTag(ret->title, chunk->title);
......@@ -65,6 +65,8 @@ void copyMpdTagToMetadataChunk(MpdTag * tag, MetadataChunk * chunk) {
initMetadataChunk(chunk);
if(!tag) return;
copyStringToChunk(tag->name, chunk->name);
copyStringToChunk(tag->title, chunk->title);
copyStringToChunk(tag->artist, chunk->artist);
......
......@@ -167,7 +167,7 @@ void initPlaylist() {
memset(playlist.songs,0,sizeof(char *)*playlist_max_length);
srand(time(NULL));
srandom(time(NULL));
if(getConf()[CONF_STATE_FILE]) {
playlist_stateFile = getConf()[CONF_STATE_FILE];
......@@ -635,7 +635,7 @@ int addSongToPlaylist(FILE * fp, Song * song) {
else */if(playlist.queued>=0) start = playlist.queued+1;
else start = playlist.current+1;
if(start < playlist.length) {
swap = rand()%(playlist.length-start);
swap = random()%(playlist.length-start);
swap+=start;
swapOrder(playlist.length-1,swap);
}
......@@ -1129,7 +1129,7 @@ void randomizeOrder(int start,int end) {
}
for(i=start;i<=end;i++) {
ri = rand()%(end-start+1)+start;
ri = random()%(end-start+1)+start;
if(ri==playlist.current) playlist.current = i;
else if(i==playlist.current) playlist.current = ri;
swapOrder(i,ri);
......@@ -1220,7 +1220,7 @@ int shufflePlaylist(FILE * fp) {
}
/* shuffle the rest of the list */
for(;i<playlist.length;i++) {
ri = rand()%(playlist.length-1)+1;
ri = random()%(playlist.length-1)+1;
swapSongs(i,ri);
}
......@@ -1318,7 +1318,7 @@ int savePlaylist(FILE * fp, char * utf8file) {
int loadPlaylist(FILE * fp, char * utf8file) {
FILE * fileP;
char s[MAXPATHLEN*1];
char s[MAXPATHLEN+1];
int slength = 0;
char * temp = strdup(utf8ToFsCharset(utf8file));
char * rfile = malloc(strlen(temp)+strlen(".")+
......@@ -1328,6 +1328,7 @@ int loadPlaylist(FILE * fp, char * utf8file) {
int parentlen = strlen(parent);
char * erroredFile = NULL;
int tempInt;
int commentCharFound = 0;
strcpy(rfile,temp);
strcat(rfile,".");
......@@ -1353,7 +1354,11 @@ int loadPlaylist(FILE * fp, char * utf8file) {
while((tempInt = fgetc(fileP))!=EOF) {
s[slength] = tempInt;
if(s[slength]=='\n' || s[slength]=='\0') {
commentCharFound = 0;
s[slength] = '\0';
if(s[0]==PLAYLIST_COMMENT) {
commentCharFound = 1;
}
if(strncmp(s,musicDir,strlen(musicDir))==0) {
strcpy(s,&(s[strlen(musicDir)]));
}
......@@ -1379,7 +1384,7 @@ int loadPlaylist(FILE * fp, char * utf8file) {
temp = fsCharsetToUtf8(s);
if(!temp) continue;
temp = strdup(temp);
if(s[0]==PLAYLIST_COMMENT && !getSongFromDB(temp)
if(commentCharFound && !getSongFromDB(temp)
&& !isRemoteUrl(temp))
{
free(temp);
......@@ -1393,7 +1398,9 @@ int loadPlaylist(FILE * fp, char * utf8file) {
else if(slength==MAXPATHLEN) {
s[slength] = '\0';
commandError(fp, ACK_ERROR_PLAYLIST_LOAD,
"\"%s\" too long", s);
"line in \"%s\" is too long", utf8file);
ERROR("line \"%s\" in playlist \"%s\" is too long\n",
s, utf8file);
while(fclose(fileP) && errno==EINTR);
if(erroredFile) free(erroredFile);
return -1;
......
......@@ -23,6 +23,8 @@
#include "utf8.h"
#include "log.h"
#include "inputStream.h"
#include "conf.h"
#include "charConv.h"
#include <sys/stat.h>
#include <stdlib.h>
......@@ -54,16 +56,20 @@ void printMpdTag(FILE * fp, MpdTag * tag) {
temp = latin1StrToUtf8Dup(str); \
free(str); \
str = temp; \
stripReturnChar(str); \
} \
}
void validateUtf8Tag(MpdTag * tag) {
fixUtf8(tag->artist);
stripReturnChar(tag->artist);
fixUtf8(tag->album);
stripReturnChar(tag->artist);
fixUtf8(tag->track);
stripReturnChar(tag->artist);
fixUtf8(tag->title);
stripReturnChar(tag->artist);
fixUtf8(tag->name);
stripReturnChar(tag->artist);
}
#ifdef HAVE_ID3TAG
......@@ -87,6 +93,18 @@ char * getID3Info(struct id3_tag * tag, char * id) {
utf8 = id3_ucs4_utf8duplicate(ucs4);
if(!utf8) return NULL;
if(getConf()[CONF_ID3V1_ENCODING]
&& (id3_tag_options(tag, 0, 0) & ID3_TAG_OPTION_ID3V1)) {
char* isostr;
setCharSetConversion("ISO-8859-1", "UTF-8");
isostr = convStrDup(utf8);
free(utf8);
setCharSetConversion("UTF-8", getConf()[CONF_ID3V1_ENCODING]);
utf8 = convStrDup(isostr);
free(isostr);
}
return utf8;
}
#endif
......@@ -99,28 +117,24 @@ MpdTag * parseId3Tag(struct id3_tag * tag) {
str = getID3Info(tag,ID3_FRAME_ARTIST);
if(str) {
if(!ret) ret = newMpdTag();
stripReturnChar(str);
ret->artist = str;
}
str = getID3Info(tag,ID3_FRAME_TITLE);
if(str) {
if(!ret) ret = newMpdTag();
stripReturnChar(str);
ret->title = str;
}
str = getID3Info(tag,ID3_FRAME_ALBUM);
if(str) {
if(!ret) ret = newMpdTag();
stripReturnChar(str);
ret->album = str;
}
str = getID3Info(tag,ID3_FRAME_TRACK);
if(str) {
if(!ret) ret = newMpdTag();
stripReturnChar(str);
ret->track = str;
}
......
......@@ -32,6 +32,9 @@ char * myFgets(char * buffer, int bufferSize, FILE * fp) {
if(ret && strlen(buffer)>0 && buffer[strlen(buffer)-1]=='\n') {
buffer[strlen(buffer)-1] = '\0';
}
if(ret && strlen(buffer)>0 && buffer[strlen(buffer)-1]=='\r') {
buffer[strlen(buffer)-1] = '\0';
}
return ret;
}
......
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