aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_control.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* output: fixed shout stuck pause bugMax Kellermann2009-08-141-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.
* output_control: close mixer on pauseMax Kellermann2009-04-211-0/+6
| | | | | For non-global mixers (only "pulse" currently), close the mixer when MPD playback is paused.
* mixer: added flag "open"Max Kellermann2009-03-261-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.
* output_plugin: replaced output_plugin.get_mixer() with mixer_pluginMax Kellermann2009-03-261-2/+17
| | | | | | The mixer core library is now responsible for creating and managing the mixer object. This removes duplicated code from the output plugins.
* output_control: close earlier on format mismatchMax Kellermann2009-03-201-3/+3
| | | | | To prevent a race condition, close the output thread before assigning the new audio format.
* output: convert audio_output.config_audio_format to booleanMax Kellermann2009-03-201-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.
* 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_control: removed audio_output_signal()Max Kellermann2009-03-101-6/+0
| | | | This function was part of a workaround which we don't need anymore.
* output: play from a music_pipe objectMax Kellermann2009-03-091-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.
* output_control: make audio_output_open() staticMax Kellermann2009-03-091-1/+1
| | | | | audio_output_open() is only called by audio_output_update(). Don't export it.
* output_all: audio_output_all_update() returns boolMax Kellermann2009-03-071-2/+4
| | | | | audio_output_all_update() returns true when there is at least open output device which is open.
* output: use GTimer instead of time_t for reopen after failureMax Kellermann2009-02-281-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.
* output: pass the music chunk pointer as void*, not char*Max Kellermann2009-02-231-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.
* output_plugin: added inline wrapper functionsMax Kellermann2009-02-161-2/+1
| | | | | Similar to the decoder plugin API: added wrapper functions to increase code readability.
* output_control: no CamelCaseMax Kellermann2009-02-161-44/+44
| | | | Renamed variables.
* output_api: no CamelCase in struct audio_outputMax Kellermann2009-02-101-8/+8
| | | | Renamed audio_output struct members.
* pcm_convert: return PCM buffer from pcm_convert()Max Kellermann2009-01-171-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.
* output: join the output thread after sending the KILL commandMax Kellermann2009-01-071-1/+5
| | | | | Be sure that the output thread has quite before we start destructing the output object.
* output: deinitialize notify objectMax Kellermann2009-01-071-0/+2
| | | | | Free memory allocated by the notify object (GMutex, GCond) when it's not used by the output object anymore.
* pcm_utils: moved conversion code to pcm_convert.cMax Kellermann2009-01-071-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.
* output: migrate from pthread to glib threadsThomas Jansen2008-12-281-2/+2
|
* Include <pthread.h> where it is necessary onlyThomas Jansen2008-12-281-1/+0
|
* output_control: no static "notify" initializationMax Kellermann2008-12-271-1/+1
| | | | Don't use NOTIFY_INITIALIZER to initialize audio_output_client_notify.
* output: don't allow length==0Max Kellermann2008-11-021-0/+2
| | | | | Nobody should call playAudio() with an empty chunk. Add some assertions on that.
* output: removed audio_output.resultMax Kellermann2008-10-291-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.
* output: delay reopen after device failureMax Kellermann2008-10-291-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.
* output: moved code to audio_output_update()Max Kellermann2008-10-291-0/+10
| | | | Moved code from syncAudioDeviceStates() to audio_output_update().
* output: use bool for return values and flagsMax Kellermann2008-10-291-4/+5
| | | | | Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
* don't include os_compat.hMax Kellermann2008-10-081-0/+2
| | | | | When there are standardized headers, use these instead of the bloated os_compat.h.
* audio_output: added method pause()Max Kellermann2008-09-291-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.
* audio_output: workaround for deadlockMax Kellermann2008-09-261-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.
* output: semi-asynchronous playbackMax Kellermann2008-09-241-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.
* output: make "struct audio_output" opaque for output pluginsMax Kellermann2008-09-241-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.
* output: one thread per audio outputMax Kellermann2008-09-241-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.
* output: copy reqAudioFormat to outAudioFormat only if not yet openMax Kellermann2008-09-111-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.
* output: removed audio_output.sameInAndOutFormatsMax Kellermann2008-09-111-6/+2
| | | | | Eliminate sameInAndOutFormats and check with audio_format_equals() each time it this information is needed. Another 4 bytes saved.
* output: removed audio_output.convertAudioFormatMax Kellermann2008-09-111-1/+1
| | | | | Instead of checking convertAudioFormat, we can simply check if reqAudioFormat is defined. This saves 4 bytes in the struct.
* audio: moved cmpAudioFormat() to audio_format.hMax Kellermann2008-09-091-4/+3
| | | | | Rename it to audio_format_equals() and return "true" if they are equal.
* audio: replaced copyAudioFormat() with simple assignmentMax Kellermann2008-09-091-5/+3
| | | | | | | | | The "!src" check in copyAudioFormat() used to hide bugs - one should never pass NULL to it. There is one caller which might pass NULL, add a check in this caller. Instead of doing mempcy(), we can simply assign the structures, which looks more natural.
* output: renamed the functions in output_control.cMax Kellermann2008-09-091-11/+11
| | | | Getting rid of CamcelCase, again.
* output: moved code from audioOutput.c to output_control.cMax Kellermann2008-09-091-0/+123
Similar to decoder_control.c, output_control.c will provide functions for controlling the output thread (which will be implemented later).