Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
269583f5
Commit
269583f5
authored
Aug 10, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pipewire: allow specifying a target by its name
parent
7c9f4f7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
4 deletions
+22
-4
plugins.rst
doc/plugins.rst
+4
-2
PipeWireOutputPlugin.cxx
src/output/plugins/PipeWireOutputPlugin.cxx
+18
-2
No files found.
doc/plugins.rst
View file @
269583f5
...
...
@@ -1080,8 +1080,10 @@ Connect to a `PipeWire <https://pipewire.org/>`_ server. Requires
* - Setting
- Description
* - **target ID**
- Link to the given target id.
* - **target NAME**
- 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``
.. _pulse_plugin:
...
...
src/output/plugins/PipeWireOutputPlugin.cxx
View file @
269583f5
...
...
@@ -25,6 +25,7 @@
#include "pcm/Silence.hxx"
#include "util/Domain.hxx"
#include "util/ScopeExit.hxx"
#include "util/StringCompare.hxx"
#include "util/WritableBuffer.hxx"
#include "Log.hxx"
...
...
@@ -53,6 +54,8 @@ static constexpr Domain pipewire_output_domain("pipewire_output");
class
PipeWireOutput
final
:
AudioOutput
{
const
char
*
const
name
;
const
char
*
const
target
;
struct
pw_thread_loop
*
thread_loop
=
nullptr
;
struct
pw_stream
*
stream
;
...
...
@@ -67,7 +70,7 @@ class PipeWireOutput final : AudioOutput {
using
RingBuffer
=
boost
::
lockfree
::
spsc_queue
<
std
::
byte
>
;
RingBuffer
*
ring_buffer
;
const
uint32_t
target_id
;
uint32_t
target_id
=
PW_ID_ANY
;
float
volume
=
1.0
;
...
...
@@ -182,8 +185,19 @@ inline
PipeWireOutput
::
PipeWireOutput
(
const
ConfigBlock
&
block
)
:
AudioOutput
(
FLAG_ENABLE_DISABLE
),
name
(
block
.
GetBlockValue
(
"name"
,
"pipewire"
)),
target
_id
(
block
.
GetBlockValue
(
"target"
,
unsigned
(
PW_ID_ANY
)
))
target
(
block
.
GetBlockValue
(
"target"
,
nullptr
))
{
if
(
target
!=
nullptr
)
{
if
(
StringIsEmpty
(
target
))
throw
std
::
runtime_error
(
"target must not be empty"
);
char
*
endptr
;
const
auto
_target_id
=
strtoul
(
target
,
&
endptr
,
10
);
if
(
endptr
>
target
&&
*
endptr
==
0
)
/* numeric value means target_id, not target
name */
target_id
=
(
uint32_t
)
_target_id
;
}
}
void
...
...
@@ -352,6 +366,8 @@ PipeWireOutput::Open(AudioFormat &audio_format)
PW_KEY_APP_NAME
,
"Music Player Daemon"
,
PW_KEY_NODE_NAME
,
"mpd"
,
nullptr
);
if
(
target
!=
nullptr
&&
target_id
==
PW_ID_ANY
)
pw_properties_setf
(
props
,
PW_KEY_NODE_TARGET
,
"%s"
,
target
);
const
PipeWire
::
ThreadLoopLock
lock
(
thread_loop
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment