aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/pulse_output_plugin.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-10-29output/pulse: initialize pulse_output.mixerMax Kellermann1-0/+1
This variable was uninitialized and led to crashes.
2009-10-23output/pulse: implement methods enable()/disable()Max Kellermann1-9/+35
Don't connect to PulseAudio before MPD has daemonized.
2009-10-23output_plugin: added methods enable() and disable()Max Kellermann1-0/+2
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-23output/pulse: call mixer on state changesMax Kellermann1-1/+104
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-21pulse: code rewrite using the asynchronous libpulse APIMax Kellermann1-73/+581
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-20output/pulse: renamed context to "Music Player Daemon"Max Kellermann1-1/+1
This looks nicer in the PulseAudio manager than just "mpd".
2009-10-20pulse: renamed source filesMax Kellermann1-3/+5
2009-10-20pulse: announce "media.role=music"Max Kellermann1-0/+2
This allows PulseAudio to do some advanced tweaks.
2009-03-26pulse: make configuration strings constMax Kellermann1-6/+4
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-4/+2
The conf.h functions deal well with config_param==NULL and will return the specified default value then.
2009-03-26output_plugin: replaced output_plugin.get_mixer() with mixer_pluginMax Kellermann1-16/+1
The mixer core library is now responsible for creating and managing the mixer object. This removes duplicated code from the output plugins.
2009-03-14mixer_api: moved mixer_plugin imports to mixer_list.hMax Kellermann1-1/+1
This patch allows the output plugins to import only mixer_list.h, instead of the full mixer_api.h (which would expose internal structures).
2009-03-14mixer_api: moved functions to mixer_control.cMax Kellermann1-0/+1
mixer_control.h should provide the functions needed to manipulate a mixer, without exposing the internal mixer API (which is provided by mixer_api.h).
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-07pulse mixerDavid Guibert1-0/+16
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]
2009-03-01output: removed duplicate debug messages from pluginsMax Kellermann1-6/+0
The MPD core logs the audio format of all audio outputs. Remove the duplicate message from the plugins.
2009-02-26output_plugin: report errors with GErrorMax Kellermann1-9/+17
Use GLib's GError library for reporting output device failures. Note that some init() methods don't clean up properly after a failure, but that's ok for now, because the MPD core will abort anyway.
2009-02-26pulse: removed pa_simple!=NULL checksMax Kellermann1-10/+2
The MPD core guarantees that the audio_output object is always consistent, and our pa_simple!=NULL checks are superfluous. Also don't manually close the device on error in pulse_play(), since the MPD core does this automatically when the play() method returns 0.
2009-02-25output_plugin: don't pass audio_output object to method init()Max Kellermann1-2/+1
audio_output_get_name() has been removed, which was the only function left in output_api.h. The output plugin doesn't need the audio_output object at all, remove the parameter from the init() method.
2009-02-25output_api: removed audio_output_get_name()Max Kellermann1-11/+8
Use config_get_block_string("name") instead of audio_output_get_name().
2009-02-23output: pass the music chunk pointer as void*, not char*Max Kellermann1-2/+2
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-23output_api: play() returns a lengthMax Kellermann1-3/+3
The old API required an output plugin to not return until all data passed to the play() method is consumed. Some output plugins have to loop to fulfill that requirement, and may block during that. Simplify these, by letting them consume only part of the buffer: make play() return the length of the consumed data.
2009-01-25conf: const pointers in block get functionsMax Kellermann1-1/+1
All config_get_block_*() functions should accept constant config_param pointers.
2009-01-18conf: added config_get_block_string()Max Kellermann1-9/+4
This replaces lots of getBlockParam() invocations.
2009-01-17conf: no CamelCase, part IMax Kellermann1-3/+3
Renamed functions, types, variables.
2009-01-01output plugins: don't include gcc.hMax Kellermann1-1/+1
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2008-11-05pulse: removed reconnect intervalMax Kellermann1-19/+2
The output thread automatically waits some time before retrying to open the device. Don't duplicate this check in the pulse plugin.
2008-11-05pulse: check if connection is open in pulse_cancel()Max Kellermann1-0/+3
The pulse plugin crashed with a segmentation fault when the pulse server was killed.
2008-10-30pulse: fix segfault without sink nameMax Kellermann1-2/+2
Commit d692e9 broke configurations without explicit server or sink configuration. Check for getBlockParam()==NULL.
2008-10-29output: use bool for return values and flagsMax Kellermann1-11/+11
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-29pulse: clear pa_simple pointer in pulse_close()Max Kellermann1-0/+1
The pointer becomes invalid due to pa_simple_free(), which may lead to segmentation faults when the output is reopened later.
2008-10-29pulse: use GLib instead of util.h/log.hMax Kellermann1-28/+25
Use GLib allocation and logging functions.
2008-10-29pulse: no CamelCaseMax Kellermann1-48/+49
2008-10-26output: don't compile plugins which are disabledMax Kellermann1-8/+0
Don't compile the sources of disabled output plugins at all.
2008-10-26renamed src/audioOutputs/ to src/output/Max Kellermann1-0/+0
Again, no CamelCase in the directory name.
2008-10-25pulse: force 16 bit audio sample formatMax Kellermann1-5/+3
PA_SAMPLE_S16NE is the only sample format which is suported by both MPD and pulseaudio. Unfortunately, pulse does not accept 24 bit samples. Instead of bailing out with an error message, we should tell the MPD core to convert all samples to 16 bit for pulse.
2008-10-10audio_format: renamed sampleRate to sample_rateMax Kellermann1-2/+2
The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
2008-09-29use C99 struct initializersMax Kellermann1-9/+8
The old struct initializers are error prone and don't allow moving elements around. Since we are going to overhaul some of the APIs soon, it's easier to have all implementations use C99 initializers.
2008-09-24output: make "struct audio_output" opaque for output pluginsMax Kellermann1-26/+32
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: set audio_output->open=1 in audio_output_task()Max Kellermann1-3/+0
Since the output plugin returns a value indicating success or error, we can have the output core code assign the "open" flag.
2008-09-24output: pass audio_format to plugin.init() and plugin.open()Max Kellermann1-3/+3
Pass the globally configured audio_format as a const pointer to plugin.init(). plugin.open() gets a writable pointer which contains the audio_format requested by the plugin. Its initial value is either the configured audio_format or the input file's audio_format.
2008-09-08output: const plugin structuresMax Kellermann1-1/+1
Since the plugin struct is never modified, we should store it in constant locations.
2008-09-07output: renamed typedef AudioOutput to struct audio_outputMax Kellermann1-7/+8
Also rename AudioOutputPlugin to struct audio_output_plugin, and use forward declarations to reduce include dependencies.
2008-09-07output: added output_api.hMax Kellermann1-3/+2
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-1/+1
Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
2008-04-12use size_t and constant pointer in ao pluginsMax Kellermann1-1/+2
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-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-5/+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-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-3/+3
I'm checking for zero-size allocations and assert()-ing them, so we can more easily get backtraces and debug problems, but we'll also allow -DNDEBUG people to live on the edge if they wish. We do not rely on errno when checking for OOM errors because some implementations of malloc do not set it, and malloc is commonly overridden by userspace wrappers. I've spent some time looking through the source and didn't find any obvious places where we would explicitly allocate 0 bytes, so we shouldn't trip any of those assertions. We also avoid allocating zero bytes because C libraries don't handle this consistently (some return NULL, some not); and it's dangerous either way. git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-08audioOutput_pulse: ansi-fy function declarations (sparse)Eric Wong1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@4599 09075e82-0dd4-0310-85a5-a0d7c8717e4f