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
ef71df60
Commit
ef71df60
authored
Jan 04, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Multiple: use std::unique_ptr<FilteredAudioOutput>
parent
f52b3b4e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
32 deletions
+27
-32
Control.cxx
src/output/Control.cxx
+11
-4
Control.hxx
src/output/Control.hxx
+4
-10
Filtered.hxx
src/output/Filtered.hxx
+1
-1
Init.cxx
src/output/Init.cxx
+6
-12
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+5
-5
No files found.
src/output/Control.cxx
View file @
ef71df60
...
...
@@ -37,13 +37,21 @@ static constexpr PeriodClock::Duration REOPEN_AFTER = std::chrono::seconds(10);
struct
notify
audio_output_client_notify
;
AudioOutputControl
::
AudioOutputControl
(
FilteredAudioOutput
*
_output
,
AudioOutputControl
::
AudioOutputControl
(
std
::
unique_ptr
<
FilteredAudioOutput
>
_output
,
AudioOutputClient
&
_client
)
noexcept
:
output
(
_output
),
client
(
_client
),
:
output
(
std
::
move
(
_output
)
),
client
(
_client
),
thread
(
BIND_THIS_METHOD
(
Task
))
{
}
AudioOutputControl
::~
AudioOutputControl
()
noexcept
{
assert
(
!
fail_timer
.
IsDefined
());
assert
(
!
thread
.
IsDefined
());
assert
(
output
==
nullptr
);
assert
(
!
open
);
}
void
AudioOutputControl
::
Configure
(
const
ConfigBlock
&
block
)
{
...
...
@@ -377,6 +385,5 @@ AudioOutputControl::FinishDestroy() noexcept
if
(
thread
.
IsDefined
())
thread
.
Join
();
delete
output
;
output
=
nullptr
;
output
.
reset
();
}
src/output/Control.hxx
View file @
ef71df60
...
...
@@ -30,6 +30,7 @@
#include <utility>
#include <exception>
#include <memory>
#include <string>
#include <map>
...
...
@@ -52,7 +53,7 @@ class AudioOutputClient;
* Controller for an #AudioOutput and its output thread.
*/
class
AudioOutputControl
{
FilteredAudioOutput
*
output
;
std
::
unique_ptr
<
FilteredAudioOutput
>
output
;
/**
* The PlayerControl object which "owns" this output. This
...
...
@@ -211,17 +212,10 @@ public:
*/
mutable
Mutex
mutex
;
AudioOutputControl
(
FilteredAudioOutput
*
_output
,
AudioOutputControl
(
std
::
unique_ptr
<
FilteredAudioOutput
>
_output
,
AudioOutputClient
&
_client
)
noexcept
;
#ifndef NDEBUG
~
AudioOutputControl
()
noexcept
{
assert
(
!
fail_timer
.
IsDefined
());
assert
(
!
thread
.
IsDefined
());
assert
(
output
==
nullptr
);
assert
(
!
open
);
}
#endif
~
AudioOutputControl
()
noexcept
;
AudioOutputControl
(
const
AudioOutputControl
&
)
=
delete
;
AudioOutputControl
&
operator
=
(
const
AudioOutputControl
&
)
=
delete
;
...
...
src/output/Filtered.hxx
View file @
ef71df60
...
...
@@ -239,7 +239,7 @@ extern struct notify audio_output_client_notify;
/**
* Throws #std::runtime_error on error.
*/
FilteredAudioOutput
*
std
::
unique_ptr
<
FilteredAudioOutput
>
audio_output_new
(
EventLoop
&
event_loop
,
const
ReplayGainConfig
&
replay_gain_config
,
const
ConfigBlock
&
block
,
...
...
src/output/Init.cxx
View file @
ef71df60
...
...
@@ -259,7 +259,7 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
convert_filter
.
Set
(
convert_filter_prepare
()));
}
FilteredAudioOutput
*
std
::
unique_ptr
<
FilteredAudioOutput
>
audio_output_new
(
EventLoop
&
event_loop
,
const
ReplayGainConfig
&
replay_gain_config
,
const
ConfigBlock
&
block
,
...
...
@@ -292,16 +292,10 @@ audio_output_new(EventLoop &event_loop,
block
));
assert
(
ao
!=
nullptr
);
auto
*
f
=
new
FilteredAudioOutput
(
plugin
->
name
,
std
::
move
(
ao
),
block
);
try
{
f
->
Setup
(
event_loop
,
replay_gain_config
,
plugin
->
mixer_plugin
,
mixer_listener
,
block
);
}
catch
(...)
{
delete
f
;
throw
;
}
auto
f
=
std
::
make_unique
<
FilteredAudioOutput
>
(
plugin
->
name
,
std
::
move
(
ao
),
block
);
f
->
Setup
(
event_loop
,
replay_gain_config
,
plugin
->
mixer_plugin
,
mixer_listener
,
block
);
return
f
;
}
src/output/MultipleOutputs.cxx
View file @
ef71df60
...
...
@@ -51,7 +51,7 @@ MultipleOutputs::~MultipleOutputs() noexcept
delete
i
;
}
static
FilteredAudioOutput
*
static
std
::
unique_ptr
<
FilteredAudioOutput
>
LoadOutput
(
EventLoop
&
event_loop
,
const
ReplayGainConfig
&
replay_gain_config
,
MixerListener
&
mixer_listener
,
...
...
@@ -73,10 +73,10 @@ LoadOutputControl(EventLoop &event_loop,
MixerListener
&
mixer_listener
,
AudioOutputClient
&
client
,
const
ConfigBlock
&
block
)
{
auto
*
output
=
LoadOutput
(
event_loop
,
replay_gain_config
,
mixer_listener
,
block
);
auto
*
control
=
new
AudioOutputControl
(
output
,
client
);
auto
output
=
LoadOutput
(
event_loop
,
replay_gain_config
,
mixer_listener
,
block
);
auto
*
control
=
new
AudioOutputControl
(
std
::
move
(
output
)
,
client
);
try
{
control
->
Configure
(
block
);
...
...
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