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
9c9a9ccd
Commit
9c9a9ccd
authored
Aug 09, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Interface: convert to class, make attributes private
parent
7381236d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
27 deletions
+36
-27
Filtered.cxx
src/output/Filtered.cxx
+3
-3
Filtered.hxx
src/output/Filtered.hxx
+1
-1
Init.cxx
src/output/Init.cxx
+4
-4
Interface.hxx
src/output/Interface.hxx
+10
-1
OutputPlugin.cxx
src/output/OutputPlugin.cxx
+17
-17
OutputPlugin.hxx
src/output/OutputPlugin.hxx
+1
-1
No files found.
src/output/Filtered.cxx
View file @
9c9a9ccd
...
...
@@ -32,15 +32,15 @@
bool
FilteredAudioOutput
::
SupportsEnableDisable
()
const
noexcept
{
assert
((
output
->
plugin
.
enable
==
nullptr
)
==
(
output
->
plugin
.
disable
==
nullptr
));
assert
((
output
->
GetPlugin
().
enable
==
nullptr
)
==
(
output
->
GetPlugin
()
.
disable
==
nullptr
));
return
output
->
plugin
.
enable
!=
nullptr
;
return
output
->
GetPlugin
()
.
enable
!=
nullptr
;
}
bool
FilteredAudioOutput
::
SupportsPause
()
const
noexcept
{
return
output
->
plugin
.
pause
!=
nullptr
;
return
output
->
GetPlugin
()
.
pause
!=
nullptr
;
}
void
...
...
src/output/Filtered.hxx
View file @
9c9a9ccd
...
...
@@ -33,7 +33,7 @@ class Mixer;
class
MixerListener
;
struct
MusicChunk
;
struct
ConfigBlock
;
struct
AudioOutput
;
class
AudioOutput
;
struct
ReplayGainConfig
;
struct
Tag
;
...
...
src/output/Init.cxx
View file @
9c9a9ccd
...
...
@@ -55,7 +55,7 @@ FilteredAudioOutput::FilteredAudioOutput(AudioOutput &_output,
:
output
(
&
_output
)
{
#ifndef NDEBUG
const
auto
&
plugin
=
output
->
plugin
;
const
auto
&
plugin
=
output
->
GetPlugin
()
;
assert
(
plugin
.
finish
!=
nullptr
);
assert
(
plugin
.
open
!=
nullptr
);
assert
(
plugin
.
close
!=
nullptr
);
...
...
@@ -172,7 +172,7 @@ FilteredAudioOutput::Configure(const ConfigBlock &block)
{
char
buffer
[
64
];
snprintf
(
buffer
,
sizeof
(
buffer
),
"
\"
%s
\"
(%s)"
,
name
,
output
->
plugin
.
name
);
name
,
output
->
GetPlugin
()
.
name
);
log_name
=
buffer
;
}
...
...
@@ -207,7 +207,7 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
MixerListener
&
mixer_listener
,
const
ConfigBlock
&
block
)
{
if
(
output
->
need_fully_defined_audio_format
&&
if
(
output
->
GetNeedFullyDefinedAudioFormat
()
&&
!
config_audio_format
.
IsFullyDefined
())
throw
std
::
runtime_error
(
"Need full audio format specification"
);
...
...
@@ -233,7 +233,7 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
try
{
mixer
=
audio_output_load_mixer
(
event_loop
,
*
this
,
block
,
output
->
plugin
.
mixer_plugin
,
output
->
GetPlugin
()
.
mixer_plugin
,
*
prepared_filter
,
mixer_listener
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
...
...
src/output/Interface.hxx
View file @
9c9a9ccd
...
...
@@ -22,7 +22,7 @@
struct
AudioOutputPlugin
;
struct
AudioOutput
{
class
AudioOutput
{
/**
* The plugin which implements this output device.
*/
...
...
@@ -30,9 +30,18 @@ struct AudioOutput {
bool
need_fully_defined_audio_format
=
false
;
public
:
AudioOutput
(
const
AudioOutputPlugin
&
_plugin
)
:
plugin
(
_plugin
)
{}
const
AudioOutputPlugin
&
GetPlugin
()
const
{
return
plugin
;
}
bool
GetNeedFullyDefinedAudioFormat
()
const
{
return
need_fully_defined_audio_format
;
}
/**
* Plugins shall call this method if they require an
* "audio_format" setting which evaluates
...
...
src/output/OutputPlugin.cxx
View file @
9c9a9ccd
...
...
@@ -36,72 +36,72 @@ ao_plugin_init(EventLoop &event_loop,
void
ao_plugin_finish
(
AudioOutput
*
ao
)
noexcept
{
ao
->
plugin
.
finish
(
ao
);
ao
->
GetPlugin
()
.
finish
(
ao
);
}
void
ao_plugin_enable
(
AudioOutput
&
ao
)
{
if
(
ao
.
plugin
.
enable
!=
nullptr
)
ao
.
plugin
.
enable
(
&
ao
);
if
(
ao
.
GetPlugin
()
.
enable
!=
nullptr
)
ao
.
GetPlugin
()
.
enable
(
&
ao
);
}
void
ao_plugin_disable
(
AudioOutput
&
ao
)
noexcept
{
if
(
ao
.
plugin
.
disable
!=
nullptr
)
ao
.
plugin
.
disable
(
&
ao
);
if
(
ao
.
GetPlugin
()
.
disable
!=
nullptr
)
ao
.
GetPlugin
()
.
disable
(
&
ao
);
}
void
ao_plugin_open
(
AudioOutput
&
ao
,
AudioFormat
&
audio_format
)
{
ao
.
plugin
.
open
(
&
ao
,
audio_format
);
ao
.
GetPlugin
()
.
open
(
&
ao
,
audio_format
);
}
void
ao_plugin_close
(
AudioOutput
&
ao
)
noexcept
{
ao
.
plugin
.
close
(
&
ao
);
ao
.
GetPlugin
()
.
close
(
&
ao
);
}
std
::
chrono
::
steady_clock
::
duration
ao_plugin_delay
(
AudioOutput
&
ao
)
noexcept
{
return
ao
.
plugin
.
delay
!=
nullptr
?
ao
.
plugin
.
delay
(
&
ao
)
return
ao
.
GetPlugin
()
.
delay
!=
nullptr
?
ao
.
GetPlugin
()
.
delay
(
&
ao
)
:
std
::
chrono
::
steady_clock
::
duration
::
zero
();
}
void
ao_plugin_send_tag
(
AudioOutput
&
ao
,
const
Tag
&
tag
)
{
if
(
ao
.
plugin
.
send_tag
!=
nullptr
)
ao
.
plugin
.
send_tag
(
&
ao
,
tag
);
if
(
ao
.
GetPlugin
()
.
send_tag
!=
nullptr
)
ao
.
GetPlugin
()
.
send_tag
(
&
ao
,
tag
);
}
size_t
ao_plugin_play
(
AudioOutput
&
ao
,
const
void
*
chunk
,
size_t
size
)
{
return
ao
.
plugin
.
play
(
&
ao
,
chunk
,
size
);
return
ao
.
GetPlugin
()
.
play
(
&
ao
,
chunk
,
size
);
}
void
ao_plugin_drain
(
AudioOutput
&
ao
)
{
if
(
ao
.
plugin
.
drain
!=
nullptr
)
ao
.
plugin
.
drain
(
&
ao
);
if
(
ao
.
GetPlugin
()
.
drain
!=
nullptr
)
ao
.
GetPlugin
()
.
drain
(
&
ao
);
}
void
ao_plugin_cancel
(
AudioOutput
&
ao
)
noexcept
{
if
(
ao
.
plugin
.
cancel
!=
nullptr
)
ao
.
plugin
.
cancel
(
&
ao
);
if
(
ao
.
GetPlugin
()
.
cancel
!=
nullptr
)
ao
.
GetPlugin
()
.
cancel
(
&
ao
);
}
bool
ao_plugin_pause
(
AudioOutput
&
ao
)
{
return
ao
.
plugin
.
pause
!=
nullptr
&&
ao
.
plugin
.
pause
(
&
ao
);
return
ao
.
GetPlugin
().
pause
!=
nullptr
&&
ao
.
GetPlugin
()
.
pause
(
&
ao
);
}
src/output/OutputPlugin.hxx
View file @
9c9a9ccd
...
...
@@ -29,7 +29,7 @@
struct
ConfigBlock
;
struct
AudioFormat
;
struct
Tag
;
struct
AudioOutput
;
class
AudioOutput
;
struct
MixerPlugin
;
class
EventLoop
;
...
...
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