aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_control.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2010-05-02output_thread: call replay gain filter manuallyMax Kellermann1-0/+6
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/+2
Remove cross_fade_apply(), and call pcm_mix() in the output thread, mixing the chunk and chunk->other together.
2010-03-10output: added option "always_on" for radio stationsMax Kellermann1-1/+14
Did you ever accidently click "stop" while feeding a radio station? This option sets the output device to "pause" to disable the "close" method. It falls back to "pause" then, which is specific to the plugin. Some plugins implement it by feeding silence.
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
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/+9
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: signal the output thread when CANCEL is finishedMax Kellermann1-0/+4
After CANCEL, the output thread waits for another signal before it continues playback, to synchronize with the caller. There were some situations where this signal wasn't sent properly. This patch adds an explicit g_cond_signal() at two code positions.
2009-11-02{decoder,player}_control: removed duplicate wakeupsMax Kellermann1-1/+1
Don't wake up the target thread in every iteration of the wait() loop. Waking it up once, right after the command has been set, must be enough.
2009-10-29output_control: fixed deadlock in audio_output_update()Max Kellermann1-1/+21
Call a version of audio_output_close() which doesn't lock recursively.
2009-10-29output: consistently lock audio output objectsMax Kellermann1-12/+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-23output_plugin: added methods enable() and disable()Max Kellermann1-1/+36
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-20mixer_plugin: use GError for error handlingMax Kellermann1-2/+9
2009-08-14output: fixed shout stuck pause bugMax Kellermann1-0/+11
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-06output: attach a filter chain to each audio_outputMax Kellermann1-0/+3
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-14/+1
REOPEN is called when the input audio format changes. The output thread may be reconfigure the PCM converter.
2009-04-21output_control: close mixer on pauseMax Kellermann1-0/+6
For non-global mixers (only "pulse" currently), close the mixer when MPD playback is paused.
2009-03-26mixer: added flag "open"Max Kellermann1-1/+2
Remember if a mixer object is open or closed. Don't call open() again if it is already open. This guarantees that the mixer plugin is always called in a consistent state, and we will be able to remove lots of checks from the implementations. To support mixers which are automatically opened even if the audio output is still closed (to set the volume before playback starts), this patch also adds the "global" flag to the mixer_plugin struct. Both ALSA and OSS set this flag, while PULSE does not.
2009-03-26output_plugin: replaced output_plugin.get_mixer() with mixer_pluginMax Kellermann1-2/+17
The mixer core library is now responsible for creating and managing the mixer object. This removes duplicated code from the output plugins.
2009-03-20output_control: close earlier on format mismatchMax Kellermann1-3/+3
To prevent a race condition, close the output thread before assigning the new audio format.
2009-03-20output: convert audio_output.config_audio_format to booleanMax Kellermann1-9/+5
The config_audio_format used to contain the configured audio format, which is copied to out_audio_format. Let's convert the former to a boolean, which indicates whether out_audio_format was already set. This simplifies some code and saves a few bytes.
2009-03-13all: Update copyright header.Avuton Olrich1-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.
2009-03-10output_control: removed audio_output_signal()Max Kellermann1-6/+0
This function was part of a workaround which we don't need anymore.
2009-03-09output: play from a music_pipe objectMax Kellermann1-19/+17
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.
2009-03-09output_control: make audio_output_open() staticMax Kellermann1-1/+1
audio_output_open() is only called by audio_output_update(). Don't export it.
2009-03-07output_all: audio_output_all_update() returns boolMax Kellermann1-2/+4
audio_output_all_update() returns true when there is at least open output device which is open.
2009-02-28output: use GTimer instead of time_t for reopen after failureMax Kellermann1-2/+20
time() is not a monotonic timer, and MPD might get confused by clock skews. clock_gettime() provides a monotonic clock, but is not portable to non-POSIX systems (i.e. Windows). This patch uses GLib's GTimer API, which aims to be portable.
2009-02-23output: pass the music chunk pointer as void*, not char*Max Kellermann1-1/+1
The meaning of the chunk depends on the audio format; don't suggest a specific format by declaring the pointer as "char*", pass "void*" instead.
2009-02-16output_plugin: added inline wrapper functionsMax Kellermann1-2/+1
Similar to the decoder plugin API: added wrapper functions to increase code readability.
2009-02-16output_control: no CamelCaseMax Kellermann1-44/+44
Renamed variables.
2009-02-10output_api: no CamelCase in struct audio_outputMax Kellermann1-8/+8
Renamed audio_output struct members.
2009-01-17pcm_convert: return PCM buffer from pcm_convert()Max Kellermann1-2/+0
Removed yet another superfluous buffer layer: return the PCM buffer from pcm_convert() instead of copying PCM data into the caller-supplied buffer.
2009-01-07output: join the output thread after sending the KILL commandMax Kellermann1-1/+5
Be sure that the output thread has quite before we start destructing the output object.
2009-01-07output: deinitialize notify objectMax Kellermann1-0/+2
Free memory allocated by the notify object (GMutex, GCond) when it's not used by the output object anymore.
2009-01-07pcm_utils: moved conversion code to pcm_convert.cMax Kellermann1-1/+0
All what's left in pcm_utils.h is the pcm_range() utility function, which is only used internally by pcm_volume and pcm_mix.
2008-12-28output: migrate from pthread to glib threadsThomas Jansen1-2/+2
2008-12-28Include <pthread.h> where it is necessary onlyThomas Jansen1-1/+0
2008-12-27output_control: no static "notify" initializationMax Kellermann1-1/+1
Don't use NOTIFY_INITIALIZER to initialize audio_output_client_notify.
2008-11-02output: don't allow length==0Max Kellermann1-0/+2
Nobody should call playAudio() with an empty chunk. Add some assertions on that.
2008-10-29output: removed audio_output.resultMax Kellermann1-6/+2
Since open() and play() close the device on error, we can simply check audio_output.open instead of audio_output.result after a call.
2008-10-29output: delay reopen after device failureMax Kellermann1-3/+6
When one of several output devices failed, MPD tried to reopen it quite often, wasting a lot of resources. This patch adds a delay: wait 10 seconds before retrying. This might be changed to exponential delays later, but for now, it makes the problem go away.
2008-10-29output: moved code to audio_output_update()Max Kellermann1-0/+10
Moved code from syncAudioDeviceStates() to audio_output_update().
2008-10-29output: use bool for return values and flagsMax Kellermann1-4/+5
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-08don't include os_compat.hMax Kellermann1-0/+2
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-09-29audio_output: added method pause()Max Kellermann1-0/+5
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.
2008-09-26audio_output: workaround for deadlockMax Kellermann1-0/+6
During debugging, I found a deadlock between flushAudioBuffer() and the audio_output_task(): audio_output_task() didn't notice that there is a command, and flushAudioBuffer() waited forever in notify_wait(). I am not sure yet what is the real cause; work around this for now by waking up non-finished audio outputs in every iteration.
2008-09-24output: semi-asynchronous playbackMax Kellermann1-8/+14
Send an output buffer to all output plugins at the same time, instead of waiting for each of them separately. Make several functions non-blocking, and introduce the new function audio_output_wait_all() to synchronize with all audio output threads.
2008-09-24output: make "struct audio_output" opaque for output pluginsMax Kellermann1-1/+2
We have eliminated direct accesses to the audio_output struct from the all output plugins. Make it opaque for them, and move its real declaration to output_internal.h, similar to decoder_internal.h. Pass the opaque structure to plugin.init() only, which will return the plugin's data pointer on success, and NULL on failure. This data pointer will be passed to all other methods instead of the audio_output struct.
2008-09-24output: one thread per audio outputMax Kellermann1-38/+39
To keep I/O nastiness and latencies away from the core, move the audio output code to a separate thread, one per output. The thread is created on demand, and currently runs until mpd exits.
2008-09-11output: copy reqAudioFormat to outAudioFormat only if not yet openMax Kellermann1-1/+7
If the output device is already open, it may have modified outAudioFormat; in this case, outAudioFormat is still valid, and does not need an overwrite.
2008-09-11output: removed audio_output.sameInAndOutFormatsMax Kellermann1-6/+2
Eliminate sameInAndOutFormats and check with audio_format_equals() each time it this information is needed. Another 4 bytes saved.