Commit 9e0ce23a authored by Max Kellermann's avatar Max Kellermann

test/run_{filter,output}: use config_find_block()

parent 04ba433c
...@@ -50,26 +50,11 @@ mixer_set_volume(gcc_unused Mixer *mixer, ...@@ -50,26 +50,11 @@ mixer_set_volume(gcc_unused Mixer *mixer,
return true; return true;
} }
static const struct config_param *
find_named_config_block(ConfigOption option, const char *name)
{
const struct config_param *param = NULL;
while ((param = config_get_next_param(option, param)) != NULL) {
const char *current_name = param->GetBlockValue("name");
if (current_name != NULL && strcmp(current_name, name) == 0)
return param;
}
return NULL;
}
static Filter * static Filter *
load_filter(const char *name) load_filter(const char *name)
{ {
const struct config_param *param; const config_param *param =
config_find_block(CONF_AUDIO_FILTER, "name", name);
param = find_named_config_block(CONF_AUDIO_FILTER, name);
if (param == NULL) { if (param == NULL) {
fprintf(stderr, "No such configured filter: %s\n", name); fprintf(stderr, "No such configured filter: %s\n", name);
return nullptr; return nullptr;
......
...@@ -53,20 +53,6 @@ filter_plugin_by_name(gcc_unused const char *name) ...@@ -53,20 +53,6 @@ filter_plugin_by_name(gcc_unused const char *name)
return NULL; return NULL;
} }
static const struct config_param *
find_named_config_block(ConfigOption option, const char *name)
{
const struct config_param *param = NULL;
while ((param = config_get_next_param(option, param)) != NULL) {
const char *current_name = param->GetBlockValue("name");
if (current_name != NULL && strcmp(current_name, name) == 0)
return param;
}
return NULL;
}
PlayerControl::PlayerControl(gcc_unused MultipleOutputs &_outputs, PlayerControl::PlayerControl(gcc_unused MultipleOutputs &_outputs,
gcc_unused unsigned _buffer_chunks, gcc_unused unsigned _buffer_chunks,
gcc_unused unsigned _buffered_before_play) gcc_unused unsigned _buffered_before_play)
...@@ -76,9 +62,8 @@ PlayerControl::~PlayerControl() {} ...@@ -76,9 +62,8 @@ PlayerControl::~PlayerControl() {}
static AudioOutput * static AudioOutput *
load_audio_output(EventLoop &event_loop, const char *name) load_audio_output(EventLoop &event_loop, const char *name)
{ {
const struct config_param *param; const config_param *param =
config_find_block(CONF_AUDIO_OUTPUT, "name", name);
param = find_named_config_block(CONF_AUDIO_OUTPUT, name);
if (param == NULL) { if (param == NULL) {
fprintf(stderr, "No such configured audio output: %s\n", name); fprintf(stderr, "No such configured audio output: %s\n", name);
return nullptr; return nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment