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
5431fca9
Commit
5431fca9
authored
Aug 08, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Filtered: add attribute "log_name"
parent
47c9d6ac
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
21 deletions
+47
-21
Control.cxx
src/output/Control.cxx
+6
-0
Control.hxx
src/output/Control.hxx
+3
-0
Filtered.cxx
src/output/Filtered.cxx
+11
-12
Filtered.hxx
src/output/Filtered.hxx
+14
-0
Init.cxx
src/output/Init.cxx
+7
-0
Thread.cxx
src/output/Thread.cxx
+6
-9
No files found.
src/output/Control.cxx
View file @
5431fca9
...
@@ -59,6 +59,12 @@ AudioOutputControl::GetName() const noexcept
...
@@ -59,6 +59,12 @@ AudioOutputControl::GetName() const noexcept
return
output
->
GetName
();
return
output
->
GetName
();
}
}
const
char
*
AudioOutputControl
::
GetLogName
()
const
noexcept
{
return
output
->
GetLogName
();
}
Mixer
*
Mixer
*
AudioOutputControl
::
GetMixer
()
const
noexcept
AudioOutputControl
::
GetMixer
()
const
noexcept
{
{
...
...
src/output/Control.hxx
View file @
5431fca9
...
@@ -232,6 +232,9 @@ public:
...
@@ -232,6 +232,9 @@ public:
gcc_pure
gcc_pure
const
char
*
GetName
()
const
noexcept
;
const
char
*
GetName
()
const
noexcept
;
gcc_pure
const
char
*
GetLogName
()
const
noexcept
;
AudioOutputClient
&
GetClient
()
noexcept
{
AudioOutputClient
&
GetClient
()
noexcept
{
return
client
;
return
client
;
}
}
...
...
src/output/Filtered.cxx
View file @
5431fca9
...
@@ -34,8 +34,8 @@ FilteredAudioOutput::Enable()
...
@@ -34,8 +34,8 @@ FilteredAudioOutput::Enable()
try
{
try
{
ao_plugin_enable
(
*
this
);
ao_plugin_enable
(
*
this
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to enable output
\"
%s
\"
[%s]
"
,
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to enable output
%s
"
,
name
,
plugin
.
name
));
GetLogName
()
));
}
}
}
}
...
@@ -51,8 +51,8 @@ FilteredAudioOutput::ConfigureConvertFilter()
...
@@ -51,8 +51,8 @@ FilteredAudioOutput::ConfigureConvertFilter()
try
{
try
{
convert_filter_set
(
convert_filter
.
Get
(),
out_audio_format
);
convert_filter_set
(
convert_filter
.
Get
(),
out_audio_format
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to convert for
\"
%s
\"
[%s]
"
,
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to convert for
%s
"
,
name
,
plugin
.
name
));
GetLogName
()
));
}
}
}
}
...
@@ -64,13 +64,13 @@ FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
...
@@ -64,13 +64,13 @@ FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
try
{
try
{
ao_plugin_open
(
*
this
,
out_audio_format
);
ao_plugin_open
(
*
this
,
out_audio_format
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open
\"
%s
\"
[%s]
"
,
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open
%s
"
,
name
,
plugin
.
name
));
GetLogName
()
));
}
}
FormatDebug
(
output_domain
,
FormatDebug
(
output_domain
,
"opened
plugin=%s name=
\"
%s
\"
audio_format=%s"
,
"opened
%s
audio_format=%s"
,
plugin
.
name
,
name
,
GetLogName
()
,
ToString
(
out_audio_format
).
c_str
());
ToString
(
out_audio_format
).
c_str
());
try
{
try
{
...
@@ -128,8 +128,7 @@ FilteredAudioOutput::Close(bool drain) noexcept
...
@@ -128,8 +128,7 @@ FilteredAudioOutput::Close(bool drain) noexcept
CloseOutput
(
drain
);
CloseOutput
(
drain
);
CloseSoftwareMixer
();
CloseSoftwareMixer
();
FormatDebug
(
output_domain
,
"closed plugin=%s name=
\"
%s
\"
"
,
FormatDebug
(
output_domain
,
"closed %s"
,
GetLogName
());
plugin
.
name
,
name
);
}
}
void
void
...
@@ -144,8 +143,8 @@ FilteredAudioOutput::IteratePause() noexcept
...
@@ -144,8 +143,8 @@ FilteredAudioOutput::IteratePause() noexcept
try
{
try
{
return
ao_plugin_pause
(
*
this
);
return
ao_plugin_pause
(
*
this
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"
\"
%s
\"
[%s] failed to pause
"
,
FormatError
(
e
,
"
Failed to pause %s
"
,
name
,
plugin
.
name
);
GetLogName
()
);
return
false
;
return
false
;
}
}
}
}
src/output/Filtered.hxx
View file @
5431fca9
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
#include "AudioFormat.hxx"
#include "AudioFormat.hxx"
#include "filter/Observer.hxx"
#include "filter/Observer.hxx"
#include <string>
class
PreparedFilter
;
class
PreparedFilter
;
class
MusicPipe
;
class
MusicPipe
;
class
EventLoop
;
class
EventLoop
;
...
@@ -39,6 +41,14 @@ struct FilteredAudioOutput {
...
@@ -39,6 +41,14 @@ struct FilteredAudioOutput {
*/
*/
const
char
*
name
;
const
char
*
name
;
private
:
/**
* A string describing this devicee in log messages. It is
* usually in the form "NAME (PLUGIN)".
*/
std
::
string
log_name
;
public
:
/**
/**
* The plugin which implements this output device.
* The plugin which implements this output device.
*/
*/
...
@@ -129,6 +139,10 @@ public:
...
@@ -129,6 +139,10 @@ public:
return
name
;
return
name
;
}
}
const
char
*
GetLogName
()
const
noexcept
{
return
log_name
.
c_str
();
}
/**
/**
* Throws #std::runtime_error on error.
* Throws #std::runtime_error on error.
*/
*/
...
...
src/output/Init.cxx
View file @
5431fca9
...
@@ -166,6 +166,13 @@ FilteredAudioOutput::Configure(const ConfigBlock &block)
...
@@ -166,6 +166,13 @@ FilteredAudioOutput::Configure(const ConfigBlock &block)
config_audio_format
.
Clear
();
config_audio_format
.
Clear
();
}
}
{
char
buffer
[
64
];
snprintf
(
buffer
,
sizeof
(
buffer
),
"
\"
%s
\"
(%s)"
,
name
,
plugin
.
name
);
log_name
=
buffer
;
}
/* set up the filter chain */
/* set up the filter chain */
prepared_filter
=
filter_chain_new
();
prepared_filter
=
filter_chain_new
();
...
...
src/output/Thread.cxx
View file @
5431fca9
...
@@ -151,8 +151,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
...
@@ -151,8 +151,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
output
->
prepared_other_replay_gain_filter
,
output
->
prepared_other_replay_gain_filter
,
output
->
prepared_filter
);
output
->
prepared_filter
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open filter for
\"
%s
\"
[%s]
"
,
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open filter for
%s
"
,
Get
Name
(),
output
->
plugin
.
name
));
Get
LogName
()
));
}
}
try
{
try
{
...
@@ -233,8 +233,7 @@ AudioOutputControl::FillSourceOrClose()
...
@@ -233,8 +233,7 @@ AudioOutputControl::FillSourceOrClose()
try
{
try
{
return
source
.
Fill
(
mutex
);
return
source
.
Fill
(
mutex
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"Failed to filter for output
\"
%s
\"
[%s]"
,
FormatError
(
e
,
"Failed to filter for %s"
,
GetLogName
());
GetName
(),
output
->
plugin
.
name
);
InternalClose
(
false
);
InternalClose
(
false
);
...
@@ -254,8 +253,8 @@ AudioOutputControl::PlayChunk() noexcept
...
@@ -254,8 +253,8 @@ AudioOutputControl::PlayChunk() noexcept
try
{
try
{
ao_plugin_send_tag
(
*
output
,
*
tag
);
ao_plugin_send_tag
(
*
output
,
*
tag
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"Failed to send tag to
\"
%s
\"
[%s]
"
,
FormatError
(
e
,
"Failed to send tag to
%s
"
,
Get
Name
(),
output
->
plugin
.
name
);
Get
LogName
()
);
}
}
}
}
}
}
...
@@ -277,9 +276,7 @@ AudioOutputControl::PlayChunk() noexcept
...
@@ -277,9 +276,7 @@ AudioOutputControl::PlayChunk() noexcept
nbytes
=
ao_plugin_play
(
*
output
,
data
.
data
,
data
.
size
);
nbytes
=
ao_plugin_play
(
*
output
,
data
.
data
,
data
.
size
);
assert
(
nbytes
<=
data
.
size
);
assert
(
nbytes
<=
data
.
size
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"
\"
%s
\"
[%s] failed to play"
,
FormatError
(
e
,
"Failed to play on %s"
,
GetLogName
());
GetName
(),
output
->
plugin
.
name
);
nbytes
=
0
;
nbytes
=
0
;
}
}
...
...
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