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
7a1d466f
Commit
7a1d466f
authored
Aug 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderPlugin: pass config_param reference
parent
83f4c48c
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
34 additions
and
35 deletions
+34
-35
DecoderList.cxx
src/DecoderList.cxx
+7
-4
DecoderPlugin.hxx
src/DecoderPlugin.hxx
+2
-2
AdPlugDecoderPlugin.cxx
src/decoder/AdPlugDecoderPlugin.cxx
+2
-2
DsdiffDecoderPlugin.cxx
src/decoder/DsdiffDecoderPlugin.cxx
+2
-2
FfmpegDecoderPlugin.cxx
src/decoder/FfmpegDecoderPlugin.cxx
+1
-1
FlacDecoderPlugin.cxx
src/decoder/FlacDecoderPlugin.cxx
+1
-1
FluidsynthDecoderPlugin.cxx
src/decoder/FluidsynthDecoderPlugin.cxx
+4
-5
MadDecoderPlugin.cxx
src/decoder/MadDecoderPlugin.cxx
+1
-1
MikmodDecoderPlugin.cxx
src/decoder/MikmodDecoderPlugin.cxx
+3
-4
Mpg123DecoderPlugin.cxx
src/decoder/Mpg123DecoderPlugin.cxx
+1
-1
OpusDecoderPlugin.cxx
src/decoder/OpusDecoderPlugin.cxx
+1
-1
WildmidiDecoderPlugin.cxx
src/decoder/WildmidiDecoderPlugin.cxx
+3
-3
sidplay_decoder_plugin.cxx
src/decoder/sidplay_decoder_plugin.cxx
+6
-8
No files found.
src/DecoderList.cxx
View file @
7a1d466f
...
...
@@ -201,8 +201,7 @@ decoder_plugin_config(const char *plugin_name)
const
struct
config_param
*
param
=
NULL
;
while
((
param
=
config_get_next_param
(
CONF_DECODER
,
param
))
!=
NULL
)
{
const
char
*
name
=
config_get_block_string
(
param
,
"plugin"
,
NULL
);
const
char
*
name
=
param
->
GetBlockValue
(
"plugin"
);
if
(
name
==
NULL
)
MPD_ERROR
(
"decoder configuration without 'plugin' name in line %d"
,
param
->
line
);
...
...
@@ -216,16 +215,20 @@ decoder_plugin_config(const char *plugin_name)
void
decoder_plugin_init_all
(
void
)
{
struct
config_param
empty
;
for
(
unsigned
i
=
0
;
decoder_plugins
[
i
]
!=
NULL
;
++
i
)
{
const
struct
decoder_plugin
*
plugin
=
decoder_plugins
[
i
];
const
struct
config_param
*
param
=
decoder_plugin_config
(
plugin
->
name
);
if
(
!
config_get_block_bool
(
param
,
"enabled"
,
true
))
if
(
param
==
nullptr
)
param
=
&
empty
;
else
if
(
!
param
->
GetBlockValue
(
"enabled"
,
true
))
/* the plugin is disabled in mpd.conf */
continue
;
if
(
decoder_plugin_init
(
plugin
,
param
))
if
(
decoder_plugin_init
(
plugin
,
*
param
))
decoder_plugins_enabled
[
i
]
=
true
;
}
}
...
...
src/DecoderPlugin.hxx
View file @
7a1d466f
...
...
@@ -42,7 +42,7 @@ struct decoder_plugin {
* @return true if the plugin was initialized successfully,
* false if the plugin is not available
*/
bool
(
*
init
)(
const
struct
config_param
*
param
);
bool
(
*
init
)(
const
config_param
&
param
);
/**
* Deinitialize a decoder plugin which was initialized
...
...
@@ -112,7 +112,7 @@ struct decoder_plugin {
*/
static
inline
bool
decoder_plugin_init
(
const
struct
decoder_plugin
*
plugin
,
const
struct
config_param
*
param
)
const
config_param
&
param
)
{
return
plugin
->
init
!=
nullptr
?
plugin
->
init
(
param
)
...
...
src/decoder/AdPlugDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -36,11 +36,11 @@
static
unsigned
sample_rate
;
static
bool
adplug_init
(
const
struct
config_param
*
param
)
adplug_init
(
const
config_param
&
param
)
{
GError
*
error
=
NULL
;
sample_rate
=
config_get_block_unsigned
(
param
,
"sample_rate"
,
48000
);
sample_rate
=
param
.
GetBlockValue
(
"sample_rate"
,
48000u
);
if
(
!
audio_check_sample_rate
(
sample_rate
,
&
error
))
{
g_warning
(
"%s
\n
"
,
error
->
message
);
g_error_free
(
error
);
...
...
src/decoder/DsdiffDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -84,9 +84,9 @@ struct DsdiffMetaData {
static
bool
lsbitfirst
;
static
bool
dsdiff_init
(
const
struct
config_param
*
param
)
dsdiff_init
(
const
config_param
&
param
)
{
lsbitfirst
=
config_get_block_bool
(
param
,
"lsbitfirst"
,
false
);
lsbitfirst
=
param
.
GetBlockValue
(
"lsbitfirst"
,
false
);
return
true
;
}
...
...
src/decoder/FfmpegDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -166,7 +166,7 @@ mpd_ffmpeg_stream_close(struct mpd_ffmpeg_stream *stream)
}
static
bool
ffmpeg_init
(
G_GNUC_UNUSED
const
struct
config_param
*
param
)
ffmpeg_init
(
gcc_unused
const
config_param
&
param
)
{
av_log_set_callback
(
mpd_ffmpeg_log_callback
);
...
...
src/decoder/FlacDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -287,7 +287,7 @@ flac_decode(struct decoder * decoder, struct input_stream *input_stream)
}
static
bool
oggflac_init
(
G_GNUC_UNUSED
const
struct
config_param
*
param
)
oggflac_init
(
gcc_unused
const
config_param
&
param
)
{
return
!!
FLAC_API_SUPPORTS_OGG_FLAC
;
}
...
...
src/decoder/FluidsynthDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -71,20 +71,19 @@ fluidsynth_mpd_log_function(int level, char *message, G_GNUC_UNUSED void *data)
}
static
bool
fluidsynth_init
(
const
struct
config_param
*
param
)
fluidsynth_init
(
const
config_param
&
param
)
{
GError
*
error
=
nullptr
;
sample_rate
=
config_get_block_unsigned
(
param
,
"sample_rate"
,
48000
);
sample_rate
=
param
.
GetBlockValue
(
"sample_rate"
,
48000u
);
if
(
!
audio_check_sample_rate
(
sample_rate
,
&
error
))
{
g_warning
(
"%s
\n
"
,
error
->
message
);
g_error_free
(
error
);
return
false
;
}
soundfont_path
=
config_get_block_string
(
param
,
"soundfont"
,
"/usr/share/sounds/sf2/FluidR3_GM.sf2"
);
soundfont_path
=
param
.
GetBlockValue
(
"soundfont"
,
"/usr/share/sounds/sf2/FluidR3_GM.sf2"
);
fluid_set_log_function
(
LAST_LOG_LEVEL
,
fluidsynth_mpd_log_function
,
nullptr
);
...
...
src/decoder/MadDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -101,7 +101,7 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
}
static
bool
mp3_plugin_init
(
G_GNUC_UNUSED
const
struct
config_param
*
param
)
mp3_plugin_init
(
gcc_unused
const
config_param
&
param
)
{
gapless_playback
=
config_get_bool
(
CONF_GAPLESS_MP3_PLAYBACK
,
DEFAULT_GAPLESS_MP3_PLAYBACK
);
...
...
src/decoder/MikmodDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -106,15 +106,14 @@ static MDRIVER drv_mpd = {
static
unsigned
mikmod_sample_rate
;
static
bool
mikmod_decoder_init
(
const
struct
config_param
*
param
)
mikmod_decoder_init
(
const
config_param
&
param
)
{
static
char
params
[]
=
""
;
mikmod_sample_rate
=
config_get_block_unsigned
(
param
,
"sample_rate"
,
44100
);
mikmod_sample_rate
=
param
.
GetBlockValue
(
"sample_rate"
,
44100u
);
if
(
!
audio_valid_sample_rate
(
mikmod_sample_rate
))
MPD_ERROR
(
"Invalid sample rate in line %d: %u"
,
param
->
line
,
mikmod_sample_rate
);
param
.
line
,
mikmod_sample_rate
);
md_device
=
0
;
md_reverb
=
0
;
...
...
src/decoder/Mpg123DecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -32,7 +32,7 @@
#define G_LOG_DOMAIN "mpg123"
static
bool
mpd_mpg123_init
(
G_GNUC_UNUSED
const
struct
config_param
*
param
)
mpd_mpg123_init
(
gcc_unused
const
config_param
&
param
)
{
mpg123_init
();
...
...
src/decoder/OpusDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -58,7 +58,7 @@ IsOpusTags(const ogg_packet &packet)
}
static
bool
mpd_opus_init
(
G_GNUC_UNUSED
const
struct
config_param
*
param
)
mpd_opus_init
(
gcc_unused
const
config_param
&
param
)
{
g_debug
(
"%s"
,
opus_get_version_string
());
...
...
src/decoder/WildmidiDecoderPlugin.cxx
View file @
7a1d466f
...
...
@@ -35,13 +35,13 @@ extern "C" {
static
constexpr
unsigned
WILDMIDI_SAMPLE_RATE
=
48000
;
static
bool
wildmidi_init
(
const
struct
config_param
*
param
)
wildmidi_init
(
const
config_param
&
param
)
{
const
char
*
config_file
;
int
ret
;
config_file
=
config_get_block_string
(
param
,
"config_file"
,
"/etc/timidity/timidity.cfg"
);
config_file
=
param
.
GetBlockValue
(
"config_file"
,
"/etc/timidity/timidity.cfg"
);
if
(
!
g_file_test
(
config_file
,
G_FILE_TEST_IS_REGULAR
))
{
g_debug
(
"configuration file does not exist: %s"
,
config_file
);
return
false
;
...
...
src/decoder/sidplay_decoder_plugin.cxx
View file @
7a1d466f
...
...
@@ -83,24 +83,22 @@ sidplay_load_songlength_db(const char *path)
}
static
bool
sidplay_init
(
const
struct
config_param
*
param
)
sidplay_init
(
const
config_param
&
param
)
{
/* read the songlengths database file */
songlength_file
=
config_get_block_string
(
param
,
"songlength_database"
,
NULL
);
songlength_file
=
param
.
GetBlockValue
(
"songlength_database"
);
if
(
songlength_file
!=
NULL
)
songlength_database
=
sidplay_load_songlength_db
(
songlength_file
);
default_songlength
=
config_get_block_unsigned
(
param
,
"default_songlength"
,
0
);
default_songlength
=
param
.
GetBlockValue
(
"default_songlength"
,
0u
);
all_files_are_containers
=
config_get_block_bool
(
param
,
"all_files_are_containers"
,
true
);
all_files_are_containers
=
param
.
GetBlockValue
(
"all_files_are_containers"
,
true
);
path_with_subtune
=
g_pattern_spec_new
(
"*/"
SUBTUNE_PREFIX
"???.sid"
);
filter_setting
=
config_get_block_bool
(
param
,
"filter"
,
true
);
filter_setting
=
param
.
GetBlockValue
(
"filter"
,
true
);
return
true
;
}
...
...
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