aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_internal.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2010-11-04output_internal: protect attribute "fail_timer" with mutexMax Kellermann1-1/+2
2010-05-02output_thread: call replay gain filter manuallyMax Kellermann1-0/+13
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/+6
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-0/+6
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.
2010-02-17replay_gain: reimplement as a filter pluginMax Kellermann1-0/+12
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-09output_thread: added command DRAINMax Kellermann1-0/+7
This command manually drains the hardware buffer. This is useful when the player thread want to make sure that everything has been played.
2009-10-29output: consistently lock audio output objectsMax Kellermann1-6/+8
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-0/+8
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-21output: convert config_audio_format to an audio_format structMax Kellermann1-6/+5
This allows more sophisticated audio format selection.
2009-08-14output: fixed shout stuck pause bugMax Kellermann1-0/+6
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-2/+13
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/+7
REOPEN is called when the input audio format changes. The output thread may be reconfigure the PCM converter.
2009-03-26output_plugin: replaced output_plugin.get_mixer() with mixer_pluginMax Kellermann1-0/+7
The mixer core library is now responsible for creating and managing the mixer object. This removes duplicated code from the output plugins.
2009-03-25output: protect audio_output.open with the mutexMax Kellermann1-1/+6
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.
2009-03-20output: convert audio_output.config_audio_format to booleanMax Kellermann1-6/+6
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-7/+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-09output: play from a music_pipe objectMax Kellermann1-10/+19
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-02-28output: use GTimer instead of time_t for reopen after failureMax Kellermann1-3/+4
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: include cleanupMax Kellermann1-1/+1
Don't include output_api.h in output_internal.h. This change requires adding missing includes in several sources.
2009-02-16output_api: moved "enum output_command" to output_internal.hMax Kellermann1-0/+11
Now that the output_command enum isn't exposed to output plugins anymore, we can hide its definition within output_internal.h.
2009-02-10output_api: no CamelCase in struct audio_outputMax Kellermann1-6/+6
Renamed audio_output struct members.
2009-02-10output_internal: added missing output_api.h includeMax Kellermann1-0/+1
output_api.h is required for enum audio_output_command.
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-07pcm_utils: moved conversion code to pcm_convert.cMax Kellermann1-1/+1
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-3/+2
2008-12-27notify: use GLib lockingMax Kellermann1-0/+1
Use GLib locking (GMutex, GCond) instead of pthread because GLib is more portable, e.g. on mingw32.
2008-10-31added prefix to header macrosMax Kellermann1-2/+2
"LOG_H" is a macro which is also used by ffmpeg/log.h. This is ffmpeg's fault, because short macros should be reserved for applications, but since it's always a good idea to choose prefixed macro names, even for applications, we are going to do that in MPD.
2008-10-29output: removed audio_output.resultMax Kellermann1-11/+0
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-0/+8
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 audioDeviceStates to audio_output.enabledMax Kellermann1-0/+5
2008-10-29output: use bool for return values and flagsMax Kellermann1-6/+6
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-21pcm_utils: renamed ConvState to struct pcm_convert_stateMax Kellermann1-1/+1
No CamelCase, and a struct instead of a typedef.
2008-09-24output: removed DEVICE_ON, DEVICE_OFFMax Kellermann1-0/+6
To check whether a device is really on or off, we should rather check audio_output.open, instead of managing another variable. Wrap audio_output.open in the inline function audio_output_is_open() and use it instead of DEVICE_ON and DEVICE_OFF.
2008-09-24output: semi-asynchronous playbackMax Kellermann1-0/+12
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: document the audio_output elementsMax Kellermann1-4/+58
2008-09-24output: make "struct audio_output" opaque for output pluginsMax Kellermann1-10/+33
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-07audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann1-3/+4
Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
2008-08-26moved code to crossfade.cMax Kellermann1-9/+10
decode.c should be a lot smaller; start by moving all code which handles cross-fading to crossfade.c. Also includes camelCase conversion.
2008-08-26clean up CPP includesMax Kellermann1-2/+0
Include only headers which are really required. This speeds up compilation and helps detect cross-layer accesses.
2008-06-02remove audioDeviceStates from playerData and getPlayerDataEric Wong1-8/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@7372 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Make the OutputBuffer API more consistentEric Wong1-1/+1
We had functions names varied between outputBufferFoo, fooOutputBuffer, and output_buffer_foo That was too confusing for my little brain to handle. And the global variable was somehow named 'cb' instead of the more obvious 'ob'... git-svn-id: https://svn.musicpd.org/mpd/trunk@7355 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Stop passing our single OutputBuffer object everywhereEric Wong1-1/+1
All of our main singleton data structures are implicitly shared, so there's no reason to keep passing them around and around in the stack and making our internal API harder to deal with. git-svn-id: https://svn.musicpd.org/mpd/trunk@7354 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Stop passing our single DecoderControl object everywhereEric Wong1-1/+1
This at least makes the argument list to a lot of our plugin functions shorter and removes a good amount of line nois^W^Wcode, hopefully making things easier to read and follow. git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Get rid of PlayerControl inside the PlayerData structEric Wong1-1/+1
It actually increases our image size a small bit and may even hurt performance a very small bit, but makes the code less verbose and easier to manage. I don't see a reason for mpd to ever support playing multiple files at the same time (users can run multiple instances of mpd if they really want to play Zaireeka, but that's such an edge case it's not worth ever supporting in our code). git-svn-id: https://svn.musicpd.org/mpd/trunk@7352 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12clean up CPP includesMax Kellermann1-2/+0
Try to only include headers which are really needed. We should particularly check all "headers including other headers". The long-term goal is to have a manageable, small API for plugins (decoders, output) without so many mpd internals cluttering the namespace. git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12remove buffered_chunks, use cb->sizeMax Kellermann1-1/+0
Second patch to make OutputBuffer self-contained: since OutputBuffer now knows its own size, we do not need the global variable "buffered_chunks" anymore. git-svn-id: https://svn.musicpd.org/mpd/trunk@7311 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12moved CHUNK_SIZE to outputBuffer.hMax Kellermann1-3/+0
The chunk size should be in outputBuffer.h since the output buffer code is its primary user. git-svn-id: https://svn.musicpd.org/mpd/trunk@7268 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12unsigned integers in playerData.[ch]Max Kellermann1-2/+2
The number of buffered chunks can obviously not become negative. The "buffered_before_play<0" therefore cannot be useful, so let's remove it, too. git-svn-id: https://svn.musicpd.org/mpd/trunk@7232 09075e82-0dd4-0310-85a5-a0d7c8717e4f