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
6f539cfc
Commit
6f539cfc
authored
Jun 24, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partition, ...: use libfmt for logging
parent
0185d58a
Show whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
269 additions
and
245 deletions
+269
-245
meson.build
meson.build
+0
-1
LogInit.cxx
src/LogInit.cxx
+4
-4
Main.cxx
src/Main.cxx
+3
-4
Partition.cxx
src/Partition.cxx
+5
-3
StateFile.cxx
src/StateFile.cxx
+5
-5
Event.cxx
src/client/Event.cxx
+3
-1
New.cxx
src/client/New.cxx
+3
-3
Process.cxx
src/client/Process.cxx
+20
-21
Check.cxx
src/config/Check.cxx
+3
-3
File.cxx
src/config/File.cxx
+5
-5
Archive.cxx
src/db/update/Archive.cxx
+7
-6
Container.cxx
src/db/update/Container.cxx
+2
-2
InotifyQueue.cxx
src/db/update/InotifyQueue.cxx
+7
-4
InotifyUpdate.cxx
src/db/update/InotifyUpdate.cxx
+5
-3
Playlist.cxx
src/db/update/Playlist.cxx
+5
-3
Remove.cxx
src/db/update/Remove.cxx
+1
-1
UpdateSong.cxx
src/db/update/UpdateSong.cxx
+13
-12
Walk.cxx
src/db/update/Walk.cxx
+4
-4
DecoderList.cxx
src/decoder/DecoderList.cxx
+7
-5
meson.build
src/decoder/meson.build
+1
-0
FaadDecoderPlugin.cxx
src/decoder/plugins/FaadDecoderPlugin.cxx
+7
-7
FfmpegDecoderPlugin.cxx
src/decoder/plugins/FfmpegDecoderPlugin.cxx
+11
-11
MikmodDecoderPlugin.cxx
src/decoder/plugins/MikmodDecoderPlugin.cxx
+5
-6
Mpg123DecoderPlugin.cxx
src/decoder/plugins/Mpg123DecoderPlugin.cxx
+12
-12
ServerSocket.cxx
src/event/ServerSocket.cxx
+11
-9
Charset.cxx
src/fs/Charset.cxx
+2
-2
CheckFile.cxx
src/fs/CheckFile.cxx
+8
-8
CdioParanoiaInputPlugin.cxx
src/input/plugins/CdioParanoiaInputPlugin.cxx
+4
-3
TidalInputPlugin.cxx
src/input/plugins/TidalInputPlugin.cxx
+5
-5
LogError.cxx
src/lib/ffmpeg/LogError.cxx
+1
-1
LogError.cxx
src/lib/pulse/LogError.cxx
+1
-1
Volume.cxx
src/mixer/Volume.cxx
+2
-2
AlsaMixerPlugin.cxx
src/mixer/plugins/AlsaMixerPlugin.cxx
+2
-2
Control.cxx
src/output/Control.cxx
+5
-3
Filtered.cxx
src/output/Filtered.cxx
+11
-9
Init.cxx
src/output/Init.cxx
+13
-12
Thread.cxx
src/output/Thread.cxx
+19
-16
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+13
-13
SndioOutputPlugin.cxx
src/output/plugins/SndioOutputPlugin.cxx
+1
-1
SlesOutputPlugin.cxx
src/output/plugins/sles/SlesOutputPlugin.cxx
+2
-2
WasapiOutputPlugin.cxx
src/output/plugins/wasapi/WasapiOutputPlugin.cxx
+17
-19
Thread.cxx
src/player/Thread.cxx
+4
-4
StorageState.cxx
src/storage/StorageState.cxx
+9
-6
FatalError.cxx
src/system/FatalError.cxx
+1
-1
No files found.
meson.build
View file @
6f539cfc
...
@@ -269,7 +269,6 @@ sources = [
...
@@ -269,7 +269,6 @@ sources = [
'src/command/CommandListBuilder.cxx',
'src/command/CommandListBuilder.cxx',
'src/Idle.cxx',
'src/Idle.cxx',
'src/IdleFlags.cxx',
'src/IdleFlags.cxx',
'src/decoder/Domain.cxx',
'src/decoder/Thread.cxx',
'src/decoder/Thread.cxx',
'src/decoder/Control.cxx',
'src/decoder/Control.cxx',
'src/decoder/Bridge.cxx',
'src/decoder/Bridge.cxx',
...
...
src/LogInit.cxx
View file @
6f539cfc
...
@@ -240,16 +240,16 @@ cycle_log_files() noexcept
...
@@ -240,16 +240,16 @@ cycle_log_files() noexcept
fd
=
open_log_file
();
fd
=
open_log_file
();
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
const
std
::
string
out_path_utf8
=
out_path
.
ToUTF8
();
const
std
::
string
out_path_utf8
=
out_path
.
ToUTF8
();
F
orma
tError
(
log_domain
,
F
m
tError
(
log_domain
,
"error re-opening log file: %s
"
,
"error re-opening log file: {}
"
,
out_path_utf8
.
c_str
()
);
out_path_utf8
);
return
-
1
;
return
-
1
;
}
}
redirect_logs
(
fd
);
redirect_logs
(
fd
);
close
(
fd
);
close
(
fd
);
Format
Debug
(
log_domain
,
"Done cycling log files"
);
Log
Debug
(
log_domain
,
"Done cycling log files"
);
return
0
;
return
0
;
#endif
#endif
}
}
src/Main.cxx
View file @
6f539cfc
...
@@ -287,9 +287,8 @@ initialize_decoder_and_player(Instance &instance,
...
@@ -287,9 +287,8 @@ initialize_decoder_and_player(Instance &instance,
"positive integer"
,
s
);
"positive integer"
,
s
);
if
(
result
<
MIN_BUFFER_SIZE
)
{
if
(
result
<
MIN_BUFFER_SIZE
)
{
FormatWarning
(
config_domain
,
"buffer size %lu is too small, using %lu bytes instead"
,
FmtWarning
(
config_domain
,
"buffer size {} is too small, using {} bytes instead"
,
(
unsigned
long
)
result
,
result
,
MIN_BUFFER_SIZE
);
(
unsigned
long
)
MIN_BUFFER_SIZE
);
result
=
MIN_BUFFER_SIZE
;
result
=
MIN_BUFFER_SIZE
;
}
}
...
@@ -521,7 +520,7 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
...
@@ -521,7 +520,7 @@ MainConfigured(const struct options &options, const ConfigData &raw_config)
raw_config
.
GetUnsigned
(
ConfigOption
::
AUTO_UPDATE_DEPTH
,
raw_config
.
GetUnsigned
(
ConfigOption
::
AUTO_UPDATE_DEPTH
,
INT_MAX
));
INT_MAX
));
#else
#else
Format
Warning
(
config_domain
,
Log
Warning
(
config_domain
,
"inotify: auto_update was disabled. enable during compilation phase"
);
"inotify: auto_update was disabled. enable during compilation phase"
);
#endif
#endif
}
}
...
...
src/Partition.cxx
View file @
6f539cfc
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "Partition.hxx"
#include "Partition.hxx"
#include "Instance.hxx"
#include "Instance.hxx"
#include "Log.hxx"
#include "Log.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "song/DetachedSong.hxx"
#include "song/DetachedSong.hxx"
#include "mixer/Volume.hxx"
#include "mixer/Volume.hxx"
#include "IdleFlags.hxx"
#include "IdleFlags.hxx"
...
@@ -67,13 +68,14 @@ PrefetchSong(InputCacheManager &cache, const char *uri) noexcept
...
@@ -67,13 +68,14 @@ PrefetchSong(InputCacheManager &cache, const char *uri) noexcept
if
(
cache
.
Contains
(
uri
))
if
(
cache
.
Contains
(
uri
))
return
;
return
;
F
ormatDebug
(
cache_domain
,
"Prefetch '%s
'"
,
uri
);
F
mtDebug
(
cache_domain
,
"Prefetch '{}
'"
,
uri
);
try
{
try
{
cache
.
Prefetch
(
uri
);
cache
.
Prefetch
(
uri
);
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
FmtError
(
cache_domain
,
"Prefetch '%s' failed"
,
uri
);
"Prefetch '{}' failed: {}"
,
uri
,
std
::
current_exception
());
}
}
}
}
...
...
src/StateFile.cxx
View file @
6f539cfc
...
@@ -93,8 +93,8 @@ StateFile::Write(OutputStream &os)
...
@@ -93,8 +93,8 @@ StateFile::Write(OutputStream &os)
void
void
StateFile
::
Write
()
StateFile
::
Write
()
{
{
F
orma
tDebug
(
state_file_domain
,
F
m
tDebug
(
state_file_domain
,
"Saving state file %s"
,
path_utf8
.
c_str
()
);
"Saving state file {}"
,
path_utf8
);
try
{
try
{
FileOutputStream
fos
(
config
.
path
);
FileOutputStream
fos
(
config
.
path
);
...
@@ -112,7 +112,7 @@ StateFile::Read()
...
@@ -112,7 +112,7 @@ StateFile::Read()
try
{
try
{
bool
success
;
bool
success
;
F
ormatDebug
(
state_file_domain
,
"Loading state file %s"
,
path_utf8
.
c_str
()
);
F
mtDebug
(
state_file_domain
,
"Loading state file {}"
,
path_utf8
);
TextFile
file
(
config
.
path
);
TextFile
file
(
config
.
path
);
...
@@ -135,8 +135,8 @@ try {
...
@@ -135,8 +135,8 @@ try {
#endif
#endif
if
(
!
success
)
if
(
!
success
)
F
orma
tError
(
state_file_domain
,
F
m
tError
(
state_file_domain
,
"Unrecognized line in state file: %s
"
,
"Unrecognized line in state file: {}
"
,
line
);
line
);
}
}
...
...
src/client/Event.cxx
View file @
6f539cfc
...
@@ -18,12 +18,14 @@
...
@@ -18,12 +18,14 @@
*/
*/
#include "Client.hxx"
#include "Client.hxx"
#include "Domain.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "Log.hxx"
#include "Log.hxx"
void
void
Client
::
OnSocketError
(
std
::
exception_ptr
ep
)
noexcept
Client
::
OnSocketError
(
std
::
exception_ptr
ep
)
noexcept
{
{
F
ormatError
(
ep
,
"error on client %d"
,
num
);
F
mtError
(
client_domain
,
"error on client {}: {}"
,
num
,
ep
);
SetExpired
();
SetExpired
();
}
}
...
...
src/client/New.cxx
View file @
6f539cfc
...
@@ -76,8 +76,8 @@ client_new(EventLoop &loop, Partition &partition,
...
@@ -76,8 +76,8 @@ client_new(EventLoop &loop, Partition &partition,
client_list
.
Add
(
*
client
);
client_list
.
Add
(
*
client
);
partition
.
clients
.
push_back
(
*
client
);
partition
.
clients
.
push_back
(
*
client
);
F
ormatInfo
(
client_domain
,
"[%u] opened from %s
"
,
F
mtInfo
(
client_domain
,
"[{}] opened from {}
"
,
num
,
remote
.
c_str
()
);
num
,
remote
);
}
}
void
void
...
@@ -89,6 +89,6 @@ Client::Close() noexcept
...
@@ -89,6 +89,6 @@ Client::Close() noexcept
if
(
FullyBufferedSocket
::
IsDefined
())
if
(
FullyBufferedSocket
::
IsDefined
())
FullyBufferedSocket
::
Close
();
FullyBufferedSocket
::
Close
();
F
ormatInfo
(
client_domain
,
"[%u
] closed"
,
num
);
F
mtInfo
(
client_domain
,
"[{}
] closed"
,
num
);
delete
this
;
delete
this
;
}
}
src/client/Process.cxx
View file @
6f539cfc
...
@@ -39,9 +39,9 @@ Client::ProcessCommandList(bool list_ok,
...
@@ -39,9 +39,9 @@ Client::ProcessCommandList(bool list_ok,
for
(
auto
&&
i
:
list
)
{
for
(
auto
&&
i
:
list
)
{
char
*
cmd
=
&*
i
.
begin
();
char
*
cmd
=
&*
i
.
begin
();
F
ormatDebug
(
client_domain
,
"process command
\"
%s
\"
"
,
cmd
);
F
mtDebug
(
client_domain
,
"process command
\"
{}
\"
"
,
cmd
);
auto
ret
=
command_process
(
*
this
,
n
++
,
cmd
);
auto
ret
=
command_process
(
*
this
,
n
++
,
cmd
);
F
ormatDebug
(
client_domain
,
"command returned %i"
,
int
(
ret
));
F
mtDebug
(
client_domain
,
"command returned {}"
,
unsigned
(
ret
));
if
(
IsExpired
())
if
(
IsExpired
())
return
CommandResult
::
CLOSE
;
return
CommandResult
::
CLOSE
;
else
if
(
ret
!=
CommandResult
::
OK
)
else
if
(
ret
!=
CommandResult
::
OK
)
...
@@ -62,8 +62,8 @@ Client::ProcessLine(char *line) noexcept
...
@@ -62,8 +62,8 @@ Client::ProcessLine(char *line) noexcept
/* all valid MPD commands begin with a lower case
/* all valid MPD commands begin with a lower case
letter; this could be a badly routed HTTP
letter; this could be a badly routed HTTP
request */
request */
F
orma
tWarning
(
client_domain
,
F
m
tWarning
(
client_domain
,
"[%u] malformed command
\"
%s
\"
"
,
"[{}] malformed command
\"
{}
\"
"
,
num
,
line
);
num
,
line
);
return
CommandResult
::
CLOSE
;
return
CommandResult
::
CLOSE
;
}
}
...
@@ -83,8 +83,8 @@ Client::ProcessLine(char *line) noexcept
...
@@ -83,8 +83,8 @@ Client::ProcessLine(char *line) noexcept
}
else
if
(
idle_waiting
)
{
}
else
if
(
idle_waiting
)
{
/* during idle mode, clients must not send anything
/* during idle mode, clients must not send anything
except "noidle" */
except "noidle" */
F
orma
tWarning
(
client_domain
,
F
m
tWarning
(
client_domain
,
"[%u] command
\"
%s
\"
during idle"
,
"[{}] command
\"
{}
\"
during idle"
,
num
,
line
);
num
,
line
);
return
CommandResult
::
CLOSE
;
return
CommandResult
::
CLOSE
;
}
}
...
@@ -93,8 +93,8 @@ Client::ProcessLine(char *line) noexcept
...
@@ -93,8 +93,8 @@ Client::ProcessLine(char *line) noexcept
if
(
StringIsEqual
(
line
,
CLIENT_LIST_MODE_END
))
{
if
(
StringIsEqual
(
line
,
CLIENT_LIST_MODE_END
))
{
const
unsigned
id
=
num
;
const
unsigned
id
=
num
;
F
orma
tDebug
(
client_domain
,
F
m
tDebug
(
client_domain
,
"[%u
] process command list"
,
"[{}
] process command list"
,
id
);
id
);
const
bool
ok_mode
=
cmd_list
.
IsOKMode
();
const
bool
ok_mode
=
cmd_list
.
IsOKMode
();
...
@@ -103,9 +103,9 @@ Client::ProcessLine(char *line) noexcept
...
@@ -103,9 +103,9 @@ Client::ProcessLine(char *line) noexcept
auto
ret
=
ProcessCommandList
(
ok_mode
,
auto
ret
=
ProcessCommandList
(
ok_mode
,
std
::
move
(
list
));
std
::
move
(
list
));
F
orma
tDebug
(
client_domain
,
F
m
tDebug
(
client_domain
,
"[%u
] process command "
"[{}
] process command "
"list returned %i"
,
id
,
int
(
ret
));
"list returned {}"
,
id
,
unsigned
(
ret
));
if
(
ret
==
CommandResult
::
OK
)
if
(
ret
==
CommandResult
::
OK
)
command_success
(
*
this
);
command_success
(
*
this
);
...
@@ -113,11 +113,10 @@ Client::ProcessLine(char *line) noexcept
...
@@ -113,11 +113,10 @@ Client::ProcessLine(char *line) noexcept
return
ret
;
return
ret
;
}
else
{
}
else
{
if
(
!
cmd_list
.
Add
(
line
))
{
if
(
!
cmd_list
.
Add
(
line
))
{
FormatWarning
(
client_domain
,
FmtWarning
(
client_domain
,
"[%u] command list size "
"[{}] command list size "
"is larger than the max (%lu)"
,
"is larger than the max ({})"
,
num
,
num
,
client_max_command_list_size
);
(
unsigned
long
)
client_max_command_list_size
);
return
CommandResult
::
CLOSE
;
return
CommandResult
::
CLOSE
;
}
}
...
@@ -133,13 +132,13 @@ Client::ProcessLine(char *line) noexcept
...
@@ -133,13 +132,13 @@ Client::ProcessLine(char *line) noexcept
}
else
{
}
else
{
const
unsigned
id
=
num
;
const
unsigned
id
=
num
;
F
orma
tDebug
(
client_domain
,
F
m
tDebug
(
client_domain
,
"[%u] process command
\"
%s
\"
"
,
"[{}] process command
\"
{}
\"
"
,
id
,
line
);
id
,
line
);
auto
ret
=
command_process
(
*
this
,
0
,
line
);
auto
ret
=
command_process
(
*
this
,
0
,
line
);
F
orma
tDebug
(
client_domain
,
F
m
tDebug
(
client_domain
,
"[%u] command returned %i
"
,
"[{}] command returned {}
"
,
id
,
int
(
ret
));
id
,
unsigned
(
ret
));
if
(
IsExpired
())
if
(
IsExpired
())
return
CommandResult
::
CLOSE
;
return
CommandResult
::
CLOSE
;
...
...
src/config/Check.cxx
View file @
6f539cfc
...
@@ -33,9 +33,9 @@ Check(const ConfigBlock &block)
...
@@ -33,9 +33,9 @@ Check(const ConfigBlock &block)
for
(
const
auto
&
i
:
block
.
block_params
)
{
for
(
const
auto
&
i
:
block
.
block_params
)
{
if
(
!
i
.
used
)
if
(
!
i
.
used
)
F
orma
tWarning
(
config_domain
,
F
m
tWarning
(
config_domain
,
"option '%s' on line %i
was not recognized"
,
"option '{}' on line {}
was not recognized"
,
i
.
name
.
c_str
()
,
i
.
line
);
i
.
name
,
i
.
line
);
}
}
}
}
...
...
src/config/File.cxx
View file @
6f539cfc
...
@@ -116,8 +116,8 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
...
@@ -116,8 +116,8 @@ ReadConfigBlock(ConfigData &config_data, BufferedReader &reader,
const
ConfigTemplate
&
option
=
config_block_templates
[
i
];
const
ConfigTemplate
&
option
=
config_block_templates
[
i
];
if
(
option
.
deprecated
)
if
(
option
.
deprecated
)
F
orma
tWarning
(
config_file_domain
,
F
m
tWarning
(
config_file_domain
,
"config parameter
\"
%s
\"
on line %u
is deprecated"
,
"config parameter
\"
{}
\"
on line {}
is deprecated"
,
name
,
reader
.
GetLineNumber
());
name
,
reader
.
GetLineNumber
());
if
(
!
option
.
repeatable
)
if
(
!
option
.
repeatable
)
...
@@ -148,8 +148,8 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
...
@@ -148,8 +148,8 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
const
ConfigTemplate
&
option
=
config_param_templates
[
i
];
const
ConfigTemplate
&
option
=
config_param_templates
[
i
];
if
(
option
.
deprecated
)
if
(
option
.
deprecated
)
F
orma
tWarning
(
config_file_domain
,
F
m
tWarning
(
config_file_domain
,
"config parameter
\"
%s
\"
on line %u
is deprecated"
,
"config parameter
\"
{}
\"
on line {}
is deprecated"
,
name
,
reader
.
GetLineNumber
());
name
,
reader
.
GetLineNumber
());
if
(
!
option
.
repeatable
)
if
(
!
option
.
repeatable
)
...
@@ -238,7 +238,7 @@ ReadConfigFile(ConfigData &config_data, Path path)
...
@@ -238,7 +238,7 @@ ReadConfigFile(ConfigData &config_data, Path path)
assert
(
!
path
.
IsNull
());
assert
(
!
path
.
IsNull
());
const
std
::
string
path_utf8
=
path
.
ToUTF8
();
const
std
::
string
path_utf8
=
path
.
ToUTF8
();
F
ormatDebug
(
config_file_domain
,
"loading file %s"
,
path_utf8
.
c_str
()
);
F
mtDebug
(
config_file_domain
,
"loading file {}"
,
path_utf8
);
FileReader
file
(
path
);
FileReader
file
(
path
);
...
...
src/db/update/Archive.cxx
View file @
6f539cfc
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "db/plugins/simple/Directory.hxx"
#include "db/plugins/simple/Directory.hxx"
#include "db/plugins/simple/Song.hxx"
#include "db/plugins/simple/Song.hxx"
#include "storage/StorageInterface.hxx"
#include "storage/StorageInterface.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/AllocatedPath.hxx"
#include "storage/FileInfo.hxx"
#include "storage/FileInfo.hxx"
#include "archive/ArchiveList.hxx"
#include "archive/ArchiveList.hxx"
...
@@ -82,13 +83,13 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
...
@@ -82,13 +83,13 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
}
}
modified
=
true
;
modified
=
true
;
F
ormatNotice
(
update_domain
,
"added %s/%s
"
,
F
mtNotice
(
update_domain
,
"added {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
}
}
}
else
{
}
else
{
if
(
!
song
->
UpdateFileInArchive
(
archive
))
{
if
(
!
song
->
UpdateFileInArchive
(
archive
))
{
F
orma
tDebug
(
update_domain
,
F
m
tDebug
(
update_domain
,
"deleting unrecognized file %s/%s
"
,
"deleting unrecognized file {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
editor
.
LockDeleteSong
(
directory
,
song
);
editor
.
LockDeleteSong
(
directory
,
song
);
}
}
...
@@ -107,8 +108,8 @@ class UpdateArchiveVisitor final : public ArchiveVisitor {
...
@@ -107,8 +108,8 @@ class UpdateArchiveVisitor final : public ArchiveVisitor {
:
walk
(
_walk
),
archive
(
_archive
),
directory
(
_directory
)
{}
:
walk
(
_walk
),
archive
(
_archive
),
directory
(
_directory
)
{}
void
VisitArchiveEntry
(
const
char
*
path_utf8
)
override
{
void
VisitArchiveEntry
(
const
char
*
path_utf8
)
override
{
F
orma
tDebug
(
update_domain
,
F
m
tDebug
(
update_domain
,
"adding archive file: %s
"
,
path_utf8
);
"adding archive file: {}
"
,
path_utf8
);
walk
.
UpdateArchiveTree
(
archive
,
directory
,
path_utf8
);
walk
.
UpdateArchiveTree
(
archive
,
directory
,
path_utf8
);
}
}
};
};
...
@@ -149,7 +150,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, std::string_view name,
...
@@ -149,7 +150,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, std::string_view name,
return
;
return
;
}
}
F
ormatDebug
(
update_domain
,
"archive %s opened"
,
path_fs
.
c_str
()
);
F
mtDebug
(
update_domain
,
"archive {} opened"
,
path_fs
);
UpdateArchiveVisitor
visitor
(
*
this
,
*
file
,
*
directory
);
UpdateArchiveVisitor
visitor
(
*
this
,
*
file
,
*
directory
);
file
->
Visit
(
visitor
);
file
->
Visit
(
visitor
);
...
...
src/db/update/Container.cxx
View file @
6f539cfc
...
@@ -75,9 +75,9 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
...
@@ -75,9 +75,9 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
// shouldn't be necessary but it's there..
// shouldn't be necessary but it's there..
song
->
mtime
=
info
.
mtime
;
song
->
mtime
=
info
.
mtime
;
F
ormatNotice
(
update_domain
,
"added %s/%s
"
,
F
mtNotice
(
update_domain
,
"added {}/{}
"
,
contdir
->
GetPath
(),
contdir
->
GetPath
(),
song
->
filename
.
c_str
()
);
song
->
filename
);
{
{
const
ScopeDatabaseLock
protect
;
const
ScopeDatabaseLock
protect
;
...
...
src/db/update/InotifyQueue.cxx
View file @
6f539cfc
...
@@ -20,9 +20,11 @@
...
@@ -20,9 +20,11 @@
#include "InotifyQueue.hxx"
#include "InotifyQueue.hxx"
#include "InotifyDomain.hxx"
#include "InotifyDomain.hxx"
#include "Service.hxx"
#include "Service.hxx"
#include "Log.hxx"
#include "UpdateDomain.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "protocol/Ack.hxx" // for class ProtocolError
#include "protocol/Ack.hxx" // for class ProtocolError
#include "util/StringCompare.hxx"
#include "util/StringCompare.hxx"
#include "Log.hxx"
/**
/**
* Wait this long after the last change before calling
* Wait this long after the last change before calling
...
@@ -53,13 +55,14 @@ InotifyQueue::OnDelay() noexcept
...
@@ -53,13 +55,14 @@ InotifyQueue::OnDelay() noexcept
throw
;
throw
;
}
}
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
FmtError
(
update_domain
,
"Failed to enqueue '%s'"
,
uri_utf8
);
"Failed to enqueue '{}': {}"
,
uri_utf8
,
std
::
current_exception
());
queue
.
pop_front
();
queue
.
pop_front
();
continue
;
continue
;
}
}
F
ormatDebug
(
inotify_domain
,
"updating '%s' job=%u
"
,
F
mtDebug
(
inotify_domain
,
"updating '{}' job={}
"
,
uri_utf8
,
id
);
uri_utf8
,
id
);
queue
.
pop_front
();
queue
.
pop_front
();
...
...
src/db/update/InotifyUpdate.cxx
View file @
6f539cfc
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include "InotifyQueue.hxx"
#include "InotifyQueue.hxx"
#include "InotifyDomain.hxx"
#include "InotifyDomain.hxx"
#include "ExcludeList.hxx"
#include "ExcludeList.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "storage/StorageInterface.hxx"
#include "storage/StorageInterface.hxx"
#include "input/InputStream.hxx"
#include "input/InputStream.hxx"
#include "input/Error.hxx"
#include "input/Error.hxx"
...
@@ -223,9 +225,9 @@ try {
...
@@ -223,9 +225,9 @@ try {
ret
=
inotify_source
->
Add
(
child_path_fs
.
c_str
(),
ret
=
inotify_source
->
Add
(
child_path_fs
.
c_str
(),
IN_MASK
);
IN_MASK
);
}
catch
(...)
{
}
catch
(...)
{
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
inotify_domain
,
"Failed to register %s
"
,
"Failed to register %s: {}
"
,
child_path_fs
.
c_str
());
child_path_fs
,
std
::
current_exception
());
continue
;
continue
;
}
}
...
...
src/db/update/Playlist.cxx
View file @
6f539cfc
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "db/DatabaseLock.hxx"
#include "db/DatabaseLock.hxx"
#include "db/PlaylistVector.hxx"
#include "db/PlaylistVector.hxx"
#include "db/plugins/simple/Directory.hxx"
#include "db/plugins/simple/Directory.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "song/DetachedSong.hxx"
#include "song/DetachedSong.hxx"
#include "input/InputStream.hxx"
#include "input/InputStream.hxx"
#include "playlist/PlaylistPlugin.hxx"
#include "playlist/PlaylistPlugin.hxx"
...
@@ -49,7 +50,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
...
@@ -49,7 +50,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
const
auto
uri_utf8
=
storage
.
MapUTF8
(
directory
->
GetPath
());
const
auto
uri_utf8
=
storage
.
MapUTF8
(
directory
->
GetPath
());
F
ormatDebug
(
update_domain
,
"scanning playlist '%s'"
,
uri_utf8
.
c_str
()
);
F
mtDebug
(
update_domain
,
"scanning playlist '{}'"
,
uri_utf8
);
try
{
try
{
Mutex
mutex
;
Mutex
mutex
;
...
@@ -80,8 +81,9 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
...
@@ -80,8 +81,9 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
}
}
}
}
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
FmtError
(
update_domain
,
"Failed to scan playlist '%s'"
,
uri_utf8
.
c_str
());
"Failed to scan playlist '{}': {}"
,
uri_utf8
,
std
::
current_exception
());
editor
.
LockDeleteDirectory
(
directory
);
editor
.
LockDeleteDirectory
(
directory
);
}
}
}
}
...
...
src/db/update/Remove.cxx
View file @
6f539cfc
...
@@ -41,7 +41,7 @@ UpdateRemoveService::RunDeferred() noexcept
...
@@ -41,7 +41,7 @@ UpdateRemoveService::RunDeferred() noexcept
}
}
for
(
const
auto
&
uri
:
copy
)
{
for
(
const
auto
&
uri
:
copy
)
{
F
ormatNotice
(
update_domain
,
"removing %s"
,
uri
.
c_str
()
);
F
mtNotice
(
update_domain
,
"removing {}"
,
uri
);
listener
.
OnDatabaseSongRemoved
(
uri
.
c_str
());
listener
.
OnDatabaseSongRemoved
(
uri
.
c_str
());
}
}
...
...
src/db/update/UpdateSong.cxx
View file @
6f539cfc
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "Walk.hxx"
#include "Walk.hxx"
#include "UpdateIO.hxx"
#include "UpdateIO.hxx"
#include "UpdateDomain.hxx"
#include "UpdateDomain.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "db/DatabaseLock.hxx"
#include "db/DatabaseLock.hxx"
#include "db/plugins/simple/Directory.hxx"
#include "db/plugins/simple/Directory.hxx"
#include "db/plugins/simple/Song.hxx"
#include "db/plugins/simple/Song.hxx"
...
@@ -41,8 +42,8 @@ try {
...
@@ -41,8 +42,8 @@ try {
}
}
if
(
!
directory_child_access
(
storage
,
directory
,
name
,
R_OK
))
{
if
(
!
directory_child_access
(
storage
,
directory
,
name
,
R_OK
))
{
F
orma
tError
(
update_domain
,
F
m
tError
(
update_domain
,
"no read permissions on %s/%s
"
,
"no read permissions on {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
if
(
song
!=
nullptr
)
if
(
song
!=
nullptr
)
editor
.
LockDeleteSong
(
directory
,
song
);
editor
.
LockDeleteSong
(
directory
,
song
);
...
@@ -59,13 +60,13 @@ try {
...
@@ -59,13 +60,13 @@ try {
}
}
if
(
song
==
nullptr
)
{
if
(
song
==
nullptr
)
{
F
ormatDebug
(
update_domain
,
"reading %s/%s
"
,
F
mtDebug
(
update_domain
,
"reading {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
auto
new_song
=
Song
::
LoadFile
(
storage
,
name
,
directory
);
auto
new_song
=
Song
::
LoadFile
(
storage
,
name
,
directory
);
if
(
!
new_song
)
{
if
(
!
new_song
)
{
F
orma
tDebug
(
update_domain
,
F
m
tDebug
(
update_domain
,
"ignoring unrecognized file %s/%s
"
,
"ignoring unrecognized file {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
return
;
return
;
}
}
...
@@ -76,14 +77,14 @@ try {
...
@@ -76,14 +77,14 @@ try {
}
}
modified
=
true
;
modified
=
true
;
F
ormatNotice
(
update_domain
,
"added %s/%s
"
,
F
mtNotice
(
update_domain
,
"added {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
}
else
if
(
info
.
mtime
!=
song
->
mtime
||
walk_discard
)
{
}
else
if
(
info
.
mtime
!=
song
->
mtime
||
walk_discard
)
{
F
ormatNotice
(
update_domain
,
"updating %s/%s
"
,
F
mtNotice
(
update_domain
,
"updating {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
if
(
!
song
->
UpdateFile
(
storage
))
{
if
(
!
song
->
UpdateFile
(
storage
))
{
F
orma
tDebug
(
update_domain
,
F
m
tDebug
(
update_domain
,
"deleting unrecognized file %s/%s
"
,
"deleting unrecognized file {}/{}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
editor
.
LockDeleteSong
(
directory
,
song
);
editor
.
LockDeleteSong
(
directory
,
song
);
}
}
...
@@ -91,9 +92,9 @@ try {
...
@@ -91,9 +92,9 @@ try {
modified
=
true
;
modified
=
true
;
}
}
}
catch
(...)
{
}
catch
(...)
{
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
update_domain
,
"error reading file %s/%s
"
,
"error reading file {}/{}: {}
"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
,
std
::
current_exception
()
);
}
}
bool
bool
...
...
src/db/update/Walk.cxx
View file @
6f539cfc
...
@@ -223,8 +223,8 @@ try {
...
@@ -223,8 +223,8 @@ try {
if
(
!
UpdateDirectory
(
*
subdir
,
exclude_list
,
info
))
if
(
!
UpdateDirectory
(
*
subdir
,
exclude_list
,
info
))
editor
.
LockDeleteDirectory
(
subdir
);
editor
.
LockDeleteDirectory
(
subdir
);
}
else
{
}
else
{
F
orma
tDebug
(
update_domain
,
F
m
tDebug
(
update_domain
,
"%s
is not a directory, archive or music"
,
name
);
"{}
is not a directory, archive or music"
,
name
);
}
}
}
catch
(...)
{
}
catch
(...)
{
LogError
(
std
::
current_exception
());
LogError
(
std
::
current_exception
());
...
@@ -520,8 +520,8 @@ UpdateWalk::Walk(Directory &root, const char *path, bool discard) noexcept
...
@@ -520,8 +520,8 @@ UpdateWalk::Walk(Directory &root, const char *path, bool discard) noexcept
return
false
;
return
false
;
if
(
!
info
.
IsDirectory
())
{
if
(
!
info
.
IsDirectory
())
{
F
ormatError
(
update_domain
,
"Not a directory: %s
"
,
F
mtError
(
update_domain
,
"Not a directory: {}
"
,
storage
.
MapUTF8
(
""
).
c_str
(
));
storage
.
MapUTF8
(
""
));
return
false
;
return
false
;
}
}
...
...
src/decoder/DecoderList.cxx
View file @
6f539cfc
...
@@ -20,9 +20,9 @@
...
@@ -20,9 +20,9 @@
#include "config.h"
#include "config.h"
#include "DecoderList.hxx"
#include "DecoderList.hxx"
#include "DecoderPlugin.hxx"
#include "DecoderPlugin.hxx"
#include "Domain.hxx"
#include "decoder/Features.h"
#include "decoder/Features.h"
#include "PluginUnavailable.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "Log.hxx"
#include "config/Data.hxx"
#include "config/Data.hxx"
#include "config/Block.hxx"
#include "config/Block.hxx"
#include "plugins/AudiofileDecoderPlugin.hxx"
#include "plugins/AudiofileDecoderPlugin.hxx"
...
@@ -49,6 +49,8 @@
...
@@ -49,6 +49,8 @@
#include "plugins/FluidsynthDecoderPlugin.hxx"
#include "plugins/FluidsynthDecoderPlugin.hxx"
#include "plugins/SidplayDecoderPlugin.hxx"
#include "plugins/SidplayDecoderPlugin.hxx"
#include "util/RuntimeError.hxx"
#include "util/RuntimeError.hxx"
#include "Log.hxx"
#include "PluginUnavailable.hxx"
#include <iterator>
#include <iterator>
...
@@ -160,9 +162,9 @@ decoder_plugin_init_all(const ConfigData &config)
...
@@ -160,9 +162,9 @@ decoder_plugin_init_all(const ConfigData &config)
if
(
plugin
.
Init
(
*
param
))
if
(
plugin
.
Init
(
*
param
))
decoder_plugins_enabled
[
i
]
=
true
;
decoder_plugins_enabled
[
i
]
=
true
;
}
catch
(
const
PluginUnavailable
&
e
)
{
}
catch
(
const
PluginUnavailable
&
e
)
{
F
ormatError
(
e
,
F
mtError
(
decoder_domain
,
"Decoder plugin '%s' is unavailable
"
,
"Decoder plugin '{}' is unavailable: {}
"
,
plugin
.
name
);
plugin
.
name
,
std
::
current_exception
()
);
}
catch
(...)
{
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to initialize decoder plugin '%s'"
,
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to initialize decoder plugin '%s'"
,
plugin
.
name
));
plugin
.
name
));
...
...
src/decoder/meson.build
View file @
6f539cfc
...
@@ -3,6 +3,7 @@ decoder_features = configuration_data()
...
@@ -3,6 +3,7 @@ decoder_features = configuration_data()
decoder_api = static_library(
decoder_api = static_library(
'decoder_api',
'decoder_api',
'DecoderAPI.cxx',
'DecoderAPI.cxx',
'Domain.cxx',
'Reader.cxx',
'Reader.cxx',
'DecoderBuffer.cxx',
'DecoderBuffer.cxx',
'DecoderPlugin.cxx',
'DecoderPlugin.cxx',
...
...
src/decoder/plugins/FaadDecoderPlugin.cxx
View file @
6f539cfc
...
@@ -357,24 +357,24 @@ faad_stream_decode(DecoderClient &client, InputStream &is,
...
@@ -357,24 +357,24 @@ faad_stream_decode(DecoderClient &client, InputStream &is,
faad_decoder_decode
(
decoder
,
buffer
,
&
frame_info
);
faad_decoder_decode
(
decoder
,
buffer
,
&
frame_info
);
if
(
frame_info
.
error
>
0
)
{
if
(
frame_info
.
error
>
0
)
{
F
orma
tWarning
(
faad_decoder_domain
,
F
m
tWarning
(
faad_decoder_domain
,
"error decoding AAC stream: %s
"
,
"error decoding AAC stream: {}
"
,
NeAACDecGetErrorMessage
(
frame_info
.
error
));
NeAACDecGetErrorMessage
(
frame_info
.
error
));
break
;
break
;
}
}
if
(
frame_info
.
channels
!=
audio_format
.
channels
)
{
if
(
frame_info
.
channels
!=
audio_format
.
channels
)
{
F
orma
tNotice
(
faad_decoder_domain
,
F
m
tNotice
(
faad_decoder_domain
,
"channel count changed from %u to %u
"
,
"channel count changed from {} to {}
"
,
audio_format
.
channels
,
frame_info
.
channels
);
audio_format
.
channels
,
frame_info
.
channels
);
break
;
break
;
}
}
if
(
frame_info
.
samplerate
!=
audio_format
.
sample_rate
)
{
if
(
frame_info
.
samplerate
!=
audio_format
.
sample_rate
)
{
F
orma
tNotice
(
faad_decoder_domain
,
F
m
tNotice
(
faad_decoder_domain
,
"sample rate changed from %u to %lu
"
,
"sample rate changed from {} to {}
"
,
audio_format
.
sample_rate
,
audio_format
.
sample_rate
,
(
unsigned
long
)
frame_info
.
samplerate
);
frame_info
.
samplerate
);
break
;
break
;
}
}
...
...
src/decoder/plugins/FfmpegDecoderPlugin.cxx
View file @
6f539cfc
...
@@ -270,8 +270,8 @@ FfmpegReceiveFrames(DecoderClient &client, InputStream *is,
...
@@ -270,8 +270,8 @@ FfmpegReceiveFrames(DecoderClient &client, InputStream *is,
{
{
char
msg
[
256
];
char
msg
[
256
];
av_strerror
(
err
,
msg
,
sizeof
(
msg
));
av_strerror
(
err
,
msg
,
sizeof
(
msg
));
F
orma
tWarning
(
ffmpeg_domain
,
F
m
tWarning
(
ffmpeg_domain
,
"avcodec_send_packet() failed: %s
"
,
"avcodec_send_packet() failed: {}
"
,
msg
);
msg
);
}
}
...
@@ -326,8 +326,8 @@ ffmpeg_send_packet(DecoderClient &client, InputStream *is,
...
@@ -326,8 +326,8 @@ ffmpeg_send_packet(DecoderClient &client, InputStream *is,
{
{
char
msg
[
256
];
char
msg
[
256
];
av_strerror
(
err
,
msg
,
sizeof
(
msg
));
av_strerror
(
err
,
msg
,
sizeof
(
msg
));
F
orma
tWarning
(
ffmpeg_domain
,
F
m
tWarning
(
ffmpeg_domain
,
"avcodec_send_packet() failed: %s
"
,
msg
);
"avcodec_send_packet() failed: {}
"
,
msg
);
}
}
return
DecoderCommand
::
NONE
;
return
DecoderCommand
::
NONE
;
...
@@ -355,12 +355,12 @@ ffmpeg_sample_format(enum AVSampleFormat sample_fmt) noexcept
...
@@ -355,12 +355,12 @@ ffmpeg_sample_format(enum AVSampleFormat sample_fmt) noexcept
const
char
*
name
=
av_get_sample_fmt_string
(
buffer
,
sizeof
(
buffer
),
const
char
*
name
=
av_get_sample_fmt_string
(
buffer
,
sizeof
(
buffer
),
sample_fmt
);
sample_fmt
);
if
(
name
!=
nullptr
)
if
(
name
!=
nullptr
)
F
orma
tError
(
ffmpeg_domain
,
F
m
tError
(
ffmpeg_domain
,
"Unsupported libavcodec SampleFormat value: %s (%d
)"
,
"Unsupported libavcodec SampleFormat value: {} ({}
)"
,
name
,
sample_fmt
);
name
,
sample_fmt
);
else
else
F
orma
tError
(
ffmpeg_domain
,
F
m
tError
(
ffmpeg_domain
,
"Unsupported libavcodec SampleFormat value: %d
"
,
"Unsupported libavcodec SampleFormat value: {}
"
,
sample_fmt
);
sample_fmt
);
return
SampleFormat
::
UNDEFINED
;
return
SampleFormat
::
UNDEFINED
;
}
}
...
@@ -499,7 +499,7 @@ FfmpegDecode(DecoderClient &client, InputStream *input,
...
@@ -499,7 +499,7 @@ FfmpegDecode(DecoderClient &client, InputStream *input,
const
AVCodecDescriptor
*
codec_descriptor
=
const
AVCodecDescriptor
*
codec_descriptor
=
avcodec_descriptor_get
(
codec_params
.
codec_id
);
avcodec_descriptor_get
(
codec_params
.
codec_id
);
if
(
codec_descriptor
!=
nullptr
)
if
(
codec_descriptor
!=
nullptr
)
F
ormatDebug
(
ffmpeg_domain
,
"codec '%s
'"
,
F
mtDebug
(
ffmpeg_domain
,
"codec '{}
'"
,
codec_descriptor
->
name
);
codec_descriptor
->
name
);
AVCodec
*
codec
=
avcodec_find_decoder
(
codec_params
.
codec_id
);
AVCodec
*
codec
=
avcodec_find_decoder
(
codec_params
.
codec_id
);
...
@@ -602,7 +602,7 @@ ffmpeg_decode(DecoderClient &client, InputStream &input)
...
@@ -602,7 +602,7 @@ ffmpeg_decode(DecoderClient &client, InputStream &input)
FfmpegOpenInput
(
stream
.
io
,
input
.
GetURI
(),
nullptr
);
FfmpegOpenInput
(
stream
.
io
,
input
.
GetURI
(),
nullptr
);
const
auto
*
input_format
=
format_context
->
iformat
;
const
auto
*
input_format
=
format_context
->
iformat
;
F
ormatDebug
(
ffmpeg_domain
,
"detected input format '%s' (%s
)"
,
F
mtDebug
(
ffmpeg_domain
,
"detected input format '{}' ({}
)"
,
input_format
->
name
,
input_format
->
long_name
);
input_format
->
name
,
input_format
->
long_name
);
FfmpegDecode
(
client
,
&
input
,
*
format_context
);
FfmpegDecode
(
client
,
&
input
,
*
format_context
);
...
@@ -668,7 +668,7 @@ ffmpeg_uri_decode(DecoderClient &client, const char *uri)
...
@@ -668,7 +668,7 @@ ffmpeg_uri_decode(DecoderClient &client, const char *uri)
FfmpegOpenInput
(
nullptr
,
uri
,
nullptr
);
FfmpegOpenInput
(
nullptr
,
uri
,
nullptr
);
const
auto
*
input_format
=
format_context
->
iformat
;
const
auto
*
input_format
=
format_context
->
iformat
;
F
ormatDebug
(
ffmpeg_domain
,
"detected input format '%s' (%s
)"
,
F
mtDebug
(
ffmpeg_domain
,
"detected input format '{}' ({}
)"
,
input_format
->
name
,
input_format
->
long_name
);
input_format
->
name
,
input_format
->
long_name
);
FfmpegDecode
(
client
,
nullptr
,
*
format_context
);
FfmpegDecode
(
client
,
nullptr
,
*
format_context
);
...
...
src/decoder/plugins/MikmodDecoderPlugin.cxx
View file @
6f539cfc
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "config.h"
#include "MikmodDecoderPlugin.hxx"
#include "MikmodDecoderPlugin.hxx"
#include "../DecoderAPI.hxx"
#include "../DecoderAPI.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "tag/Handler.hxx"
#include "tag/Handler.hxx"
#include "fs/Path.hxx"
#include "fs/Path.hxx"
#include "util/Domain.hxx"
#include "util/Domain.hxx"
...
@@ -126,8 +127,8 @@ mikmod_decoder_init(const ConfigBlock &block)
...
@@ -126,8 +127,8 @@ mikmod_decoder_init(const ConfigBlock &block)
DMODE_16BITS
);
DMODE_16BITS
);
if
(
MikMod_Init
(
params
))
{
if
(
MikMod_Init
(
params
))
{
F
orma
tError
(
mikmod_domain
,
F
m
tError
(
mikmod_domain
,
"Could not init MikMod: %s
"
,
"Could not init MikMod: {}
"
,
MikMod_strerror
(
MikMod_errno
));
MikMod_strerror
(
MikMod_errno
));
return
false
;
return
false
;
}
}
...
@@ -155,8 +156,7 @@ mikmod_decoder_file_decode(DecoderClient &client, Path path_fs)
...
@@ -155,8 +156,7 @@ mikmod_decoder_file_decode(DecoderClient &client, Path path_fs)
handle
=
Player_Load
(
path2
,
128
,
0
);
handle
=
Player_Load
(
path2
,
128
,
0
);
if
(
handle
==
nullptr
)
{
if
(
handle
==
nullptr
)
{
FormatError
(
mikmod_domain
,
FmtError
(
mikmod_domain
,
"failed to open mod: {}"
,
path_fs
);
"failed to open mod: %s"
,
path_fs
.
c_str
());
return
;
return
;
}
}
...
@@ -189,8 +189,7 @@ mikmod_decoder_scan_file(Path path_fs, TagHandler &handler) noexcept
...
@@ -189,8 +189,7 @@ mikmod_decoder_scan_file(Path path_fs, TagHandler &handler) noexcept
MODULE
*
handle
=
Player_Load
(
path2
,
128
,
0
);
MODULE
*
handle
=
Player_Load
(
path2
,
128
,
0
);
if
(
handle
==
nullptr
)
{
if
(
handle
==
nullptr
)
{
FormatDebug
(
mikmod_domain
,
FmtDebug
(
mikmod_domain
,
"Failed to open file: {}"
,
path_fs
);
"Failed to open file: %s"
,
path_fs
.
c_str
());
return
false
;
return
false
;
}
}
...
...
src/decoder/plugins/Mpg123DecoderPlugin.cxx
View file @
6f539cfc
...
@@ -65,8 +65,8 @@ mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
...
@@ -65,8 +65,8 @@ mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
{
{
int
error
=
mpg123_open
(
handle
,
path_fs
);
int
error
=
mpg123_open
(
handle
,
path_fs
);
if
(
error
!=
MPG123_OK
)
{
if
(
error
!=
MPG123_OK
)
{
F
orma
tWarning
(
mpg123_domain
,
F
m
tWarning
(
mpg123_domain
,
"libmpg123 failed to open %s: %s
"
,
"libmpg123 failed to open {}: {}
"
,
path_fs
,
mpg123_plain_strerror
(
error
));
path_fs
,
mpg123_plain_strerror
(
error
));
return
false
;
return
false
;
}
}
...
@@ -77,16 +77,16 @@ mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
...
@@ -77,16 +77,16 @@ mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
int
channels
,
encoding
;
int
channels
,
encoding
;
error
=
mpg123_getformat
(
handle
,
&
rate
,
&
channels
,
&
encoding
);
error
=
mpg123_getformat
(
handle
,
&
rate
,
&
channels
,
&
encoding
);
if
(
error
!=
MPG123_OK
)
{
if
(
error
!=
MPG123_OK
)
{
F
orma
tWarning
(
mpg123_domain
,
F
m
tWarning
(
mpg123_domain
,
"mpg123_getformat() failed: %s
"
,
"mpg123_getformat() failed: {}
"
,
mpg123_plain_strerror
(
error
));
mpg123_plain_strerror
(
error
));
return
false
;
return
false
;
}
}
if
(
encoding
!=
MPG123_ENC_SIGNED_16
)
{
if
(
encoding
!=
MPG123_ENC_SIGNED_16
)
{
/* other formats not yet implemented */
/* other formats not yet implemented */
F
orma
tWarning
(
mpg123_domain
,
F
m
tWarning
(
mpg123_domain
,
"expected MPG123_ENC_SIGNED_16, got %d
"
,
"expected MPG123_ENC_SIGNED_16, got {}
"
,
encoding
);
encoding
);
return
false
;
return
false
;
}
}
...
@@ -187,8 +187,8 @@ mpd_mpg123_file_decode(DecoderClient &client, Path path_fs)
...
@@ -187,8 +187,8 @@ mpd_mpg123_file_decode(DecoderClient &client, Path path_fs)
int
error
;
int
error
;
mpg123_handle
*
const
handle
=
mpg123_new
(
nullptr
,
&
error
);
mpg123_handle
*
const
handle
=
mpg123_new
(
nullptr
,
&
error
);
if
(
handle
==
nullptr
)
{
if
(
handle
==
nullptr
)
{
F
orma
tError
(
mpg123_domain
,
F
m
tError
(
mpg123_domain
,
"mpg123_new() failed: %s
"
,
"mpg123_new() failed: {}
"
,
mpg123_plain_strerror
(
error
));
mpg123_plain_strerror
(
error
));
return
;
return
;
}
}
...
@@ -238,8 +238,8 @@ mpd_mpg123_file_decode(DecoderClient &client, Path path_fs)
...
@@ -238,8 +238,8 @@ mpd_mpg123_file_decode(DecoderClient &client, Path path_fs)
error
=
mpg123_read
(
handle
,
buffer
,
sizeof
(
buffer
),
&
nbytes
);
error
=
mpg123_read
(
handle
,
buffer
,
sizeof
(
buffer
),
&
nbytes
);
if
(
error
!=
MPG123_OK
)
{
if
(
error
!=
MPG123_OK
)
{
if
(
error
!=
MPG123_DONE
)
if
(
error
!=
MPG123_DONE
)
F
orma
tWarning
(
mpg123_domain
,
F
m
tWarning
(
mpg123_domain
,
"mpg123_read() failed: %s
"
,
"mpg123_read() failed: {}
"
,
mpg123_plain_strerror
(
error
));
mpg123_plain_strerror
(
error
));
break
;
break
;
}
}
...
@@ -277,8 +277,8 @@ mpd_mpg123_scan_file(Path path_fs, TagHandler &handler) noexcept
...
@@ -277,8 +277,8 @@ mpd_mpg123_scan_file(Path path_fs, TagHandler &handler) noexcept
int
error
;
int
error
;
mpg123_handle
*
const
handle
=
mpg123_new
(
nullptr
,
&
error
);
mpg123_handle
*
const
handle
=
mpg123_new
(
nullptr
,
&
error
);
if
(
handle
==
nullptr
)
{
if
(
handle
==
nullptr
)
{
F
orma
tError
(
mpg123_domain
,
F
m
tError
(
mpg123_domain
,
"mpg123_new() failed: %s
"
,
"mpg123_new() failed: {}
"
,
mpg123_plain_strerror
(
error
));
mpg123_plain_strerror
(
error
));
return
false
;
return
false
;
}
}
...
...
src/event/ServerSocket.cxx
View file @
6f539cfc
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "config.h"
#include "ServerSocket.hxx"
#include "ServerSocket.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "net/IPv4Address.hxx"
#include "net/IPv4Address.hxx"
#include "net/IPv6Address.hxx"
#include "net/IPv6Address.hxx"
#include "net/StaticSocketAddress.hxx"
#include "net/StaticSocketAddress.hxx"
...
@@ -150,15 +151,15 @@ ServerSocket::OneServerSocket::Accept() noexcept
...
@@ -150,15 +151,15 @@ ServerSocket::OneServerSocket::Accept() noexcept
UniqueSocketDescriptor
peer_fd
(
event
.
GetSocket
().
AcceptNonBlock
(
peer_address
));
UniqueSocketDescriptor
peer_fd
(
event
.
GetSocket
().
AcceptNonBlock
(
peer_address
));
if
(
!
peer_fd
.
IsDefined
())
{
if
(
!
peer_fd
.
IsDefined
())
{
const
SocketErrorMessage
msg
;
const
SocketErrorMessage
msg
;
F
orma
tError
(
server_socket_domain
,
F
m
tError
(
server_socket_domain
,
"accept() failed: %s
"
,
(
const
char
*
)
msg
);
"accept() failed: {}
"
,
(
const
char
*
)
msg
);
return
;
return
;
}
}
if
(
!
peer_fd
.
SetKeepAlive
())
{
if
(
!
peer_fd
.
SetKeepAlive
())
{
const
SocketErrorMessage
msg
;
const
SocketErrorMessage
msg
;
F
orma
tError
(
server_socket_domain
,
F
m
tError
(
server_socket_domain
,
"Could not set TCP keepalive option: %s
"
,
"Could not set TCP keepalive option: {}
"
,
(
const
char
*
)
msg
);
(
const
char
*
)
msg
);
}
}
...
@@ -227,12 +228,13 @@ ServerSocket::Open()
...
@@ -227,12 +228,13 @@ ServerSocket::Open()
if
(
good
!=
nullptr
&&
good
->
GetSerial
()
==
i
.
GetSerial
())
{
if
(
good
!=
nullptr
&&
good
->
GetSerial
()
==
i
.
GetSerial
())
{
const
auto
address_string
=
i
.
ToString
();
const
auto
address_string
=
i
.
ToString
();
const
auto
good_string
=
good
->
ToString
();
const
auto
good_string
=
good
->
ToString
();
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
server_socket_domain
,
"bind to '%s
' failed "
"bind to '{}
' failed "
"(continuing anyway, because "
"(continuing anyway, because "
"binding to '%s' succeeded)"
,
"binding to '{}' succeeded): {}"
,
address_string
.
c_str
(),
address_string
,
good_string
.
c_str
());
good_string
,
std
::
current_exception
());
}
else
if
(
bad
==
nullptr
)
{
}
else
if
(
bad
==
nullptr
)
{
bad
=
&
i
;
bad
=
&
i
;
...
...
src/fs/Charset.cxx
View file @
6f539cfc
...
@@ -48,8 +48,8 @@ SetFSCharset(const char *charset)
...
@@ -48,8 +48,8 @@ SetFSCharset(const char *charset)
fs_converter
=
IcuConverter
::
Create
(
charset
);
fs_converter
=
IcuConverter
::
Create
(
charset
);
assert
(
fs_converter
!=
nullptr
);
assert
(
fs_converter
!=
nullptr
);
F
orma
tDebug
(
path_domain
,
F
m
tDebug
(
path_domain
,
"SetFSCharset: fs charset is: %s"
,
fs_charset
.
c_str
()
);
"SetFSCharset: fs charset is {}"
,
fs_charset
);
}
}
#endif
#endif
...
...
src/fs/CheckFile.cxx
View file @
6f539cfc
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "CheckFile.hxx"
#include "CheckFile.hxx"
#include "Log.hxx"
#include "Log.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "config/Domain.hxx"
#include "config/Domain.hxx"
#include "FileInfo.hxx"
#include "FileInfo.hxx"
#include "Path.hxx"
#include "Path.hxx"
...
@@ -31,8 +32,7 @@ CheckDirectoryReadable(Path path_fs)
...
@@ -31,8 +32,7 @@ CheckDirectoryReadable(Path path_fs)
try
{
try
{
const
FileInfo
fi
(
path_fs
);
const
FileInfo
fi
(
path_fs
);
if
(
!
fi
.
IsDirectory
())
{
if
(
!
fi
.
IsDirectory
())
{
FormatError
(
config_domain
,
FmtError
(
config_domain
,
"Not a directory: {}"
,
path_fs
);
"Not a directory: %s"
,
path_fs
.
ToUTF8
().
c_str
());
return
;
return
;
}
}
...
@@ -42,9 +42,9 @@ try {
...
@@ -42,9 +42,9 @@ try {
const
FileInfo
fi2
(
x
);
const
FileInfo
fi2
(
x
);
}
catch
(
const
std
::
system_error
&
e
)
{
}
catch
(
const
std
::
system_error
&
e
)
{
if
(
IsAccessDenied
(
e
))
if
(
IsAccessDenied
(
e
))
F
orma
tError
(
config_domain
,
F
m
tError
(
config_domain
,
"No permission to traverse (
\"
execute
\"
) directory: %s
"
,
"No permission to traverse (
\"
execute
\"
) directory: {}
"
,
path_fs
.
ToUTF8
().
c_str
()
);
path_fs
);
}
}
#endif
#endif
...
@@ -52,9 +52,9 @@ try {
...
@@ -52,9 +52,9 @@ try {
const
DirectoryReader
reader
(
path_fs
);
const
DirectoryReader
reader
(
path_fs
);
}
catch
(
const
std
::
system_error
&
e
)
{
}
catch
(
const
std
::
system_error
&
e
)
{
if
(
IsAccessDenied
(
e
))
if
(
IsAccessDenied
(
e
))
F
orma
tError
(
config_domain
,
F
m
tError
(
config_domain
,
"No permission to read directory: %s
"
,
"No permission to read directory: {}
"
,
path_fs
.
ToUTF8
().
c_str
()
);
path_fs
);
}
}
}
catch
(...)
{
}
catch
(...)
{
LogError
(
std
::
current_exception
());
LogError
(
std
::
current_exception
());
...
...
src/input/plugins/CdioParanoiaInputPlugin.cxx
View file @
6f539cfc
...
@@ -207,7 +207,8 @@ input_cdio_open(const char *uri,
...
@@ -207,7 +207,8 @@ input_cdio_open(const char *uri,
cdio_cddap_verbose_set
(
drv
,
CDDA_MESSAGE_FORGETIT
,
CDDA_MESSAGE_FORGETIT
);
cdio_cddap_verbose_set
(
drv
,
CDDA_MESSAGE_FORGETIT
,
CDDA_MESSAGE_FORGETIT
);
if
(
speed
>
0
)
{
if
(
speed
>
0
)
{
FormatDebug
(
cdio_domain
,
"Attempting to set CD speed to %dx"
,
speed
);
FmtDebug
(
cdio_domain
,
"Attempting to set CD speed to {}x"
,
speed
);
cdio_cddap_speed_set
(
drv
,
speed
);
cdio_cddap_speed_set
(
drv
,
speed
);
}
}
...
@@ -301,8 +302,8 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
...
@@ -301,8 +302,8 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
}
catch
(...)
{
}
catch
(...)
{
char
*
s_err
=
cdio_cddap_errors
(
drv
);
char
*
s_err
=
cdio_cddap_errors
(
drv
);
if
(
s_err
)
{
if
(
s_err
)
{
F
orma
tError
(
cdio_domain
,
F
m
tError
(
cdio_domain
,
"paranoia_read: %s
"
,
s_err
);
"paranoia_read: {}
"
,
s_err
);
cdio_cddap_free_messages
(
s_err
);
cdio_cddap_free_messages
(
s_err
);
}
}
...
...
src/input/plugins/TidalInputPlugin.cxx
View file @
6f539cfc
...
@@ -27,10 +27,10 @@
...
@@ -27,10 +27,10 @@
#include "input/ProxyInputStream.hxx"
#include "input/ProxyInputStream.hxx"
#include "input/FailingInputStream.hxx"
#include "input/FailingInputStream.hxx"
#include "input/InputPlugin.hxx"
#include "input/InputPlugin.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "config/Block.hxx"
#include "config/Block.hxx"
#include "thread/Mutex.hxx"
#include "thread/Mutex.hxx"
#include "util/Domain.hxx"
#include "util/Domain.hxx"
#include "util/Exception.hxx"
#include "util/StringCompare.hxx"
#include "util/StringCompare.hxx"
#include "Log.hxx"
#include "Log.hxx"
...
@@ -117,8 +117,8 @@ TidalInputStream::OnTidalSession() noexcept
...
@@ -117,8 +117,8 @@ TidalInputStream::OnTidalSession() noexcept
void
void
TidalInputStream
::
OnTidalTrackSuccess
(
std
::
string
url
)
noexcept
TidalInputStream
::
OnTidalTrackSuccess
(
std
::
string
url
)
noexcept
{
{
F
ormatDebug
(
tidal_domain
,
"Tidal track '%s' resolves to %s
"
,
F
mtDebug
(
tidal_domain
,
"Tidal track '{}' resolves to {}
"
,
track_id
.
c_str
(),
url
.
c_str
()
);
track_id
,
url
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
@@ -154,8 +154,8 @@ TidalInputStream::OnTidalTrackError(std::exception_ptr e) noexcept
...
@@ -154,8 +154,8 @@ TidalInputStream::OnTidalTrackError(std::exception_ptr e) noexcept
/* the session has expired - obtain a new session id
/* the session has expired - obtain a new session id
by logging in again */
by logging in again */
F
ormatInfo
(
tidal_domain
,
"Session expired ('%s'), retrying to log in"
,
F
mtInfo
(
tidal_domain
,
GetFullMessage
(
e
).
c_str
()
);
"Session expired ('{}'), retrying to log in"
,
e
);
retry_login
=
false
;
retry_login
=
false
;
tidal_session
->
AddLoginHandler
(
*
this
);
tidal_session
->
AddLoginHandler
(
*
this
);
...
...
src/lib/ffmpeg/LogError.cxx
View file @
6f539cfc
...
@@ -38,5 +38,5 @@ LogFfmpegError(int errnum, const char *prefix)
...
@@ -38,5 +38,5 @@ LogFfmpegError(int errnum, const char *prefix)
{
{
char
msg
[
256
];
char
msg
[
256
];
av_strerror
(
errnum
,
msg
,
sizeof
(
msg
));
av_strerror
(
errnum
,
msg
,
sizeof
(
msg
));
F
ormatError
(
ffmpeg_domain
,
"%s: %s
"
,
prefix
,
msg
);
F
mtError
(
ffmpeg_domain
,
"{}: {}
"
,
prefix
,
msg
);
}
}
src/lib/pulse/LogError.cxx
View file @
6f539cfc
...
@@ -28,5 +28,5 @@ void
...
@@ -28,5 +28,5 @@ void
LogPulseError
(
pa_context
*
context
,
const
char
*
prefix
)
noexcept
LogPulseError
(
pa_context
*
context
,
const
char
*
prefix
)
noexcept
{
{
const
int
e
=
pa_context_errno
(
context
);
const
int
e
=
pa_context_errno
(
context
);
F
ormatError
(
pulse_domain
,
"%s: %s
"
,
prefix
,
pa_strerror
(
e
));
F
mtError
(
pulse_domain
,
"{}: {}
"
,
prefix
,
pa_strerror
(
e
));
}
}
src/mixer/Volume.cxx
View file @
6f539cfc
...
@@ -106,8 +106,8 @@ read_sw_volume_state(const char *line, MultipleOutputs &outputs)
...
@@ -106,8 +106,8 @@ read_sw_volume_state(const char *line, MultipleOutputs &outputs)
if
(
*
end
==
0
&&
sv
>=
0
&&
sv
<=
100
)
if
(
*
end
==
0
&&
sv
>=
0
&&
sv
<=
100
)
software_volume_change
(
outputs
,
sv
);
software_volume_change
(
outputs
,
sv
);
else
else
F
orma
tWarning
(
volume_domain
,
F
m
tWarning
(
volume_domain
,
"Can't parse software volume: %s
"
,
line
);
"Can't parse software volume: {}
"
,
line
);
return
true
;
return
true
;
}
}
...
...
src/mixer/plugins/AlsaMixerPlugin.cxx
View file @
6f539cfc
...
@@ -125,8 +125,8 @@ AlsaMixerMonitor::DispatchSockets() noexcept
...
@@ -125,8 +125,8 @@ AlsaMixerMonitor::DispatchSockets() noexcept
int
err
=
snd_mixer_handle_events
(
mixer
);
int
err
=
snd_mixer_handle_events
(
mixer
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
F
orma
tError
(
alsa_mixer_domain
,
F
m
tError
(
alsa_mixer_domain
,
"snd_mixer_handle_events() failed: %s
"
,
"snd_mixer_handle_events() failed: {}
"
,
snd_strerror
(
err
));
snd_strerror
(
err
));
if
(
err
==
-
ENODEV
)
{
if
(
err
==
-
ENODEV
)
{
...
...
src/output/Control.cxx
View file @
6f539cfc
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#include "Control.hxx"
#include "Control.hxx"
#include "Filtered.hxx"
#include "Filtered.hxx"
#include "Client.hxx"
#include "Client.hxx"
#include "Domain.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "mixer/MixerControl.hxx"
#include "mixer/MixerControl.hxx"
#include "config/Block.hxx"
#include "config/Block.hxx"
#include "Log.hxx"
#include "Log.hxx"
...
@@ -286,9 +288,9 @@ AudioOutputControl::Open(std::unique_lock<Mutex> &lock,
...
@@ -286,9 +288,9 @@ AudioOutputControl::Open(std::unique_lock<Mutex> &lock,
try
{
try
{
mixer_open
(
output
->
mixer
);
mixer_open
(
output
->
mixer
);
}
catch
(...)
{
}
catch
(...)
{
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
output_domain
,
"Failed to open mixer for '%s'
"
,
"Failed to open mixer for '{}': {}
"
,
GetName
());
GetName
(),
std
::
current_exception
());
}
}
}
}
...
...
src/output/Filtered.cxx
View file @
6f539cfc
...
@@ -20,12 +20,14 @@
...
@@ -20,12 +20,14 @@
#include "Filtered.hxx"
#include "Filtered.hxx"
#include "Interface.hxx"
#include "Interface.hxx"
#include "Domain.hxx"
#include "Domain.hxx"
#include "Log.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "mixer/MixerInternal.hxx"
#include "mixer/MixerInternal.hxx"
#include "mixer/plugins/SoftwareMixerPlugin.hxx"
#include "mixer/plugins/SoftwareMixerPlugin.hxx"
#include "filter/plugins/ConvertFilterPlugin.hxx"
#include "filter/plugins/ConvertFilterPlugin.hxx"
#include "util/RuntimeError.hxx"
#include "util/RuntimeError.hxx"
#include "util/StringBuffer.hxx"
#include "util/StringBuffer.hxx"
#include "Log.hxx"
bool
bool
FilteredAudioOutput
::
SupportsEnableDisable
()
const
noexcept
FilteredAudioOutput
::
SupportsEnableDisable
()
const
noexcept
...
@@ -91,10 +93,9 @@ FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
...
@@ -91,10 +93,9 @@ FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
GetLogName
()));
GetLogName
()));
}
}
FormatDebug
(
output_domain
,
FmtDebug
(
output_domain
,
"opened %s audio_format=%s"
,
"opened {} audio_format={}"
,
GetLogName
(),
GetLogName
(),
out_audio_format
);
ToString
(
out_audio_format
).
c_str
());
try
{
try
{
ConfigureConvertFilter
();
ConfigureConvertFilter
();
...
@@ -109,7 +110,7 @@ FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
...
@@ -109,7 +110,7 @@ FilteredAudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
DSD and fall back to PCM */
DSD and fall back to PCM */
LogError
(
std
::
current_exception
());
LogError
(
std
::
current_exception
());
Format
Error
(
output_domain
,
"Retrying without DSD"
);
Log
Error
(
output_domain
,
"Retrying without DSD"
);
desired_audio_format
.
format
=
SampleFormat
::
FLOAT
;
desired_audio_format
.
format
=
SampleFormat
::
FLOAT
;
OpenOutputAndConvert
(
desired_audio_format
);
OpenOutputAndConvert
(
desired_audio_format
);
...
@@ -127,8 +128,9 @@ FilteredAudioOutput::CloseOutput(bool drain) noexcept
...
@@ -127,8 +128,9 @@ FilteredAudioOutput::CloseOutput(bool drain) noexcept
try
{
try
{
Drain
();
Drain
();
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
FmtError
(
output_domain
,
"Failed to drain %s"
,
GetLogName
());
"Failed to drain {}: {}"
,
GetLogName
(),
std
::
current_exception
());
}
}
}
else
}
else
Cancel
();
Cancel
();
...
@@ -156,7 +158,7 @@ FilteredAudioOutput::Close(bool drain) noexcept
...
@@ -156,7 +158,7 @@ FilteredAudioOutput::Close(bool drain) noexcept
CloseOutput
(
drain
);
CloseOutput
(
drain
);
CloseSoftwareMixer
();
CloseSoftwareMixer
();
F
ormatDebug
(
output_domain
,
"closed %s
"
,
GetLogName
());
F
mtDebug
(
output_domain
,
"closed {}
"
,
GetLogName
());
}
}
std
::
chrono
::
steady_clock
::
duration
std
::
chrono
::
steady_clock
::
duration
...
...
src/output/Init.cxx
View file @
6f539cfc
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "Domain.hxx"
#include "Domain.hxx"
#include "OutputAPI.hxx"
#include "OutputAPI.hxx"
#include "Defaults.hxx"
#include "Defaults.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "pcm/AudioParser.hxx"
#include "pcm/AudioParser.hxx"
#include "mixer/MixerList.hxx"
#include "mixer/MixerList.hxx"
#include "mixer/MixerType.hxx"
#include "mixer/MixerType.hxx"
...
@@ -68,8 +69,8 @@ audio_output_detect()
...
@@ -68,8 +69,8 @@ audio_output_detect()
if
(
plugin
->
test_default_device
==
nullptr
)
if
(
plugin
->
test_default_device
==
nullptr
)
continue
;
continue
;
F
orma
tInfo
(
output_domain
,
F
m
tInfo
(
output_domain
,
"Attempting to detect a %s
audio device"
,
"Attempting to detect a {}
audio device"
,
plugin
->
name
);
plugin
->
name
);
if
(
ao_plugin_test_default_device
(
plugin
))
if
(
ao_plugin_test_default_device
(
plugin
))
return
plugin
;
return
plugin
;
...
@@ -188,9 +189,9 @@ FilteredAudioOutput::Configure(const ConfigBlock &block,
...
@@ -188,9 +189,9 @@ FilteredAudioOutput::Configure(const ConfigBlock &block,
/* It's not really fatal - Part of the filter chain
/* It's not really fatal - Part of the filter chain
has been set up already and even an empty one will
has been set up already and even an empty one will
work (if only with unexpected behaviour) */
work (if only with unexpected behaviour) */
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
output_domain
,
"Failed to initialize filter chain for '%s'
"
,
"Failed to initialize filter chain for '{}': {}
"
,
name
);
name
,
std
::
current_exception
()
);
}
}
}
}
...
@@ -238,9 +239,9 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
...
@@ -238,9 +239,9 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
*
prepared_filter
,
*
prepared_filter
,
mixer_listener
);
mixer_listener
);
}
catch
(...)
{
}
catch
(...)
{
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
output_domain
,
"Failed to initialize hardware mixer for '%s'
"
,
"Failed to initialize hardware mixer for '{}': {}
"
,
name
);
name
,
std
::
current_exception
()
);
}
}
/* use the hardware mixer for replay gain? */
/* use the hardware mixer for replay gain? */
...
@@ -250,8 +251,8 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
...
@@ -250,8 +251,8 @@ FilteredAudioOutput::Setup(EventLoop &event_loop,
replay_gain_filter_set_mixer
(
*
prepared_replay_gain_filter
,
replay_gain_filter_set_mixer
(
*
prepared_replay_gain_filter
,
mixer
,
100
);
mixer
,
100
);
else
else
F
orma
tError
(
output_domain
,
F
m
tError
(
output_domain
,
"No such mixer for output '%s
'"
,
name
);
"No such mixer for output '{}
'"
,
name
);
}
else
if
(
!
StringIsEqual
(
replay_gain_handler
,
"software"
)
&&
}
else
if
(
!
StringIsEqual
(
replay_gain_handler
,
"software"
)
&&
prepared_replay_gain_filter
!=
nullptr
)
{
prepared_replay_gain_filter
!=
nullptr
)
{
throw
std
::
runtime_error
(
"Invalid
\"
replay_gain_handler
\"
value"
);
throw
std
::
runtime_error
(
"Invalid
\"
replay_gain_handler
\"
value"
);
...
@@ -289,8 +290,8 @@ audio_output_new(EventLoop &normal_event_loop, EventLoop &rt_event_loop,
...
@@ -289,8 +290,8 @@ audio_output_new(EventLoop &normal_event_loop, EventLoop &rt_event_loop,
plugin
=
audio_output_detect
();
plugin
=
audio_output_detect
();
F
orma
tNotice
(
output_domain
,
F
m
tNotice
(
output_domain
,
"Successfully detected a %s
audio device"
,
"Successfully detected a {}
audio device"
,
plugin
->
name
);
plugin
->
name
);
}
}
...
...
src/output/Thread.cxx
View file @
6f539cfc
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include "Filtered.hxx"
#include "Filtered.hxx"
#include "Client.hxx"
#include "Client.hxx"
#include "Domain.hxx"
#include "Domain.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "thread/Util.hxx"
#include "thread/Util.hxx"
#include "thread/Slack.hxx"
#include "thread/Slack.hxx"
#include "thread/Name.hxx"
#include "thread/Name.hxx"
...
@@ -166,10 +168,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
...
@@ -166,10 +168,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
}
}
if
(
f
!=
in_audio_format
||
f
!=
output
->
out_audio_format
)
if
(
f
!=
in_audio_format
||
f
!=
output
->
out_audio_format
)
FormatDebug
(
output_domain
,
"converting in=%s -> f=%s -> out=%s"
,
FmtDebug
(
output_domain
,
"converting in={} -> f={} -> out={}"
,
ToString
(
in_audio_format
).
c_str
(),
in_audio_format
,
f
,
output
->
out_audio_format
);
ToString
(
f
).
c_str
(),
ToString
(
output
->
out_audio_format
).
c_str
());
}
}
inline
void
inline
void
...
@@ -231,8 +231,9 @@ AudioOutputControl::FillSourceOrClose() noexcept
...
@@ -231,8 +231,9 @@ AudioOutputControl::FillSourceOrClose() noexcept
try
{
try
{
return
source
.
Fill
(
mutex
);
return
source
.
Fill
(
mutex
);
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
FmtError
(
output_domain
,
"Failed to filter for %s"
,
GetLogName
());
"Failed to filter for {}: {}"
,
GetLogName
(),
std
::
current_exception
());
InternalCloseError
(
std
::
current_exception
());
InternalCloseError
(
std
::
current_exception
());
return
false
;
return
false
;
}
}
...
@@ -250,9 +251,9 @@ AudioOutputControl::PlayChunk(std::unique_lock<Mutex> &lock) noexcept
...
@@ -250,9 +251,9 @@ AudioOutputControl::PlayChunk(std::unique_lock<Mutex> &lock) noexcept
caught_interrupted
=
true
;
caught_interrupted
=
true
;
return
false
;
return
false
;
}
catch
(...)
{
}
catch
(...)
{
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
output_domain
,
"Failed to send tag to %s
"
,
"Failed to send tag to {}: {}
"
,
GetLogName
());
GetLogName
(),
std
::
current_exception
());
}
}
}
}
...
@@ -277,8 +278,9 @@ AudioOutputControl::PlayChunk(std::unique_lock<Mutex> &lock) noexcept
...
@@ -277,8 +278,9 @@ AudioOutputControl::PlayChunk(std::unique_lock<Mutex> &lock) noexcept
caught_interrupted
=
true
;
caught_interrupted
=
true
;
return
false
;
return
false
;
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
FmtError
(
output_domain
,
"Failed to play on %s"
,
GetLogName
());
"Failed to play on {}"
,
GetLogName
(),
std
::
current_exception
());
InternalCloseError
(
std
::
current_exception
());
InternalCloseError
(
std
::
current_exception
());
return
false
;
return
false
;
}
}
...
@@ -356,9 +358,9 @@ AudioOutputControl::InternalPause(std::unique_lock<Mutex> &lock) noexcept
...
@@ -356,9 +358,9 @@ AudioOutputControl::InternalPause(std::unique_lock<Mutex> &lock) noexcept
success
=
output
->
IteratePause
();
success
=
output
->
IteratePause
();
}
catch
(
AudioOutputInterrupted
)
{
}
catch
(
AudioOutputInterrupted
)
{
}
catch
(...)
{
}
catch
(...)
{
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
output_domain
,
"Failed to pause %s
"
,
"Failed to pause {}: {}
"
,
GetLogName
());
GetLogName
(),
std
::
current_exception
());
}
}
if
(
!
success
)
{
if
(
!
success
)
{
...
@@ -416,8 +418,9 @@ AudioOutputControl::InternalDrain() noexcept
...
@@ -416,8 +418,9 @@ AudioOutputControl::InternalDrain() noexcept
output
->
Drain
();
output
->
Drain
();
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
FmtError
(
output_domain
,
"Failed to flush filter on %s"
,
GetLogName
());
"Failed to flush filter on {}: {}"
,
GetLogName
(),
std
::
current_exception
());
InternalCloseError
(
std
::
current_exception
());
InternalCloseError
(
std
::
current_exception
());
return
;
return
;
}
}
...
...
src/output/plugins/AlsaOutputPlugin.cxx
View file @
6f539cfc
...
@@ -498,8 +498,8 @@ alsa_test_default_device()
...
@@ -498,8 +498,8 @@ alsa_test_default_device()
int
ret
=
snd_pcm_open
(
&
handle
,
default_device
,
int
ret
=
snd_pcm_open
(
&
handle
,
default_device
,
SND_PCM_STREAM_PLAYBACK
,
SND_PCM_NONBLOCK
);
SND_PCM_STREAM_PLAYBACK
,
SND_PCM_NONBLOCK
);
if
(
ret
)
{
if
(
ret
)
{
F
orma
tError
(
alsa_output_domain
,
F
m
tError
(
alsa_output_domain
,
"Error opening default ALSA device: %s
"
,
"Error opening default ALSA device: {}
"
,
snd_strerror
(
-
ret
));
snd_strerror
(
-
ret
));
return
false
;
return
false
;
}
else
}
else
...
@@ -548,13 +548,13 @@ AlsaOutput::Setup(AudioFormat &audio_format,
...
@@ -548,13 +548,13 @@ AlsaOutput::Setup(AudioFormat &audio_format,
buffer_time
,
period_time
,
buffer_time
,
period_time
,
audio_format
,
params
);
audio_format
,
params
);
F
ormatDebug
(
alsa_output_domain
,
"format=%s (%s
)"
,
F
mtDebug
(
alsa_output_domain
,
"format={} ({}
)"
,
snd_pcm_format_name
(
hw_result
.
format
),
snd_pcm_format_name
(
hw_result
.
format
),
snd_pcm_format_description
(
hw_result
.
format
));
snd_pcm_format_description
(
hw_result
.
format
));
F
ormatDebug
(
alsa_output_domain
,
"buffer_size=%u period_size=%u
"
,
F
mtDebug
(
alsa_output_domain
,
"buffer_size={} period_size={}
"
,
(
unsigned
)
hw_result
.
buffer_size
,
hw_result
.
buffer_size
,
(
unsigned
)
hw_result
.
period_size
);
hw_result
.
period_size
);
AlsaSetupSw
(
pcm
,
hw_result
.
buffer_size
-
hw_result
.
period_size
,
AlsaSetupSw
(
pcm
,
hw_result
.
buffer_size
-
hw_result
.
period_size
,
hw_result
.
period_size
);
hw_result
.
period_size
);
...
@@ -708,7 +708,7 @@ AlsaOutput::Open(AudioFormat &audio_format)
...
@@ -708,7 +708,7 @@ AlsaOutput::Open(AudioFormat &audio_format)
throw
FormatRuntimeError
(
"Failed to open ALSA device
\"
%s
\"
: %s"
,
throw
FormatRuntimeError
(
"Failed to open ALSA device
\"
%s
\"
: %s"
,
GetDevice
(),
snd_strerror
(
err
));
GetDevice
(),
snd_strerror
(
err
));
F
ormatDebug
(
alsa_output_domain
,
"opened %s type=%s
"
,
F
mtDebug
(
alsa_output_domain
,
"opened {} type={}
"
,
snd_pcm_name
(
pcm
),
snd_pcm_name
(
pcm
),
snd_pcm_type_name
(
snd_pcm_type
(
pcm
)));
snd_pcm_type_name
(
snd_pcm_type
(
pcm
)));
...
@@ -734,7 +734,7 @@ AlsaOutput::Open(AudioFormat &audio_format)
...
@@ -734,7 +734,7 @@ AlsaOutput::Open(AudioFormat &audio_format)
#ifdef ENABLE_DSD
#ifdef ENABLE_DSD
if
(
params
.
dsd_mode
==
PcmExport
::
DsdMode
::
DOP
)
if
(
params
.
dsd_mode
==
PcmExport
::
DsdMode
::
DOP
)
Format
Debug
(
alsa_output_domain
,
"DoP (DSD over PCM) enabled"
);
Log
Debug
(
alsa_output_domain
,
"DoP (DSD over PCM) enabled"
);
#endif
#endif
pcm_export
->
Open
(
audio_format
.
format
,
pcm_export
->
Open
(
audio_format
.
format
,
...
@@ -775,12 +775,12 @@ inline int
...
@@ -775,12 +775,12 @@ inline int
AlsaOutput
::
Recover
(
int
err
)
noexcept
AlsaOutput
::
Recover
(
int
err
)
noexcept
{
{
if
(
err
==
-
EPIPE
)
{
if
(
err
==
-
EPIPE
)
{
F
orma
tDebug
(
alsa_output_domain
,
F
m
tDebug
(
alsa_output_domain
,
"Underrun on ALSA device
\"
%s
\"
"
,
"Underrun on ALSA device
\"
{}
\"
"
,
GetDevice
());
GetDevice
());
}
else
if
(
err
==
-
ESTRPIPE
)
{
}
else
if
(
err
==
-
ESTRPIPE
)
{
F
orma
tDebug
(
alsa_output_domain
,
F
m
tDebug
(
alsa_output_domain
,
"ALSA device
\"
%s
\"
was suspended"
,
"ALSA device
\"
{}
\"
was suspended"
,
GetDevice
());
GetDevice
());
}
}
...
@@ -1158,7 +1158,7 @@ try {
...
@@ -1158,7 +1158,7 @@ try {
}
}
if
(
throttle_silence_log
.
CheckUpdate
(
std
::
chrono
::
seconds
(
5
)))
if
(
throttle_silence_log
.
CheckUpdate
(
std
::
chrono
::
seconds
(
5
)))
Format
Warning
(
alsa_output_domain
,
"Decoder is too slow; playing silence to avoid xrun"
);
Log
Warning
(
alsa_output_domain
,
"Decoder is too slow; playing silence to avoid xrun"
);
/* insert some silence if the buffer has not enough
/* insert some silence if the buffer has not enough
data yet, to avoid ALSA xrun */
data yet, to avoid ALSA xrun */
...
...
src/output/plugins/SndioOutputPlugin.cxx
View file @
6f539cfc
...
@@ -60,7 +60,7 @@ sndio_test_default_device()
...
@@ -60,7 +60,7 @@ sndio_test_default_device()
{
{
auto
*
hdl
=
sio_open
(
SIO_DEVANY
,
SIO_PLAY
,
0
);
auto
*
hdl
=
sio_open
(
SIO_DEVANY
,
SIO_PLAY
,
0
);
if
(
!
hdl
)
{
if
(
!
hdl
)
{
Format
Error
(
sndio_output_domain
,
Log
Error
(
sndio_output_domain
,
"Error opening default sndio device"
);
"Error opening default sndio device"
);
return
false
;
return
false
;
}
}
...
...
src/output/plugins/sles/SlesOutputPlugin.cxx
View file @
6f539cfc
...
@@ -391,11 +391,11 @@ SlesOutput::Cancel() noexcept
...
@@ -391,11 +391,11 @@ SlesOutput::Cancel() noexcept
SLresult
result
=
play
.
SetPlayState
(
SL_PLAYSTATE_PAUSED
);
SLresult
result
=
play
.
SetPlayState
(
SL_PLAYSTATE_PAUSED
);
if
(
result
!=
SL_RESULT_SUCCESS
)
if
(
result
!=
SL_RESULT_SUCCESS
)
Format
Error
(
sles_domain
,
"Play.SetPlayState(PAUSED) failed"
);
Log
Error
(
sles_domain
,
"Play.SetPlayState(PAUSED) failed"
);
result
=
queue
.
Clear
();
result
=
queue
.
Clear
();
if
(
result
!=
SL_RESULT_SUCCESS
)
if
(
result
!=
SL_RESULT_SUCCESS
)
Format
Warning
(
sles_domain
,
Log
Warning
(
sles_domain
,
"AndroidSimpleBufferQueue.Clear() failed"
);
"AndroidSimpleBufferQueue.Clear() failed"
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
src/output/plugins/wasapi/WasapiOutputPlugin.cxx
View file @
6f539cfc
...
@@ -422,7 +422,7 @@ inline void
...
@@ -422,7 +422,7 @@ inline void
WasapiOutputThread
::
Work
()
noexcept
WasapiOutputThread
::
Work
()
noexcept
try
{
try
{
SetThreadName
(
"Wasapi Output Worker"
);
SetThreadName
(
"Wasapi Output Worker"
);
Format
Debug
(
wasapi_output_domain
,
"Working thread started"
);
Log
Debug
(
wasapi_output_domain
,
"Working thread started"
);
COM
com
;
COM
com
;
AtScopeExit
(
this
)
{
AtScopeExit
(
this
)
{
...
@@ -448,7 +448,7 @@ try {
...
@@ -448,7 +448,7 @@ try {
Status
current_state
=
status
.
load
();
Status
current_state
=
status
.
load
();
switch
(
current_state
)
{
switch
(
current_state
)
{
case
Status
:
:
FINISH
:
case
Status
:
:
FINISH
:
Format
Debug
(
wasapi_output_domain
,
Log
Debug
(
wasapi_output_domain
,
"Working thread stopped"
);
"Working thread stopped"
);
return
;
return
;
...
@@ -589,8 +589,8 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
...
@@ -589,8 +589,8 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
if
(
device_format
.
Format
.
wBitsPerSample
==
24
)
{
if
(
device_format
.
Format
.
wBitsPerSample
==
24
)
{
params
.
pack24
=
true
;
params
.
pack24
=
true
;
}
}
F
ormatDebug
(
wasapi_output_domain
,
"Packing data: shift8=%d pack24=%d
"
,
F
mtDebug
(
wasapi_output_domain
,
"Packing data: shift8={} pack24={}
"
,
int
(
params
.
shift8
),
int
(
params
.
pack24
)
);
params
.
shift8
,
params
.
pack24
);
pcm_export
.
emplace
();
pcm_export
.
emplace
();
pcm_export
->
Open
(
audio_format
.
format
,
audio_format
.
channels
,
params
);
pcm_export
->
Open
(
audio_format
.
format
,
audio_format
.
channels
,
params
);
}
}
...
@@ -608,11 +608,11 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
...
@@ -608,11 +608,11 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
FAILED
(
result
))
{
FAILED
(
result
))
{
throw
MakeHResultError
(
result
,
"Unable to get device period"
);
throw
MakeHResultError
(
result
,
"Unable to get device period"
);
}
}
F
orma
tDebug
(
wasapi_output_domain
,
F
m
tDebug
(
wasapi_output_domain
,
"Default device period: %lu
ns, Minimum device period: "
"Default device period: {}
ns, Minimum device period: "
"%lu
ns"
,
"{}
ns"
,
(
unsigned
long
)
ns
(
hundred_ns
(
default_device_period
)).
count
(),
ns
(
hundred_ns
(
default_device_period
)).
count
(),
(
unsigned
long
)
ns
(
hundred_ns
(
min_device_period
)).
count
());
ns
(
hundred_ns
(
min_device_period
)).
count
());
REFERENCE_TIME
buffer_duration
;
REFERENCE_TIME
buffer_duration
;
if
(
Exclusive
())
{
if
(
Exclusive
())
{
...
@@ -621,8 +621,8 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
...
@@ -621,8 +621,8 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
const
REFERENCE_TIME
align
=
hundred_ns
(
ms
(
50
)).
count
();
const
REFERENCE_TIME
align
=
hundred_ns
(
ms
(
50
)).
count
();
buffer_duration
=
(
align
/
default_device_period
)
*
default_device_period
;
buffer_duration
=
(
align
/
default_device_period
)
*
default_device_period
;
}
}
F
ormatDebug
(
wasapi_output_domain
,
"Buffer duration: %lu
ns"
,
F
mtDebug
(
wasapi_output_domain
,
"Buffer duration: {}
ns"
,
(
unsigned
long
)
ns
(
hundred_ns
(
buffer_duration
)).
count
());
ns
(
hundred_ns
(
buffer_duration
)).
count
());
if
(
Exclusive
())
{
if
(
Exclusive
())
{
if
(
HRESULT
result
=
client
->
Initialize
(
if
(
HRESULT
result
=
client
->
Initialize
(
...
@@ -639,10 +639,9 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
...
@@ -639,10 +639,9 @@ WasapiOutput::DoOpen(AudioFormat &audio_format)
std
::
ceil
(
double
(
buffer_size_in_frames
*
std
::
ceil
(
double
(
buffer_size_in_frames
*
hundred_ns
(
s
(
1
)).
count
())
/
hundred_ns
(
s
(
1
)).
count
())
/
SampleRate
());
SampleRate
());
FormatDebug
(
FmtDebug
(
wasapi_output_domain
,
wasapi_output_domain
,
"Aligned buffer duration: {} ns"
,
"Aligned buffer duration: %lu ns"
,
ns
(
hundred_ns
(
buffer_duration
)).
count
());
(
unsigned
long
)
ns
(
hundred_ns
(
buffer_duration
)).
count
());
client
.
reset
();
client
.
reset
();
client
=
Activate
<
IAudioClient
>
(
*
device
);
client
=
Activate
<
IAudioClient
>
(
*
device
);
result
=
client
->
Initialize
(
result
=
client
->
Initialize
(
...
@@ -687,8 +686,7 @@ WasapiOutput::Close() noexcept
...
@@ -687,8 +686,7 @@ WasapiOutput::Close() noexcept
try
{
try
{
thread
->
CheckException
();
thread
->
CheckException
();
}
catch
(...)
{
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
LogError
(
wasapi_output_domain
,
"exception while stopping"
);
"exception while stopping"
);
}
}
thread
->
Finish
();
thread
->
Finish
();
com_worker
->
Async
([
&
]()
{
com_worker
->
Async
([
&
]()
{
...
@@ -1029,8 +1027,8 @@ WasapiOutput::EnumerateDevices(IMMDeviceEnumerator &enumerator)
...
@@ -1029,8 +1027,8 @@ WasapiOutput::EnumerateDevices(IMMDeviceEnumerator &enumerator)
if
(
name
==
nullptr
)
if
(
name
==
nullptr
)
continue
;
continue
;
F
orma
tNotice
(
wasapi_output_domain
,
F
m
tNotice
(
wasapi_output_domain
,
"Device
\"
%u
\"
\"
%s
\"
"
,
i
,
name
.
c_str
()
);
"Device
\"
{}
\"
\"
{}
\"
"
,
i
,
name
);
}
}
}
}
...
...
src/player/Thread.cxx
View file @
6f539cfc
...
@@ -558,9 +558,9 @@ Player::CheckDecoderStartup(std::unique_lock<Mutex> &lock) noexcept
...
@@ -558,9 +558,9 @@ Player::CheckDecoderStartup(std::unique_lock<Mutex> &lock) noexcept
}
}
if
(
!
paused
&&
!
OpenOutput
())
{
if
(
!
paused
&&
!
OpenOutput
())
{
F
orma
tError
(
player_domain
,
F
m
tError
(
player_domain
,
"problems opening audio device "
"problems opening audio device "
"while playing
\"
%s
\"
"
,
"while playing
\"
{}
\"
"
,
dc
.
song
->
GetURI
());
dc
.
song
->
GetURI
());
return
true
;
return
true
;
}
}
...
@@ -964,7 +964,7 @@ Player::SongBorder() noexcept
...
@@ -964,7 +964,7 @@ Player::SongBorder() noexcept
{
{
const
ScopeUnlock
unlock
(
pc
.
mutex
);
const
ScopeUnlock
unlock
(
pc
.
mutex
);
F
ormatNotice
(
player_domain
,
"played
\"
%s
\"
"
,
song
->
GetURI
());
F
mtNotice
(
player_domain
,
"played
\"
{}
\"
"
,
song
->
GetURI
());
ReplacePipe
(
dc
.
pipe
);
ReplacePipe
(
dc
.
pipe
);
...
@@ -1135,7 +1135,7 @@ Player::Run() noexcept
...
@@ -1135,7 +1135,7 @@ Player::Run() noexcept
cross_fade_tag
.
reset
();
cross_fade_tag
.
reset
();
if
(
song
!=
nullptr
)
{
if
(
song
!=
nullptr
)
{
F
ormatNotice
(
player_domain
,
"played
\"
%s
\"
"
,
song
->
GetURI
());
F
mtNotice
(
player_domain
,
"played
\"
{}
\"
"
,
song
->
GetURI
());
song
.
reset
();
song
.
reset
();
}
}
...
...
src/storage/StorageState.cxx
View file @
6f539cfc
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
*/
*/
#include "StorageState.hxx"
#include "StorageState.hxx"
#include "lib/fmt/ExceptionFormatter.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "storage/Registry.hxx"
#include "storage/Registry.hxx"
...
@@ -90,7 +91,9 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
...
@@ -90,7 +91,9 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
else
if
((
value
=
StringAfterPrefix
(
line
,
MOUNT_STATE_STORAGE_URI
)))
else
if
((
value
=
StringAfterPrefix
(
line
,
MOUNT_STATE_STORAGE_URI
)))
uri
=
value
;
uri
=
value
;
else
else
FormatError
(
storage_domain
,
"Unrecognized line in mountpoint state: %s"
,
line
);
FmtError
(
storage_domain
,
"Unrecognized line in mountpoint state: {}"
,
line
);
}
}
if
(
instance
.
storage
==
nullptr
)
if
(
instance
.
storage
==
nullptr
)
...
@@ -104,7 +107,7 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
...
@@ -104,7 +107,7 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
return
true
;
return
true
;
}
}
F
ormatDebug
(
storage_domain
,
"Restoring mount %s => %s"
,
uri
.
c_str
(),
url
.
c_str
()
);
F
mtDebug
(
storage_domain
,
"Restoring mount {} => {}"
,
uri
,
url
);
auto
&
composite_storage
=
*
(
CompositeStorage
*
)
instance
.
storage
;
auto
&
composite_storage
=
*
(
CompositeStorage
*
)
instance
.
storage
;
if
(
composite_storage
.
IsMountPoint
(
uri
.
c_str
()))
{
if
(
composite_storage
.
IsMountPoint
(
uri
.
c_str
()))
{
...
@@ -120,7 +123,7 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
...
@@ -120,7 +123,7 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
auto
&
event_loop
=
instance
.
io_thread
.
GetEventLoop
();
auto
&
event_loop
=
instance
.
io_thread
.
GetEventLoop
();
auto
storage
=
CreateStorageURI
(
event_loop
,
url
.
c_str
());
auto
storage
=
CreateStorageURI
(
event_loop
,
url
.
c_str
());
if
(
storage
==
nullptr
)
{
if
(
storage
==
nullptr
)
{
F
ormatError
(
storage_domain
,
"Unrecognized storage URI: %s"
,
url
.
c_str
()
);
F
mtError
(
storage_domain
,
"Unrecognized storage URI: {}"
,
url
);
return
true
;
return
true
;
}
}
...
@@ -128,9 +131,9 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
...
@@ -128,9 +131,9 @@ storage_state_restore(const char *line, TextFile &file, Instance &instance)
try
{
try
{
db
->
Mount
(
uri
.
c_str
(),
url
.
c_str
());
db
->
Mount
(
uri
.
c_str
(),
url
.
c_str
());
}
catch
(...)
{
}
catch
(...)
{
F
ormatError
(
std
::
current_exception
()
,
F
mtError
(
storage_domain
,
"Failed to restore mount to %s
"
,
"Failed to restore mount to {}: {}
"
,
url
.
c_str
());
url
,
std
::
current_exception
());
return
true
;
return
true
;
}
}
}
}
...
...
src/system/FatalError.cxx
View file @
6f539cfc
...
@@ -83,7 +83,7 @@ FatalSystemError(const char *msg)
...
@@ -83,7 +83,7 @@ FatalSystemError(const char *msg)
FatalSystemError
(
msg
,
GetLastError
());
FatalSystemError
(
msg
,
GetLastError
());
#else
#else
auto
system_error
=
std
::
strerror
(
errno
);
auto
system_error
=
std
::
strerror
(
errno
);
F
ormatError
(
fatal_error_domain
,
"%s: %s
"
,
msg
,
system_error
);
F
mtError
(
fatal_error_domain
,
"{}: {}
"
,
msg
,
system_error
);
Abort
();
Abort
();
#endif
#endif
}
}
...
...
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