Added files

This commit is contained in:
2024-05-27 13:39:48 +02:00
parent cf54afa7ed
commit d075dc791f
7 changed files with 187 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# Load pipewire configuration at conf hook processing time. This allows to
# override pulseaudio defaults configuration which is also applied via hook.
#
# Note since hooks are run after @GENTOO_PORTAGE_EPREFIX@/etc/asound.conf and ~/.asoundrc are applied,
# we load these again here make sure that user configuration takes precedence.
@hooks [
{
func load
files [
"@GENTOO_PORTAGE_EPREFIX@/usr/share/alsa/alsa.conf.d/99-pipewire-default.conf"
"@GENTOO_PORTAGE_EPREFIX@/etc/asound.conf"
"~/.asoundrc"
]
errors false
}
]

View File

@@ -0,0 +1,52 @@
.TH "gentoo-pipewire-launcher" "1" "2023-06-15"
.SH "NAME"
gentoo\-pipewire\-launcher \- start instances of PipeWire, PipeWire-Pulse and WirePlumber
.SH "SYNOPSIS"
.BR gentoo\-pipewire\-launcher
[restart]
.SH "DESCRIPTION"
\fIgentoo\-pipewire\-launcher\fR starts instances of PipeWire and
WirePlumber.
Two instances of PipeWire are started: one as the core sound-server, and
one for PulseAudio emulation (cf.\&
.BR pipewire-pulse (1)\fR).
.PP
It must be run in an environment with an active D-Bus session bus,
i.e. one in which the
.B DBUS_SESSION_BUS_ADDRESS
environment variable is set appropriately.
.PP
\fIgentoo\-pipewire\-launcher\fR
tries to avoid restarting, in order to avoid audio dropouts.
However, a restart can be forced by calling
\fIgentoo\-pipewire\-launcher\fR
with an argument of \(oqrestart\(cq.
.PP
.B ${XDG_CONFIG_HOME}/gentoo\-pipewire\-launcher.conf
(or, if
.B ${XDG_CONFIG_HOME}
is not set,
.BR ${HOME}/.config/gentoo\-pipewire\-launcher.conf )
can be used to specify absolute paths of files to which log output
should be sent, by specifying values for one or more of the
.B GENTOO_PIPEWIRE_LOG\fR,
.B GENTOO_PIPEWIRE_PULSE_LOG\fR,
and
.B GENTOO_WIREPLUMBER_LOG
variables, one per line.
.SH "REPORTING BUGS"
Please report bugs via https://bugs.gentoo.org/
.SH "FILES"
.TP
.B ${XDG_CONFIG_HOME}/gentoo\-pipewire\-launcher.conf
configures locations of files for log output.
.TP
.B ${HOME}/.config/gentoo\-pipewire\-launcher.conf
configures locations of files for log output if
.B ${XDG_CONFIG_HOME}
is not set.
.SH "SEE ALSO"
.BR pipewire (1),
.BR pipewire-pulse (1),
.BR wireplumber (1),
.BR pipewire.conf (5)

View File

@@ -0,0 +1,84 @@
#!/bin/sh
# PipeWire launcher script for XDG compliant desktops on OpenRC.
#
# systemd users are very _STRONGLY_ advised to use the much
# more reliable and predictable user units instead.
# WARNING: This script assumes being run inside XDG compliant session,
# which means D-Bus session instance is expected to be correctly set up
# prior to this script starting. If that is not true, things may break!
DATE_FORMAT='+%Y-%m-%dT%H:%M:%S%Z'
CONF="${XDG_CONFIG_HOME:-${HOME}/.config}/gentoo-pipewire-launcher.conf"
if [ -f "${CONF}" ]
then
. "${CONF}"
else
GENTOO_PIPEWIRE_LOG='/dev/null'
GENTOO_PIPEWIRE_PULSE_LOG='/dev/null'
GENTOO_WIREPLUMBER_LOG='/dev/null'
fi
for L in \
"${GENTOO_PIPEWIRE_LOG}" \
"${GENTOO_PIPEWIRE_PULSE_LOG}" \
"${GENTOO_WIREPLUMBER_LOG}"
do
if [ ! -e "${L}" ]
then
touch "${L}"
fi
done
restart () {
echo "Terminating PipeWire processes ..."
pkill -u "${USER}" -x pipewire\|wireplumber 1>/dev/null 2>&1
# pidwait was renamed to pwait w/ procps-4 (bug #914030)
if command -v pidwait > /dev/null ; then
pidwait -u "${USER}" -x pipewire\|wireplumber
elif command -v pwait > /dev/null ; then
pwait -u "${USER}" -x pipewire\|wireplumber
fi
echo "PipeWire terminated."
}
if [ "${#}" -gt 0 ]
then
if [ "${1}" = 'restart' ]
then
restart
else
echo "Unrecognised argument." >&2
echo "Usage: gentoo-pipewire-launcher [restart]" >&2
exit 1
fi
fi
if pgrep -u "${USER}" -x pipewire\|wireplumber 1>/dev/null 2>&1
then
echo "PipeWire already running, exiting." >&2
echo "(Use 'gentoo-pipewire-launcher restart' to restart PipeWire and WirePlumber.)" >&2
exit 1
fi
# The core daemon which by itself does probably nothing.
echo "[$(@GENTOO_PORTAGE_EPREFIX@/bin/date ${DATE_FORMAT})] Starting PipeWire." 1>>"${GENTOO_PIPEWIRE_LOG}"
@GENTOO_PORTAGE_EPREFIX@/usr/bin/pipewire 1>>"${GENTOO_PIPEWIRE_LOG}" 2>&1 &
# The so called pipewire-pulse daemon used for PulseAudio compatibility.
# Commenting this out will stop the PA proxying daemon from starting,
# however ALSA (with pipewire-alsa), JACK (with jack-sdk) and PW API using
# clients will still have access to audio and may end up clashing with
# non-PW apps over HW control (most notably, /usr/bin/pulseaudio daemon).
echo "[$(@GENTOO_PORTAGE_EPREFIX@/bin/date ${DATE_FORMAT})] Starting PipeWire-Pulse." 1>>"${GENTOO_PIPEWIRE_PULSE_LOG}"
@GENTOO_PORTAGE_EPREFIX@/usr/bin/pipewire -c pipewire-pulse.conf 1>>"${GENTOO_PIPEWIRE_PULSE_LOG}" 2>&1 &
# Hack for bug #822498
sleep 1
# Finally a session manager is required for PipeWire to do anything.
echo "[$(@GENTOO_PORTAGE_EPREFIX@/bin/date ${DATE_FORMAT})] Starting WirePlumber." 1>>"${GENTOO_WIREPLUMBER_LOG}"
exec @GENTOO_PORTAGE_EPREFIX@/usr/bin/wireplumber 1>>"${GENTOO_WIREPLUMBER_LOG}" 2>&1

View File

@@ -0,0 +1,6 @@
wireplumber.profiles = {
main = {
hardware.audio = required
hardware.bluetooth = required
}
}

View File

@@ -0,0 +1,12 @@
diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in
--- a/src/daemon/pipewire.conf.in
+++ b/src/daemon/pipewire.conf.in
@@ -6,7 +6,7 @@ context.properties = {
#support.dbus = true
#link.max-buffers = 64
link.max-buffers = 16 # version < 3 clients can't handle more
- #mem.warn-mlock = false
+ mem.warn-mlock = true # Gentoo should have good RLIMITs now
#mem.allow-mlock = true
#mem.mlock-all = false
#clock.power-of-two-quantum = true

View File

@@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Name[de]=PipeWire Mediensystem
Name=PipeWire Media System
Comment[de]=Das PipeWire Mediensystem starten
Comment=Start the PipeWire Media System
Exec=/usr/bin/gentoo-pipewire-launcher restart
Terminal=false
Type=Application
X-GNOME-HiddenUnderSystemd=true
X-KDE-HiddenUnderSystemd=true
X-systemd-skip=true