Commit Graph

327 Commits

Author SHA1 Message Date
Max Kellermann 733989a284 util/StringUtil: move comparison functions to StringCompare.cxx 2015-11-06 09:20:18 +01:00
Max Kellermann f066bb7716 unix/Daemon, playlist/...: remove unused Domain variables 2015-10-16 18:08:59 +02:00
Max Kellermann ce0d896492 unix/Daemon, playlist/pls, ...: remove unused Domain variables 2015-09-17 23:15:54 +02:00
François Revol 7743647460 output: add native Haiku audio output and mixer support
Also uses the notification system to display tags.
2015-09-17 22:46:46 +02:00
Max Kellermann b31d171ae8 *: doxygen fixups 2015-03-17 11:21:43 +01:00
Max Kellermann 1c90b0c19d *: change C-style prototypes, drop "(void)" 2015-03-03 20:05:08 +01:00
Max Kellermann 4fa5538e2b config/Param: split block-specific attributes to new struct ConfigBlock
The old struct config_param remains only for top-level string options.
2015-01-21 23:56:33 +01:00
Max Kellermann fe85fa3bea ConfigData: move struct config_param to Param.hxx 2015-01-21 21:23:02 +01:00
Max Kellermann 4c74016b1a MixerAll: restore "null" mixer volume from state file 2015-01-16 19:48:26 +01:00
Max Kellermann 712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann 99e6409a67 {mixer,output}/pulse: move code to LogPulseError() 2014-12-29 22:42:52 +01:00
Max Kellermann fe9db8b369 {mixer,output}/pulse: use a common Domain instance 2014-12-29 22:25:14 +01:00
Max Kellermann ca035d0e8d mixer/pulse: remove redundant "virtual" keywords 2014-12-29 22:23:58 +01:00
Max Kellermann 0debba0f6e mixer/null: new mixer plugin 2014-12-02 18:20:44 +01:00
Max Kellermann f2bd2c318c MixerType: convert to strictly-typed enum 2014-12-02 18:20:44 +01:00
Max Kellermann 21c42819c7 MixerType: rename to CamelCase 2014-12-02 18:19:31 +01:00
Max Kellermann aafff8fd5c fs/output, fs/TextFile: move to fs/io/ 2014-08-07 19:38:25 +02:00
Max Kellermann 9fb351a139 *Save, *State: use the OutputStream API instead of FILE* 2014-07-30 22:17:01 +02:00
Max Kellermann 073e9d06ec mixer/software: keep attribute "volume" in the 0..100 range
The attribute must be 0..100 and not 0..1024.  Previously, the code
was inconsistent.
2014-05-12 12:46:14 +02:00
Pete Beardmore 9da57e7458 PulseOutputPlugin: avoid locking mainloop object from within mainloop thread
-fixes regression introduced by:
 '8d6fedf8177d0d2ced81e6d93d35c368b2ac69db [PATCH] Mixer: add class MixerListener'
-listener.OnMixerVolumeChanged() called GetVolume() which attempted to acquire
the lock but as per 'pa_threaded_mainloop_lock()' documentation:
This function may not be called inside the event loop thread. Events that are
dispatched from the event loop thread are executed with this lock held
-this patch seperates the underlying action of GetVolume() into a new
GetVolumeInternal() function, to be called only when the lock is already held, as
is the case for the listener.OnMixerVolumeChanged() call
2014-03-05 17:17:41 +00:00
Max Kellermann 8d6fedf817 Mixer: add class MixerListener
Use a listener interface instead of GlobalEvents.
2014-02-19 21:40:14 +01:00
Max Kellermann 0a0659d737 mixer/Plugin: pass AudioOutput reference to init()
Passing a void pointer is unsafe.
2014-02-06 21:10:12 +01:00
Max Kellermann b6df4680df MixerPlugin: convert function pointers to Mixer virtual methods 2014-02-06 20:52:33 +01:00
Max Kellermann e04090b477 Mixer: delete the implicit copy constructor 2014-02-06 20:52:25 +01:00
Max Kellermann c9fb6f7bdb Mixer: make the constructor "explicit" 2014-02-06 20:52:25 +01:00
Max Kellermann ad6b05ae17 mixer/software: use IgnoreError() 2014-02-06 20:52:25 +01:00
Max Kellermann 855f26c43d Mixer: use reference instead of pointer for MixerPlugin 2014-02-05 17:25:47 +01:00
Max Kellermann f86e159536 Mixer: rename struct mixer_plugin to MixerPlugin 2014-02-05 17:22:34 +01:00
Max Kellermann e8938b1069 MixerPlugin: add EventLoop& init() parameter 2014-02-05 00:02:02 +01:00
Max Kellermann 68b79f97f3 output: rename source files 2014-01-28 11:42:54 +01:00
Max Kellermann 815d72065c output: rename struct audio_output to AudioOutput 2014-01-28 11:34:09 +01:00
Max Kellermann e0dc721324 OutputPlugin: rename struct audio_output_plugin to AudioOutputPlugin 2014-01-28 11:33:15 +01:00
Max Kellermann f5a923b9d1 OutputAll: convert to class, move instance to class Partition
Another big chunk of code for multi-player support.
2014-01-28 09:20:53 +01:00
Max Kellermann 68eda78704 Mixer*: move to mixer/ 2014-01-24 16:44:32 +01:00
Max Kellermann 7c52a1c04b Filter*: move to filter/ 2014-01-24 16:43:57 +01:00
Max Kellermann 197b503f3e Config*: move to config/ 2014-01-24 00:20:01 +01:00
Max Kellermann ea5b901bcc output/*: move to output/plugins/ 2014-01-23 23:49:50 +01:00
Max Kellermann 4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Max Kellermann 08f5b9f1f9 event/MultiSocketMonitor: add method ClearSocketList() 2014-01-06 18:27:26 +01:00
Max Kellermann 7b540f0226 event/MultiSocketMonitor: add method ReplaceSocketList()
Move code from AlsaMixerPlugin.
2014-01-05 01:28:36 +01:00
Max Kellermann 87fce8ef27 mixer/alsa: use DeferredMonitor to update file descriptors
EventLoop::AddCall() and EventLoop::AddIdle() are unsafe, because we
can't cancel those calls.
2014-01-04 15:58:59 +01:00
Max Kellermann 6d21b9448a pcm/PcmVolume: rename to Volume.cxx 2013-12-23 10:35:21 +01:00
Max Kellermann 86e72ffefb util/Clamp: generic Clamp() function 2013-12-22 21:08:06 +01:00
Max Kellermann 9cfd9d7ce0 Merge branch 'v0.18.x' 2013-12-15 19:17:40 +01:00
Max Kellermann 42a09ff17a mixer/alsa: fix deadlock
This deadlock was a regression by commit 8e38b4f8.  Since we currently
can't resolve this, let's revert the commit, and add a GLib specific
workaround for the build failure.
2013-12-15 19:07:25 +01:00
Max Kellermann c7b1038a9d Merge branch 'v0.18.x' 2013-12-14 12:37:16 +01:00
Max Kellermann 8e38b4f83c mixer/alsa: use BlockingCall() instead of EventLoop::AddCall()
This is safer, and works without epoll().  Fixes a build failure with
uClibc, which does not support epoll().
2013-12-13 14:35:36 +01:00
Max Kellermann f90abe9530 include cleanup using iwyu 2013-11-28 11:50:54 +01:00
Max Kellermann 88e630170e mixer/software: fix double free bug 2013-10-30 23:12:45 +01:00
Max Kellermann 20597b3632 *: use nullptr instead of NULL 2013-10-28 23:58:17 +01:00
Max Kellermann 222dc8a239 Util/ASCII: add StringEqualsCaseASCII() overload with length
Replaces GLib's g_ascii_strncasecmp().
2013-10-21 08:42:55 +02:00
Max Kellermann 0e4d2e7277 Util/ASCII: add function StringEqualsCaseASCII()
Replaces GLib's g_ascii_strcasecmp().
2013-10-20 23:09:51 +02:00
Max Kellermann dbd88e6aef Client, ...: remove unnecessary glib.h include 2013-10-15 22:51:09 +02:00
Max Kellermann 060814daa8 Log: new logging library API
Prepare to migrate away from GLib.  Currently, we're still using GLib
as a backend.
2013-10-02 08:57:55 +02:00
Max Kellermann a2ce2447a6 Merge branch 'v0.17.x' 2013-10-01 17:20:38 +02:00
Max Kellermann 9a1076256d mixer/alsa: handle ENODEV
Fixes busy loop when USB sound device gets unplugged (Mantis bug
#3824).
2013-10-01 16:35:27 +02:00
Max Kellermann 72ef38d4a7 mixer/alsa: log snd_mixer_handle_events() errors 2013-10-01 16:30:20 +02:00
Max Kellermann 26d92c80ed conf.h: remove obsolete header
Use only ConfigData.hxx in plugin sources to reduce header
dependencies.
2013-09-05 08:47:10 +02:00
Max Kellermann 29030b54c9 util/Error: new error passing library
Replaces GLib's GError.
2013-09-04 18:14:22 +02:00
Max Kellermann 5c48d3fbba alsa/mixer: defer InvalidateSockets() call to I/O thread 2013-08-10 14:05:06 +02:00
Max Kellermann 342333f72a mixer/alsa: invoke InvalidateSockets() in constructor 2013-08-10 13:54:23 +02:00
Max Kellermann be0c8495cd event/MultiSocketMonitor: PrepareSockets() returns timeout
Simplify the API, don't use GLib specific integer type.
2013-08-10 11:52:31 +02:00
Max Kellermann abe090ec1f *: remove remaining __cplusplus checks 2013-08-07 19:58:52 +02:00
Max Kellermann 123dd5fe2d mixer/alsa: use AllocatedArray for the pollfd buffer 2013-08-07 18:56:57 +02:00
Max Kellermann b70d38dc10 Makefile.am: move sources to libsystem.a 2013-08-07 10:31:31 +02:00
Max Kellermann 85b77b81ca *: use gcc.h macros instead of GLib 2013-08-04 23:48:01 +02:00
Max Kellermann a0beb5fa26 MixerPlugin: pass config_param reference 2013-08-04 14:07:50 +02:00
Max Kellermann f54bcc1f16 FilterPlugin: pass config_param reference 2013-08-04 14:07:50 +02:00
Max Kellermann 06f898cc12 tag: convert to C++ 2013-07-30 20:19:53 +02:00
Max Kellermann 648196319f output_api: convert to C++ 2013-07-30 08:34:10 +02:00
Max Kellermann 8ce9b53093 mixer/software: use gcc_unused instead of G_GNUC_UNUSED 2013-04-16 23:50:41 +02:00
Max Kellermann cb8449a66d MixerInternal: convert to class 2013-04-16 21:33:25 +02:00
Max Kellermann 621467717d mixer/winmm: convert to a class 2013-04-16 21:31:03 +02:00
Max Kellermann 506c716cf2 mixer/Software: convert to a class 2013-04-16 21:25:27 +02:00
Max Kellermann 9f625b0a0d mixer/Pulse: convert to a class 2013-04-16 21:18:54 +02:00
Max Kellermann bc1b4131cb mixer/Oss: convert to a class 2013-04-16 21:11:14 +02:00
Max Kellermann 80ba3c5932 mixer/Alsa: convert to a class 2013-04-16 21:11:06 +02:00
Max Kellermann e63420a8c2 output/Pulse: convert to C++ 2013-04-16 20:51:21 +02:00
Max Kellermann c654c7630a pcm_*: move to src/pcm/ 2013-04-09 01:24:52 +02:00
Max Kellermann 496f70fc0d mixer_plugin: convert to C++ 2013-02-22 20:51:23 +01:00
Max Kellermann 9ede4c5f3c {output,mixer}/winmm: convert to C++ 2013-02-22 20:29:03 +01:00
Max Kellermann a9ce0218c1 FilterInternal: convert struct filter to a OO interface 2013-02-02 09:34:07 +01:00
Max Kellermann 3894450b10 filter: convert to C++ 2013-02-01 17:47:09 +01:00
Max Kellermann 1b175025fe pcm_*: convert to C++ 2013-01-31 21:11:06 +01:00
Max Kellermann 7764136211 mixer/software, filter/volume: convert to C++ 2013-01-31 21:11:06 +01:00
Max Kellermann 26a9ce7b29 output/{alsa,oss}: convert to C++ 2013-01-29 14:32:32 +01:00
Max Kellermann e22ef6c481 output/roar: convert to C++ 2013-01-16 23:29:56 +01:00
Max Kellermann 2101daef5a mixer/Alsa: use MultiSocketMonitor 2013-01-15 18:18:00 +01:00
Max Kellermann 49f3855407 configure.ac: enable WIN32_LEAN_AND_MEAN on Windows 2013-01-11 11:06:16 +01:00
Max Kellermann 26ebfc04b0 EventPipe: rename to GlobalEvents 2013-01-09 23:31:43 +01:00
Max Kellermann 5faf443038 event_pipe.h: convert to C++ 2013-01-09 22:37:47 +01:00
Max Kellermann d3e1b72d38 mixer/{alsa,pulse}: convert to C++ 2013-01-09 22:25:24 +01:00
Max Kellermann 457d98c860 output/raop: delete the RAOP plugin
This plugin is horrible code, I mean it.  Last year, I tried hard to
fix it, but I figured would take less time to do a full rewrite.
Given that I don't even have any device that supports RAOP, I can't do
that properly.  After 16 months, nobody volunteered for fixing it.
Hereby, I delete it, because having no RAOP plugin is better than
having this mess.  Sorry.
2012-05-29 23:15:41 +02:00
Max Kellermann 26ec62714c mixer/alsa: listen for external volume changes
Use libasound's polling functions, implement a bridge to GSource /
GPollFD and send idle events to clients when an external program
changes the ALSA mixer volume.
2012-01-05 01:52:40 +01:00
Max Kellermann 7873b5e78b mixer/alsa: move code to alsa_mixer_setup()
Better error handling.
2012-01-05 01:52:05 +01:00
Max Kellermann 1b889c527f mixer/alsa: move code to alsa_mixer_lookup_elem() 2012-01-05 00:52:41 +01:00
Max Kellermann 3934d2d30c output/pulse: don't expose internal struct in public header
Provide _lock() and _unlock() to wrap all accesses from the mixer
plugin.
2011-09-17 19:50:36 +02:00
Max Kellermann 947848ebf6 output/roar: export volume methods
Use these instead of exposing the internal roar_t struct.
2011-09-17 19:33:51 +02:00
Max Kellermann 062948b110 mixer/raop: include cleanup 2011-08-31 08:31:26 +02:00
Max Kellermann 82f336a78f output/raop: remove excessive debug messages 2011-08-24 01:47:27 +02:00
Max Kellermann 350aa33022 output/raop: consistently use GError 2011-08-24 01:47:26 +02:00
Hans-Kristian Arntzen d9353c4fd3 Remove unused headers in Roar plugin.
Should fix build errors for Win32.
2011-03-23 21:59:22 +01:00
Max Kellermann 0c9fc2f809 Merge commit 'release-0.16.2'
Conflicts:
	Makefile.am
	NEWS
	configure.ac
2011-03-19 09:58:07 +01:00
Hans-Kristian Arntzen 1a954748a0 RoarAudio output plugin 2011-03-16 17:57:47 +01:00
Thomas Jansen 948b8f35e6 general: whitespace cleanup
Remove trailing whitespace found by this command:
find -name '*.[ch]' | xargs grep "[[:space:]]$"
2011-02-09 22:42:31 +01:00
Max Kellermann c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Dustin Puckett 79e0db4ca0 output/raop: new output plugin
Remote Audio Output Protocol (RAOP), for Apple devices.
2011-01-28 21:17:09 +01:00
Denis Krjuchkov e6fc88a758 mixer: winmm_mixer implemented 2010-10-09 02:45:08 +06:00
Avuton Olrich 9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann 5b82ffc291 include config.h in all sources
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-11-12 09:17:03 +01:00
Max Kellermann e0e6813a1d fd_util: removed creat_cloexec()
Add a "mode" argument to open_cloexec() instead.
2009-11-10 16:53:24 +01:00
Max Kellermann e3af0032b2 set the close-on-exec flag on all file descriptors
Added the "fd_util" library, which attempts to use the new thread-safe
Linux system calls pipe2(), accept4() and the options O_CLOEXEC,
SOCK_CLOEXEC.  Without these, it falls back to FD_CLOEXEC, which is
not thread safe.

This is particularly important for the "pipe" output plugin (and
others, such as JACK/PulseAudio), because we were heavily leaking file
descriptors to child processes.
2009-11-07 18:55:16 +01:00
Max Kellermann c426a0bc5c output/pulse: call mixer on state changes
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-23 10:33:26 +02:00
Max Kellermann ede828c910 mixer_control: allow methods "open" and "close" to be NULL
It's possible to have a mixer implementation which does not explicitly
need the methods open() and close().
2009-10-23 09:15:51 +02:00
Max Kellermann 7dd172efec mixer/pulse: don't get volume if stream is not yet ready
Moved the check from pulse_mixer_open() to pulse_mixer_update().
2009-10-22 20:28:12 +02:00
Max Kellermann b479a264b6 pulse: code rewrite using the asynchronous libpulse API
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-21 10:30:42 +02:00
Max Kellermann ac32f36e4e mixer_plugin: pass audio_output pointer to mixer_plugin.init()
This allows the mixer object to access its associated audio output
object.
2009-10-21 09:48:41 +02:00
Max Kellermann 4e2fb3fb89 mixer_plugin: use GError for error handling 2009-10-20 22:10:56 +02:00
Max Kellermann 097e200a97 mixer/{oss,alsa}: renamed the mixer source files 2009-10-20 21:23:05 +02:00
Max Kellermann bc4266bef8 pulse: renamed source files 2009-10-20 21:05:11 +02:00
Max Kellermann 5d74b1efef mixer/software: new mixer which controls filter/volume
This mixer plugin may be used instead of the traditional global
software mixer.  It integrates with the "volume" filter plugin, and
can control the software volume of an audio output which has no
hardware mixer.
2009-07-06 21:52:15 +02:00
Max Kellermann 9038882d95 alsa_mixer: use g_ascii_strcasecmp() instead of strcasecmp()
strcasecmp() is locale dependent, making it a bad choice for internal
string comparisons.
2009-04-28 09:28:16 +02:00
Daniel Kahn Gillmor 05dfdfdb39 alsa_mixer: add mixer_index option
This allows you to select controls with duplicate names.
2009-04-28 09:15:48 +02:00
Max Kellermann d2010c0289 pulse_mixer: use PULSE's mainloop lock instead of GMutex
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-04-25 13:53:15 +02:00
Max Kellermann eb059a789c alsa_mixer: call snd_config_update_free_global() in finish()
snd_config_update_free_global() frees cached ALSA configuration.  This
keeps valgrind a little bit more quiet.  This patch moves the call
from the open() method into the finish() method, which seems more
natural: it allows the use of the config cache, and improves the
cleanup phase.
2009-04-21 22:47:08 +02:00
Max Kellermann 43864762ee mixer: assert that the new volume value is valid
Added an assertion in mixer_set_volume().  Removed the range checks
from the ALSA and OSS plugins.
2009-03-27 20:10:39 +01:00
Max Kellermann 7d3921bb88 pulse_mixer: protect the struct with a mutex
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-27 16:55:17 +01:00
Max Kellermann 7f762a5cec pulse_mixer: return if mixer is offline
Eliminate one indent level.  Also remove several debug useless debug
messages.
2009-03-27 16:44:37 +01:00
Max Kellermann 13319e0b70 pulse_mixer: removed superfluous G_GNUC_UNUSED attributes
Those parameters are used after all.
2009-03-27 16:44:36 +01:00
Max Kellermann d448392f25 pulse_mixer: use local pa_cvolume variable for set_volume()
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-27 16:44:36 +01:00
Max Kellermann 8258457b43 pulse_mixer: wait for get_volume() operation to complete
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-27 16:44:36 +01:00
Max Kellermann 929c200c38 pulse_mixer: adapted code style
Use the same code style as the rest of MPD.
2009-03-27 00:43:47 +01:00
Max Kellermann 4343c108b3 pulse_mixer: removed superfluous initializations
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-26 19:50:31 +01:00
Max Kellermann 239e6da442 pulse_mixer: allocate "volume" statically
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-26 19:50:27 +01:00
Max Kellermann 6c480d7db4 pulse_mixer: removed superfluous NULL checks in close()
When the MPD core knows that the pulse mixer is open, pm->mainloop and
pm->context must be non-NULL.
2009-03-26 19:50:23 +01:00
Max Kellermann 8cf206f2ee pulse_mixer: initialize "online" and "index" in open()
The attributes "online" and "index" were not properly reinitialized
after a close/open cycle.
2009-03-26 19:50:15 +01:00
Max Kellermann 52575d1b9d pulse: make configuration strings const
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-26 19:50:10 +01:00
Max Kellermann cd4964cdee pulse: don't check config_param!=NULL
The conf.h functions deal well with config_param==NULL and will return
the specified default value then.
2009-03-26 19:50:02 +01:00
Max Kellermann 74273d419a pulse_mixer: free libpulse objects on failure
When the mixer initialization fails, we have to free the libpulse
objects we have already created, to prevent resource leaks.
2009-03-26 19:49:58 +01:00
Max Kellermann 3d2c8b001a pulse_mixer: unlock the mainloop on failure
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-26 19:49:55 +01:00
Max Kellermann d113c07190 pulse_mixer: moved code to pulse_mixer_setup()
Prepare for adding proper error handling.
2009-03-26 19:49:39 +01:00
Max Kellermann 3be1850744 alsa_mixer: initialize "volume_set" in the open() method
"volume_set" is an attribute which becomes undefined when the mixer is
closed.  That means, it must be initialized each time the mixer is
opened.
2009-03-26 19:49:36 +01:00
Max Kellermann 0c9799babe alsa_mixer: removed superfluous checks
The MPD core guarantees that methods are always invoked in a
consistent state.  This means we can remove lots of checks from the
volume methods.
2009-03-26 19:49:31 +01:00
Max Kellermann 331b714a7a alsa_mixer: pass default device to config_get_block_string()
Instead of replacing NULL with the default device in the open()
method, pass the default device to config_get_block_string().
2009-03-26 19:49:26 +01:00
Max Kellermann f06f049cd8 alsa_mixer: make "device" and "control" const
Use config_get_block_string() instead of config_dup_block_string().
2009-03-26 19:48:55 +01:00
Max Kellermann c552d17c03 oss_mixer: call oss_find_mixer() in init() method
Detect misconfiguration during MPD startup.
2009-03-26 19:48:21 +01:00
Max Kellermann 881026623c oss_mixer: removed superfluous checks
The MPD core guarantees that methods are always invoked in a
consistent state.  This means we can remove lots of checks from the
volume methods.
2009-03-26 19:48:13 +01:00
Max Kellermann dd8c6d6738 oss_mixer: use g_ascii_strncasecmp() instead of strncasecmp()
strncasecmp() is locale dependent, but we only need ASCII here.
2009-03-26 19:47:52 +01:00
Max Kellermann 114d5982bb oss_mixer: pass default path to config_get_block_string()
Instead of replacing NULL with the default path in the open() method,
pass the default path to config_get_block_string().
2009-03-26 19:47:47 +01:00
Max Kellermann aec4fe06b5 oss_mixer: make "device" and "control" const
Use config_get_block_string() instead of config_dup_block_string().
2009-03-26 19:46:46 +01:00
Max Kellermann 1fcf09a816 mixer_control: close mixer on failure
When getting or setting the volume fails, the MPD core close the
mixer.  Moved the duplicated code from the mixer plugins.
2009-03-26 19:46:33 +01:00
Max Kellermann 617a4fd2d2 mixer: added flag "open"
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.
2009-03-26 19:43:18 +01:00
David Guibert 2a52d49536 pulse_mixer: keep mixer attached when another pulse sink is closed.
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-17 08:40:50 +01:00
David Guibert 0ad56e0f8e pulse_mixer: close
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-17 08:40:50 +01:00
Avuton Olrich 0aee49bdf8 all: Update copyright header.
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-13 11:51:55 -07:00
David Guibert 498ec26f25 pulse_mixer: allow mpd to reconnect to the pulse mixer
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-07 19:55:09 +01:00
Max Kellermann 5ffb2dd88c pulse_mixer: added missing copyright header 2009-03-07 15:59:29 +01:00
Max Kellermann b1137fe81a pulse_mixer: added GLib log domain
Shorten some log messages, let GLib add the "pulse_mixer" prefix.
2009-03-07 15:59:26 +01:00
Max Kellermann 6069cafda0 pulse: clean up includes
Don't include output_api.h - this is not an output plugin.  Added
missing explicit conf.h and string.h includes.
2009-03-07 15:59:22 +01:00
David Guibert 21bb10f4bf pulse mixer
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-07 15:59:20 +01:00
Max Kellermann 83ce0e5325 mixer_api: replaced method "control()" with "{get,set}_volume()"
The method control() is too complicated, and overengineered.  Replace
it with two trivial functions: get_volume() and set_volume().
2009-02-16 01:39:52 +01:00
Max Kellermann 936449c622 mixer_api: removed struct mixer_data
The mixer plugins should re-use the mixer struct and incorporate it in
their object class.
2009-01-25 17:45:16 +01:00
Max Kellermann dc575106c2 mixer: merged methods "init" and "configure"
Both methods are always called together.  There is no point in having
them separate.  This simplifies the code, because the old configure()
method could be called more than once, and had to free old
allocations.
2009-01-25 17:38:12 +01:00
Max Kellermann db2058a265 mixer: removed mixer_configure_legacy(), AC_MIXER_CONFIGURE
Those have been superseded by the new legacy configuration code.
2009-01-25 17:38:06 +01:00
Max Kellermann ad8561bfdc mixer: make all mixer_plugin pointers const
The plugin structures must never be modified.
2009-01-25 17:37:52 +01:00
Max Kellermann 899eb5383d mixer: added missing copyright headers 2009-01-25 17:37:50 +01:00
Max Kellermann 3635c93acb conf: allow param==NULL
Return the default value in the conf_get_block_*() functions when
param==NULL was passed.

This simplifies a lot of code, because all initialization can be done
in one code path, regardless whether configuration is present.
2009-01-25 16:04:03 +01:00
Max Kellermann 5f77910097 conf: const pointers in block get functions
All config_get_block_*() functions should accept constant config_param
pointers.
2009-01-25 16:03:49 +01:00
Max Kellermann a531a1e650 conf: added config_get_block_string()
This replaces lots of getBlockParam() invocations.
2009-01-18 19:37:27 +01:00
Max Kellermann a0603d8897 mixer: don't check for NULL before g_free()
The g_free() function includes a NULL check.  We don't have to do it
twice.
2009-01-18 18:55:51 +01:00
Max Kellermann 4d472c265e conf: no CamelCase, part I
Renamed functions, types, variables.
2009-01-17 20:23:27 +01:00
Max Kellermann b12b5130c9 mixer: check param==NULL in the alsa and oss mixer code
When MPD starts without audio output configuration, the "param"
variable is NULL.  This triggers a segmentation fault in both mixer
plugins.
2009-01-16 17:11:18 +01:00
Viliam Mateicka d357f58542 removing mixer_reconfigure memmory leak, fixing configure of alsa and oss mixer (passing parameters) 2009-01-11 17:13:01 +01:00
Viliam Mateicka 11c29cccb3 Introducing mixer api
This patch tryes to introduce pluggable mixer (struct mixer_plugin) along with some basic infrastructure (mixer_* functions). Instance of mixer (struct mixer) is used in
alsa and oss output plugin
2009-01-10 17:55:38 +01:00
Viliam Mateicka 1a04e57168 renaming mixer.h to mixer_api.h 2009-01-04 19:15:18 +01:00
Max Kellermann ecb20c5f7e mixer: renamed mix_* options to mixer_*
There is no reason to use the shortcut "mix" instead of "mixer".
2009-01-01 18:36:47 +01:00
Viliam Mateicka 9a70c4d06d Moving mixers to audio outputs 2008-12-31 16:46:41 +01:00