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
6975d3ca
Commit
6975d3ca
authored
Jul 30, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/pipewire: switch from pw_main_loop to pw_thread_loop
We need this for pw_thread_loop_lock().
parent
cdca27e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
22 deletions
+11
-22
PipeWireOutputPlugin.cxx
src/output/plugins/PipeWireOutputPlugin.cxx
+11
-22
No files found.
src/output/plugins/PipeWireOutputPlugin.cxx
View file @
6975d3ca
...
...
@@ -21,7 +21,6 @@
//#include "lib/pipewire/MainLoop.hxx"
#include "../OutputAPI.hxx"
#include "../Error.hxx"
#include "thread/Thread.hxx"
#ifdef __GNUC__
#pragma GCC diagnostic push
...
...
@@ -43,8 +42,9 @@
#include <stdexcept>
class
PipeWireOutput
final
:
AudioOutput
{
Thread
thread
{
BIND_THIS_METHOD
(
RunThread
)};
struct
pw_main_loop
*
loop
;
const
char
*
const
name
;
struct
pw_thread_loop
*
thread_loop
;
struct
pw_stream
*
stream
;
std
::
byte
buffer
[
1024
];
...
...
@@ -83,10 +83,6 @@ private:
o
.
Process
();
}
void
RunThread
()
noexcept
{
pw_main_loop_run
(
loop
);
}
/* virtual methods from class AudioOutput */
void
Enable
()
override
;
void
Disable
()
noexcept
override
;
...
...
@@ -110,6 +106,7 @@ static constexpr auto stream_events = PipeWireOutput::MakeStreamEvents();
inline
PipeWireOutput
::
PipeWireOutput
(
const
ConfigBlock
&
block
)
:
AudioOutput
(
FLAG_ENABLE_DISABLE
),
name
(
block
.
GetBlockValue
(
"name"
,
"pipewire"
)),
target_id
(
block
.
GetBlockValue
(
"target"
,
unsigned
(
PW_ID_ANY
)))
{
}
...
...
@@ -117,25 +114,17 @@ PipeWireOutput::PipeWireOutput(const ConfigBlock &block)
void
PipeWireOutput
::
Enable
()
{
loop
=
pw_main_loop_new
(
nullptr
);
if
(
loop
==
nullptr
)
throw
std
::
runtime_error
(
"pw_main_loop_new() failed"
);
try
{
thread
.
Start
();
}
catch
(...)
{
pw_main_loop_destroy
(
loop
);
throw
;
}
thread_loop
=
pw_thread_loop_new
(
name
,
nullptr
);
if
(
thread_loop
==
nullptr
)
throw
std
::
runtime_error
(
"pw_thread_loop_new() failed"
);
pw_thread_loop_start
(
thread_loop
);
}
void
PipeWireOutput
::
Disable
()
noexcept
{
pw_main_loop_quit
(
loop
);
thread
.
Join
();
pw_main_loop_destroy
(
loop
);
pw_thread_loop_destroy
(
thread_loop
);
}
static
constexpr
enum
spa_audio_format
...
...
@@ -198,7 +187,7 @@ PipeWireOutput::Open(AudioFormat &audio_format)
PW_KEY_NODE_NAME
,
"mpd"
,
nullptr
);
stream
=
pw_stream_new_simple
(
pw_
main_loop_get_loop
(
loop
),
stream
=
pw_stream_new_simple
(
pw_
thread_loop_get_loop
(
thread_
loop
),
"mpd"
,
props
,
&
stream_events
,
...
...
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