From 83681de3c10ef15f96f21e4ae541eedd56bd620b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Wed, 1 Feb 2023 03:03:25 +0000 Subject: [PATCH] ao_pipewire: add support for exclusive mode --- DOCS/man/options.rst | 8 ++++---- audio/out/ao_pipewire.c | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 442a7ff3e1..9739873a91 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -1846,10 +1846,10 @@ Audio Enable exclusive output mode. In this mode, the system is usually locked out, and only mpv will be able to output audio. - This only works for some audio outputs, such as ``wasapi`` and - ``coreaudio``. Other audio outputs silently ignore this options. They either - have no concept of exclusive mode, or the mpv side of the implementation is - missing. + This only works for some audio outputs, such as ``wasapi``, ``coreaudio`` + and ``pipewire``. Other audio outputs silently ignore this option. + They either have no concept of exclusive mode, or the mpv side of the + implementation is missing. ``--audio-fallback-to-null=`` If no audio device can be opened, behave as if ``--ao=null`` was given. This diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index ec7f68bb0e..d8ad7148ee 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -554,6 +554,9 @@ static int init(struct ao *ao) PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS; + if (ao->init_flags & AO_INIT_EXCLUSIVE) + flags |= PW_STREAM_FLAG_EXCLUSIVE; + if (pw_stream_connect(p->stream, PW_DIRECTION_OUTPUT, PW_ID_ANY, flags, params, 1) < 0) { pw_thread_loop_unlock(p->loop);