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
ebecee3d
Commit
ebecee3d
authored
May 23, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Internal: move "client" to struct AudioOutputControl
parent
194f733c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
47 deletions
+24
-47
Control.cxx
src/output/Control.cxx
+3
-8
Control.hxx
src/output/Control.hxx
+10
-2
Init.cxx
src/output/Init.cxx
+1
-3
Internal.hxx
src/output/Internal.hxx
+1
-9
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+4
-5
Thread.cxx
src/output/Thread.cxx
+2
-2
run_output.cxx
test/run_output.cxx
+3
-18
No files found.
src/output/Control.cxx
View file @
ebecee3d
...
...
@@ -38,8 +38,9 @@ static constexpr PeriodClock::Duration REOPEN_AFTER = std::chrono::seconds(10);
struct
notify
audio_output_client_notify
;
AudioOutputControl
::
AudioOutputControl
(
AudioOutput
*
_output
)
:
output
(
_output
),
AudioOutputControl
::
AudioOutputControl
(
AudioOutput
*
_output
,
AudioOutputClient
&
_client
)
:
output
(
_output
),
client
(
_client
),
thread
(
BIND_THIS_METHOD
(
Task
)),
mutex
(
output
->
mutex
)
{
...
...
@@ -59,12 +60,6 @@ AudioOutputControl::GetName() const noexcept
return
output
->
GetName
();
}
AudioOutputClient
&
AudioOutputControl
::
GetClient
()
noexcept
{
return
*
output
->
client
;
}
Mixer
*
AudioOutputControl
::
GetMixer
()
const
noexcept
{
...
...
src/output/Control.hxx
View file @
ebecee3d
...
...
@@ -51,6 +51,12 @@ class AudioOutputControl {
AudioOutput
*
output
;
/**
* The PlayerControl object which "owns" this output. This
* object is needed to signal command completion.
*/
AudioOutputClient
&
client
;
/**
* The error that occurred in the output thread. It is
* cleared whenever the output is opened successfully.
*
...
...
@@ -164,7 +170,7 @@ class AudioOutputControl {
public
:
Mutex
&
mutex
;
explicit
AudioOutputControl
(
AudioOutput
*
_outpu
t
);
AudioOutputControl
(
AudioOutput
*
_output
,
AudioOutputClient
&
_clien
t
);
#ifndef NDEBUG
~
AudioOutputControl
()
{
...
...
@@ -185,7 +191,9 @@ public:
gcc_pure
const
char
*
GetName
()
const
noexcept
;
AudioOutputClient
&
GetClient
()
noexcept
;
AudioOutputClient
&
GetClient
()
noexcept
{
return
client
;
}
gcc_pure
Mixer
*
GetMixer
()
const
noexcept
;
...
...
src/output/Init.cxx
View file @
ebecee3d
...
...
@@ -265,8 +265,7 @@ AudioOutput *
audio_output_new
(
EventLoop
&
event_loop
,
const
ReplayGainConfig
&
replay_gain_config
,
const
ConfigBlock
&
block
,
MixerListener
&
mixer_listener
,
AudioOutputClient
&
client
)
MixerListener
&
mixer_listener
)
{
const
AudioOutputPlugin
*
plugin
;
...
...
@@ -302,6 +301,5 @@ audio_output_new(EventLoop &event_loop,
throw
;
}
ao
->
client
=
&
client
;
return
ao
;
}
src/output/Internal.hxx
View file @
ebecee3d
...
...
@@ -30,7 +30,6 @@ class MusicPipe;
class
EventLoop
;
class
Mixer
;
class
MixerListener
;
class
AudioOutputClient
;
struct
MusicChunk
;
struct
ConfigBlock
;
struct
AudioOutputPlugin
;
...
...
@@ -136,12 +135,6 @@ struct AudioOutput {
mutable
Mutex
mutex
;
/**
* The PlayerControl object which "owns" this output. This
* object is needed to signal command completion.
*/
AudioOutputClient
*
client
;
/**
* Source of audio data.
*/
AudioOutputSource
source
;
...
...
@@ -258,8 +251,7 @@ AudioOutput *
audio_output_new
(
EventLoop
&
event_loop
,
const
ReplayGainConfig
&
replay_gain_config
,
const
ConfigBlock
&
block
,
MixerListener
&
mixer_listener
,
AudioOutputClient
&
client
);
MixerListener
&
mixer_listener
);
void
audio_output_free
(
AudioOutput
*
ao
)
noexcept
;
...
...
src/output/MultipleOutputs.cxx
View file @
ebecee3d
...
...
@@ -53,11 +53,10 @@ static AudioOutput *
LoadOutput
(
EventLoop
&
event_loop
,
const
ReplayGainConfig
&
replay_gain_config
,
MixerListener
&
mixer_listener
,
AudioOutputClient
&
client
,
const
ConfigBlock
&
block
)
const
ConfigBlock
&
block
)
try
{
return
audio_output_new
(
event_loop
,
replay_gain_config
,
block
,
mixer_listener
,
client
);
mixer_listener
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
if
(
block
.
line
>
0
)
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to configure output in line %i"
,
...
...
@@ -74,8 +73,8 @@ LoadOutputControl(EventLoop &event_loop,
{
auto
*
output
=
LoadOutput
(
event_loop
,
replay_gain_config
,
mixer_listener
,
client
,
block
);
auto
*
control
=
new
AudioOutputControl
(
output
);
block
);
auto
*
control
=
new
AudioOutputControl
(
output
,
client
);
try
{
control
->
Configure
(
block
);
...
...
src/output/Thread.cxx
View file @
ebecee3d
...
...
@@ -365,7 +365,7 @@ AudioOutputControl::Play() noexcept
give it a chance to refill the pipe before
it runs empty */
const
ScopeUnlock
unlock
(
mutex
);
output
->
client
->
ChunksConsumed
();
client
.
ChunksConsumed
();
n
=
0
;
}
...
...
@@ -374,7 +374,7 @@ AudioOutputControl::Play() noexcept
}
while
(
FillSourceOrClose
());
const
ScopeUnlock
unlock
(
mutex
);
output
->
client
->
ChunksConsumed
();
client
.
ChunksConsumed
();
return
true
;
}
...
...
test/run_output.cxx
View file @
ebecee3d
...
...
@@ -20,7 +20,6 @@
#include "config.h"
#include "output/Internal.hxx"
#include "output/OutputPlugin.hxx"
#include "output/Client.hxx"
#include "config/Param.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
...
...
@@ -43,16 +42,6 @@
#include <stdlib.h>
#include <stdio.h>
class
DummyAudioOutputClient
final
:
public
AudioOutputClient
{
public
:
/* virtual methods from AudioOutputClient */
void
ChunksConsumed
()
override
{
}
void
ApplyEnabled
()
override
{
}
};
const
FilterPlugin
*
filter_plugin_by_name
(
gcc_unused
const
char
*
name
)
noexcept
{
...
...
@@ -61,8 +50,7 @@ filter_plugin_by_name(gcc_unused const char *name) noexcept
}
static
AudioOutput
*
load_audio_output
(
EventLoop
&
event_loop
,
AudioOutputClient
&
client
,
const
char
*
name
)
load_audio_output
(
EventLoop
&
event_loop
,
const
char
*
name
)
{
const
auto
*
param
=
config_find_block
(
ConfigBlockOption
::
AUDIO_OUTPUT
,
"name"
,
name
);
...
...
@@ -71,8 +59,7 @@ load_audio_output(EventLoop &event_loop, AudioOutputClient &client,
name
);
return
audio_output_new
(
event_loop
,
ReplayGainConfig
(),
*
param
,
*
(
MixerListener
*
)
nullptr
,
client
);
*
(
MixerListener
*
)
nullptr
);
}
static
void
...
...
@@ -140,9 +127,7 @@ try {
/* initialize the audio output */
DummyAudioOutputClient
client
;
AudioOutput
*
ao
=
load_audio_output
(
io_thread
.
GetEventLoop
(),
client
,
argv
[
2
]);
AudioOutput
*
ao
=
load_audio_output
(
io_thread
.
GetEventLoop
(),
argv
[
2
]);
/* parse the audio format */
...
...
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