aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_thread.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* player: don't clear command before do_play() returnsMax Kellermann2008-10-241-1/+0
| | | | | | | | | This bug caused the audio output devices to stay open, although MPD wasn't playing: quitDecode() resetted player_control.command, assuming that the command was STOP. This way, player_task() didn't see the CLOSE_AUDIO command, and the device was kept open. Don't clear player_control.command in quitDecode().
* player: don't send partial frames of silenceMax Kellermann2008-10-231-1/+7
| | | | | | Another partial frame fix: the silence buffer was 1020 bytes, which had room for 127.5 24 bit stereo frames. Don't send the partial last frame in this case.
* pcm_utils: no CamelCaseMax Kellermann2008-10-211-2/+2
| | | | Renamed all functions which were still in CamelCase.
* player: replaced buffered_before_play with buffering flagMax Kellermann2008-10-121-9/+10
| | | | | | buffered_before_play was copied to struct player because it was used to disable buffering when seeking. Instead of mainaining a copy of this number, move just the flag to the player struct.
* player: added commands QUEUE and CANCELMax Kellermann2008-10-121-29/+48
| | | | | | QUEUE adds a new song to the player's queue. CANCEL clears the queue. These two commands replace the old and complex queueState and queueLockState code.
* player: added struct playerMax Kellermann2008-10-121-48/+75
| | | | | The player struct holds the local variables which used to be passed to all those helper functions in player_thread.c.
* player: removed player_control.fileTimeMax Kellermann2008-10-111-1/+2
| | | | | | | This variable is superfluous, it is only used to copy its value to player_control.totalTime. Since the original source of this value (song->tag->time) will still be available at this point, we can safely remove fileTime.
* player: don't wake up decoder after every frameMax Kellermann2008-10-101-1/+7
| | | | | | | The decoder was woken up after each chunk which had been played. That caused a lot of superfluous context switches. Wake up the decoder only when a certain amount of the buffer has been consumed. This formula is somewhat arbitrary, and has to be proven experimentally.
* player: added player_control.audio_formatMax Kellermann2008-10-101-6/+2
| | | | This replaces the attributes bits, channels, sampleRate.
* audio_format: renamed sampleRate to sample_rateMax Kellermann2008-10-101-1/+1
| | | | | The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
* song: removed CamelCaseMax Kellermann2008-10-081-2/+2
| | | | CamelCase is ugly... rename all functions.
* use the "bool" data type instead of "int"Max Kellermann2008-10-081-4/+4
| | | | "bool" should be used in C99 programs for boolean values.
* song: converted typedef Song to struct songMax Kellermann2008-10-081-0/+1
| | | | Again, a data type which can be forward-declared.
* audio_output: added method pause()Max Kellermann2008-09-291-1/+1
| | | | | | | | | | | | pause() puts the audio output into pause mode: if supported, it may perform a special action, which keeps the device open, but does not play anything. Output plugins like "shout" might want to play silence during pause, so their clients won't be disconnected. Plugins which do not support pausing will simply be closed, and have to be reopened when unpaused. This pach includes an implementation for the shout plugin, which sends silence chunks.
* notify: protect notify->pending with the mutexMax Kellermann2008-09-261-2/+0
| | | | | | | | | | There was a known deadlocking bug in the notify library: when the other thread set notify->pending after the according check in notify_wait(), the latter thread was deadlocked. Resolve this by synchronizing all accesses to notify->pending with the notify object's mutex. Since notify_signal_sync() was never used, we can remove it. As a consequence, we don't need notify_enter() and notify_leave() anymore; eliminate them, too.
* audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann2008-09-071-1/+1
| | | | | Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
* moved player_command_finished() to player_thread.cMax Kellermann2008-08-261-0/+8
|
* moved code to pc_init(), dc_init()Max Kellermann2008-08-261-3/+2
|
* renamed player.c to player_control.cMax Kellermann2008-08-261-1/+1
| | | | | Give player.c a better name, meaning that the code is used to control the player thread.
* renamed decode.h to decoder_control.hMax Kellermann2008-08-261-1/+1
|
* moved global variable "pc" to player.hMax Kellermann2008-08-261-0/+1
| | | | | This is the last of the three variables. Now we don't need playerData.h anymore in most sources.
* moved variable "dc" to decode.hMax Kellermann2008-08-261-6/+7
| | | | | Now that "dc" is available here, we don't have to pass it to decoder_is_idle() and decoder_is_starting() anymore.
* player_thread: removed decode(), renamed decodeParent()Max Kellermann2008-08-261-15/+4
| | | | | decode() is a trivial wrapper for decodeParent(). Merge both and rename them to do_play().
* hide DecoderControl accesses in inline functionsMax Kellermann2008-08-261-10/+6
| | | | | | Unfortunately, we have to pass the DecoderControl pointer to these inline functions, because the global variable "dc" may not be available here. This will be fixed later.
* check for decoder error before state!=STARTMax Kellermann2008-08-261-9/+8
| | | | | When dc->error!=NOERROR, we do not need to check state!=START. Simplify the checks by moving the error check to the top.
* don't reset dc->command in quitDecode()Max Kellermann2008-08-261-1/+0
| | | | | | The decoder thread is responsible for resetting dc->command after a command was executed. As a consequence, we can assume that dc->command is already NONE after decoder_stop().
* added decoder_control.cMax Kellermann2008-08-261-50/+17
| | | | | | The source "decoder_control.c" provides an API for controlling the decoder. This replaces various direct accesses to the DecoderControl struct.
* fix a comment regarding the player queueMax Kellermann2008-08-261-1/+1
|
* rewrote playerKill()Max Kellermann2008-08-261-0/+8
| | | | | | | playerKill() was marked as deprecated, but it seems like a good idea to do proper cleanup in all threads (e.g. for usable valgrind results). Introduce the command "EXIT" which makes the player thread exit cleanly.
* player: don't call STOP before CLOSE_AUDIOMax Kellermann2008-08-261-1/+2
| | | | | | | | | playerWait() stops the player thread (twice!) and closes the output device. It should be well enough to just send CLOSE_AUDIO, without STOP. This requires a tiny change to the player thread code: make it break when CLOSE_AUDIO is sent.
* assert song->url != NULLMax Kellermann2008-08-261-0/+4
|
* don't call quitDecode() in waitOnDecode()Max Kellermann2008-08-261-2/+3
| | | | | To make the code more consistent, call quitDecode() only at the end of decodeParent().
* moved code to player_thread.cMax Kellermann2008-08-261-0/+466
Move code which runs in the player thread to player_thread.c. Having a lot of player thread code in decode.c isn't easy to understand.