summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink.c
Commit message (Collapse)AuthorAgeFilesLines
* capture: Implement per-stream volume control for capture streams.Colin Guthrie2011-06-221-2/+4
| | | | | | | This piggy backs onto the previous changes for protocol 22 and thus does not bump the version. This and the previous commits should be seen as mostly atomic. Apologies for any bisecting issues this causes (although I would expect these to be minimal)
* alsa-sink: Some trivial tidyupsColin Guthrie2011-06-221-11/+15
| | | | | Mostly typo fixes but also a change to make a function relating to sink inputs use more generic variable names.
* core: Factor out passthrough checks into their own functionsArun Raghavan2011-05-021-1/+1
| | | | | | | | | | Since we currently have two mechanisms to signal a passthrough connection (non-PCM format or PA_SINK_INPUT_PASSTHROUGH flag), we move all the related checks into functions and use those everywhere. This makes things more consistent, and should we decide to get rid of the flag, we only need to change pa_sink_input_*_is_passthrough() accordingly.
* sink: Trivial typo fix in commentArun Raghavan2011-05-021-1/+1
|
* sink-input: Kill passthrough streams if moving to an unsupported sinkArun Raghavan2011-05-021-0/+27
| | | | | | This will eventually be replaced by a hook to let clients know that the stream has moved so that they can gracefully reconnect and renegotiate a supported format.
* sink: Fix leak in pa_sink_check_formats()Arun Raghavan2011-05-021-1/+4
| | | | We weren't freeing the sink formats idxset.
* sink: Remove PASSTHROUGH flagArun Raghavan2011-05-021-15/+22
| | | | | | | This removes the passthrough flag from sinks since we will drop exclusively passthrough sinks in favour of providing a list of formats supported by each sink. We can still determine whether a sink is in passthrough mode by checking if any non-PCM streams are attached to it.
* sink: Extend API for compressed formats supportArun Raghavan2011-05-021-0/+51
| | | | | | This adds a get_formats() vfunc for sinks to provide a list of formats they can support. pa_sink_check_formats() can be used during or after routing to determine what formats from a stream the sink can support.
* Fix up according to Coding StyleMaarten Bosmans2011-03-111-16/+16
| | | | Only whitespace changes in here
* Revert "Add volume ramping feature - sink modification"Arun Raghavan2011-02-281-6/+1
| | | | | | | | | | This reverts commit 897ef86b7fbb87ef17d30c584e6cd93abfc342bc. Conflicts: src/pulsecore/sink.c (part of a patch series removing all ramping code)
* sink: Add casts to some printf arguments to get rid of compiler warnings.Tanu Kaskinen2011-02-281-5/+6
|
* sink: Don't send unnecessary PA_SINK_MESSAGE_SET_SHARED_VOLUME messages.Tanu Kaskinen2011-02-281-2/+0
| | | | If send_msg is false, the message will be sent by the caller.
* Implement the "volume sharing" feature.Tanu Kaskinen2011-02-261-160/+395
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we have a filter sink that does some processing, currently the benefits of the flat volume feature are not really available. That's because if you have a music player that is connected to the filter sink, the hardware sink doesn't have any idea of the music player's stream volume. This problem is solved by this "volume sharing" feature. The volume sharing feature works so that the filter sinks that want to avoid the previously described problem declare that they don't want to have independent volume, but they follow the master sink volume instead. The PA_SINK_SHARE_VOLUME_WITH_MASTER sink flag is used for that declaration. Then the volume logic is changed so that the hardware sink calculates its real volume using also the streams connected to the filter sink in addition to the streams that are connected directly to the hardware sink. Basically we're trying to create an illusion that from volume point of view all streams are connected directly to the hardware sink. For that illusion to work, the volumes of the filter sinks and their virtual streams have to be managed carefully according to a set of rules: If a filter sink follows the hardware sink volume, then the filter sink's * reference_volume always equals the hw sink's reference_volume * real_volume always equals the hw sink's real_volume * soft_volume is always 0dB (ie. no soft volume) If a filter sink doesn't follow the hardware sink volume, then the filter sink's * reference_volume can be whatever (completely independent from the hw sink) * real_volume always equals reference_volume * soft_volume always equals real_volume (and reference_volume) If a filter sink follows the hardware sink volume, and the hardware sink supports flat volume, then the filter sink's virtual stream's * volume always equals the hw sink's real_volume * reference_ratio is calculated normally from the stream volume and the hw sink's reference_volume * real_ratio always equals 0dB (follows from the first point) * soft_volume always equals volume_factor (follows from the previous point) If a filter sink follows the hardware sink volume, and the hardware sink doesn't support flat volume, then the filter sink's virtual stream's * volume is always 0dB * reference_ratio is always 0dB * real_ratio is always 0dB * soft_volume always equals volume_factor If a filter sink doesn't follow the hardware sink volume, then the filter sink's virtual stream is handled as a regular stream. Since the volumes of the virtual streams are controlled by a set of rules, the user is not allowed to change the virtual streams' volumes. It would probably also make sense to forbid changing the filter sinks' volume, but that's not strictly necessary, and currently changing a filter sink's volume changes actually the hardware sink's volume, and from there it propagates to all filter sinks ("funny" effects are expected when adjusting a single channel in cases where all sinks don't have the same channel maps). This patch is based on the work of Marc-André Lureau, who did the initial implementation for Pulseaudio 0.9.15.
* core: Added new hooks: PA_CORE_HOOK_SOURCE_PORT_CHANGED and ↵Kim Therkelsen2011-02-251-0/+2
| | | | | | | | | | | PA_CORE_HOOK_SINK_PORT_CHANGED This allows modules to know when certain ports are changed. This will allow e.g. a filter module (or LADSAP) to only load when a certain port is used on the device (e.g. to only filter headphones and not normal speakers). (Comment from Colin Guthrie: This may also have use in UCM)
* core: Link virtual sinks and sources to their streams.Tanu Kaskinen2011-02-221-0/+1
| | | | | | | | | | | | | | | This change doesn't add any functionality in itself, but it will be useful in the future for operating on chains of sinks or sources that are piggy-backing on each other. For example, the PA_PROP_DEVICE_MASTER_DEVICE property could be handled in the core so that each virtual device doesn't have to maintain it separately. By using the origin_sink and destination_source pointers the core is able to see at stream creation time that the stream is created by a virtual device, and then update that device's property list using the name of the master device that the stream is being connected to. The same thing can be done also when the stream is being moved from a device to another, in which case the _MASTER_DEVICE property needs updating.
* ratelimit: fix log levels of log suppression messagesLennart Poettering2011-01-311-1/+1
| | | | | | | | | When logging a suppression message do so on the same log level as the suppressed messages. Cherry picked by Colin Guthrie from ec5a7857127a1b3b9c5517c4a70a9b2c8aab35ca with a couple of additional changes due to extra limiting in master that was not present in stable-queue.
* core: Use pa_sink_get_latency_within_thread() in sync-volume codeJyri Sarha2011-01-151-9/+2
|
* core: Use volume_change_safety_margin when rewinding sync-volume eventsJyri Sarha2011-01-151-6/+16
| | | | | After this patch the volume changes are applied immediately after sink rewind before processing streams and monitor source.
* intended-roles: Mark devices with a form factor of 'headset' as being ↵Colin Guthrie2010-10-161-1/+2
| | | | | | | appropriate for 'phone' streams This was a result a report by Patrick Ben Koetter relating to his Logitech Wireless Headset.
* daemon-conf: Add sync volume parameters to daemon-confJyri Sarha2010-10-161-4/+2
| | | | | | Signed-off-by: Jyri Sarha <jyri.sarha@nokia.com> Reviewed-by: Tanu Kaskinen <tanu.kaskinen@digia.com> Reviewd-by: Colin Guthrie <cguthrie@mandriva.org>
* core: Add infrastructure for synchronizing HW and SW volume changesJyri Sarha2010-10-161-16/+280
| | | | | | | | | | | | | | | | To make concurrent use of SW and HW volume glitchles their application needs to be synchronized. For accurate synchronization the HW volume needs to be applied in IO thread. This patch adds infrastructure to delay the applying of HW volume to match with SW volume timing. To avoid synchronization problems this patch moves many of the volume and mute related functions from main thread to IO thread. All these changes become active only if the sync volume flag for a sink has been set. So, for this patch to have any effect it needs to be taken into use by sink implementor. Signed-off-by: Jyri Sarha <jyri.sarha@nokia.com> Reviewed-by: Tanu Kaskinen <tanu.kaskinen@digia.com> Reviewd-by: Colin Guthrie <cguthrie@mandriva.org>
* suspend: Do not assert when checking for device suspended status and a ↵Colin Guthrie2010-10-011-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | stream is not linked. When looping through the streams on a given device checking to see if the stream is 'active' there should be no assert if the stream is not linked, it should simply be ignored. This assert can be hit if a sink and a sink input are both created and setup but the final put calls are left to the end as is done in module-ladspa-sink. While the order of the calls in module-ladspa-sink could be altered, we should deal gracefully with the way it is now and not complain about ending up in this state. A trigger case was trivial: 1. Load a ladspa-sink. 2. Play a stream and move it to it. 3. Unload the module, then reload it. 4. Due to module-stream-restore and module-suspend-on-idle, the hook callbacks will ultimately hit this assert. Thanks to Kim Therkelsen for highlighting this issue.
* AC3 passthrough supportPierre-Louis Bossart2010-08-121-0/+18
| | | | | | | | | | | | Second version after Tanu's feedback TODO: - notify client that volume control is disabled - change sink rate in passthrough mode if needed - automatic detection of passthrough mode instead of hard coded profile names Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
* core: rework how stream volumes affect sink volumesLennart Poettering2010-02-231-1/+41
|
* Merge remote branch 'origin/merge-queue'Lennart Poettering2009-11-051-1/+5
|\ | | | | | | | | | | Conflicts: src/pulsecore/sink-input.c src/pulsecore/sink.c
| * Add volume ramping feature - sink modificationmerge-queuezbt2009-08-051-1/+5
| |
* | sink: simplify silence checksWim Taymans2009-10-301-12/+10
| |
* | use cloexec wrappers wherever applicableLennart Poettering2009-10-301-2/+2
| |
* | core: drop unnecessary variable initializationLennart Poettering2009-09-031-1/+1
| |
* | sink: simplify pa_sink_render_full() by replacing it by a pa_sink_render() ↵Lennart Poettering2009-09-021-76/+14
| | | | | | | | plus a couple of pa_sink_render_full()
* | core: fill up memblock with pa_sink_render_into_full() in ↵Lennart Poettering2009-09-011-11/+5
| | | | | | | | pa_sink_render_full() instead of doing our own loop
* | core: handle suspended state in pa_sink_render_full() similar to the other ↵Lennart Poettering2009-09-011-1/+10
| | | | | | | | render functions
* | core: add missing sink_unref()Lennart Poettering2009-09-011-0/+3
| |
* | core: always allow volume setting with single-channel pa_cvolumeLennart Poettering2009-08-311-2/+8
| |
* | core: initialize sink/source priorities automatically based on their proplistsLennart Poettering2009-08-291-0/+47
| |
* | core: add priority field to pa_sink/pa_sourceLennart Poettering2009-08-281-0/+1
| |
* | object: speed up type verification by not relying on strcmp()Lennart Poettering2009-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using string contents for type identification use the address of a constant string array. This should speed up type verifications a little sind we only need to compare one machine word instead of a full string. Also, this saves a few strings. To make clear that types must be compared via address and not string contents 'type_name' is now called 'type_id'. This also simplifies the macros for declaring and defining public and private subclasses.
* | sink-input: add callbacks that are called whenever the mute/volume changesLennart Poettering2009-08-211-3/+13
| |
* | sink: volume handling rework, new flat volume logicLennart Poettering2009-08-191-139/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - We now implement a logic where the sink maintains two distinct volumes: the 'reference' volume which is shown to the users, and the 'real' volume, which is configured to the hardware. The latter is configured to the max of all streams. Volume changes on sinks are propagated back to the streams proportional to the reference volume change. Volume changes on sink inputs are forwarded to the sink by 'pushing' the volume if necessary. This renames the old 'virtual_volume' to 'real_volume'. The 'reference_volume' is now the one exposed to users. By this logic the sink volume visible to the user, will always be the "upper" boundary for everything that is played. Saved/restored stream volumes are measured relative to this boundary, the factor here is always < 1.0. - introduce accuracy for sink volumes, similar to the accuracy we already have for source volumes. - other cleanups.
* | core: add to FIXMEsLennart Poettering2009-08-161-0/+1
| |
* | core: introduce pa_{sink|source}_update_flags()Lennart Poettering2009-08-151-1/+21
| |
* | core: document difference between IO and main thread view on requested latencyLennart Poettering2009-08-151-0/+3
| |
* | core: don't update latency range if not changedLennart Poettering2009-08-151-2/+5
| |
* | core: call pa_sink_get_latency_within_thread() instead of going directly via ↵Lennart Poettering2009-08-151-8/+2
| | | | | | | | process_msg()
* | core: make fixed latency dynamically changeableLennart Poettering2009-08-151-17/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | This of course makes the name 'fixed' a bit of a misnomer. However the definitions are now like this: fixed latency: the latency may change during runtime, but is solely controlled by the backend, the client has no influence. dynamic latency: the latency may change during runtime, influenced by the requests of the clients. i.e. fixed vs. dynamic is from the perspective of the client.
* | core: move rtpoll to thread_info sub structureLennart Poettering2009-08-151-6/+5
| |
* | core: split of FAIL_ON_SUSPEND into KILL_ON_SUSPEND and NO_CREATE_ON_SUSPENDLennart Poettering2009-08-151-2/+2
| |
* | core: introduce pa_{sink_input|source_output}_fail_move()Lennart Poettering2009-08-151-5/+3
| |
* | core: add assert macros for verifying calling contextLennart Poettering2009-08-131-15/+74
| | | | | | | | | | | | | | This adds pa_assert_io_context() and pa_assert_ctl_context() in addition to a few related macros. When called they will fail when the current execution context is not IO resp. not control context. (aka 'thread' context vs. 'main' context)
* | ladspa/remap: make sure we process all requested rewinds unconditionallyLennart Poettering2009-08-071-2/+5
| | | | | | | | | | | | | | In some situations a rewind request travelling downstream might be optimized away on its way and an upstream rewind processing might never come back. Hence, call _process_rewind() before each _render()just to make sure we processed them all.