Commit ac298765 authored by Led's avatar Led

0.11.0-rc1

parent d7a18b97
Developer -> Warren Dukes <shank@mercury.chem.pitt.edu> Developer -> Warren Dukes <shank@mercury.chem.pitt.edu>
Developer -> tw-nym Developer -> tw-nym
wave File Support -> normalperson audiofile support and command.c cleanup -> normalperson
setuid patch -> Nagilum setuid patch -> Nagilum
'next' and 'previous' patch -> Niklas Hofer 'next' and 'previous' patch -> Niklas Hofer
command.c cleanup -> mackstann command.c and signal handling cleanup -> mackstann
replayGain -> AliasMrJones replayGain -> AliasMrJones
libid3tag and libmad copyrighted by Robert Leslie, http://www.underbit.com/products/mad libid3tag and libmad copyrighted by Robert Leslie, http://www.underbit.com/products/mad
......
ver 0.11.0 (2004/6/17)
1) Support for playing mp3 and Ogg Vorbis streams
2) Non-blocking Update
3) Replaygain support for Ogg Vorbis and FLAC (by Eric Moore aka AliasMrJones)
4) audio_output_format option that allows for all audio output to be converted to a format compatible with any sound card
5) Own routines for to always support UTF-8 <-> ISO-8859-1 conversion
6) Added "Id" and "Pos" metadata for songs in playlist
7) Added commands: plchanges, currentsong, playid, seekid, playlistid, moveid, swapid, deleteid
8) UTF-8 validation of all tags
9) Update specific files/directories (for fast, incremental updating)
10) Added ACK error codes
11) Mod file support
12) Added command_list_ok_begin
13) Play after stop resumes from last position in the playlist
14) Play while pause resumes playback
15) Better signal handling by mackstann
16) Cleanup decoder interface (now called InputPlugins)
17) --create-db no long starts the daemon
18) --no-daemon outputs to log files
19) --stdout sends output to stdout/stderr
20) Default port is now 6600
21) Lots of other cleanups and Bugfixes
ver 0.10.4 (2004/5/26)
1) Fix configure problems on OpenBSD with langinfo and iconv
2) Fix an infinte loop when writing to an interface and it has expired
3) Fix a segfault in decoding flac's
4) Ingore CRC stuff in mp3's since some encoders did not compute the CRC correctly
5) Fix a segfault in processing faulty mp4 metadata
ver 0.10.3 (2004/4/2) ver 0.10.3 (2004/4/2)
1) Fix a segfault when a blanck line is sent from a client 1) Fix a segfault when a blanck line is sent from a client
2) Fix for loading playlists on platforms where char is unsigned 2) Fix for loading playlists on platforms where char is unsigned
......
...@@ -29,7 +29,10 @@ FAAD2 - http://faac.sf.net ...@@ -29,7 +29,10 @@ FAAD2 - http://faac.sf.net
For MP4/AAC support. For MP4/AAC support.
Audiofile - http://www.68k.org/~michael/audiofile/ Audiofile - http://www.68k.org/~michael/audiofile/
For wave support. For wave, aiff, and au support.
libmikmod - http://mikmod.raphnet.net/
For Mod support.
Download Download
-------- --------
......
*) put some sort of error reporting for streaming/inputStream! *) put some sort of error reporting for streaming/inputStream!
*) Fix charset errors so they don't goto stderr/out
*) compute time of vorbis from actual number of samples played
*) remove previous hack for streams
Post-1.0 Post-1.0
-------- --------
1) crosslink "list" stuff, for example, artists are crosslinked to alubms and 1) crosslink "list" stuff, for example, artists are crosslinked to alubms and
......
Music Player Daemon (MPD) - UPGRADING Music Player Daemon (MPD) - UPGRADING
Upgrading to 0.11.0
-------------------
The database format has changed a little bit, but in a backward compatible way.
This means that if you upgrade to 0.11.0 from 0.10.x, you do not need to make
any changes. However, if you downgrade back to 0.10.x, then you will need
to recreate your db.
The default port for MPD is now 6600, so update your mpd and client
configurations appropriatly.
Upgrading to 0.10.0 Upgrading to 0.10.0
------------------- -------------------
......
...@@ -25,6 +25,16 @@ Command Completion: ...@@ -25,6 +25,16 @@ Command Completion:
A command returns "OK\n" on completion or "ACK some error\n" on failure. A command returns "OK\n" on completion or "ACK some error\n" on failure.
These denote the end of command execution. These denote the end of command execution.
NOTE:
-----
For manipulating playlists and playing, there are two sets of commands. One
set uses the song id of a song in the playlist, while another set uses the
playlist position of the song. The commands using song id's should be used
instead of the commands that manipulate and control playback based on playlist
position. Using song id's is a safer method when multiple clients are
interacting with MPD.
Commands: Commands:
--------- ---------
...@@ -47,10 +57,18 @@ close ...@@ -47,10 +57,18 @@ close
crossfade <int seconds> crossfade <int seconds>
sets crossfading between songs sets crossfading between songs
currentsong
displays the song info of current song (same song that is identified
in status)
delete <int song> delete <int song>
delete _song_ from playlist delete _song_ from playlist
increments playlist version by 1 increments playlist version by 1
deleteid <int songid>
delete song with _songid_ from playlist
increments playlist version by 1
find <string type> <string what> find <string type> <string what>
finds songs in the db that are exactly _what_ finds songs in the db that are exactly _what_
_type_ should be "album", "artist", or "title" _type_ should be "album", "artist", or "title"
...@@ -85,12 +103,17 @@ move <int from> <int to> ...@@ -85,12 +103,17 @@ move <int from> <int to>
move song at _from_ to _to_ in the playlist move song at _from_ to _to_ in the playlist
increments playlist version by 1 increments playlist version by 1
move <int songid> <int to>
move song with _songid_ to _to_ in the playlist
increments playlist version by 1
next next
plays next song in playlist plays next song in playlist
pause <bool pause> pause <bool pause>
toggle pause/resume playing toggle pause/resume playing
_pause_ is optional and should be 0 or 1 _pause_ is required and should be 0 or 1
NOTE: use of pause command w/o the _pause_ argument is depricated
password <string password> password <string password>
this is used for authentication with the server. this is used for authentication with the server.
...@@ -102,6 +125,9 @@ ping ...@@ -102,6 +125,9 @@ ping
play <int song> play <int song>
begin playing playlist at song number _song_, _song_ is optional begin playing playlist at song number _song_, _song_ is optional
playid <int songid>
begin playing playlist at song with _songid_, _songid_ is optional
playlist playlist
displays the current playlist displays the current playlist
NOTE: do not use this, instead use 'playlistinfo' NOTE: do not use this, instead use 'playlistinfo'
...@@ -110,9 +136,15 @@ playlistinfo <int song> ...@@ -110,9 +136,15 @@ playlistinfo <int song>
displays list of songs in the playlist displays list of songs in the playlist
_song_ is optional and species a single song to displa info for _song_ is optional and species a single song to displa info for
playlistiid <int songid>
displays list of songs in the playlist
_songid_ is optional and species a single song to display info for
plchanges <playlist version> plchanges <playlist version>
displays changed songs currently in the playlist since displays changed songs currently in the playlist since
_playlist version_ _playlist version_
NOTE: to detect songs that were deleted at the end of the playlist,
use playlistlength returned by status command.
previous previous
plays previous song in playlist plays previous song in playlist
...@@ -138,6 +170,9 @@ seek <int song> <int time> ...@@ -138,6 +170,9 @@ seek <int song> <int time>
seeks to the position _time_ (in seconds) of entry _song_ in the seeks to the position _time_ (in seconds) of entry _song_ in the
playlist playlist
seekid <int songid> <int time>
seeks to the position _time_ (in seconds) of song with _songid_
setvol <int vol> setvol <int vol>
set volume to _vol_ set volume to _vol_
_vol_ the range of volume is 0-100 _vol_ the range of volume is 0-100
...@@ -163,7 +198,8 @@ status ...@@ -163,7 +198,8 @@ status
playlist: (31-bit unsigned integer, the playlist version number) playlist: (31-bit unsigned integer, the playlist version number)
playlistlength: (integer, the length of the playlist) playlistlength: (integer, the length of the playlist)
state: ("play", "stop", or "pause") state: ("play", "stop", or "pause")
song: (current song playing/paused, playlist song number) song: (current song stopped on or playing, playlist song number)
songid: (current song stopped on or playing, playlist songid)
time: <int elapsed>:<time total> (of current playing/paused song) time: <int elapsed>:<time total> (of current playing/paused song)
bitrate: <int bitrate> (instantaneous bitrate in kbps) bitrate: <int bitrate> (instantaneous bitrate in kbps)
xfade: <int seconds> (crossfade in seconds) xfade: <int seconds> (crossfade in seconds)
...@@ -178,6 +214,10 @@ swap <int song1> <int song2> ...@@ -178,6 +214,10 @@ swap <int song1> <int song2>
swap positions of _song1_ and _song2_ swap positions of _song1_ and _song2_
increments playlist version by 1 increments playlist version by 1
swapid <int songid1> <int songid2>
swap positions of of songs with song id's of _songid1_ and _songid2_
increments playlist version by 1
update <string path> update <string path>
searches mp3 directory for new music and removes old music from the db searches mp3 directory for new music and removes old music from the db
_path_ is an optional argument that maybe a particular directory or _path_ is an optional argument that maybe a particular directory or
...@@ -187,8 +227,10 @@ update <string path> ...@@ -187,8 +227,10 @@ update <string path>
where job id, is the job id requested for your update, and is displayed where job id, is the job id requested for your update, and is displayed
in status, while the requested update is happening in status, while the requested update is happening
increments playlist version by 1 increments playlist version by 1
NOTE: to update a number of paths/songs at once, use command_list, NOTE: To update a number of paths/songs at once, use command_list,
it will be much more faster/effecient it will be much more faster/effecient. Also, if you use a
command_list for updating, only one update_db job id will be returned
per sequence of updates.
volume <int change> volume <int change>
change volume by amount _change_ change volume by amount _change_
......
...@@ -24,15 +24,21 @@ can be specified on the command line: PORT, MUSIC_DIR, PLAYLIST_DIR, LOG_FILE, ...@@ -24,15 +24,21 @@ can be specified on the command line: PORT, MUSIC_DIR, PLAYLIST_DIR, LOG_FILE,
Read more about MPD on http://www.musicpd.org Read more about MPD on http://www.musicpd.org
.SH OPTIONS .SH OPTIONS
.TP .TP
.B --create-db .BI --create-db
(Re)Crete the db file for mpd. (Re)Crete the db file for mpd.
.TP .TP
.BI --help .BI --help
Output a brief help message.
.br .br
Output a brief help message.
.TP
.BI --no-create-db
Do not create the db file for mpd, even if it doesn't exist.
.TP .TP
.BI --no-daemon .BI --no-daemon
Don't detach from console or redirect output to log files. Don't detach from console.
.TP
.BI --stdout
Don't redirect output to log files.
.TP .TP
.BI --verbose .BI --verbose
Output verbose amounts of information to the logs Output verbose amounts of information to the logs
...@@ -116,10 +122,16 @@ This specifies which mixer control to use (sometimes referred to as the "device" ...@@ -116,10 +122,16 @@ This specifies which mixer control to use (sometimes referred to as the "device"
.B max_playlist_length <int> .B max_playlist_length <int>
This specifies the maximum number of songs that can be in the playlist. The default is 4096 songs. This specifies the maximum number of songs that can be in the playlist. The default is 4096 songs.
.TP .TP
.B buffer_size <size in KB> .B audio_buffer_size <size in KB>
This specifies the size of the buffer that mpd uses. The default is 2048 kilobytes. This specifies the size of the audio output buffer that mpd uses. The default is 2048 kilobytes.
.B buffer_before play <0-100%> .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%. This specifies the amount of the audio buffer that will be filled before a song begins playing. The default is 25%.
.TP
.B audio_output_format <sample_rate:bits:channels>
This specifies the format all decoded audio should be converted to for playing. This options is useful if your sound card only supports a limited number of sample rates and if you want to ensure all transitions between songs are crossfaded/gapless. This option is not recommended for all users because it can cause a reduction in sound quality. The two most common formats are "48000:16:2" and "44100:16:2".
.TP
.B replaygain <album or track>
This specifies whether to use replaygain tags (currently only supported for FLAC and Ogg Vorbis formats).
.TP .TP
.B max_command_list_size <size in KB> .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. This specifies the maximum size a command list can be (in kilobytes). The default is 2048 kilobytes.
...@@ -195,7 +207,7 @@ max_playlist_length "4096" ...@@ -195,7 +207,7 @@ max_playlist_length "4096"
.br .br
buffer_before_play "25%" buffer_before_play "25%"
.br .br
buffer_size "2048" audio_buffer_size "2048"
.br .br
#db_file "~/playlists/.mpddb" #db_file "~/playlists/.mpddb"
.br .br
...@@ -226,5 +238,7 @@ bind_to_address "any" ...@@ -226,5 +238,7 @@ bind_to_address "any"
#default_permissions "read,add,control,admin" #default_permissions "read,add,control,admin"
.br .br
#filesystem_charset "UTF-8" #filesystem_charset "UTF-8"
.br
#replaygain "album"
.SH SEE ALSO .SH SEE ALSO
mpc(1) mpc(1)
...@@ -68,11 +68,13 @@ error_file "~/.mpd/mpd.error" ...@@ -68,11 +68,13 @@ error_file "~/.mpd/mpd.error"
# misc audio output options # misc audio output options
#audio_write_size "1024" #audio_write_size "1024"
# use track or album replaygain
#replaygain "album"
################################## ##################################
#### OUTPUT BUFFER SETTINGS ###### #### OUTPUT BUFFER SETTINGS ######
#buffer_size "2048" #audio_buffer_size "2048"
#buffer_before_play "25%" #buffer_before_play "25%"
################################## ##################################
......
#ifndef ACK_H #ifndef ACK_H
#define ACK_H #define ACK_H
/* Common Errors */
#define ACK_ERROR_NOT_LIST 1 #define ACK_ERROR_NOT_LIST 1
#define ACK_ERROR_ARG 2 #define ACK_ERROR_ARG 2
#define ACK_ERROR_PASSWORD 3 #define ACK_ERROR_PASSWORD 3
#define ACK_ERROR_PERMISSION 4 #define ACK_ERROR_PERMISSION 4
#define ACK_ERROR_UNKNOWN 5 #define ACK_ERROR_UNKNOWN 5
#define ACK_ERROR_NO_EXIST 6
#define ACK_ERROR_PLAYLIST_MAX 7 #define ACK_ERROR_NO_EXIST 50
#define ACK_ERROR_SYSTEM 8 #define ACK_ERROR_PLAYLIST_MAX 51
#define ACK_ERROR_PLAYLIST_LOAD 9 #define ACK_ERROR_SYSTEM 52
#define ACK_ERROR_UPDATE_ALREADY 10 #define ACK_ERROR_PLAYLIST_LOAD 53
#define ACK_ERROR_PLAYER_SYNC 11 #define ACK_ERROR_UPDATE_ALREADY 54
#define ACK_ERROR_EXIST 12 #define ACK_ERROR_PLAYER_SYNC 55
#define ACK_ERROR_EXIST 56
#endif #endif
...@@ -256,7 +256,7 @@ int playAudio(char * playChunk, int size) { ...@@ -256,7 +256,7 @@ int playAudio(char * playChunk, int size) {
int send; int send;
if(audio_device==NULL) { if(audio_device==NULL) {
ERROR("trying to play w/ the audio device being open!\n"); ERROR("trying to play w/o the audio device being open!\n");
return -1; return -1;
} }
...@@ -302,4 +302,3 @@ void audioError() { ...@@ -302,4 +302,3 @@ void audioError() {
} }
#endif #endif
} }
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
#define COMMAND_CROSSFADE "crossfade" #define COMMAND_CROSSFADE "crossfade"
#define COMMAND_URL_HANDLERS "urlhandlers" #define COMMAND_URL_HANDLERS "urlhandlers"
#define COMMAND_PLCHANGES "plchanges" #define COMMAND_PLCHANGES "plchanges"
#define COMMAND_CURRENT "current" #define COMMAND_CURRENTSONG "currentsong"
#define COMMAND_STATUS_VOLUME "volume" #define COMMAND_STATUS_VOLUME "volume"
#define COMMAND_STATUS_STATE "state" #define COMMAND_STATUS_STATE "state"
...@@ -185,7 +185,7 @@ int handlePlayId(FILE * fp, unsigned int * permission, int argArrayLength, ...@@ -185,7 +185,7 @@ int handlePlayId(FILE * fp, unsigned int * permission, int argArrayLength,
return -1; return -1;
} }
} }
return playPlaylist(fp, id, 0); return playPlaylistById(fp, id, 0);
} }
int handleStop(FILE * fp, unsigned int * permission, int argArrayLength, int handleStop(FILE * fp, unsigned int * permission, int argArrayLength,
...@@ -194,7 +194,7 @@ int handleStop(FILE * fp, unsigned int * permission, int argArrayLength, ...@@ -194,7 +194,7 @@ int handleStop(FILE * fp, unsigned int * permission, int argArrayLength,
return stopPlaylist(fp); return stopPlaylist(fp);
} }
int handleCurrent(FILE * fp, unsigned int * permission, int argArrayLength, int handleCurrentSong(FILE * fp, unsigned int * permission, int argArrayLength,
char ** argArray) char ** argArray)
{ {
int song = getPlaylistCurrentSong(); int song = getPlaylistCurrentSong();
...@@ -327,7 +327,7 @@ int handleDeleteId(FILE * fp, unsigned int * permission, int argArrayLength, ...@@ -327,7 +327,7 @@ int handleDeleteId(FILE * fp, unsigned int * permission, int argArrayLength,
"need a positive integer"); "need a positive integer");
return -1; return -1;
} }
return deleteFromPlaylist(fp, id); return deleteFromPlaylistById(fp, id);
} }
int handlePlaylist(FILE * fp, unsigned int * permission, int argArrayLength, int handlePlaylist(FILE * fp, unsigned int * permission, int argArrayLength,
...@@ -664,7 +664,7 @@ int handleSwapId(FILE * fp, unsigned int * permission, int argArrayLength, ...@@ -664,7 +664,7 @@ int handleSwapId(FILE * fp, unsigned int * permission, int argArrayLength,
argArray[2]); argArray[2]);
return -1; return -1;
} }
return swapSongsInPlaylist(fp, id1, id2); return swapSongsInPlaylistById(fp, id1, id2);
} }
int handleSeek(FILE * fp, unsigned int * permission, int argArrayLength, int handleSeek(FILE * fp, unsigned int * permission, int argArrayLength,
...@@ -708,7 +708,7 @@ int handleSeekId(FILE * fp, unsigned int * permission, int argArrayLength, ...@@ -708,7 +708,7 @@ int handleSeekId(FILE * fp, unsigned int * permission, int argArrayLength,
"\"%s\" is not a integer", argArray[2]); "\"%s\" is not a integer", argArray[2]);
return -1; return -1;
} }
return seekSongInPlaylist(fp, id, time); return seekSongInPlaylistById(fp, id, time);
} }
int handleListAllInfo(FILE * fp, unsigned int * permission, int argArrayLength, int handleListAllInfo(FILE * fp, unsigned int * permission, int argArrayLength,
...@@ -761,7 +761,7 @@ void initCommands() { ...@@ -761,7 +761,7 @@ void initCommands() {
addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay,NULL); addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay,NULL);
addCommand(COMMAND_PLAYID ,PERMISSION_CONTROL, 0, 1,handlePlayId,NULL); addCommand(COMMAND_PLAYID ,PERMISSION_CONTROL, 0, 1,handlePlayId,NULL);
addCommand(COMMAND_STOP ,PERMISSION_CONTROL, 0, 0,handleStop,NULL); addCommand(COMMAND_STOP ,PERMISSION_CONTROL, 0, 0,handleStop,NULL);
addCommand(COMMAND_CURRENT ,PERMISSION_READ , 0, 0,handleCurrent,NULL); addCommand(COMMAND_CURRENTSONG ,PERMISSION_READ , 0, 0,handleCurrentSong,NULL);
addCommand(COMMAND_PAUSE ,PERMISSION_CONTROL, 0, 1,handlePause,NULL); addCommand(COMMAND_PAUSE ,PERMISSION_CONTROL, 0, 1,handlePause,NULL);
addCommand(COMMAND_STATUS ,PERMISSION_READ, 0, 0,commandStatus,NULL); addCommand(COMMAND_STATUS ,PERMISSION_READ, 0, 0,commandStatus,NULL);
addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill,NULL); addCommand(COMMAND_KILL ,PERMISSION_ADMIN, -1,-1,handleKill,NULL);
......
...@@ -123,7 +123,7 @@ char ** readConf(char * file) { ...@@ -123,7 +123,7 @@ char ** readConf(char * file) {
"filesystem_charset", "filesystem_charset",
"password", "password",
"default_permissions", "default_permissions",
"buffer_size", "audio_buffer_size",
"replaygain", "replaygain",
"audio_output_format" "audio_output_format"
}; };
......
...@@ -161,16 +161,16 @@ int waitOnDecode(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, ...@@ -161,16 +161,16 @@ int waitOnDecode(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
} }
int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
int * decodeWaitedOn) int * decodeWaitedOn, int * next)
{ {
int ret = -1; int ret = -1;
if(decode_pid && *decode_pid>0) { if(decode_pid && *decode_pid>0) {
cb->next = -1;
if(dc->state==DECODE_STATE_STOP || dc->error || if(dc->state==DECODE_STATE_STOP || dc->error ||
strcmp(dc->utf8url, pc->utf8url)!=0) strcmp(dc->utf8url, pc->utf8url)!=0)
{ {
stopDecode(dc); stopDecode(dc);
*next = -1;
cb->begin = 0; cb->begin = 0;
cb->end = 0; cb->end = 0;
dc->error = 0; dc->error = 0;
...@@ -180,6 +180,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, ...@@ -180,6 +180,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
if(*decode_pid>0 && dc->state!=DECODE_STATE_STOP && if(*decode_pid>0 && dc->state!=DECODE_STATE_STOP &&
dc->seekable) dc->seekable)
{ {
*next = -1;
dc->seekWhere = pc->seekWhere > pc->totalTime-0.1 ? dc->seekWhere = pc->seekWhere > pc->totalTime-0.1 ?
pc->totalTime-0.1 : pc->totalTime-0.1 :
pc->seekWhere; pc->seekWhere;
...@@ -230,7 +231,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb, ...@@ -230,7 +231,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
if(pause) closeAudioDevice(); \ if(pause) closeAudioDevice(); \
} \ } \
if(pc->seek) { \ if(pc->seek) { \
if(decodeSeek(pc,dc,cb,&decodeWaitedOn) == 0) { \ if(decodeSeek(pc,dc,cb,&decodeWaitedOn,&next) == 0) { \
doCrossFade = 0; \ doCrossFade = 0; \
nextChunk = -1; \ nextChunk = -1; \
bbp = 0; \ bbp = 0; \
...@@ -445,6 +446,8 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { ...@@ -445,6 +446,8 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
int previousMetadataChunk = -1; int previousMetadataChunk = -1;
MetadataChunk currentMetadataChunk; MetadataChunk currentMetadataChunk;
int currentChunkSent = 1; int currentChunkSent = 1;
int end;
int next = -1;
memset(silence,0,CHUNK_SIZE); memset(silence,0,CHUNK_SIZE);
...@@ -472,12 +475,12 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { ...@@ -472,12 +475,12 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
pc->queueState==PLAYER_QUEUE_FULL && pc->queueState==PLAYER_QUEUE_FULL &&
pc->queueLockState==PLAYER_QUEUE_UNLOCKED) pc->queueLockState==PLAYER_QUEUE_UNLOCKED)
{ {
cb->next = cb->end; next = cb->end;
dc->start = 1; dc->start = 1;
pc->queueState = PLAYER_QUEUE_DECODE; pc->queueState = PLAYER_QUEUE_DECODE;
kill(getppid(),SIGUSR1); kill(getppid(),SIGUSR1);
} }
if(cb->next>=0 && doCrossFade==0 && !dc->start) { if(next>=0 && doCrossFade==0 && !dc->start) {
nextChunk = -1; nextChunk = -1;
if(isCurrentAudioFormat(&(cb->audioFormat))) { if(isCurrentAudioFormat(&(cb->audioFormat))) {
doCrossFade = 1; doCrossFade = 1;
...@@ -492,21 +495,26 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { ...@@ -492,21 +495,26 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
} }
else doCrossFade = -1; else doCrossFade = -1;
} }
/* copy thse to locale variables to prevent any potential
race conditions and weirdness */
end = cb->end;
if(pause) my_usleep(10000); if(pause) my_usleep(10000);
else if(cb->begin!=cb->end && cb->begin!=cb->next) { else if(cb->begin!=end && cb->begin!=next) {
if(doCrossFade==1 && cb->next>=0 && if(doCrossFade==1 && next>=0 &&
((cb->next>cb->begin && ((next>cb->begin &&
(fadePosition=cb->next-cb->begin) (fadePosition=next-cb->begin)
<=crossFadeChunks) || <=crossFadeChunks) ||
(cb->begin>cb->next && (cb->begin>next &&
(fadePosition=cb->next-cb->begin+ (fadePosition=next-cb->begin+
buffered_chunks)<=crossFadeChunks))) buffered_chunks)<=crossFadeChunks)))
{ {
if(nextChunk<0) { if(nextChunk<0) {
crossFadeChunks = fadePosition; crossFadeChunks = fadePosition;
} }
test = cb->end; test = end;
if(cb->end < cb->begin) test+=buffered_chunks; if(end < cb->begin) test+=buffered_chunks;
nextChunk = cb->begin+crossFadeChunks; nextChunk = cb->begin+crossFadeChunks;
if(nextChunk<test) { if(nextChunk<test) {
if(nextChunk>=buffered_chunks) if(nextChunk>=buffered_chunks)
...@@ -558,11 +566,11 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { ...@@ -558,11 +566,11 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
cb->begin = 0; cb->begin = 0;
} }
} }
else if(cb->next==cb->begin) { else if(next==cb->begin) {
if(doCrossFade==1 && nextChunk>=0) { if(doCrossFade==1 && nextChunk>=0) {
nextChunk = cb->begin+crossFadeChunks; nextChunk = cb->begin+crossFadeChunks;
test = cb->end; test = cb->end;
if(cb->end < cb->begin) test+=buffered_chunks; if(end < cb->begin) test+=buffered_chunks;
if(nextChunk<test) { if(nextChunk<test) {
if(nextChunk>=buffered_chunks) if(nextChunk>=buffered_chunks)
{ {
...@@ -590,7 +598,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { ...@@ -590,7 +598,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
break; break;
} }
else { else {
cb->next = -1; next = -1;
if(waitOnDecode(pc,dc,cb,&decodeWaitedOn)<0) { if(waitOnDecode(pc,dc,cb,&decodeWaitedOn)<0) {
return; return;
} }
...@@ -633,7 +641,6 @@ void decode() { ...@@ -633,7 +641,6 @@ void decode() {
pc = &(getPlayerData()->playerControl); pc = &(getPlayerData()->playerControl);
dc = &(getPlayerData()->decoderControl); dc = &(getPlayerData()->decoderControl);
dc->error = 0; dc->error = 0;
cb->next = -1;
dc->seek = 0; dc->seek = 0;
dc->stop = 0; dc->stop = 0;
dc->start = 1; dc->start = 1;
......
...@@ -931,7 +931,7 @@ int readDirectoryDB() { ...@@ -931,7 +931,7 @@ int readDirectoryDB() {
char * tempCharset; char * tempCharset;
if(foundFsCharset) { if(foundFsCharset) {
ERROR("already found " WARNING("already found "
"fs charset in db\n"); "fs charset in db\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -944,11 +944,11 @@ int readDirectoryDB() { ...@@ -944,11 +944,11 @@ int readDirectoryDB() {
getConf()[CONF_FS_CHARSET]) && getConf()[CONF_FS_CHARSET]) &&
strcmp(fsCharset,tempCharset)) strcmp(fsCharset,tempCharset))
{ {
ERROR("Using \"%s\" for the " WARNING("Using \"%s\" for the "
"filesystem charset " "filesystem charset "
"instead of \"%s\"\n", "instead of \"%s\"\n",
fsCharset,tempCharset); fsCharset,tempCharset);
ERROR("maybe you need to " WARNING("maybe you need to "
"recreate the db?\n"); "recreate the db?\n");
setFsCharset(fsCharset); setFsCharset(fsCharset);
} }
...@@ -1275,4 +1275,3 @@ Song * getSongFromDB(char * file) { ...@@ -1275,4 +1275,3 @@ Song * getSongFromDB(char * file) {
time_t getDbModTime() { time_t getDbModTime() {
return directory_dbModTime; return directory_dbModTime;
} }
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
...@@ -318,7 +318,8 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) ...@@ -318,7 +318,8 @@ int ogg_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
sendDataToOutputBuffer(cb, inStream, dc, sendDataToOutputBuffer(cb, inStream, dc,
inStream->seekable, inStream->seekable,
chunk, chunkpos, chunk, chunkpos,
ov_time_tell(&vf), ov_pcm_tell(&vf)/
dc->audioFormat.sampleRate,
bitRate); bitRate);
if(dc->stop) break; if(dc->stop) break;
......
...@@ -20,10 +20,16 @@ ...@@ -20,10 +20,16 @@
#include "conf.h" #include "conf.h"
#include "myfprintf.h" #include "myfprintf.h"
#include "utils.h"
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h>
int logLevel = LOG_LEVEL_LOW; int logLevel = LOG_LEVEL_LOW;
short warningFlushed = 0;
static char * warningBuffer = NULL;
void initLog() { void initLog() {
if(strcmp(getConf()[CONF_LOG_LEVEL],"default")==0) { if(strcmp(getConf()[CONF_LOG_LEVEL],"default")==0) {
...@@ -37,4 +43,37 @@ void initLog() { ...@@ -37,4 +43,37 @@ void initLog() {
} }
else ERROR("unknown log level \"%s\"\n",getConf()[CONF_LOG_LEVEL]); else ERROR("unknown log level \"%s\"\n",getConf()[CONF_LOG_LEVEL]);
} }
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
#define BUFFER_LENGTH 4096
void bufferWarning(char * format, ... ) {
va_list arglist;
char temp[BUFFER_LENGTH+1];
memset(temp, 0, BUFFER_LENGTH+1);
va_start(arglist, format);
vsnprintf(temp, BUFFER_LENGTH, format, arglist);
warningBuffer = appendToString(warningBuffer, temp);
va_end(arglist);
}
void flushWarningLog() {
char * s;
if(warningBuffer == NULL) return;
s = strtok(warningBuffer, "\n");
while ( s != NULL ) {
myfprintf(stderr, "%s\n", s);
s = strtok(NULL, "\n");
}
free(warningBuffer);
warningBuffer = NULL;
warningFlushed = 1;
}
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define LOG_LEVEL_DEBUG 2 #define LOG_LEVEL_DEBUG 2
extern int logLevel; extern int logLevel;
extern short warningFlushed;
#define ERROR(...) myfprintf(stderr, __VA_ARGS__) #define ERROR(...) myfprintf(stderr, __VA_ARGS__)
...@@ -40,7 +41,15 @@ extern int logLevel; ...@@ -40,7 +41,15 @@ extern int logLevel;
#define DEBUG(...) if(logLevel>=LOG_LEVEL_DEBUG) \ #define DEBUG(...) if(logLevel>=LOG_LEVEL_DEBUG) \
myfprintf(stdout, __VA_ARGS__) myfprintf(stdout, __VA_ARGS__)
#define WARNING(...) { \
if(warningFlushed) myfprintf(stderr, __VA_ARGS__); \
else bufferWarning(__VA_ARGS__); \
}
void initLog(); void initLog();
void bufferWarning(char * format, ... );
void flushWarningLog();
#endif #endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
...@@ -68,7 +68,7 @@ int isValidRemoteUtf8Url(char * utf8url) { ...@@ -68,7 +68,7 @@ int isValidRemoteUtf8Url(char * utf8url) {
temp = utf8url; temp = utf8url;
while(*temp) { while(*temp) {
if((*temp >= 'a' && *temp <= 'z') || if((*temp >= 'a' && *temp <= 'z') ||
(*temp >= 'A' && *temp <= 'z') || (*temp >= 'A' && *temp <= 'Z') ||
(*temp >= '0' && *temp <= '9') || (*temp >= '0' && *temp <= '9') ||
*temp == '$' || *temp == '$' ||
*temp == '-' || *temp == '-' ||
......
...@@ -124,10 +124,12 @@ void parseOptions(int argc, char ** argv, Options * options) { ...@@ -124,10 +124,12 @@ void parseOptions(int argc, char ** argv, Options * options) {
argcLeft--; argcLeft--;
} }
else if(strcmp(argv[i],"--create-db")==0) { else if(strcmp(argv[i],"--create-db")==0) {
options->stdOutput = 1;
options->createDB = 1; options->createDB = 1;
argcLeft--; argcLeft--;
} }
else if(strcmp(argv[i],"--update-db")==0) { else if(strcmp(argv[i],"--update-db")==0) {
options->stdOutput = 1;
options->updateDB = 1; options->updateDB = 1;
argcLeft--; argcLeft--;
} }
...@@ -289,7 +291,15 @@ void changeToUser(Options * options) { ...@@ -289,7 +291,15 @@ void changeToUser(Options * options) {
} }
void openLogFiles(Options * options, FILE ** out, FILE ** err) { void openLogFiles(Options * options, FILE ** out, FILE ** err) {
if(options->stdOutput) return; mode_t prev;
if(options->stdOutput) {
flushWarningLog();
return;
}
/* be sure to create log files w/ rw permissions*/
prev = umask(0066);
if(NULL==(*out=fopen(options->logFile,"a"))) { if(NULL==(*out=fopen(options->logFile,"a"))) {
ERROR("problem opening file \"%s\" for writing\n", ERROR("problem opening file \"%s\" for writing\n",
...@@ -302,6 +312,8 @@ void openLogFiles(Options * options, FILE ** out, FILE ** err) { ...@@ -302,6 +312,8 @@ void openLogFiles(Options * options, FILE ** out, FILE ** err) {
options->errorFile); options->errorFile);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
umask(prev);
} }
void openDB(Options * options, char * argv0) { void openDB(Options * options, char * argv0) {
...@@ -316,6 +328,7 @@ void openDB(Options * options, char * argv0) { ...@@ -316,6 +328,7 @@ void openDB(Options * options, char * argv0) {
argv0); argv0);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
flushWarningLog();
initMp3Directory(); initMp3Directory();
if(writeDirectoryDB()<0) { if(writeDirectoryDB()<0) {
ERROR("problem opening db for reading or writing\n"); ERROR("problem opening db for reading or writing\n");
...@@ -324,6 +337,7 @@ void openDB(Options * options, char * argv0) { ...@@ -324,6 +337,7 @@ void openDB(Options * options, char * argv0) {
if(options->createDB) exit(EXIT_SUCCESS); if(options->createDB) exit(EXIT_SUCCESS);
} }
if(options->updateDB) { if(options->updateDB) {
flushWarningLog();
updateMp3Directory(); updateMp3Directory();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
...@@ -379,6 +393,7 @@ void setupLogOutput(Options * options, FILE * out, FILE * err) { ...@@ -379,6 +393,7 @@ void setupLogOutput(Options * options, FILE * out, FILE * err) {
myfprintfStdLogMode(out, err, options->logFile, myfprintfStdLogMode(out, err, options->logFile,
options->errorFile); options->errorFile);
flushWarningLog();
} }
/* lets redirect stdin to dev null as a work around for libao bug */ /* lets redirect stdin to dev null as a work around for libao bug */
...@@ -471,4 +486,3 @@ int main(int argc, char * argv[]) { ...@@ -471,4 +486,3 @@ int main(int argc, char * argv[]) {
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
/* vim:set shiftwidth=8 tabstop=8 expandtab: */
...@@ -31,4 +31,3 @@ void myfprintf(FILE * fp, char * format, ... ); ...@@ -31,4 +31,3 @@ void myfprintf(FILE * fp, char * format, ... );
int myfprintfCloseAndOpenLogFile(); int myfprintfCloseAndOpenLogFile();
#endif #endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
...@@ -37,7 +37,6 @@ typedef struct _OutputBuffer { ...@@ -37,7 +37,6 @@ typedef struct _OutputBuffer {
float * volatile times; float * volatile times;
mpd_sint16 volatile begin; mpd_sint16 volatile begin;
mpd_sint16 volatile end; mpd_sint16 volatile end;
mpd_sint16 volatile next;
AudioFormat audioFormat; AudioFormat audioFormat;
MetadataChunk metadataChunks[BUFFERED_METACHUNKS]; MetadataChunk metadataChunks[BUFFERED_METACHUNKS];
mpd_sint8 metaChunkSet[BUFFERED_METACHUNKS]; mpd_sint8 metaChunkSet[BUFFERED_METACHUNKS];
......
...@@ -86,13 +86,13 @@ void setFsCharset(char * charset) { ...@@ -86,13 +86,13 @@ void setFsCharset(char * charset) {
DEBUG("setFsCharset: fs charset is: %s\n",fsCharset); DEBUG("setFsCharset: fs charset is: %s\n",fsCharset);
if(setCharSetConversion("UTF-8",fsCharset)!=0) { if(setCharSetConversion("UTF-8",fsCharset)!=0) {
ERROR("fs charset conversion problem: " WARNING("fs charset conversion problem: "
"not able to convert from \"%s\" to \"%s\"\n", "not able to convert from \"%s\" to \"%s\"\n",
fsCharset,"UTF-8"); fsCharset,"UTF-8");
error = 1; error = 1;
} }
if(setCharSetConversion(fsCharset,"UTF-8")!=0) { if(setCharSetConversion(fsCharset,"UTF-8")!=0) {
ERROR("fs charset conversion problem: " WARNING("fs charset conversion problem: "
"not able to convert from \"%s\" to \"%s\"\n", "not able to convert from \"%s\" to \"%s\"\n",
"UTF-8",fsCharset); "UTF-8",fsCharset);
error = 1; error = 1;
...@@ -100,7 +100,7 @@ void setFsCharset(char * charset) { ...@@ -100,7 +100,7 @@ void setFsCharset(char * charset) {
if(error) { if(error) {
free(fsCharset); free(fsCharset);
ERROR("setting fs charset to ISO-8859-1!\n"); WARNING("setting fs charset to ISO-8859-1!\n");
fsCharset = strdup("ISO-8859-1"); fsCharset = strdup("ISO-8859-1");
} }
} }
...@@ -145,28 +145,28 @@ void initPaths(char * playlistDirArg, char * musicDirArg) { ...@@ -145,28 +145,28 @@ void initPaths(char * playlistDirArg, char * musicDirArg) {
originalLocale = strdup(originalLocale); originalLocale = strdup(originalLocale);
if(!(currentLocale = setlocale(LC_CTYPE,""))) { if(!(currentLocale = setlocale(LC_CTYPE,""))) {
ERROR("problems setting current locale with " WARNING("problems setting current locale with "
"setlocale()\n"); "setlocale()\n");
} }
else { else {
if(strcmp(currentLocale,"C")==0 || if(strcmp(currentLocale,"C")==0 ||
strcmp(currentLocale,"POSIX")==0) strcmp(currentLocale,"POSIX")==0)
{ {
ERROR("current locale is \"%s\"\n", WARNING("current locale is \"%s\"\n",
currentLocale); currentLocale);
} }
else if((temp = nl_langinfo(CODESET))) { else if((temp = nl_langinfo(CODESET))) {
charset = strdup(temp); charset = strdup(temp);
} }
else ERROR("problems getting charset for locale\n"); else WARNING("problems getting charset for locale\n");
if(!setlocale(LC_CTYPE,originalLocale)) { if(!setlocale(LC_CTYPE,originalLocale)) {
ERROR("problems resetting locale with setlocale()\n"); WARNING("problems resetting locale with setlocale()\n");
} }
} }
free(originalLocale); free(originalLocale);
} }
else ERROR("problems getting locale with setlocale()\n"); else WARNING("problems getting locale with setlocale()\n");
#endif #endif
#endif #endif
...@@ -175,7 +175,7 @@ void initPaths(char * playlistDirArg, char * musicDirArg) { ...@@ -175,7 +175,7 @@ void initPaths(char * playlistDirArg, char * musicDirArg) {
free(charset); free(charset);
} }
else { else {
ERROR("setting filesystem charset to ISO-8859-1\n"); WARNING("setting filesystem charset to ISO-8859-1\n");
setFsCharset("ISO-8859-1"); setFsCharset("ISO-8859-1");
} }
} }
......
...@@ -424,7 +424,7 @@ void printPlaylistSongInfo(FILE * fp, int song) { ...@@ -424,7 +424,7 @@ void printPlaylistSongInfo(FILE * fp, int song) {
if((tag = (playlist.songs[song])->tag)) { if((tag = (playlist.songs[song])->tag)) {
printMpdTag(fp, tag); printMpdTag(fp, tag);
} }
myfprintf(fp, "Num: %i\n", song); myfprintf(fp, "Pos: %i\n", song);
myfprintf(fp, "Id: %i\n", playlist.numToId[song]); myfprintf(fp, "Id: %i\n", playlist.numToId[song]);
} }
...@@ -767,12 +767,12 @@ int deleteFromPlaylist(FILE * fp, int song) { ...@@ -767,12 +767,12 @@ int deleteFromPlaylist(FILE * fp, int song) {
playlist_noGoToNext = 1; playlist_noGoToNext = 1;
} }
if(playlist.current>=playlist.length) { if(playlist.current>songOrder) {
incrPlaylistCurrent();
}
else if(playlist.current>songOrder) {
playlist.current--; playlist.current--;
} }
else if(playlist.current>=playlist.length) {
incrPlaylistCurrent();
}
if(playlist.queued>songOrder) { if(playlist.queued>songOrder) {
playlist.queued--; playlist.queued--;
...@@ -1156,6 +1156,7 @@ int setPlaylistRandomStatus(FILE * fp, int status) { ...@@ -1156,6 +1156,7 @@ int setPlaylistRandomStatus(FILE * fp, int status) {
playlist.current < playlist.length) playlist.current < playlist.length)
{ {
swapOrder(playlist.current, 0); swapOrder(playlist.current, 0);
playlist.current = 0;
} }
} }
else orderPlaylist(); else orderPlaylist();
...@@ -1165,14 +1166,16 @@ int setPlaylistRandomStatus(FILE * fp, int status) { ...@@ -1165,14 +1166,16 @@ int setPlaylistRandomStatus(FILE * fp, int status) {
} }
int previousSongInPlaylist(FILE * fp) { int previousSongInPlaylist(FILE * fp) {
static time_t lastTime = 0;
time_t diff = time(NULL) - lastTime;
lastTime += diff;
if(playlist_state!=PLAYLIST_STATE_PLAY) return 0; if(playlist_state!=PLAYLIST_STATE_PLAY) return 0;
syncPlaylistWithQueue(0); syncPlaylistWithQueue(0);
if (getPlayerElapsedTime()>PLAYLIST_PREV_UNLESS_ELAPSED && if (diff && getPlayerElapsedTime() > PLAYLIST_PREV_UNLESS_ELAPSED) {
playlist.songs[playlist.order[playlist.current]]->type
!= SONG_TYPE_URL)
{
return playPlaylistOrderNumber(fp,playlist.current); return playPlaylistOrderNumber(fp,playlist.current);
} }
else { else {
......
...@@ -70,4 +70,22 @@ int ipv6Supported() { ...@@ -70,4 +70,22 @@ int ipv6Supported() {
return 0; return 0;
} }
/* vim:set shiftwidth=4 tabstop=8 expandtab: */ char * appendToString(char * dest, const char * src) {
int destlen;
int srclen = strlen(src);
if(dest == NULL) {
dest = malloc(srclen+1);
memset(dest, 0, srclen+1);
destlen = 0;
}
else {
destlen = strlen(dest);
dest = realloc(dest, destlen+srclen+1);
}
memcpy(dest+destlen, src, srclen);
dest[destlen+srclen] = '\0';
return dest;
}
...@@ -33,5 +33,6 @@ void my_usleep(long usec); ...@@ -33,5 +33,6 @@ void my_usleep(long usec);
int ipv6Supported(); int ipv6Supported();
char * appendToString(char * dest, const char * src);
#endif #endif
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
...@@ -68,7 +68,7 @@ int prepOssMixer(char * device) { ...@@ -68,7 +68,7 @@ int prepOssMixer(char * device) {
int devmask = 0; int devmask = 0;
if((volume_ossFd = open(device,O_RDONLY))<0) { if((volume_ossFd = open(device,O_RDONLY))<0) {
ERROR("unable to open oss mixer \"%s\"\n",device); WARNING("unable to open oss mixer \"%s\"\n",device);
return -1; return -1;
} }
...@@ -78,7 +78,7 @@ int prepOssMixer(char * device) { ...@@ -78,7 +78,7 @@ int prepOssMixer(char * device) {
int i,j; int i,j;
if(ioctl(volume_ossFd,SOUND_MIXER_READ_DEVMASK,&devmask)<0) { if(ioctl(volume_ossFd,SOUND_MIXER_READ_DEVMASK,&devmask)<0) {
ERROR("errors getting read_devmask for oss mixer\n"); WARNING("errors getting read_devmask for oss mixer\n");
close(volume_ossFd); close(volume_ossFd);
return -1; return -1;
} }
...@@ -96,13 +96,13 @@ int prepOssMixer(char * device) { ...@@ -96,13 +96,13 @@ int prepOssMixer(char * device) {
} }
if(i>=SOUND_MIXER_NRDEVICES) { if(i>=SOUND_MIXER_NRDEVICES) {
ERROR("mixer control \"%s\" not found\n", WARNING("mixer control \"%s\" not found\n",
getConf()[CONF_MIXER_CONTROL]); getConf()[CONF_MIXER_CONTROL]);
close(volume_ossFd); close(volume_ossFd);
return -1; return -1;
} }
else if(!( ( 1 << i ) & devmask )) { else if(!( ( 1 << i ) & devmask )) {
ERROR("mixer control \"%s\" not usable\n", WARNING("mixer control \"%s\" not usable\n",
getConf()[CONF_MIXER_CONTROL]); getConf()[CONF_MIXER_CONTROL]);
close(volume_ossFd); close(volume_ossFd);
return -1; return -1;
...@@ -122,7 +122,7 @@ int getOssVolumeLevel() { ...@@ -122,7 +122,7 @@ int getOssVolumeLevel() {
int left, right, level; int left, right, level;
if(ioctl(volume_ossFd,MIXER_READ(volume_ossControl),&level) < 0) { if(ioctl(volume_ossFd,MIXER_READ(volume_ossControl),&level) < 0) {
ERROR("unable to read volume\n"); WARNING("unable to read volume\n");
return -1; return -1;
} }
...@@ -130,7 +130,7 @@ int getOssVolumeLevel() { ...@@ -130,7 +130,7 @@ int getOssVolumeLevel() {
right = (level & 0xff00) >> 8; right = (level & 0xff00) >> 8;
if(left!=right) { if(left!=right) {
ERROR("volume for left and right is not the same, \"%i\" and " WARNING("volume for left and right is not the same, \"%i\" and "
"\"%i\"\n",left,right); "\"%i\"\n",left,right);
} }
...@@ -174,27 +174,27 @@ int prepAlsaMixer(char * card) { ...@@ -174,27 +174,27 @@ int prepAlsaMixer(char * card) {
char * controlName = VOLUME_MIXER_ALSA_CONTROL_DEFAULT; char * controlName = VOLUME_MIXER_ALSA_CONTROL_DEFAULT;
if((err = snd_mixer_open(&volume_alsaMixerHandle,0))<0) { if((err = snd_mixer_open(&volume_alsaMixerHandle,0))<0) {
ERROR("problems opening alsa mixer: %s\n",snd_strerror(err)); WARNING("problems opening alsa mixer: %s\n",snd_strerror(err));
return -1; return -1;
} }
if((err = snd_mixer_attach(volume_alsaMixerHandle,card))<0) { if((err = snd_mixer_attach(volume_alsaMixerHandle,card))<0) {
snd_mixer_close(volume_alsaMixerHandle); snd_mixer_close(volume_alsaMixerHandle);
ERROR("problems problems attaching alsa mixer: %s\n", WARNING("problems problems attaching alsa mixer: %s\n",
snd_strerror(err)); snd_strerror(err));
return -1; return -1;
} }
if((err = snd_mixer_selem_register(volume_alsaMixerHandle,NULL,NULL))<0) { if((err = snd_mixer_selem_register(volume_alsaMixerHandle,NULL,NULL))<0) {
snd_mixer_close(volume_alsaMixerHandle); snd_mixer_close(volume_alsaMixerHandle);
ERROR("problems snd_mixer_selem_register'ing: %s\n", WARNING("problems snd_mixer_selem_register'ing: %s\n",
snd_strerror(err)); snd_strerror(err));
return -1; return -1;
} }
if((err = snd_mixer_load(volume_alsaMixerHandle))<0) { if((err = snd_mixer_load(volume_alsaMixerHandle))<0) {
snd_mixer_close(volume_alsaMixerHandle); snd_mixer_close(volume_alsaMixerHandle);
ERROR("problems snd_mixer_selem_register'ing: %s\n", WARNING("problems snd_mixer_selem_register'ing: %s\n",
snd_strerror(err)); snd_strerror(err));
return -1; return -1;
} }
...@@ -223,7 +223,7 @@ int prepAlsaMixer(char * card) { ...@@ -223,7 +223,7 @@ int prepAlsaMixer(char * card) {
return 0; return 0;
} }
ERROR("can't find alsa mixer_control \"%s\"\n",controlName); WARNING("can't find alsa mixer_control \"%s\"\n",controlName);
snd_mixer_close(volume_alsaMixerHandle); snd_mixer_close(volume_alsaMixerHandle);
return -1; return -1;
...@@ -244,7 +244,7 @@ int getAlsaVolumeLevel() { ...@@ -244,7 +244,7 @@ int getAlsaVolumeLevel() {
if((err = snd_mixer_selem_get_playback_volume(volume_alsaElem, if((err = snd_mixer_selem_get_playback_volume(volume_alsaElem,
SND_MIXER_SCHN_FRONT_LEFT,&level))<0) { SND_MIXER_SCHN_FRONT_LEFT,&level))<0) {
ERROR("problems getting alsa volume: %s\n",snd_strerror(err)); WARNING("problems getting alsa volume: %s\n",snd_strerror(err));
return -1; return -1;
} }
...@@ -272,7 +272,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) { ...@@ -272,7 +272,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
if((err = snd_mixer_selem_get_playback_volume(volume_alsaElem, if((err = snd_mixer_selem_get_playback_volume(volume_alsaElem,
SND_MIXER_SCHN_FRONT_LEFT,&level))<0) { SND_MIXER_SCHN_FRONT_LEFT,&level))<0) {
commandError(fp, ACK_ERROR_SYSTEM, "problems getting volume"); commandError(fp, ACK_ERROR_SYSTEM, "problems getting volume");
ERROR("problems getting alsa volume: %s\n",snd_strerror(err)); WARNING("problems getting alsa volume: %s\n",snd_strerror(err));
return -1; return -1;
} }
...@@ -298,7 +298,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) { ...@@ -298,7 +298,7 @@ int changeAlsaVolumeLevel(FILE * fp, int change, int rel) {
if((err = snd_mixer_selem_set_playback_volume_all( if((err = snd_mixer_selem_set_playback_volume_all(
volume_alsaElem,level))<0) { volume_alsaElem,level))<0) {
commandError(fp, ACK_ERROR_SYSTEM, "problems setting volume"); commandError(fp, ACK_ERROR_SYSTEM, "problems setting volume");
ERROR("problems setting alsa volume: %s\n",snd_strerror(err)); WARNING("problems setting alsa volume: %s\n",snd_strerror(err));
return -1; return -1;
} }
...@@ -365,7 +365,7 @@ void initVolume() { ...@@ -365,7 +365,7 @@ void initVolume() {
void openVolumeDevice() { void openVolumeDevice() {
if(prepMixer(volume_mixerDevice)<0) { if(prepMixer(volume_mixerDevice)<0) {
ERROR("using software volume\n"); WARNING("using software volume\n");
volume_mixerType = VOLUME_MIXER_TYPE_SOFTWARE; volume_mixerType = VOLUME_MIXER_TYPE_SOFTWARE;
} }
} }
......
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