summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-08-10 11:28:25 +0200
committerMax Kellermann <max@musicpd.org>2021-08-10 11:28:29 +0200
commit528e05f0250d9f92c00f56f259f60a1b9c756f4f (patch)
treee490624cafd11c99a2525fba273626e4a5f03de5
parent269583f5dd9949b106a86b11df7408e51fc34557 (diff)
output/pipewire: add config option "remote"
-rw-r--r--doc/plugins.rst3
-rw-r--r--src/output/plugins/PipeWireOutputPlugin.cxx6
2 files changed, 9 insertions, 0 deletions
diff --git a/doc/plugins.rst b/doc/plugins.rst
index f97b78c5c..40d629bbe 100644
--- a/doc/plugins.rst
+++ b/doc/plugins.rst
@@ -1084,6 +1084,9 @@ Connect to a `PipeWire <https://pipewire.org/>`_ server. Requires
- Link to the given target. If not specified, let the PipeWire
manager select a target. To get a list of available targets,
type ``pw-cli dump short Node``
+ * - **remote NAME**
+ - The name of the remote to connect to. The default is
+ ``pipewire-0``.
.. _pulse_plugin:
diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx
index cf623a1cb..73b4cf0c8 100644
--- a/src/output/plugins/PipeWireOutputPlugin.cxx
+++ b/src/output/plugins/PipeWireOutputPlugin.cxx
@@ -54,6 +54,7 @@ static constexpr Domain pipewire_output_domain("pipewire_output");
class PipeWireOutput final : AudioOutput {
const char *const name;
+ const char *const remote;
const char *const target;
struct pw_thread_loop *thread_loop = nullptr;
@@ -185,6 +186,7 @@ inline
PipeWireOutput::PipeWireOutput(const ConfigBlock &block)
:AudioOutput(FLAG_ENABLE_DISABLE),
name(block.GetBlockValue("name", "pipewire")),
+ remote(block.GetBlockValue("remote", nullptr)),
target(block.GetBlockValue("target", nullptr))
{
if (target != nullptr) {
@@ -366,6 +368,10 @@ PipeWireOutput::Open(AudioFormat &audio_format)
PW_KEY_APP_NAME, "Music Player Daemon",
PW_KEY_NODE_NAME, "mpd",
nullptr);
+
+ if (remote != nullptr && target_id == PW_ID_ANY)
+ pw_properties_setf(props, PW_KEY_REMOTE_NAME, "%s", remote);
+
if (target != nullptr && target_id == PW_ID_ANY)
pw_properties_setf(props, PW_KEY_NODE_TARGET, "%s", target);