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
Hide 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
return
output
->
GetName
();
}
const
char
*
AudioOutputControl
::
GetLogName
()
const
noexcept
{
return
output
->
GetLogName
();
}
Mixer
*
AudioOutputControl
::
GetMixer
()
const
noexcept
{
...
...
src/output/Control.hxx
View file @
5431fca9
...
...
@@ -232,6 +232,9 @@ public:
gcc_pure
const
char
*
GetName
()
const
noexcept
;
gcc_pure
const
char
*
GetLogName
()
const
noexcept
;
AudioOutputClient
&
GetClient
()
noexcept
{
return
client
;
}
...
...
src/output/Filtered.cxx
View file @
5431fca9
...
...
@@ -34,8 +34,8 @@ FilteredAudioOutput::Enable()
try
{
ao_plugin_enable
(
*
this
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to enable output
\"
%s
\"
[%s]
"
,
name
,
plugin
.
name
));
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to enable output
%s
"
,
GetLogName
()
));
}
}
...
...
@@ -51,8 +51,8 @@ FilteredAudioOutput::ConfigureConvertFilter()
try
{
convert_filter_set
(
convert_filter
.
Get
(),
out_audio_format
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to convert for
\"
%s
\"
[%s]
"
,
name
,
plugin
.
name
));
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to convert for
%s
"
,
GetLogName
()
));
}
}
...
...
@@ -64,13 +64,13 @@ FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
try
{
ao_plugin_open
(
*
this
,
out_audio_format
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open
\"
%s
\"
[%s]
"
,
name
,
plugin
.
name
));
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open
%s
"
,
GetLogName
()
));
}
FormatDebug
(
output_domain
,
"opened
plugin=%s name=
\"
%s
\"
audio_format=%s"
,
plugin
.
name
,
name
,
"opened
%s
audio_format=%s"
,
GetLogName
()
,
ToString
(
out_audio_format
).
c_str
());
try
{
...
...
@@ -128,8 +128,7 @@ FilteredAudioOutput::Close(bool drain) noexcept
CloseOutput
(
drain
);
CloseSoftwareMixer
();
FormatDebug
(
output_domain
,
"closed plugin=%s name=
\"
%s
\"
"
,
plugin
.
name
,
name
);
FormatDebug
(
output_domain
,
"closed %s"
,
GetLogName
());
}
void
...
...
@@ -144,8 +143,8 @@ FilteredAudioOutput::IteratePause() noexcept
try
{
return
ao_plugin_pause
(
*
this
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"
\"
%s
\"
[%s] failed to pause
"
,
name
,
plugin
.
name
);
FormatError
(
e
,
"
Failed to pause %s
"
,
GetLogName
()
);
return
false
;
}
}
src/output/Filtered.hxx
View file @
5431fca9
...
...
@@ -23,6 +23,8 @@
#include "AudioFormat.hxx"
#include "filter/Observer.hxx"
#include <string>
class
PreparedFilter
;
class
MusicPipe
;
class
EventLoop
;
...
...
@@ -39,6 +41,14 @@ struct FilteredAudioOutput {
*/
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.
*/
...
...
@@ -129,6 +139,10 @@ public:
return
name
;
}
const
char
*
GetLogName
()
const
noexcept
{
return
log_name
.
c_str
();
}
/**
* Throws #std::runtime_error on error.
*/
...
...
src/output/Init.cxx
View file @
5431fca9
...
...
@@ -166,6 +166,13 @@ FilteredAudioOutput::Configure(const ConfigBlock &block)
config_audio_format
.
Clear
();
}
{
char
buffer
[
64
];
snprintf
(
buffer
,
sizeof
(
buffer
),
"
\"
%s
\"
(%s)"
,
name
,
plugin
.
name
);
log_name
=
buffer
;
}
/* set up the filter chain */
prepared_filter
=
filter_chain_new
();
...
...
src/output/Thread.cxx
View file @
5431fca9
...
...
@@ -151,8 +151,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
output
->
prepared_other_replay_gain_filter
,
output
->
prepared_filter
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open filter for
\"
%s
\"
[%s]
"
,
Get
Name
(),
output
->
plugin
.
name
));
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open filter for
%s
"
,
Get
LogName
()
));
}
try
{
...
...
@@ -233,8 +233,7 @@ AudioOutputControl::FillSourceOrClose()
try
{
return
source
.
Fill
(
mutex
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"Failed to filter for output
\"
%s
\"
[%s]"
,
GetName
(),
output
->
plugin
.
name
);
FormatError
(
e
,
"Failed to filter for %s"
,
GetLogName
());
InternalClose
(
false
);
...
...
@@ -254,8 +253,8 @@ AudioOutputControl::PlayChunk() noexcept
try
{
ao_plugin_send_tag
(
*
output
,
*
tag
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"Failed to send tag to
\"
%s
\"
[%s]
"
,
Get
Name
(),
output
->
plugin
.
name
);
FormatError
(
e
,
"Failed to send tag to
%s
"
,
Get
LogName
()
);
}
}
}
...
...
@@ -277,9 +276,7 @@ AudioOutputControl::PlayChunk() noexcept
nbytes
=
ao_plugin_play
(
*
output
,
data
.
data
,
data
.
size
);
assert
(
nbytes
<=
data
.
size
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"
\"
%s
\"
[%s] failed to play"
,
GetName
(),
output
->
plugin
.
name
);
FormatError
(
e
,
"Failed to play on %s"
,
GetLogName
());
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