aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer/pulse_mixer_plugin.c (unfollow)
Commit message (Collapse)AuthorFilesLines
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-10-23output/pulse: call mixer on state changesMax Kellermann1-127/+40
Don't let the mixer plugin "override" the libpulse callbacks. Instead, add a "mixer" attribute to the pulse_output struct, and call the mixer on all interesting events.
2009-10-22mixer/pulse: don't get volume if stream is not yet readyMax Kellermann1-3/+3
Moved the check from pulse_mixer_open() to pulse_mixer_update().
2009-10-21pulse: code rewrite using the asynchronous libpulse APIMax Kellermann1-209/+126
This is a complete rewrite of the PulseAudio output plugin. It uses the asynchronous API, which gives us more control over everything. Additionally, it connects to the PulseAudio server on startup, and keeps this connection up while MPD runs. During pause, instead of closing the stream, it enables "cork".
2009-10-21mixer_plugin: pass audio_output pointer to mixer_plugin.init()Max Kellermann1-1/+1
This allows the mixer object to access its associated audio output object.
2009-10-20mixer_plugin: use GError for error handlingMax Kellermann1-13/+34
2009-10-20pulse: renamed source filesMax Kellermann1-2/+2
2009-04-25pulse_mixer: use PULSE's mainloop lock instead of GMutexMax Kellermann1-27/+13
Using two different kinds of locks may result in a race condition with a deadlock. The libpulse callbacks need no locks at all, because the mainloop object can be assumed to be already locked.
2009-03-27pulse_mixer: protect the struct with a mutexMax Kellermann1-1/+29
There are numerous race conditions between the libpulse thread (pulse_mixer.c callbacks) and the rest of MPD. Protect the volatile attributes of the pulse_mixer struct with a mutex to fix that.
2009-03-27pulse_mixer: return if mixer is offlineMax Kellermann1-29/+27
Eliminate one indent level. Also remove several debug useless debug messages.
2009-03-27pulse_mixer: removed superfluous G_GNUC_UNUSED attributesMax Kellermann1-4/+4
Those parameters are used after all.
2009-03-27pulse_mixer: use local pa_cvolume variable for set_volume()Max Kellermann1-2/+3
Don't mess with pulse_mixer.volume for setting the volume. This variable should only be used to transfer the current volume from sink_input_vol() to pulse_mixer_get_volume().
2009-03-27pulse_mixer: wait for get_volume() operation to completeMax Kellermann1-1/+34
The pa_context_get_sink_input_info() function is asynchronous, and after it returns, libpulse does not guarantee that the operation has completed yet; in fact, it is not likely. Explicitly wait for the operation to complete. The code for the new pulse_wait_for_operation() function was inspired by mplayer and xine code.
2009-03-27pulse_mixer: adapted code styleMax Kellermann1-27/+52
Use the same code style as the rest of MPD.
2009-03-26pulse_mixer: removed superfluous initializationsMax Kellermann1-7/+2
Don't initialize attributes which are only used in an open mixer. As long as nobody accesses them, their values are uninitialized and undefined.
2009-03-26pulse_mixer: allocate "volume" staticallyMax Kellermann1-10/+6
The pm->volume attribute was allocated in pulse_mixer_init(), but is never freed. This leaks memory. Instead of adding the g_free() call to pulse_mixer_finish(), let's just make "volume" a static attribute of the pulse_mixer struct. That is easier to deal with.
2009-03-26pulse_mixer: removed superfluous NULL checks in close()Max Kellermann1-12/+4
When the MPD core knows that the pulse mixer is open, pm->mainloop and pm->context must be non-NULL.
2009-03-26pulse_mixer: initialize "online" and "index" in open()Max Kellermann1-2/+5
The attributes "online" and "index" were not properly reinitialized after a close/open cycle.
2009-03-26pulse: make configuration strings constMax Kellermann1-6/+6
Nobody needs to modify these strings. We can make them const, and convert config_dup_block_string() to config_get_block_string(). This also fixes memory leaks in the pulse mixer.
2009-03-26pulse: don't check config_param!=NULLMax Kellermann1-6/+3
The conf.h functions deal well with config_param==NULL and will return the specified default value then.
2009-03-26pulse_mixer: free libpulse objects on failureMax Kellermann1-0/+6
When the mixer initialization fails, we have to free the libpulse objects we have already created, to prevent resource leaks.
2009-03-26pulse_mixer: unlock the mainloop on failureMax Kellermann1-0/+2
It's illegal to return from pulse_mixer_setup() without unlocking the main loop. In the error handling, that unlock() call was missing.
2009-03-26pulse_mixer: moved code to pulse_mixer_setup()Max Kellermann1-15/+26
Prepare for adding proper error handling.
2009-03-17pulse_mixer: keep mixer attached when another pulse sink is closed.David Guibert1-1/+2
The mixer state is defined as offline only if the associated stream is removed. Signed-off-by: David Guibert <david.guibert@gmail.com>
2009-03-17pulse_mixer: closeDavid Guibert1-1/+14
when the mixer is closed, - the mainloop is stopped. - the context is disconnected. - then the mainloop is freed. Signed-off-by: David Guibert <david.guibert@gmail.com>
2009-03-13all: Update copyright header.Avuton Olrich1-3/+4
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-07pulse_mixer: allow mpd to reconnect to the pulse mixerDavid Guibert1-29/+24
This patch follows the commit 21bb10f4b. >From Max Kellermann: > I removed the daemonization changes in main.c. Please explain why you > changed that. If you need it for some reason, make that a separate > patch with a good description of your rationale. > That's the biggest flaw of your code: it opens the mixer device in the > init() method, while the open() method is empty. When the pulse > daemon is not available (either during MPD startup or when it dies > while MPD runs), the plugin will not even attempt to reconnect to > pulse. Please move the code to the open() method, to make that work. I changed the daemonize call as the fork losts the connection to the pulse server. According to your remark, the init() method should be moved to the open() ones. With the modification, mpd is able to reconnect the pulse mixer after restarting the pulseaudio daemon. Signed-off-by: David Guibert <david.guibert@gmail.com> Signed-off-by: Max Kellermann <max@duempel.org>
2009-03-07pulse_mixer: added missing copyright headerMax Kellermann1-0/+18
2009-03-07pulse_mixer: added GLib log domainMax Kellermann1-14/+16
Shorten some log messages, let GLib add the "pulse_mixer" prefix.
2009-03-07pulse: clean up includesMax Kellermann1-2/+4
Don't include output_api.h - this is not an output plugin. Added missing explicit conf.h and string.h includes.
2009-03-07pulse mixerDavid Guibert1-0/+277
This patch introduces the mixer for the pulse output. Technically speaking, the pulse index is needed to get or set the volume. You must define callback fonctions to get this index since the pulse output in mpd is done using the simpe api. The pulse simple api does not provide the index of the newly defined output. So callback fonctions are associated to the pulse context. The list of all the sink input is then retreived. Then we select the name of the mpd pulse output and control its volume by its associated index number. Signed-off-by: Patrice Linel <patnathanael@gmail.com> Signed-off-by: David Guibert <david.guibert@gmail.com> [mk: fixed whitespace errors and broke long lines; removed daemonization changes from main.c]