aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputThread.cxx (unfollow)
Commit message (Collapse)AuthorFilesLines
2013-01-04player_control.h: convert header to C++Max Kellermann1-1/+1
2013-01-04MusicChunk: move functions to methodsMax Kellermann1-2/+2
2013-01-04buffer, pipe: convert to C++Max Kellermann1-2/+3
2013-01-04output_*: convert to C++Max Kellermann1-13/+18
2012-09-25output: new option "tags" may be used to disable sending tagsMax Kellermann1-1/+1
Implements Mantis ticket 0003340.
2012-08-29decoder/mad, output_thread: add gcc_unlikely()Max Kellermann1-1/+1
2012-06-12audio-parser, output_thread: work around -Wmaybe-uninitializedMax Kellermann1-0/+5
False positives in gcc 4.7.
2011-10-20pcm_mix: return bool, make unimplemented format non-fatalMax Kellermann1-2/+6
Let the caller deal with a failure.
2011-10-10pcm_{mix,volume}: pass only sample_format to pcm_mix()Max Kellermann1-1/+1
The other audio_format attributes are not used.
2011-09-19output_plugin: the plugin allocates the audio_output objectMax Kellermann1-17/+14
Pass audio_output objects around instead of void pointers. This will give some more control to the plugin, and prepares for non-blocking audio outputs.
2011-09-01output_thread: reimplement CANCEL synchronizationMax Kellermann1-7/+1
The output thread could hang indefinitely after finishing CANCEL, because it could have missed the signal while the output was not unlocked in ao_command_finished(). This patch removes the wait() call after CANCEL, and adds the flag "allow_play" instead. While this flag is set, playback is skipped. With this flag, there will not be any excess wait() call after the pipe has been cleared. This patch fixes a bug that causes mpd to discontinue playback after seeking, due to the race condition described above.
2011-07-20output_thread: unlock the mutex while calling cancel()Max Kellermann1-1/+6
The method may take longer, and we shouldn't be holding the lock.
2011-03-16audio_format, output_thread: add more audio_format_valid() assertionsMax Kellermann1-0/+5
2011-01-29copyright year 2011Max Kellermann1-1/+1
2011-01-10include cleanupMax Kellermann1-0/+1
2011-01-10player_control: removed the global variable "pc"Max Kellermann1-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.
2011-01-07output_thread: fix double lockMax Kellermann1-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.
2010-12-21add void casts to suppress "result unused" warnings (clang)Max Kellermann1-1/+1
2010-11-05output_plugin: add method delay()Max Kellermann1-0/+30
This method is used to reduce the delay of commands issued to the shout plugin.
2010-11-04output_thread: fix assertion failure due to race condition in OPENMax Kellermann1-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().
2010-11-04output_internal: protect attribute "fail_timer" with mutexMax Kellermann1-0/+5
2010-09-25eliminate g_error() usageThomas Jansen1-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.
2010-08-19output_thread: fix race condition after CANCEL commandMax Kellermann1-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().
2010-05-02output_thread: call replay gain filter manuallyMax Kellermann1-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).
2010-05-02player_thread: move cross-fading to output threadMax Kellermann1-0/+30
Remove cross_fade_apply(), and call pcm_mix() in the output thread, mixing the chunk and chunk->other together.
2010-05-02output_thread: moved code to ao_filter_open(), ao_filter_close()Max Kellermann1-7/+19
2010-05-02output_thread: moved filter invocation to ao_filter_chunk()Max Kellermann1-16/+52
2010-02-17replay_gain: optionally use hardware mixer to apply replay gainMax Kellermann1-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.
2010-02-17replay_gain: reimplement as a filter pluginMax Kellermann1-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.
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
2009-11-14audio_format: added function audio_format_to_string()Max Kellermann1-10/+6
Unified function for converting an audio_format object to a string, for log messages and for the "status" command.
2009-11-12include config.h in all sourcesMax Kellermann1-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.
2009-11-09output_thread: added command DRAINMax Kellermann1-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.
2009-11-02output_thread: moved code to ao_next_chunk()Max Kellermann1-6/+11
2009-11-02output_thread: return from ao_play() if chunk->next is NULLMax Kellermann1-5/+4
When the "next" chunk to be played is NULL, return from ao_play() immediately, without going over the "while" loop (no-op).
2009-11-02output_thread: check command before g_cond_wait()Max Kellermann1-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.
2009-10-31player_control: protect command, state, error with a mutexMax Kellermann1-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.
2009-10-29output_thread: return bool from ao_play()Max Kellermann1-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.
2009-10-29output: consistently lock audio output objectsMax Kellermann1-16/+39
Always keep the audio_output object locked within the output thread, unless a plugin method is called. This fixes several race conditions.
2009-10-29output_plugin: added method "drain"Max Kellermann1-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.
2009-10-29output_thread: removed redundant filter_close() callMax Kellermann1-4/+0
Don't call filter_close() right after ao_close().
2009-10-23output_plugin: added methods enable() and disable()Max Kellermann1-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.
2009-10-21audio_format: wildcards allowed in audio_format configurationMax Kellermann1-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.
2009-10-21output: convert config_audio_format to an audio_format structMax Kellermann1-2/+4
This allows more sophisticated audio format selection.
2009-10-21output_thread: check again if output is open on PAUSEMax Kellermann1-0/+9
Basically the same as the 0.15.5 patch "check again if output is open on CANCEL". Same race condition, same fix.
2009-10-16output_thread: check again if output is open on CANCELMax Kellermann1-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.
2009-08-14output: fixed shout stuck pause bugMax Kellermann1-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.
2009-07-19Add reverse_endian field to struct audio_format and handle conversionDavid Woodhouse1-4/+6
2009-07-06output: attach a filter chain to each audio_outputMax Kellermann1-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.
2009-07-06output: added command REOPENMax Kellermann1-0/+25
REOPEN is called when the input audio format changes. The output thread may be reconfigure the PCM converter.