From e74fa2a5ac3bbeb33f9ceb739b02256e3136ef1ceddd634275d1164babcec92b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 29 Nov 2021 13:58:23 +0000 Subject: [PATCH] Accepting request 934559 from home:tiwai:branches:multimedia:libs - Improving the handling with pipewire (bsc#1188516): * Split the setup script to a sub-package pulseaudio-setup to be shared with pipewire-pulseaudio package * Modified setup script to adapt pipewire-pulse OBS-URL: https://build.opensuse.org/request/show/934559 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pulseaudio?expand=0&rev=249 --- pulseaudio.changes | 8 ++++++++ pulseaudio.spec | 26 +++++++++++++++++++------- setup-pulseaudio | 36 +++++++++++++++++++++++++++--------- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/pulseaudio.changes b/pulseaudio.changes index 598a175..751c0b8 100644 --- a/pulseaudio.changes +++ b/pulseaudio.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Nov 23 10:52:47 CET 2021 - tiwai@suse.de + +- Improving the handling with pipewire (bsc#1188516): + * Split the setup script to a sub-package pulseaudio-setup to be + shared with pipewire-pulseaudio package + * Modified setup script to adapt pipewire-pulse + ------------------------------------------------------------------- Wed Nov 17 11:11:29 UTC 2021 - Callum Farmer diff --git a/pulseaudio.spec b/pulseaudio.spec index d5ce0fe..1a52008 100644 --- a/pulseaudio.spec +++ b/pulseaudio.spec @@ -101,7 +101,7 @@ Requires: udev >= 146 Requires(pre): user(pulse) ## needs the same liborc version which was used to build against %requires_eq liborc-0_4-0 -Requires(post): %fillup_prereq +Requires(post): pulseaudio-setup Recommends: alsa-plugins-pulse Suggests: libsoxr0 >= 0.1.1 Conflicts: kernel < 2.6.31 @@ -118,6 +118,15 @@ pulseaudio is a networked sound server for Linux, other Unix like operating systems and Microsoft Windows. It is intended to be an improved drop-in replacement for the Enlightened Sound Daemon (ESOUND). +%package setup +Summary: Set-up script for PulseAudio +Group: System/Sound Daemons +Requires(post): %fillup_prereq + +%description setup +This package contains a setup script for making PulseAudio working with +various applications. + %package module-lirc Summary: LIRC module for PulseAudio Group: System/Sound Daemons @@ -407,7 +416,6 @@ install -Dm0644 %{SOURCE10} %{buildroot}%{_sysusersdir}/system-user-pulse.conf %post /sbin/ldconfig %tmpfiles_create pulseaudio.conf -%{fillup_only -an sound} if [ ! -f /etc/systemd/user/sockets.target.wants/%{name}.socket ]; then echo "Switching PulseAudio activation using systemd user socket." echo "Please log out from all sessions once to make it effective." @@ -451,6 +459,9 @@ exit 0 %service_del_postun pulseaudio.service exit 0 +%post setup +%{fillup_only -an sound} + %post gdm-hooks %tmpfiles_create pulseaudio-gdm-hooks.conf @@ -458,11 +469,9 @@ exit 0 %doc README %license LICENSE GPL LGPL %{_bindir}/pulseaudio -%{_bindir}/setup-pulseaudio %{_bindir}/qpaeq %dir %{_datadir}/pulseaudio %{_datadir}/pulseaudio/alsa-mixer -%{_fillupdir}/sysconfig.sound-pulseaudio %dir %{_libdir}/pulseaudio %{_libdir}/pulseaudio/libpulsecore-%{drvver}.so %dir %{_libdir}/pulse-%{drvver}/ @@ -564,13 +573,16 @@ exit 0 %{_prefix}/lib/tmpfiles.d/pulseaudio.conf %ghost %dir %{_localstatedir}/lib/pulseaudio +# xwayland integration +%{_userunitdir}/pulseaudio-x11.service + +%files setup +%{_bindir}/setup-pulseaudio +%{_fillupdir}/sysconfig.sound-pulseaudio # created by setup-pulseaudio script %ghost %{_sysconfdir}/profile.d/pulseaudio.sh %ghost %{_sysconfdir}/profile.d/pulseaudio.csh -# xwayland integration -%{_userunitdir}/pulseaudio-x11.service - %files gdm-hooks %attr(0750, gdm, gdm) %ghost %dir %{_localstatedir}/lib/gdm %attr(0700, gdm, gdm) %ghost %dir %{_localstatedir}/lib/gdm/.pulse diff --git a/setup-pulseaudio b/setup-pulseaudio index 106e2f2..78c2c0b 100644 --- a/setup-pulseaudio +++ b/setup-pulseaudio @@ -66,6 +66,20 @@ setup_gconf_vendor() { fi } +has_user_pulseaudio() { + test -f /etc/systemd/user/sockets.target.wants/pulseaudio.socket && reutrn 0 + test -f /etc/systemd/user/sockets.target.wants/pipewire-pulse.socket && return 0 + return 1 +} + +pulseaudio_bin_name() { + if [ -x /usr/bin/pulseaudio ]; then + echo "pulseaudio" + else + echo "pipewire-pulse" + fi +} + enable_phonon() { echo "Enabling PulseAudio for Phonon..." delete_variable PHONON_PULSEAUDIO_DISABLE @@ -213,7 +227,8 @@ enable_qemu () { } enable_autospawn() { - test -f /etc/systemd/user/sockets.target.wants/pulseaudio.socket && return + has_user_pulseaudio && return + test -x /usr/bin/pulseaudio || return echo "Enabling PulseAudio autospawn..." if grep -q ^autospawn $pulse_client_conf >/dev/null 2>&1; then sed -i -e "s|^autospawn.*|autospawn = yes|g" $pulse_client_conf @@ -223,10 +238,11 @@ enable_autospawn() { } enable_systemd() { - test -f /etc/systemd/user/sockets.target.wants/pulseaudio.socket || return + has_user_pulseaudio || return echo "Enabling systemd user socket..." - systemctl --global unmask pulseaudio.socket - systemctl --global unmask pulseaudio.service + s=$(pulseaudio_bin_name) + systemctl --global unmask $s.socket + systemctl --global unmask $s.service } disable_alsa() { @@ -329,7 +345,8 @@ disable_qemu () { } disable_autospawn() { - test -f /etc/systemd/user/sockets.target.wants/pulseaudio.socket && return + has_user_pulseaudio && return + test -x /usr/bin/pulseaudio || return echo "Disabling PulseAudio autospawn..." if grep -q ^autospawn $pulse_client_conf >/dev/null 2>&1; then sed -i -e "s|^autospawn.*|autospawn = no|g" $pulse_client_conf @@ -341,12 +358,13 @@ disable_autospawn() { } disable_systemd() { - test -f /etc/systemd/user/sockets.target.wants/pulseaudio.socket || return + has_user_pulseaudio || return echo "Disabling systemd user socket..." - systemctl --global mask pulseaudio.socket - systemctl --global mask pulseaudio.service + s=$(pulseaudio_bin_name) + systemctl --global mask $s.socket + systemctl --global mask $s.service # kill leftover PA processes - killall pulseaudio > /dev/null 2>&1 + killall $s > /dev/null 2>&1 } enable_all() {