platform/upstream/pulseaudio.git
4 years agoalsa sink/source: fix the mixer initialization
Jaroslav Kysela [Tue, 31 Mar 2020 11:32:46 +0000 (13:32 +0200)]
alsa sink/source: fix the mixer initialization

- remove duplicate mixer initialization in sink
- use the similar mixer initialization for source like for sink

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoucm: fix the port / ucm device activation on boot
Jaroslav Kysela [Tue, 31 Mar 2020 11:24:36 +0000 (13:24 +0200)]
ucm: fix the port / ucm device activation on boot

The UCM device must be activated using the pa_alsa_ucm_set_port()
call on boot (the sink creation time). In case when the
mixer controls are not defined for the application in the
UCM configuration, the mixer_handle is NULL.

Call the pa_alsa_ucm_set_port() before the mixer_handle check.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoi18n: Add pulseaudio.pot to version control
Tanu Kaskinen [Mon, 24 Feb 2020 03:51:02 +0000 (05:51 +0200)]
i18n: Add pulseaudio.pot to version control

Since the .pot file can be automatically generated, it hasn't been
included in the git repository so far. However, we're planning[1] to
start using Fedora's Weblate translation service, and it requires the
.pot file to be in the repository.

[1] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/785

4 years agoi18n: Replace po/es.po with the Fedora Zanata version
Tanu Kaskinen [Sun, 23 Feb 2020 07:38:39 +0000 (09:38 +0200)]
i18n: Replace po/es.po with the Fedora Zanata version

The Zanata version is more recent, and there haven't been other changes
to upstream than the fixes in a15cde4179a2bd3e97394ed6aca78af467dd34f6.
I modified the Zanata version to include those fixes.

4 years agoi18n: Replace po/ja.po with the Fedora Zanata version
Tanu Kaskinen [Sun, 16 Feb 2020 07:58:15 +0000 (09:58 +0200)]
i18n: Replace po/ja.po with the Fedora Zanata version

The Zanata version is more recent, and there don't seem to be many
changes that would be lost in our upstream version since 2012 (based on
the file header, the Zanata version was probably in sync with master
some time in 2012).

4 years agoi18n: Merge Catalan translation from fedora.zanata.org
Tanu Kaskinen [Sun, 9 Feb 2020 09:57:17 +0000 (11:57 +0200)]
i18n: Merge Catalan translation from fedora.zanata.org

Merged with this command, which takes new translations from the Zanata
version, but doesn't take changed translations, except when they clear
the fuzzy flag from a translation:
    msgcat --use-first po/ca.po po/ca.po.zanata -o po/ca.po

I also manually copied new translator names to the header comment. I
didn't update the header key/value section, but here are the interesting
bits from the Zanata version:

"POT-Creation-Date: 2015-10-06 16:57+0200\n"
"PO-Revision-Date: 2019-07-25 10:42+0000\n"
"Last-Translator: Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

4 years agoi18n: Import Bulgarian translation from fedora.zanata.org
Tanu Kaskinen [Sun, 9 Feb 2020 09:50:50 +0000 (11:50 +0200)]
i18n: Import Bulgarian translation from fedora.zanata.org

4 years agoprotocol-native: Fix error code
Tanu Kaskinen [Thu, 5 Mar 2020 07:11:09 +0000 (09:11 +0200)]
protocol-native: Fix error code

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/816

4 years agoalsa-ucm: use the right profile name
Wim Taymans [Wed, 25 Mar 2020 15:30:23 +0000 (16:30 +0100)]
alsa-ucm: use the right profile name

Use the right profile name or else we could pass NULL to
pa_hashmap_get() and crash.

4 years agoalsa: handle unavailbale HW volume in UCM
Wim Taymans [Fri, 20 Mar 2020 11:03:08 +0000 (12:03 +0100)]
alsa: handle unavailbale HW volume in UCM

It is possible that UCM doesn't specify hardware volume controls.
Fall back to software controls instead of aborting.

4 years agobluetooth: Ensure that only one A2DP codec is registered to bluez
Pali Rohár [Thu, 19 Mar 2020 13:02:40 +0000 (14:02 +0100)]
bluetooth: Ensure that only one A2DP codec is registered to bluez

Support for multiple codecs needs to use a new Bluez API which pulseaudio
does not implement yet.

So register explicitly only SBC codec which is provided by pulseaudio A2DP
codec API.

4 years agoucm: Don't log errors during normal operation
Tanu Kaskinen [Tue, 17 Mar 2020 07:26:57 +0000 (09:26 +0200)]
ucm: Don't log errors during normal operation

It's completely normal to not have explicit channel configuration for
stereo devices. In fact, the ALSA developers actively avoid configuring
the channels for stereo devices.

I also dropped the word "duplex" from the messages, because "stereo
duplex" implies bidirectionality, but most devices use one direction
only.

4 years agodaemon: Add --log-target=journal to pulseaudio.service
Philip Withnall [Wed, 11 Mar 2020 10:46:04 +0000 (10:46 +0000)]
daemon: Add --log-target=journal to pulseaudio.service

When running under systemd from its `.service` file, the daemon is
started with `--daemonize=no`. This means that the default logging
target is `stderr` (see the documentation for `--log-target` in
`pulse-daemon.conf(5)`). That works fine, but results in all the
structured logging data from the `pa_log()` calls being thrown away and
not making it into the journal.

In order to preserve structured logging data, and hence make the
messages in the journal a little more useful (for example, allowing the
user to filter by message priority), explicitly pass
`--log-target=journal` in the `.service` file. This should always be
appropriate because the journal should always be used with systemd.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
4 years agoci: Go back to using CI templates from master
Arun Raghavan [Sat, 7 Mar 2020 12:14:00 +0000 (07:14 -0500)]
ci: Go back to using CI templates from master

Consensus is that we prefer this to potentially remaining on older,
commits and manually updating at unknown frequency.

4 years agoci: Update for changes in CI template
Arun Raghavan [Sat, 7 Mar 2020 02:43:00 +0000 (21:43 -0500)]
ci: Update for changes in CI template

This updates things based on changes in the templates that we use. Also
pins the ref in the template repo so that our build does not break when
the template parameters change.

This does mean that we should likely periodically check the ci-templates
repo, but this seems to be better than the build breaking unexpectedly.

4 years agoremap/arm: Adjust inline asm constraints
Khem Raj [Thu, 5 Mar 2020 19:48:28 +0000 (11:48 -0800)]
remap/arm: Adjust inline asm constraints

gcc10 can effectively emit single precision registers if right
operand modifier constraint is not in use

This results in assembler rejecting the code

/tmp/ccEG4QpI.s:646: Error: VFP/Neon double precision register expected -- `vtbl.8 d3,{d0,d1},s8'
/tmp/ccEG4QpI.s:678: Error: invalid instruction shape -- `vmul.f32 d0,d0,s8'

Therefore add %P qualifier to request double registers sinece 'w' could
mean variable could be stored in s0..s14 and GCC defaults to printing out s0..s14.
Note those registers map to d0..d7 also.

Output generated is exactly same with gcc9, and it also now compiles
with gcc10

Its not documented well in gcc docs and there is a ticket for that
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84343

Signed-off-by: Khem Raj <raj.khem@gmail.com>
4 years agoalsa ucm: do not assign JackHWMute when JackControl is missing for the UCM device
Jaroslav Kysela [Sun, 1 Mar 2020 14:55:07 +0000 (15:55 +0100)]
alsa ucm: do not assign JackHWMute when JackControl is missing for the UCM device

Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/14

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoman: Deprecate the enable-remixing option
Alexander E. Patrakov [Sat, 15 Feb 2020 13:07:33 +0000 (18:07 +0500)]
man: Deprecate the enable-remixing option

The new remixing-use-all-sink-channels=no option covers all valid
use cases.

4 years agoUpdate configure.ac to fix the enable_gstreamer summary
Sebastien [Thu, 20 Feb 2020 14:19:28 +0000 (14:19 +0000)]
Update configure.ac to fix the enable_gstreamer summary

4 years agoalsa-ucm: correct the channel default logic (stereo)
Jaroslav Kysela [Tue, 11 Feb 2020 09:54:16 +0000 (10:54 +0100)]
alsa-ucm: correct the channel default logic (stereo)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agobuild: Bump soversion for libpulse v13.99.1
Arun Raghavan [Fri, 14 Feb 2020 10:07:56 +0000 (05:07 -0500)]
build: Bump soversion for libpulse

No interface changes, but minor implementation change via a fix for when
contexts are freed.

4 years agoalsa: Document that mixer elements can be identified by a combination of name and...
Tanu Kaskinen [Fri, 14 Feb 2020 09:01:04 +0000 (11:01 +0200)]
alsa: Document that mixer elements can be identified by a combination of name and index

4 years agosink, source: Fix inaccurate log message
Tanu Kaskinen [Wed, 5 Feb 2020 08:04:23 +0000 (10:04 +0200)]
sink, source: Fix inaccurate log message

The stream moving is done also when the active port changes to
unavailable, not only when the device is unlinked like the old log
message suggests.

4 years agosink, source: Fix stream rescue from sinks or sources without port
Georg Chini [Mon, 3 Feb 2020 10:19:47 +0000 (11:19 +0100)]
sink, source: Fix stream rescue from sinks or sources without port

Currently pa_{sink,source}_move_streams_to_default_{sink,source}() check the
availability of the old sink or source. The sink or source is only marked as
unavailable if the active port of a sink or source is not available.
Therefore sinks or sources without port are always considered available,
even if they are in the process of being unlinked and streams are not
rescued.

This patch removes the availability check because it is unnecessary. The
functions are only called if the sink or source becomes unavailable or if
the default sink or source changes, therefore the default_sink_changed or
default_source_changed argument can be used as an indicator if the old
sink or source is still present. In the case that the old default sink or
source becomes unavailable, the function will be called twice, once when
the default sink or source changes and once when the old sink or source
is unlinked.

4 years agoshell-completion: Do not use 'awk -e' in bash completion
Jarno Suni [Thu, 30 Jan 2020 09:50:26 +0000 (09:50 +0000)]
shell-completion: Do not use 'awk -e' in bash completion

mawk does not support  option -e. If mawk is the default awk,
like it is in Ubuntu by default, the completion does not work.

4 years agoshell-completions/bash: Add pactl set-default-sink and set-default-source
Jarno Suni [Tue, 21 Jan 2020 13:17:32 +0000 (13:17 +0000)]
shell-completions/bash: Add pactl set-default-sink and set-default-source

pactl has these commands, too. Use the same order as the
man page, except the undocumented 'help'. Note that the commands are
sorted alphabetically when completed anyway, though
that can be disabled since Bash 4.4
(https://unix.stackexchange.com/q/215937/111181)

The zsh completions already support set-default-sink and
set-default-source.

4 years agodaemon.conf: Add boolean rescue_streams parameter
Georg Chini [Wed, 22 Jan 2020 07:12:59 +0000 (08:12 +0100)]
daemon.conf: Add boolean rescue_streams parameter

Since merge requests

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/209 and
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/216

the rescuing of streams could no longer be disabled. This patch adds a boolean
parameter rescue-streams to daemon.conf which allows to disable rescuing.

The parameter defaults to true (rescuing enabled).

4 years agoPermit root-owned home directory
Nick Moriarty [Fri, 26 Jul 2019 08:28:09 +0000 (08:28 +0000)]
Permit root-owned home directory

On certain types of filesystem (especially NFS appliances which support
multiple operating systems), the user's home directory may report as
being owned by root rather than the user, yet still permit the user to
create and modify files normally (which will be owned by them).

Our users have home directories hosted on a NetApp storage appliance
which uses mixed-mode ACLs but where the home directory is set up with
NTFS ACLs at the top level.  This means they have the expected effective
permissions, but the ownership reports as root.  This could also be the
case if the filesystem were using NFS4 ACLs or similar.

4 years agosink-input, source-output: Fix stream rescue if a move fails
Georg Chini [Thu, 16 Jan 2020 14:05:38 +0000 (15:05 +0100)]
sink-input, source-output: Fix stream rescue if a move fails

Merge Requests [1] and [2] introduced a regression. Streams were no longer moved
to the default sink or source if a started move failed. This patch fixes the problem.

[1] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/209
[2] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/215

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/794

4 years agol10n: zh_TW: update translation
Yi-Jyun Pan [Sat, 11 Jan 2020 05:53:36 +0000 (05:53 +0000)]
l10n: zh_TW: update translation

4 years agovirtual sources: Propagate asyncmsgq change after source-output move
Georg Chini [Mon, 13 Jan 2020 19:40:04 +0000 (20:40 +0100)]
virtual sources: Propagate asyncmsgq change after source-output move

Currently, when the master of a virtual source is moved, the change of the
asyncmsgq is not propagated to other attached virtual sources. This leads
to a crash when the original master source is no longer available.

This patch fixes the issue by modifying the moving callback to propagate the
change to attached virtual sources.

Virtual sinks show a similar bug but that will be fixed in a different patch
series.

4 years agovirtual-surround-sink: Use correct sample spec with memblockq
Tanu Kaskinen [Sun, 5 Jan 2020 07:31:07 +0000 (09:31 +0200)]
virtual-surround-sink: Use correct sample spec with memblockq

The memblockq stores data in the virtual sink format, not in the master
sink format. The wrong sample spec caused a crash when the virtual sink
rendered data whose length was not divisible by the sink input frame
size.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/786

4 years agovirtual-source: Don't process the rewind during requesting it
Tanu Kaskinen [Sat, 4 Jan 2020 09:39:08 +0000 (11:39 +0200)]
virtual-source: Don't process the rewind during requesting it

The request_rewind() callback of the uplink sink called
pa_sink_process_rewind(), which is not allowed. Things are supposed to
happen so that first a rewind is requested, and then during the next
rtpoll loop the sink will process the request. Calling
pa_sink_process_rewind() during the request phase caused a crash.

Having a request_rewind() callback is completely unnecessary, because
it's only useful for forwarding the request to a downstream sink. In
this case there is no downstream sink.

I also set max_rewind to 0, because the sink doesn't support rewinding.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/775

4 years agomodule-jackdbus-detect: Separate sink/source channels arguments
Ben Buchwald [Tue, 18 Dec 2018 21:40:59 +0000 (16:40 -0500)]
module-jackdbus-detect: Separate sink/source channels arguments

If a channels argument is passed module-jackdbus-detect, it is passed to both
module-jack-sink and module-jack-source when those are started. This is a
problem if you want a different number of input channels from output channels.
In particular, if you want more of one than you physically have of the other,
it will fail. This commit adds separate source_channels and sink_channels
arguments to be able to specify the channels arguments to module-jack-source
and module-jack-sink separately. The combined channels argument is kept for
backwards compatibility and will be used as a default for source_channels and
sink_channels if either of them is omitted.

4 years agomodule-jackdbus-detect: Allow omitting channels argument
Ben Buchwald [Tue, 18 Dec 2018 22:12:30 +0000 (17:12 -0500)]
module-jackdbus-detect: Allow omitting channels argument

module-jackdbus-detect documents the channels argument as optional and "if
omitted, the sink wil use the number of physical output port and the source
will use the number of physical input ports registered in the JACK server."
However, although it would correctly omit the channels argument to
module-jack-sink and module-jack-source if its channel argument was omitted,
its argument validation was broken to consider omitting channels an error.
This commit properly validates the channels argument so omitting it is
accepted.

4 years agobluetooth: Print SO_TIMESTAMP warning for SCO source only once
Pali Rohár [Fri, 21 Jun 2019 18:36:09 +0000 (20:36 +0200)]
bluetooth: Print SO_TIMESTAMP warning for SCO source only once

4 years agobluetooth: Implement reading SO_TIMESTAMP for A2DP source
Pali Rohár [Sat, 4 May 2019 06:54:29 +0000 (08:54 +0200)]
bluetooth: Implement reading SO_TIMESTAMP for A2DP source

4 years agoswitch-on-connect: Blacklist HDMI devices by default
Tanu Kaskinen [Fri, 27 Dec 2019 09:10:54 +0000 (11:10 +0200)]
switch-on-connect: Blacklist HDMI devices by default

As the comment says, switching to HDMI automatically often causes
problems. Commit bae8c16bfadb43c596b03f9c7ff7c9e9f1709b76
("switch-on-connect: Do not ignore HDMI sinks") enabled switching to
HDMI earlier. It was known already then that HDMI monitors don't
necessarily have speakers on them, but I accepted the patch on the
basis that module-switch-on-connect acts only if the card profile is
switched to HDMI, so if switching to HDMI is wrong, then already the
profile switch should cause problems. I didn't think of the case where
the default sink is on some other card, in which case switching the
profile on the HDMI card doesn't cause problems by itself.

I don't want to revert bae8c16bfa, because João needs to be able to
configure their systems to automatically switch to HDMI. Instead, this
patch utilizes the new blacklisting feature in module-switch-on-connect
to blacklist HDMI sinks by default. Switching to HDMI can be enabled by
setting the blacklist modarg to an empty string or something that
doesn't match HDMI sinks.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/749

4 years agocore-util: Handle zero-length volume string
Tanu Kaskinen [Fri, 27 Dec 2019 05:33:52 +0000 (07:33 +0200)]
core-util: Handle zero-length volume string

Without checking for zero we end up accessing memory outside the str
buffer: str[len - 1].

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/768

4 years agoalsa-ucm: allow to set profile priority from UCM value
Jaroslav Kysela [Tue, 10 Dec 2019 11:34:19 +0000 (12:34 +0100)]
alsa-ucm: allow to set profile priority from UCM value

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-mixer: improve check for the empty path set for sink/source
Jaroslav Kysela [Sun, 8 Dec 2019 22:17:32 +0000 (23:17 +0100)]
alsa-mixer: improve check for the empty path set for sink/source

The unused mixer instances are created without this code.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-mixer: do the quick card number lookup to save mixer instances
Jaroslav Kysela [Sun, 8 Dec 2019 21:48:45 +0000 (22:48 +0100)]
alsa-mixer: do the quick card number lookup to save mixer instances

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: add support for HDMI ELD
Jaroslav Kysela [Sat, 7 Dec 2019 22:22:33 +0000 (23:22 +0100)]
alsa-ucm: add support for HDMI ELD

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa: rewrite mixer open/close, cache mixer accesses in probe
Jaroslav Kysela [Sat, 7 Dec 2019 19:39:21 +0000 (20:39 +0100)]
alsa: rewrite mixer open/close, cache mixer accesses in probe

The ALSA mixer can be opened multiple times (especially for UCM
in the probe). This adds a simple mixer cache to prevent
multiple open calls.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-mixer: Set the intended-role of Steelseries Arctis 5/7 headset as phone
Laurent Bigonville [Thu, 7 Mar 2019 10:36:02 +0000 (11:36 +0100)]
alsa-mixer: Set the intended-role of Steelseries Arctis 5/7 headset as phone

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/640

4 years agoalsa-mixer: Add the ability to pass the intended-role to the mapping
Laurent Bigonville [Thu, 7 Mar 2019 10:35:30 +0000 (11:35 +0100)]
alsa-mixer: Add the ability to pass the intended-role to the mapping

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/640

4 years agoraop: Add autoreconnect feature
ckdo [Thu, 15 Aug 2019 06:14:42 +0000 (08:14 +0200)]
raop: Add autoreconnect feature

This patch adds the autoreconnect feature to the raop module.
This is mainly to be used in a server context, but can be used
also in a desktop usage context.

With autoreconnect feature, the raop module behaves like this:

- At initialisation or in case of the RTSP TCP connection lost, it
  tries to reconnect every 5 seconds
- In case of any fatal error, it tries to reconnect every 5 seconds
- In UDP mode, if no timing packets received anymore for a long time,
  RTSP connection is closed, then it tries to reconnect..
- After reconnection, once RTSP session has been established again,
  playing is resumed automatically.
- When the connection is not established yet (or loss), the sink
  behaves like a null sink. In the source code I called it "autonull",
  even if autonull is set to autoreconnect param value, it could be
  split into two different params.

4 years agoraop: Code clarification : Only free the I/O thread when everything is initialized
ckdo [Tue, 29 Oct 2019 07:55:02 +0000 (08:55 +0100)]
raop: Code clarification : Only free the I/O thread when everything is initialized

4 years agoraop: Code clarification : Detect raop_client recording state in a proper way
ckdo [Tue, 29 Oct 2019 07:52:25 +0000 (08:52 +0100)]
raop: Code clarification : Detect raop_client recording state in a proper way

4 years agoraop: Fix callback call in raop client after auth : only call once everything is...
ckdo [Thu, 24 Oct 2019 14:07:20 +0000 (16:07 +0200)]
raop: Fix callback call in raop client after auth : only call once everything is freed

4 years agoraop: Fix rewinding handling : process just after request received
ckdo [Thu, 24 Oct 2019 13:09:23 +0000 (15:09 +0200)]
raop: Fix rewinding handling : process just after request received

4 years agostream: clarify the meaning of NULL device
Tanu Kaskinen [Sat, 21 Dec 2019 07:58:57 +0000 (09:58 +0200)]
stream: clarify the meaning of NULL device

The old wording could be understood so that the default sink/source
would always be used, but sometimes a policy module does a different
decision (for example module-stream-restore).

Related: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/767

4 years agomacro: Move PA_LIKELY()/PA_UNLIKELY(), PA_CLAMP()/PA_CLAMP_UNLIKELY() to pulse/gccmacro.h
Peter Meerwald [Wed, 20 May 2015 15:03:52 +0000 (17:03 +0200)]
macro: Move PA_LIKELY()/PA_UNLIKELY(), PA_CLAMP()/PA_CLAMP_UNLIKELY() to pulse/gccmacro.h

PA_CLAMP_VOLUME() in pulse/volume.h makes use of PA_CLAMP_UNLIKELY()

see https://bugs.freedesktop.org/show_bug.cgi?id=89515

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
4 years agogitlab: explain the container image tag better
Tanu Kaskinen [Fri, 20 Dec 2019 06:00:59 +0000 (08:00 +0200)]
gitlab: explain the container image tag better

4 years agogitlab: Make container updates automatic
Arun Raghavan [Thu, 21 Nov 2019 10:34:18 +0000 (16:04 +0530)]
gitlab: Make container updates automatic

4 years agoraop: Allow channel map module argument
RODRIGUEZ Christophe [Fri, 20 Dec 2019 19:49:09 +0000 (19:49 +0000)]
raop: Allow channel map module argument

4 years agoraop: Fix soft volume not applied on initial volume
ckdo [Sun, 29 Sep 2019 17:01:33 +0000 (19:01 +0200)]
raop: Fix soft volume not applied on initial volume

4 years agoalsa-mixer: handle interface type (CARD,PCM) for mixer element lookups
Jaroslav Kysela [Sat, 7 Dec 2019 16:54:04 +0000 (17:54 +0100)]
alsa-mixer: handle interface type (CARD,PCM) for mixer element lookups

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: use the proper mixer name for ucm pcm sink/source
Jaroslav Kysela [Sat, 7 Dec 2019 10:50:13 +0000 (11:50 +0100)]
alsa-ucm: use the proper mixer name for ucm pcm sink/source

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: get the mixer names from ucm, don't guess
Jaroslav Kysela [Fri, 6 Dec 2019 20:32:21 +0000 (21:32 +0100)]
alsa-ucm: get the mixer names from ucm, don't guess

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: add control and mixer device items
Jaroslav Kysela [Fri, 6 Dec 2019 19:33:45 +0000 (20:33 +0100)]
alsa-ucm: add control and mixer device items

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-util: do not try to guess the mixer name from the PCM name
Jaroslav Kysela [Fri, 6 Dec 2019 15:05:07 +0000 (16:05 +0100)]
alsa-util: do not try to guess the mixer name from the PCM name

This is just invalid. It results to an error in almost all cases.
The hw:<number> scheme is sufficient to get the right card mixer.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: do not try to use UCM device name as jack name by default
Jaroslav Kysela [Fri, 6 Dec 2019 14:43:04 +0000 (15:43 +0100)]
alsa-ucm: do not try to use UCM device name as jack name by default

Remove the implicit rule. It is perfectly ok to have the jack with
the same name for another I/O in the driver. Trust only the
value obtained from UCM.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: parse correctly the device values
Jaroslav Kysela [Fri, 6 Dec 2019 20:51:47 +0000 (21:51 +0100)]
alsa-ucm: parse correctly the device values

The UCM library is used to get the fallback values from the verbs
and the defaults section. There is no reason to duplicate this code
inside application.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agostream-restore: skip entries set on source from gnome-control-center
Hui Wang [Sat, 7 Dec 2019 05:04:39 +0000 (13:04 +0800)]
stream-restore: skip entries set on source from gnome-control-center

When users select an input device from gnome-control-center UI, the
source of this input device will be set to the
configured_default_source and the default_source, these actions are
expected, but after these actions, the gnome-control-center will call
extension_cb() to modify the entries in the database, let all stream
entries to bind the source users select, this is not correct since the
source is default_source now.

This is a temp fix for this issue, after gnome-control-center fixes
this problem, this patch should be reverted.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosource: move the streams to the default_source when the source unlink
Hui Wang [Tue, 10 Dec 2019 08:26:34 +0000 (16:26 +0800)]
source: move the streams to the default_source when the source unlink

When a source is unlinked, all streams of this source are moved to
default_source, this action is implemented in the core rather than
modules now.

And after this change, the module-rescue-streams is not needed, but
for backward compatibility, we keep it as a dummy module.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agodevice-port: moving streams since active_port on source changes status
Hui Wang [Sat, 7 Dec 2019 04:05:51 +0000 (12:05 +0800)]
device-port: moving streams since active_port on source changes status

When the active port of a source becomes unavailable, all streams from
that source should be moved to the default source.

When the active port of a source changes state from unavailable, all
streams that have their preferred_source set to this source should be
moved to this source.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosource: move streams to new appeared sources if they prefer these sources
Hui Wang [Sat, 7 Dec 2019 03:36:25 +0000 (11:36 +0800)]
source: move streams to new appeared sources if they prefer these sources

When a new source appears, all streams that have their
preferred_source set to the new source should be moved to the new
source.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agocore: move source-outputs conditionally when update default_source
Hui Wang [Sat, 7 Dec 2019 03:14:23 +0000 (11:14 +0800)]
core: move source-outputs conditionally when update default_source

When the default source changes, the streams from the old default
source should be moved to the new default source, unless the
preferred_source string is set to the old default source and the
active port of the old default source is not unavailable

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosource-output: clear the preferred_source if it is default_source
Hui Wang [Sat, 7 Dec 2019 02:29:14 +0000 (10:29 +0800)]
source-output: clear the preferred_source if it is default_source

When the user moves a stream to the current default source, the
preferred_source should be set to NULL and module-stream-restore
should clear the routing for that stream in the stream database. From
that point on the stream will be always routed to the default source.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosource-output: add a new API pa_source_output_set_preferred_source
Hui Wang [Sat, 7 Dec 2019 02:13:28 +0000 (10:13 +0800)]
source-output: add a new API pa_source_output_set_preferred_source

If the source here is NULL, that means users want to clear the
preferred_source and move the source-output to the default_source,
otherwise set the preferred_source to the source->name and move the
source-output to the source. After that fire the source_output_change
event.

After adding this API, we can use this API to simplify the entry_apply
in the module-stream-restore.c.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosource-output: change bool save_source to char *preferred_source
Hui Wang [Fri, 6 Dec 2019 13:51:10 +0000 (21:51 +0800)]
source-output: change bool save_source to char *preferred_source

The finial objective is to store the preferred source name in the
source-output struct, and use module-stream-restore to save and
restore it.

This patch just replaces the save_source with preferred_source, and
tries to keep the original logic.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agoalsa: Skip resume PCM if hardware doesn't support it
Kai-Heng Feng [Tue, 10 Dec 2019 08:16:18 +0000 (16:16 +0800)]
alsa: Skip resume PCM if hardware doesn't support it

Hardwares without SNDRV_PCM_INFO_RESUME capability, like USB Audio,
don't support snd_pcm_resume() when it's in suspended state.

Let's use snd_pcm_hw_params_can_resume() to check hardware's capability
before snd_pcm_resume() attempt. If it doesn't support resume, just go
to snd_pcm_drop() to leave suspended state directly.

4 years agoSplit the enable-lfe-remixing setting into two
Alexander Patrakov [Tue, 10 Dec 2019 06:50:59 +0000 (06:50 +0000)]
Split the enable-lfe-remixing setting into two

remixing-produce-lfe controls upmixing, and remixing-consume-lfe
controls downmixing. The motivation is that a user might want to
synthesize LFE while playing stereo audio on his/her 5.1 speakers,
but at the same time follow the industry recommendation to omit
the LFE channel when producting a stereo downmix (e.g. for headphones)
from 5.1 content. Or the other way round.

Fixes: #753.

4 years agocard-restore: prevent segfault caused by 'restore_bluetooth_profile=true'
Marc Ranolfi [Sat, 7 Dec 2019 22:06:28 +0000 (19:06 -0300)]
card-restore: prevent segfault caused by 'restore_bluetooth_profile=true'

This fixes an oversight introduced in 1f45082c which ultimately causes a segfault error in 'add_key_value()' from 'modargs.c'.

Closes #773.

4 years agoalsa-ucm: validate access to PA_DEVICE_PORT_DATA()
Jaroslav Kysela [Wed, 4 Dec 2019 18:33:01 +0000 (19:33 +0100)]
alsa-ucm: validate access to PA_DEVICE_PORT_DATA()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: add comments to ucm_get_mixer_id()
Jaroslav Kysela [Wed, 4 Dec 2019 15:29:51 +0000 (16:29 +0100)]
alsa-ucm: add comments to ucm_get_mixer_id()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: fix parsing for JackControl
Jaroslav Kysela [Tue, 3 Dec 2019 14:13:48 +0000 (15:13 +0100)]
alsa-ucm: fix parsing for JackControl

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: split correctly JackHWMute device names
Jaroslav Kysela [Tue, 3 Dec 2019 13:52:08 +0000 (14:52 +0100)]
alsa-ucm: split correctly JackHWMute device names

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: add support for master volume
Jaroslav Kysela [Wed, 27 Nov 2019 10:34:49 +0000 (11:34 +0100)]
alsa-ucm: add support for master volume

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: use the correct mixer identifiers as first
Jaroslav Kysela [Tue, 26 Nov 2019 09:54:15 +0000 (10:54 +0100)]
alsa-ucm: use the correct mixer identifiers as first

The mixer identifiers should be used for snd_mixer_selem API.
Use them as first, then try to fallback to the raw control
identifiers.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: Fix volume control based on review
Jaska Uimonen [Tue, 1 Oct 2019 15:34:17 +0000 (18:34 +0300)]
alsa-ucm: Fix volume control based on review

- sync mixer logic added
- mixer path creation, empty set in mapping creation, paths added in path creation
- path creation moved inside new port creation as it might be called twice otherwise
- some comments added

4 years agoalsa-ucm: Support Playback/CaptureVolume
Arun Raghavan [Tue, 3 May 2016 12:52:10 +0000 (18:22 +0530)]
alsa-ucm: Support Playback/CaptureVolume

This allows us to support the PlaybackVolume and CaptureVolume commands
in UCM, specifying a mixer control to use for hardware volume control.
This only works with ports corresponding to single devices at the
moment, and doesn't support stacking controls for combination ports.

The configuration is intended to provide a control (like Headphone
Playback Volume), but we try to resolve to a simple mixer control
(Headphone) to reuse existing volume paths.

On the UCM side, this also requires that when disabling the device for
the port, the volume should be reset to some default.

When enabling/disabling combination devices, things are a bit iffy since
we have no way to reset the volume before switching to a combination
device. It would be nice to have a combination-transition-sequence
command in UCM to handle this and other similar cases.

PlaybackSwitch and CaptureSwitch are yet to be implemented.

4 years agoalsa-mixer: improve alsa_id_decode() function
Jaroslav Kysela [Tue, 26 Nov 2019 09:35:14 +0000 (10:35 +0100)]
alsa-mixer: improve alsa_id_decode() function

Accept those identifiers:

        Speaker,1
        'Speaker',1
        "Speaker",1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-mixer: handle the index for ALSA mixer element identifiers
Jaroslav Kysela [Sat, 23 Nov 2019 19:59:24 +0000 (20:59 +0100)]
alsa-mixer: handle the index for ALSA mixer element identifiers

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: add mixer IDs to ucm_items
Jaroslav Kysela [Sat, 23 Nov 2019 14:50:29 +0000 (15:50 +0100)]
alsa-ucm: add mixer IDs to ucm_items

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-ucm: use ucm2 name for the direct card index open
Jaroslav Kysela [Sat, 23 Nov 2019 14:17:30 +0000 (15:17 +0100)]
alsa-ucm: use ucm2 name for the direct card index open

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
4 years agoalsa-mixer: add support for LucidSound LS31, and create usb-gaming-headset profile
Dave Chiluk [Fri, 9 Aug 2019 04:10:01 +0000 (23:10 -0500)]
alsa-mixer: add support for LucidSound LS31, and create usb-gaming-headset profile

4 years agoalsa-mixer: Add support for SteelSeries Arctis 5 2019 headset
Krzysztof Stasiowski [Tue, 18 Jun 2019 11:50:35 +0000 (11:50 +0000)]
alsa-mixer: Add support for SteelSeries Arctis 5 2019 headset

Signed-off-by: Dave Chiluk <chiluk@ubuntu.com>
4 years agoalsa-mixer: add support for SteelSeries Arctis Pro 2019 headset
Josh [Sat, 25 May 2019 09:35:01 +0000 (02:35 -0700)]
alsa-mixer: add support for SteelSeries Arctis Pro 2019 headset

Signed-off-by: Dave Chiluk <chiluk@ubuntu.com>
4 years agostream-restore: skip entries setting action from gnome-control-center
Hui Wang [Thu, 17 Jan 2019 03:21:45 +0000 (11:21 +0800)]
stream-restore: skip entries setting action from gnome-control-center

When users select an output device from gnome-control-center UI, the
sink of this output device will be set to the configured_default_sink
and the default_sink, these actions are expected, but after these
actions, the gnome-control-center will call extension_cb() to modify
the entries in the database, let all stream entries to bind the sink
users select, this is not correct since the sink is default_sink now.

This is a temp fix for this issue, after gnome-control-center fixes
this problem, this patch should be reverted.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosink: move the streams to the default_sink when the sink is unlinked
Hui Wang [Wed, 16 Jan 2019 07:40:53 +0000 (15:40 +0800)]
sink: move the streams to the default_sink when the sink is unlinked

When a sink is unlinked, all streams of this sink are moved to
default_sink, this action is implemented in the core rather than
modules now.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agodevice-port: moving streams due to changing the status of active_port
Hui Wang [Wed, 16 Jan 2019 04:58:16 +0000 (12:58 +0800)]
device-port: moving streams due to changing the status of active_port

When the active port of a sink becomes unavailable, all streams from
that sink should be moved to the default sink.

When the active port of a sink changes state from unavailable, all
streams that have their preferred_sink set to this sink should be moved
to this sink.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosink: move streams to new appeared sinks if they prefer these sinks
Hui Wang [Wed, 16 Jan 2019 04:10:38 +0000 (12:10 +0800)]
sink: move streams to new appeared sinks if they prefer these sinks

When a new sink appears, all streams that have their preferred_sink
set to the new sink should be moved to the new sink.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agocore: move sink-inputs conditionally when update default_sink
Hui Wang [Wed, 16 Jan 2019 02:35:45 +0000 (10:35 +0800)]
core: move sink-inputs conditionally when update default_sink

When the default sink changes, the streams from the old default sink
should be moved to the new default sink, unless the preferred_sink
string is set to the old default sink and the active port of the old
default sink is not unavailable

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosink-input: clear the preferred_sink if it is default_sink
Hui Wang [Wed, 16 Jan 2019 01:07:26 +0000 (09:07 +0800)]
sink-input: clear the preferred_sink if it is default_sink

When the user moves a stream to the current default sink, the
preferred_sink should be set to NULL and module-stream-restore
should clear the routing for that stream in the stream database. From
that point on the stream will be always routed to the default sink.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosink-input: add a new API pa_sink_input_set_preferred_sink
Hui Wang [Tue, 15 Jan 2019 11:28:23 +0000 (19:28 +0800)]
sink-input: add a new API pa_sink_input_set_preferred_sink

If the sink here is NULL, that means users want to clear the
preferred_sink and move the sink-input to the default_sink, otherwise
set the preferred_sink to the sink->name and move the sink-input to
the sink. After that fire the sink_input_change event.

After adding this API, we can use this API to simplify the entry_apply
in the module-stream-restore.c.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agosink-input: change bool save_sink to char *preferred_sink
Hui Wang [Tue, 15 Jan 2019 04:12:52 +0000 (12:12 +0800)]
sink-input: change bool save_sink to char *preferred_sink

The finial objective is to store the preferred sink name in the
sink-input struct, and use module-stream-restore to save and restore
it.

This patch just replaces the save_sink with preferred_sink, and tries
to keep the original logic.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
4 years agoswitch-on-connect: Fix warning on discarded const qualifier
Arun Raghavan [Fri, 22 Nov 2019 15:46:33 +0000 (21:16 +0530)]
switch-on-connect: Fix warning on discarded const qualifier

pa_modargs_get_value() returns a const string -- instead of discarding
the const qualifier, let's just duplicate the string and free it
explicitly in the failure case.

4 years agoswitch-on-connect: Add blacklisting
Ryszard Knop [Sun, 17 Nov 2019 14:24:03 +0000 (15:24 +0100)]
switch-on-connect: Add blacklisting

Add a new module argument, blacklist, which is a regular expression.
If the sink/source name matches the provided blacklist regex, don't
automatically switch to it. By default, no devices are blacklisted.

Add a new function to check whenever a regex pattern is valid, plus
extra NULL asserts in pa_match.