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
cb7366f4
Commit
cb7366f4
authored
Jan 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AudioOutput: make "plugin" a reference
parent
bf803e24
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
37 deletions
+37
-37
Init.cxx
src/output/Init.cxx
+6
-6
Internal.hxx
src/output/Internal.hxx
+1
-1
OutputControl.cxx
src/output/OutputControl.cxx
+3
-3
OutputPlugin.cxx
src/output/OutputPlugin.cxx
+17
-17
OutputThread.cxx
src/output/OutputThread.cxx
+10
-10
No files found.
src/output/Init.cxx
View file @
cb7366f4
...
...
@@ -47,7 +47,7 @@
#define AUDIO_FILTERS "filters"
AudioOutput
::
AudioOutput
(
const
AudioOutputPlugin
&
_plugin
)
:
plugin
(
&
_plugin
),
:
plugin
(
_plugin
),
enabled
(
true
),
really_enabled
(
false
),
open
(
false
),
pause
(
false
),
...
...
@@ -59,10 +59,10 @@ AudioOutput::AudioOutput(const AudioOutputPlugin &_plugin)
other_replay_gain_filter
(
nullptr
),
command
(
AO_COMMAND_NONE
)
{
assert
(
plugin
->
finish
!=
nullptr
);
assert
(
plugin
->
open
!=
nullptr
);
assert
(
plugin
->
close
!=
nullptr
);
assert
(
plugin
->
play
!=
nullptr
);
assert
(
plugin
.
finish
!=
nullptr
);
assert
(
plugin
.
open
!=
nullptr
);
assert
(
plugin
.
close
!=
nullptr
);
assert
(
plugin
.
play
!=
nullptr
);
}
static
const
AudioOutputPlugin
*
...
...
@@ -245,7 +245,7 @@ audio_output_setup(AudioOutput *ao, const config_param ¶m,
Error
mixer_error
;
ao
->
mixer
=
audio_output_load_mixer
(
ao
,
param
,
ao
->
plugin
->
mixer_plugin
,
ao
->
plugin
.
mixer_plugin
,
*
ao
->
filter
,
mixer_error
);
if
(
ao
->
mixer
==
nullptr
&&
mixer_error
.
IsDefined
())
FormatError
(
mixer_error
,
...
...
src/output/Internal.hxx
View file @
cb7366f4
...
...
@@ -69,7 +69,7 @@ struct AudioOutput {
/**
* The plugin which implements this output device.
*/
const
AudioOutputPlugin
*
const
plugin
;
const
AudioOutputPlugin
&
plugin
;
/**
* The #mixer object associated with this audio output device.
...
...
src/output/OutputControl.cxx
View file @
cb7366f4
...
...
@@ -104,7 +104,7 @@ void
audio_output_enable
(
AudioOutput
*
ao
)
{
if
(
!
ao
->
thread
.
IsDefined
())
{
if
(
ao
->
plugin
->
enable
==
nullptr
)
{
if
(
ao
->
plugin
.
enable
==
nullptr
)
{
/* don't bother to start the thread now if the
device doesn't even have a enable() method;
just assign the variable and we're done */
...
...
@@ -122,7 +122,7 @@ void
audio_output_disable
(
AudioOutput
*
ao
)
{
if
(
!
ao
->
thread
.
IsDefined
())
{
if
(
ao
->
plugin
->
disable
==
nullptr
)
if
(
ao
->
plugin
.
disable
==
nullptr
)
ao
->
really_enabled
=
false
;
else
/* if there's no thread yet, the device cannot
...
...
@@ -248,7 +248,7 @@ audio_output_play(AudioOutput *ao)
void
audio_output_pause
(
AudioOutput
*
ao
)
{
if
(
ao
->
mixer
!=
nullptr
&&
ao
->
plugin
->
pause
==
nullptr
)
if
(
ao
->
mixer
!=
nullptr
&&
ao
->
plugin
.
pause
==
nullptr
)
/* the device has no pause mode: close the mixer,
unless its "global" flag is set (checked by
mixer_auto_close()) */
...
...
src/output/OutputPlugin.cxx
View file @
cb7366f4
...
...
@@ -35,75 +35,75 @@ ao_plugin_init(const AudioOutputPlugin *plugin,
void
ao_plugin_finish
(
AudioOutput
*
ao
)
{
ao
->
plugin
->
finish
(
ao
);
ao
->
plugin
.
finish
(
ao
);
}
bool
ao_plugin_enable
(
AudioOutput
*
ao
,
Error
&
error_r
)
{
return
ao
->
plugin
->
enable
!=
nullptr
?
ao
->
plugin
->
enable
(
ao
,
error_r
)
return
ao
->
plugin
.
enable
!=
nullptr
?
ao
->
plugin
.
enable
(
ao
,
error_r
)
:
true
;
}
void
ao_plugin_disable
(
AudioOutput
*
ao
)
{
if
(
ao
->
plugin
->
disable
!=
nullptr
)
ao
->
plugin
->
disable
(
ao
);
if
(
ao
->
plugin
.
disable
!=
nullptr
)
ao
->
plugin
.
disable
(
ao
);
}
bool
ao_plugin_open
(
AudioOutput
*
ao
,
AudioFormat
&
audio_format
,
Error
&
error
)
{
return
ao
->
plugin
->
open
(
ao
,
audio_format
,
error
);
return
ao
->
plugin
.
open
(
ao
,
audio_format
,
error
);
}
void
ao_plugin_close
(
AudioOutput
*
ao
)
{
ao
->
plugin
->
close
(
ao
);
ao
->
plugin
.
close
(
ao
);
}
unsigned
ao_plugin_delay
(
AudioOutput
*
ao
)
{
return
ao
->
plugin
->
delay
!=
nullptr
?
ao
->
plugin
->
delay
(
ao
)
return
ao
->
plugin
.
delay
!=
nullptr
?
ao
->
plugin
.
delay
(
ao
)
:
0
;
}
void
ao_plugin_send_tag
(
AudioOutput
*
ao
,
const
Tag
*
tag
)
{
if
(
ao
->
plugin
->
send_tag
!=
nullptr
)
ao
->
plugin
->
send_tag
(
ao
,
tag
);
if
(
ao
->
plugin
.
send_tag
!=
nullptr
)
ao
->
plugin
.
send_tag
(
ao
,
tag
);
}
size_t
ao_plugin_play
(
AudioOutput
*
ao
,
const
void
*
chunk
,
size_t
size
,
Error
&
error
)
{
return
ao
->
plugin
->
play
(
ao
,
chunk
,
size
,
error
);
return
ao
->
plugin
.
play
(
ao
,
chunk
,
size
,
error
);
}
void
ao_plugin_drain
(
AudioOutput
*
ao
)
{
if
(
ao
->
plugin
->
drain
!=
nullptr
)
ao
->
plugin
->
drain
(
ao
);
if
(
ao
->
plugin
.
drain
!=
nullptr
)
ao
->
plugin
.
drain
(
ao
);
}
void
ao_plugin_cancel
(
AudioOutput
*
ao
)
{
if
(
ao
->
plugin
->
cancel
!=
nullptr
)
ao
->
plugin
->
cancel
(
ao
);
if
(
ao
->
plugin
.
cancel
!=
nullptr
)
ao
->
plugin
.
cancel
(
ao
);
}
bool
ao_plugin_pause
(
AudioOutput
*
ao
)
{
return
ao
->
plugin
->
pause
!=
nullptr
&&
ao
->
plugin
->
pause
(
ao
);
return
ao
->
plugin
.
pause
!=
nullptr
&&
ao
->
plugin
.
pause
(
ao
);
}
src/output/OutputThread.cxx
View file @
cb7366f4
...
...
@@ -65,7 +65,7 @@ ao_enable(AudioOutput *ao)
if
(
!
success
)
{
FormatError
(
error
,
"Failed to enable
\"
%s
\"
[%s]"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
return
false
;
}
...
...
@@ -157,7 +157,7 @@ ao_open(AudioOutput *ao)
ao_filter_open
(
ao
,
ao
->
in_audio_format
,
error
);
if
(
!
filter_audio_format
.
IsDefined
())
{
FormatError
(
error
,
"Failed to open filter for
\"
%s
\"
[%s]"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
ao
->
fail_timer
.
Update
();
return
;
...
...
@@ -176,7 +176,7 @@ ao_open(AudioOutput *ao)
if
(
!
success
)
{
FormatError
(
error
,
"Failed to open
\"
%s
\"
[%s]"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
ao_filter_close
(
ao
);
ao
->
fail_timer
.
Update
();
...
...
@@ -186,7 +186,7 @@ ao_open(AudioOutput *ao)
if
(
!
convert_filter_set
(
ao
->
convert_filter
,
ao
->
out_audio_format
,
error
))
{
FormatError
(
error
,
"Failed to convert for
\"
%s
\"
[%s]"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
ao_filter_close
(
ao
);
ao
->
fail_timer
.
Update
();
...
...
@@ -197,7 +197,7 @@ ao_open(AudioOutput *ao)
FormatDebug
(
output_domain
,
"opened plugin=%s name=
\"
%s
\"
audio_format=%s"
,
ao
->
plugin
->
name
,
ao
->
name
,
ao
->
plugin
.
name
,
ao
->
name
,
audio_format_to_string
(
ao
->
out_audio_format
,
&
af_string
));
if
(
ao
->
in_audio_format
!=
ao
->
out_audio_format
)
...
...
@@ -229,7 +229,7 @@ ao_close(AudioOutput *ao, bool drain)
ao
->
mutex
.
lock
();
FormatDebug
(
output_domain
,
"closed plugin=%s name=
\"
%s
\"
"
,
ao
->
plugin
->
name
,
ao
->
name
);
ao
->
plugin
.
name
,
ao
->
name
);
}
static
void
...
...
@@ -245,7 +245,7 @@ ao_reopen_filter(AudioOutput *ao)
error
))
{
FormatError
(
error
,
"Failed to open filter for
\"
%s
\"
[%s]"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
/* this is a little code duplication fro ao_close(),
but we cannot call this function because we must
...
...
@@ -342,7 +342,7 @@ ao_chunk_data(AudioOutput *ao, const struct music_chunk *chunk,
&
length
,
error
);
if
(
data
==
nullptr
)
{
FormatError
(
error
,
"
\"
%s
\"
[%s] failed to filter"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
return
nullptr
;
}
}
...
...
@@ -413,7 +413,7 @@ ao_filter_chunk(AudioOutput *ao, const struct music_chunk *chunk,
data
=
ao
->
filter
->
FilterPCM
(
data
,
length
,
&
length
,
error
);
if
(
data
==
nullptr
)
{
FormatError
(
error
,
"
\"
%s
\"
[%s] failed to filter"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
return
nullptr
;
}
...
...
@@ -462,7 +462,7 @@ ao_play_chunk(AudioOutput *ao, const struct music_chunk *chunk)
if
(
nbytes
==
0
)
{
/* play()==0 means failure */
FormatError
(
error
,
"
\"
%s
\"
[%s] failed to play"
,
ao
->
name
,
ao
->
plugin
->
name
);
ao
->
name
,
ao
->
plugin
.
name
);
ao_close
(
ao
,
false
);
...
...
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