summaryrefslogtreecommitdiffstats
path: root/pulse
Commit message (Collapse)AuthorAgeFilesLines
* pulse: immediately trigger EIO when connection is droppedHEADmasterLennart Poettering2009-08-051-1/+8
| | | | | | | | | | When the connection is dropped notify the application immediately instead of waiting until the applications calls into us the next time. This makes "aplay" handle connections shutdown similar to hardware unplugs: an immediate EIO is thrown. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: rework object destruction paths a bitLennart Poettering2009-08-042-14/+12
| | | | | | | | | Make sure we deal better with partially initialized structs. Don't check for pointer state before calling free() since free() does that anyway. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: unify stream/context state checksLennart Poettering2009-08-042-67/+95
| | | | | | | | | Unify (and simplify) the paths that check for the validity of a stream/context: always call into check_stream()/pulse_check_connection() when applicable instead of rolling our own checks each time. Also check for validity of mainloop before locking it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: get rid of redundant state variableLennart Poettering2009-08-042-17/+3
| | | | | | | | snd_pulse_t::state was mostly shadowing the state of pa_context_get_state(snd_pulse_t::context), so get rid of it and use the state of the context directly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: move a couple of PCM related functions from pulse.c to pcm_pulse.cLennart Poettering2009-08-043-82/+95
| | | | | | | | A number of functions in pulse.c are only relevant for the PCM handling, so let's move them to pcm_pulse.c. This allows us to simplify their argument lists a bit. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: replace manual mainloop by pa_mainloop_iterate()Lennart Poettering2009-08-041-9/+1
| | | | | | | The pa_mainloop_prepare()/_poll()/_dispatch() can be simplified by simply calling pa_mainloop_iterate() which does all this in one call. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: call pa_threaded_mainloop_wait() to handle spurious wakeupsLennart Poettering2009-08-031-3/+10
| | | | | | | | pa_threaded_mainloop_wait() can wake up for no reason, according to the specs of the underlying POSIX ptrhead_cond_wait() docs, so we need to call it in a loop here which should be cleaner anyway. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: unify destruction of snd_pulse_tLennart Poettering2009-08-031-19/+12
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: use PA_CONTEXT_IS_GOOD where applicableLennart Poettering2009-08-031-3/+2
| | | | | | | | | PA_CONTEXT_IS_GOOD is a safer way to check whether a context is still valid. This patch also bumps the version requirement of libpulse to 0.9.11. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: get rid of a number of assert()sLennart Poettering2009-08-033-36/+112
| | | | | | | | | | Instead of hitting an assert when any of the plugin functions is called in an invalid context we should return a clean error to make sure programs are not unnecessarily aborted. This should fix issues such as http://pulseaudio.org/ticket/595 Signed-off-by: Takashi Iwai <tiwai@suse.de>
* alsa-plugins/pulse: Implement 'pause'.Troy Moure2009-06-181-0/+25
| | | | | | | Just cork or uncork the stream to pause or unpause it. Signed-off-by: Troy Moure <twmoure@szypr.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse: Add numid check in ctl pluginTakashi Iwai2009-02-171-0/+5
| | | | | | | Added the check of non-zero numid and optimize the look-up for the element. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Mark as static the functions not used outside their unit.Diego E. 'Flameeyes' Pettenò2008-11-211-1/+1
| | | | | | | This allows the compiler to assume more about their interface, if at all possible. Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
* Check for --no-undefined linker flag and use it.Diego E. 'Flameeyes' Pettenò2008-11-211-1/+1
| | | | | | | This adds extra safety that the built libraries will have all the correct dependencies linked in. Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
* pulse - Fix capture problemTakashi Iwai2008-10-151-7/+4
| | | | | | | | In pulse_start(), pa_stream_trigger() may return NULL for the capture stream, and this caused -EIO error. Allow now pa_stream_trigger() returning NULL. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse - Fix destruction logic on failed constructionLennart Poettering2008-09-261-0/+6
| | | | | | | We need to stop the main loop first, then free the context and finally free the mainloop. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse - Fix destruction order on failureLennart Poettering2008-09-261-5/+2
| | | | | | | | If we failure we should make sure the event loop thread is not running and hence not accessing our source/sink strings before we free those strings. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse - fix minor memory leakLennart Poettering2008-09-261-0/+1
| | | | | | If we fail, we need to free the device string Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse - Start PA event loop after we have created the contextLennart Poettering2008-09-261-3/+3
| | | | | | | | We shouldn't be passing the main loop object to the pa_context while that loop is running and not locked. Push the main loop startup after we created the main loop. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* A bag of clean-ups for pcm_ctl.cLennart Poettering2008-09-031-95/+184
| | | | | Use more error checking where appropriate, optimize a few things, split common code into seperate functions.
* Remove our own poll handler implementation entirelyLennart Poettering2008-09-032-27/+0
| | | | | Neither pcm_pulse.c nor ctl_pulse.c is using our poll handler implementation anymore, so let's get rid of the common parts previously used by them, too
* Don't implement our own poll handlers, we can use the default onesLennart Poettering2008-09-031-43/+3
| | | | | As long as we have only a single fd to watch we can use the default poll handler implementations. So let's do this.
* Add const to our snd_pcm_ioplug_callback_t instancesLennart Poettering2008-09-031-2/+2
| | | | The fields are constant so let's declare that they actually are.
* Use S32/FLOAT32 only where available in the PA libsLennart Poettering2008-09-031-0/+8
| | | | | S32 samples are a recent addition to the PA API, so check if they are available before actually using them.
* Use PA_STREAM_EARLY_REQUESTS if availableLennart Poettering2008-09-031-3/+10
| | | | | | | | | | | Use PA_STREAM_EARLY_REQUESTS if PA knows it. PA >= 0.9.12 learned this flag which will make the buffering more similar to traditional fragment/period-based scheduling. Instead of delaying buffer fillup until the latest moment possible this will cause fillups much earlier. This is useful for compatibility for broken ALSA clients that don't care about 'readability' of the ALSA fd but instead schedule audio via usleep() or a similar call. (One exampler being mplayer)
* Make sure we always have a sensible channel mappingLennart Poettering2008-09-031-12/+13
| | | | | If PA doesn't know a default channel map for the specified number of channels, synthesize one by extending a known one with a smaller channel number.
* Adjust buffering metrics to match what PA internally usesLennart Poettering2008-09-031-4/+4
| | | | | Follow more closely the buffering metrics PA uses internally. This avoids clamping of the metricsin PA internally.
* Save a byte of memoryLennart Poettering2008-09-031-1/+2
| | | | | | | Since we only need a single char, we should allocate only a single char, instead of a string of two bytes. Woah! We're saving memory, baby!
* Split out O_NONBLOCK setting into seperate functionLennart Poettering2008-09-031-2/+14
| | | | Since we set O_NONBLOCK more than once, make it a nice and correct function.
* A bag of minor clean-ups for pulse.cLennart Poettering2008-09-031-22/+60
| | | | Use more error checking where appropriate, optimize a few things.
* Drop our own implementation of the poll() callbacksLennart Poettering2008-09-031-43/+2
| | | | | The ctl extension interfaces support poll() via a single file descriptor anyway, so let's use it instead of rolling our own poll support callbacks.
* Make pulse_ext_callback constLennart Poettering2008-09-031-1/+1
| | | | | We can make our instance of snd_ctl_ext_callback_t const without any problems, so let's do it.
* A bag of minor clean ups for ctl_pulse.cLennart Poettering2008-09-031-43/+71
| | | | | Use more error checking where applicable, optimize a few things, use PulseAudio API functions for comparing pa_cvolume structures.
* Rework hardware parameter selectionLennart Poettering2008-09-031-5/+5
| | | | Follow more closely the real limits of PulseAudio's API.
* Remove fix for bug 0003470Lennart Poettering2008-09-031-12/+0
| | | | | This fix is completely broken (introduces new segfaults) and the assert is tries to fix is superfluous anyway, so let's just remove this altogether.
* Add more error checkingLennart Poettering2008-09-031-12/+32
| | | | Add a bit more error checking where necessary
* Get rid of pulse_poll_revents()Lennart Poettering2008-09-034-20/+1
| | | | pulse_poll_revents() has no real purpose, so let's remove it.
* Add trailing NUL character to snprintf outputLennart Poettering2008-09-031-0/+1
| | | | | snprintf doesn't necessarily append a trailing NUL to the strings it writes. So let's do it explicitly.
* Support S32 sample typesLennart Poettering2008-09-031-1/+9
| | | | | PulseAudio has been supporting these for a while, so let's make use of them here.
* use SNDERR instead of fprintf to print error messagesLennart Poettering2008-09-032-4/+3
| | | | | We shouldn't spam on stderr unconditionally, so let's use ALSA subsystem for printing errors.
* Call pa_context_disconnect() explicitlyLennart Poettering2008-09-031-0/+1
| | | | | | | | Make sure the pa_context is disconnected when we unref it. This is also done implicitly when the last reference to the pa_context is dropped, but that might be later then expected in case someone else took a reference on our object. To make sure that the pa_context will than not make any call into our code, disconnect it explicitly.
* Don't modify the SIGPIPE handlerLennart Poettering2008-09-031-2/+0
| | | | | | Since quite a while (2 years or so) PulsAudio doesn't require SIGPIPE anymore to be set to SIG_IGN. Since resetting this was incredibly ugly in the first place it is now time to get rid of this.
* Make pulse_new() a proper C functionLennart Poettering2008-09-032-2/+2
| | | | | C functions taking no argument need a (void) as argument list. It's C++ where () is allowed too.
* Add Emacs-style /*-*- linux-c -*-*/ header commentLennart Poettering2008-09-035-0/+10
| | | | | As suggested in the kernel's CodingStyle document force Emacs into kernel-style indenting to prevent future indenting chaos, at least for Emacs users.
* Reindent to Linux kernel styleLennart Poettering2008-09-035-1149/+1252
| | | | | | | The PulseAudio plugin was horrible mix-up of different indenting styles even in the same files. Indenting by 4, by 2, by 8 characters, sometimes with tabs, sometimes with spaces. To fix this chaos I ran all files through "indent -kr -i8". Hopefully future patches will follow kernel style indenting too.
* send both an uncork and a trigger in _start()Lennart Poettering2008-07-201-6/+15
| | | | | | | | | | | | | | Heya! Here's a patch for alsa-plugins: When playing very short streams, the pulse plugin needs call pa_stream_trigger() in snd_pcm_start() to make sure the stream is actually started, in addition to uncorking the stream. Lennart Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse - Returns errors instead of assert()Takashi Iwai2008-07-161-4/+16
| | | | | | | | | | | Some sanity checks in pcm_pulse.c with assert() causes the program to abort unexpectedly when the pulseaudio daemon is dead. This is suboptimal. Examples: https://bugzilla.novell.com/show_bug.cgi?id=409532 Now fixed to return an error instead. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* pulse - Change to hook load_if_runningSjoerd Simons2008-06-061-8/+11
| | | | | | | | | | | | | | | | | Unfortunately some more testing revealed some issues with it, specifically if pulse is running your complete config is replaced the bits in the on_pulse_is_running directive. Which might not be what one actually wants :) I couldn't find a proper solution for this. So i've changed the code to optionally load config files. Just like the load hook does. Actually i just optionally call the snd_config_hook_load function, but that's not actually in the alsa API.... Also it now decides pulse is running as soon as the authorizing step begins (just after the actually connection is setup), which should save some round-trips and overhead. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Pulseaudio alsa configure hookSjoerd Simons2008-06-062-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The attached patch extends the alsa pulse plugin set with a alsa configuration hook. Allowing one to specify some configuration parameters that only come into effect when pulseaudio is running. For example a configution file like: @hooks [ { func on_pulse_is_running pcm.!default { type pulse } ctl.!default { type pulse } } ] will redirect the default alsa pcm and ctl to pulse iff pulse is running. (Assuming you defined the hook function correctly ofcourse) This is usefull for distributions that don't want to force their users to switch completely to pulseaudio, but have things a bit more dynamic :) The solutions isn't optimal though. It will mean that every program loading accessing alsa will try to make an (extra) connection to pulse to decide what to do. But i think it's the best we can do for now (or at least that i can do with my minimal knowledge of alsa). A nicer solution would be a way to always specify the pulse plugin as default and have a sort of fallback for when that fails. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Various plugins don't support "hint" sectionsTakashi Iwai2008-06-062-2/+2
| | | | | | | | | Ignore hint sections defined by hand. Those are heplful to get listed in various places, such as aplay -L ALSA bug#3834: https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3834 Signed-off-by: Takashi Iwai <tiwai@suse.de>