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
7a23c123
Commit
7a23c123
authored
Feb 05, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/List: add RAII class
parent
e85b24be
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
23 deletions
+21
-23
Main.cxx
src/Main.cxx
+1
-2
DecoderList.hxx
src/decoder/DecoderList.hxx
+11
-0
ContainerScan.cxx
test/ContainerScan.cxx
+1
-3
RunChromaprint.cxx
test/RunChromaprint.cxx
+3
-7
dump_playlist.cxx
test/dump_playlist.cxx
+1
-2
read_tags.cxx
test/read_tags.cxx
+1
-2
run_decoder.cxx
test/run_decoder.cxx
+3
-7
No files found.
src/Main.cxx
View file @
7a23c123
...
...
@@ -534,7 +534,7 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
pcm_convert_global_init
(
raw_config
);
decoder_plugin_init_all
(
raw_config
);
const
ScopeDecoderPluginsInit
decoder_plugins_init
(
raw_config
);
#ifdef ENABLE_DATABASE
const
bool
create_db
=
InitDatabaseAndStorage
(
raw_config
);
...
...
@@ -669,7 +669,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
instance
->
FinishShutdownPartitions
();
command_finish
();
decoder_plugin_deinit_all
();
return
EXIT_SUCCESS
;
}
...
...
src/decoder/DecoderList.hxx
View file @
7a23c123
...
...
@@ -42,6 +42,17 @@ decoder_plugin_init_all(const ConfigData &config);
void
decoder_plugin_deinit_all
()
noexcept
;
class
ScopeDecoderPluginsInit
{
public
:
explicit
ScopeDecoderPluginsInit
(
const
ConfigData
&
config
)
{
decoder_plugin_init_all
(
config
);
}
~
ScopeDecoderPluginsInit
()
noexcept
{
decoder_plugin_deinit_all
();
}
};
template
<
typename
F
>
static
inline
const
DecoderPlugin
*
decoder_plugins_find
(
F
f
)
noexcept
...
...
test/ContainerScan.cxx
View file @
7a23c123
...
...
@@ -65,7 +65,7 @@ try {
const
Path
path
=
Path
::
FromFS
(
argv
[
1
]);
decoder_plugin_init_all
(
ConfigData
()
);
const
ScopeDecoderPluginsInit
decoder_plugins_init
({}
);
const
auto
*
plugin
=
FindContainerDecoderPlugin
(
path
);
if
(
plugin
==
nullptr
)
{
...
...
@@ -87,8 +87,6 @@ try {
bos
.
Flush
();
decoder_plugin_deinit_all
();
return
EXIT_SUCCESS
;
}
catch
(...)
{
PrintException
(
std
::
current_exception
());
...
...
test/RunChromaprint.cxx
View file @
7a23c123
...
...
@@ -91,22 +91,18 @@ class GlobalInit {
const
ConfigData
config
;
EventThread
io_thread
;
const
ScopeInputPluginsInit
input_plugins_init
;
const
ScopeDecoderPluginsInit
decoder_plugins_init
;
public
:
explicit
GlobalInit
(
Path
config_path
)
:
config
(
AutoLoadConfigFile
(
config_path
)),
input_plugins_init
(
config
,
io_thread
.
GetEventLoop
())
input_plugins_init
(
config
,
io_thread
.
GetEventLoop
()),
decoder_plugins_init
(
config
)
{
io_thread
.
Start
();
decoder_plugin_init_all
(
config
);
pcm_convert_global_init
(
config
);
}
~
GlobalInit
()
{
decoder_plugin_deinit_all
();
}
};
class
ChromaprintDecoderClient
final
:
public
DecoderClient
{
...
...
test/dump_playlist.cxx
View file @
7a23c123
...
...
@@ -66,7 +66,7 @@ try {
const
ScopeInputPluginsInit
input_plugins_init
(
config
,
io_thread
.
GetEventLoop
());
playlist_list_global_init
(
config
);
decoder_plugin_init_all
(
config
);
const
ScopeDecoderPluginsInit
decoder_plugins_init
(
config
);
/* open the playlist */
...
...
@@ -116,7 +116,6 @@ try {
playlist
.
reset
();
is
.
reset
();
decoder_plugin_deinit_all
();
playlist_list_global_finish
();
return
EXIT_SUCCESS
;
...
...
test/read_tags.cxx
View file @
7a23c123
...
...
@@ -96,8 +96,7 @@ try {
const
ScopeInputPluginsInit
input_plugins_init
(
ConfigData
(),
io_thread
.
GetEventLoop
());
decoder_plugin_init_all
(
ConfigData
());
AtScopeExit
()
{
decoder_plugin_deinit_all
();
};
const
ScopeDecoderPluginsInit
decoder_plugins_init
({});
plugin
=
decoder_plugin_from_name
(
decoder_name
);
if
(
plugin
==
NULL
)
{
...
...
test/run_decoder.cxx
View file @
7a23c123
...
...
@@ -89,19 +89,15 @@ class GlobalInit {
const
ConfigData
config
;
EventThread
io_thread
;
const
ScopeInputPluginsInit
input_plugins_init
;
const
ScopeDecoderPluginsInit
decoder_plugins_init
;
public
:
explicit
GlobalInit
(
Path
config_path
)
:
config
(
AutoLoadConfigFile
(
config_path
)),
input_plugins_init
(
config
,
io_thread
.
GetEventLoop
())
input_plugins_init
(
config
,
io_thread
.
GetEventLoop
()),
decoder_plugins_init
(
config
)
{
io_thread
.
Start
();
decoder_plugin_init_all
(
config
);
}
~
GlobalInit
()
{
decoder_plugin_deinit_all
();
}
};
...
...
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