aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_control.c (unfollow)
Commit message (Collapse)AuthorFilesLines
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.
2008-09-11output: removed audio_output.convertAudioFormatMax Kellermann1-1/+1
Instead of checking convertAudioFormat, we can simply check if reqAudioFormat is defined. This saves 4 bytes in the struct.
2008-09-09audio: moved cmpAudioFormat() to audio_format.hMax Kellermann1-4/+3
Rename it to audio_format_equals() and return "true" if they are equal.
2008-09-09audio: replaced copyAudioFormat() with simple assignmentMax Kellermann1-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.
2008-09-09output: renamed the functions in output_control.cMax Kellermann1-11/+11
Getting rid of CamcelCase, again.
2008-09-09output: moved code from audioOutput.c to output_control.cMax Kellermann1-107/+1
Similar to decoder_control.c, output_control.c will provide functions for controlling the output thread (which will be implemented later).
2008-09-09output: renamed method namesMax Kellermann1-12/+11
No CamelCase. Also don't declare typedefs for the methods.
2008-09-08output: static audio_output_plugin list as arrayMax Kellermann1-44/+11
Instead of having to register each output plugin, store them statically in an array. This eliminates the need for the List library here, and saves some small allocations during startup.
2008-09-07output: replace audio_output.*Func with audio_output.pluginMax Kellermann1-17/+11
Instead of copying all that stuff from the audio output plugin to the audio output structure, store a pointer to the plugin.
2008-09-07output: renamed typedef AudioOutput to struct audio_outputMax Kellermann1-15/+16
Also rename AudioOutputPlugin to struct audio_output_plugin, and use forward declarations to reduce include dependencies.
2008-09-07output: added output_api.hMax Kellermann1-0/+1
Just like decoder_api.h, output_api.h provides the audio output API which is used by the plugins.
2008-09-07audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann1-4/+4
Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
2008-08-29tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann1-1/+2
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
2008-08-29pass constant pointersMax Kellermann1-1/+1
And again, convert arguments to const.
2008-08-26moved struct AudioFormat to audio_format.hMax Kellermann1-0/+1
We want to expose the AudioFormat structure to plugins; remove some clutter by moving its declaration to a separate header file.
2008-04-12const pointers in audioOutput.cMax Kellermann1-1/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@7345 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12use free()/malloc() instead of realloc()Max Kellermann1-2/+3
When growing the audioOutput->convBuffer, we can use free()+malloc() instead of realloc(), which saves a memcpy(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7295 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12use size_t in audioOutput.c internalsMax Kellermann1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@7294 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12use size_t and constant pointer in ao pluginsMax Kellermann1-3/+4
The audio output plugins should get a constant pointer, because they must not modify the buffer. Since the size is a non-negative buffer size in bytes, we should change its type to size_t. git-svn-id: https://svn.musicpd.org/mpd/trunk@7293 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12use size_t for pcm_sizeOfConvBuffer() resultMax Kellermann1-4/+4
In my previous patch set, I forgot to change the pcm_sizeOfConvBuffer() invocation in convertAudioFormat() to also use size_t. git-svn-id: https://svn.musicpd.org/mpd/trunk@7292 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-02-05fix -Wconst warningsMax Kellermann1-2/+2
[ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-2/+1
This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-09Tidying up some code.J. Alexander Treuman1-17/+10
git-svn-id: https://svn.musicpd.org/mpd/trunk@6527 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-30Only call finishDriverFunc if there is one. The null plugin doesn't haveJ. Alexander Treuman1-1/+2
one now, and trying to call NULL was causing a segfault at exit. git-svn-id: https://svn.musicpd.org/mpd/trunk@6398 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman1-6/+3
call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26Make pcm_convertAudioFormat return the buffer size. This is necessaryJ. Alexander Treuman1-8/+6
because lsr may return less than the input buffer size, and the rest of the audio code needs to know the new size. This fixes the clicking that was introduced with recent changes to the lsr code. A huge thanks to remiss for figuring this out. git-svn-id: https://svn.musicpd.org/mpd/trunk@6273 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-24Reverting to the full lsr API. Turns out the simple API needs all of theJ. Alexander Treuman1-4/+6
audio at once, so it won't work for us. The old full API code was still heavily broken, as each call to pcm_convertSampleRate() used the same state, even if it was processing two streams of audio. The new code keeps a separate state for each audio stream that's being converted. git-svn-id: https://svn.musicpd.org/mpd/trunk@6255 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-22Split pcm_convertAudioFormat into separate functions for bitrate, channel,J. Alexander Treuman1-5/+3
and samplerate conversion. This makes the code much easier to read, and fixes a few bugs that were previously there. git-svn-id: https://svn.musicpd.org/mpd/trunk@6224 09075e82-0dd4-0310-85a5-a0d7c8717e4f