aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_thread.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* include cleanupMax Kellermann2011-01-101-0/+1
|
* player_control: removed the global variable "pc"Max Kellermann2011-01-101-1/+1
| | | | | | | Allocate a player_control object where needed, and pass it around. Each "client" object is associated with a "player_control" instance. This prepares multi-player support.
* output_thread: fix double lockMax Kellermann2011-01-071-3/+0
| | | | | | | | During the whole output thread, the audio_output object is locked, and it is only unlocked while waiting for the GCond and while running a plugin method. The error handler in ao_play_chunk() attempted to lock the object again, which was code from MPD 0.15.x which should have been removed a long time ago.
* add void casts to suppress "result unused" warnings (clang)Max Kellermann2010-12-211-1/+1
|
* Merge release 0.15.14 from branch 'v0.15.x'Max Kellermann2010-11-071-1/+14
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: NEWS configure.ac src/decoder_control.c src/decoder_control.h src/input/rewind_input_plugin.c src/output_control.c src/output_thread.c src/player_thread.c
| * output_thread: fix assertion failure due to race condition in OPENMax Kellermann2010-11-041-1/+9
| | | | | | | | | | | | Change the assertion on "fail_timer==NULL" in OPEN to a runtime check. This assertion crashed when the output thread failed while the player thread was calling audio_output_open().
| * output_internal: protect attribute "fail_timer" with mutexMax Kellermann2010-11-041-0/+5
| |
| * output_thread: fix race condition after CANCEL commandMax Kellermann2010-08-191-0/+10
| | | | | | | | | | | | Clear the notification before finishing the CANCEL command, so the notify_wait() after that will always wait for the right notification, sent by audio_output_all_cancel().
* | output_plugin: add method delay()Max Kellermann2010-11-051-0/+30
| | | | | | | | | | This method is used to reduce the delay of commands issued to the shout plugin.
* | eliminate g_error() usageThomas Jansen2010-09-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced all occurrences of g_error() with MPD_ERROR() located in a new header file 'mpd_error.h'. This macro uses g_critical() to print the error message and then exits gracefully in contrast to g_error() which would internally call abort() to produce a core dump. The macro name is distinctive and allows to find all places with dubious error handling. The long-term goal is to get rid of MPD_ERROR() altogether. To facilitate the eventual removal of this macro it was added in a new header file rather than to an existing header file. This fixes #2995 and #3007.
* | output_thread: call replay gain filter manuallyMax Kellermann2010-05-021-15/+57
| | | | | | | | | | | | Don't add it to the filter chain, because we need to apply replay gain before cross-fading with the next song. Add a second replay_gain filter which is used for the song being faded in (chunk->other).
* | player_thread: move cross-fading to output threadMax Kellermann2010-05-021-0/+30
| | | | | | | | | | Remove cross_fade_apply(), and call pcm_mix() in the output thread, mixing the chunk and chunk->other together.
* | output_thread: moved code to ao_filter_open(), ao_filter_close()Max Kellermann2010-05-021-7/+19
| |
* | output_thread: moved filter invocation to ao_filter_chunk()Max Kellermann2010-05-021-16/+52
| |
* | replay_gain: optionally use hardware mixer to apply replay gainMax Kellermann2010-02-171-1/+2
| | | | | | | | | | | | | | | | | | | | Add an option for each audio output which enables the use of the hardware mixer, instead of the software volume code. This is hardware specific, and assumes linear volume control. This is not the case for hardware mixers which were tested, making this patch somewhat useless, but we will use it to experiment with the settings, to find a good solution.
* | replay_gain: reimplement as a filter pluginMax Kellermann2010-02-171-0/+11
| | | | | | | | | | | | | | Apply the replay gain in the output thread. This means a new setting will be active instantly, without going through the whole music pipe. And we might have different replay gain settings for each audio output device.
* | Update copyright notices.Avuton Olrich2009-12-311-1/+1
| |
* | audio_format: added function audio_format_to_string()Max Kellermann2009-11-141-10/+6
| | | | | | | | | | Unified function for converting an audio_format object to a string, for log messages and for the "status" command.
* | include config.h in all sourcesMax Kellermann2009-11-121-0/+1
| | | | | | | | | | | | After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
* | output_thread: added command DRAINMax Kellermann2009-11-091-0/+13
| | | | | | | | | | This command manually drains the hardware buffer. This is useful when the player thread want to make sure that everything has been played.
* | output_thread: moved code to ao_next_chunk()Max Kellermann2009-11-021-6/+11
| |
* | output_thread: return from ao_play() if chunk->next is NULLMax Kellermann2009-11-021-5/+4
| | | | | | | | | | When the "next" chunk to be played is NULL, return from ao_play() immediately, without going over the "while" loop (no-op).
* | output_thread: check command before g_cond_wait()Max Kellermann2009-11-021-1/+2
| | | | | | | | | | | | | | After CANCEL, call g_cond_wait() only if the new command is still NONE. Problem is that ao_command_finished() has to unlock the audio_output object, and in the meantime, the player thread might have submitted a new command.
* | Merge branch 'v0.15.x'Max Kellermann2009-10-311-0/+9
|\| | | | | | | | | | | | | | | Conflicts: NEWS configure.ac src/decoder/ffmpeg_plugin.c src/update.c
| * output_thread: check again if output is open on PAUSEMax Kellermann2009-10-211-0/+9
| | | | | | | | | | Basically the same as the 0.15.5 patch "check again if output is open on CANCEL". Same race condition, same fix.
* | player_control: protect command, state, error with a mutexMax Kellermann2009-10-311-1/+1
| | | | | | | | | | | | Use GMutex/GCond instead of the notify library. Manually lock the player_control object before accessing the protected attributes. Use the GCond object to notify the player thread and the main thread.
* | output_thread: return bool from ao_play()Max Kellermann2009-10-291-4/+22
| | | | | | | | | | | | Return false when there was no chunk in the pipe. If the function returns true, then audio_output_task() will not wait for a notify from the player thread. This fixes a race condition.
* | output: consistently lock audio output objectsMax Kellermann2009-10-291-16/+39
| | | | | | | | | | Always keep the audio_output object locked within the output thread, unless a plugin method is called. This fixes several race conditions.
* | output_plugin: added method "drain"Max Kellermann2009-10-291-11/+13
| | | | | | | | | | | | | | drain() is the opposite of cancel(): it waits until all data in the buffer has finished playing. Instead of implicitly draining in the close() method like the ALSA plugin has been doing it forever, let the output thread decide whether to drain or to cancel.
* | output_thread: removed redundant filter_close() callMax Kellermann2009-10-291-4/+0
| | | | | | | | Don't call filter_close() right after ao_close().
* | output_plugin: added methods enable() and disable()Max Kellermann2009-10-231-0/+50
| | | | | | | | | | | | | | With these methods, an output plugin can allocate some global resources only if it is actually enabled. The method enable() is called after daemonization, which allows for more sophisticated resource allocation during that method.
* | audio_format: wildcards allowed in audio_format configurationMax Kellermann2009-10-211-5/+6
| | | | | | | | | | | | An asterisk means that this attribute should not be enforced, and stays whatever it used to be. This way, some configuration values work like masks.
* | output: convert config_audio_format to an audio_format structMax Kellermann2009-10-211-2/+4
| | | | | | | | This allows more sophisticated audio format selection.
* | Merged release 0.15.5 from branch 'v0.15.x'Max Kellermann2009-10-181-1/+2
|\| | | | | | | | | | | | | | | Conflicts: NEWS configure.ac src/decoder/flac_plugin.c src/update.c
| * output_thread: check again if output is open on CANCELMax Kellermann2009-10-161-1/+2
| | | | | | | | | | | | | | | | When the player thread unpauses, it sends CANCEL to the output thread, after having checked that the output is still open. Problem is when the output thread closes the device before it can process the CANCEL command - race condition. This patch adds another "open" check inside the output thread.
* | Merged release 0.15.2 from branch 'v0.15.x'Max Kellermann2009-08-151-0/+3
|\| | | | | | | | | | | | | Conflicts: NEWS configure.ac
| * output: fixed shout stuck pause bugMax Kellermann2009-08-141-0/+3
| | | | | | | | | | | | Explicitly make the output thread leave the ao_pause() loop. This patch is a workaround, and the "pause" flag is not managed in a thread-safe way, but that's good enough for now.
* | Add reverse_endian field to struct audio_format and handle conversionDavid Woodhouse2009-07-191-4/+6
| |
* | Merged release 0.15.1 from branch 'v0.15.x'Max Kellermann2009-07-161-1/+5
|\|
| * output_thread: don't play next chunk after command==PAUSEMax Kellermann2009-06-291-1/+5
| | | | | | | | | | When the PAUSE loop ends, re-check the next command before calling ao_play() again.
* | output: attach a filter chain to each audio_outputMax Kellermann2009-07-061-15/+77
| | | | | | | | | | | | | | | | This patch adds initial filter support for audio outputs. Each audio output gets a "filter" attribute, which is used by ao_play_chunk(). The PCM conversion is now performed by convert_filter_plugin. audio_output.convert_state has been removed.
* | output: added command REOPENMax Kellermann2009-07-061-0/+25
| | | | | | | | | | REOPEN is called when the input audio format changes. The output thread may be reconfigure the PCM converter.
* | output_thread: moved OPEN handler to ao_open()Max Kellermann2009-07-061-43/+48
|/
* output_all: synchronize playback with player_control.notifyMax Kellermann2009-03-261-1/+2
| | | | | | | | | This patch fixes a longer delay when moving around songs in the playlist. The main thread wants to enqueue a new "next" song into the player thread, but the player thread is waiting inside audio_output_all_wait() for the output threads. Use player_control.notify there, so audio_output_all_wait() gets woken up by the main thread, too.
* output_all: synchronize playback with a notify objectMax Kellermann2009-03-251-0/+2
| | | | | | Use audio_output_client_notify instead of g_usleep(1ms) in audio_output_all_wait() to synchronize with the output_thread. Signal the audio_output_client_notify object in ao_play().
* output: protect audio_output.open with the mutexMax Kellermann2009-03-251-2/+4
| | | | | | There was a deadlock between the output thread and the player thread: when the output thread failed (and closed itself) while the player thread worked with the audio_output object, MPD could crash.
* all: Update copyright header.Avuton Olrich2009-03-131-6/+7
| | | | | | | | This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
* output_thread: check commands while playingMax Kellermann2009-03-101-1/+1
| | | | | | | Check audio_output.command after each sub-chunk has been played. It discards the rest of the chunk, but since all commands make the device stop anyway, this is not a problem, but part of the improvement. This improves the latency of audio output commands.
* output: play from a music_pipe objectMax Kellermann2009-03-091-17/+80
| | | | | | | | Instead of passing individual buffers to audio_output_all_play(), pass music_chunk objects. Append all those chunks asynchronously to a music_pipe instance. All output threads may then read chunks from this pipe. This reduces MPD's internal latency by an order of magnitude.
* output_thread: wait 10 seconds before reopening after play failureMax Kellermann2009-03-091-0/+4
| | | | | | This is similar to the MPD 0.14 patch "wait 10 seconds before reopening a failed device", which only covered open() failures. This patch adds the same feature for play().