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
f54bcc1f
Commit
f54bcc1f
authored
Aug 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FilterPlugin: pass config_param reference
parent
ca0d09c5
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
36 additions
and
35 deletions
+36
-35
FilterConfig.cxx
src/FilterConfig.cxx
+4
-5
FilterPlugin.cxx
src/FilterPlugin.cxx
+3
-5
FilterPlugin.hxx
src/FilterPlugin.hxx
+3
-3
OutputInit.cxx
src/OutputInit.cxx
+6
-4
AutoConvertFilterPlugin.cxx
src/filter/AutoConvertFilterPlugin.cxx
+3
-1
ChainFilterPlugin.cxx
src/filter/ChainFilterPlugin.cxx
+1
-1
ConvertFilterPlugin.cxx
src/filter/ConvertFilterPlugin.cxx
+1
-1
NormalizeFilterPlugin.cxx
src/filter/NormalizeFilterPlugin.cxx
+1
-1
NullFilterPlugin.cxx
src/filter/NullFilterPlugin.cxx
+1
-1
ReplayGainFilterPlugin.cxx
src/filter/ReplayGainFilterPlugin.cxx
+1
-1
RouteFilterPlugin.cxx
src/filter/RouteFilterPlugin.cxx
+6
-7
VolumeFilterPlugin.cxx
src/filter/VolumeFilterPlugin.cxx
+1
-1
SoftwareMixerPlugin.cxx
src/mixer/SoftwareMixerPlugin.cxx
+3
-1
run_filter.cxx
test/run_filter.cxx
+2
-3
No files found.
src/FilterConfig.cxx
View file @
f54bcc1f
...
...
@@ -48,8 +48,7 @@ filter_plugin_config(const char *filter_template_name, GError **error_r)
const
struct
config_param
*
param
=
NULL
;
while
((
param
=
config_get_next_param
(
CONF_AUDIO_FILTER
,
param
))
!=
NULL
)
{
const
char
*
name
=
config_get_block_string
(
param
,
"name"
,
NULL
);
const
char
*
name
=
param
->
GetBlockValue
(
"name"
);
if
(
name
==
NULL
)
{
g_set_error
(
error_r
,
filter_quark
(),
1
,
"filter configuration without 'name' name in line %d"
,
...
...
@@ -100,14 +99,14 @@ filter_chain_parse(Filter &chain, const char *spec, GError **error_r)
}
// Instantiate one of those filter plugins with the template name as a hint
Filter
*
f
=
filter_configured_new
(
cfg
,
error_r
);
Filter
*
f
=
filter_configured_new
(
*
cfg
,
error_r
);
if
(
f
==
NULL
)
{
// The error has already been set, just stop.
break
;
}
const
char
*
plugin_name
=
config_get_block_string
(
cfg
,
"plugin"
,
"unknown"
);
const
char
*
plugin_name
=
cfg
->
GetBlockValue
(
"plugin"
,
"unknown"
);
filter_chain_append
(
chain
,
plugin_name
,
f
);
++
added_filters
;
...
...
src/FilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -28,7 +28,7 @@
Filter
*
filter_new
(
const
struct
filter_plugin
*
plugin
,
const
struct
config_param
*
param
,
GError
**
error_r
)
const
config_param
&
param
,
GError
**
error_r
)
{
assert
(
plugin
!=
NULL
);
assert
(
error_r
==
NULL
||
*
error_r
==
NULL
);
...
...
@@ -37,15 +37,13 @@ filter_new(const struct filter_plugin *plugin,
}
Filter
*
filter_configured_new
(
const
struct
config_param
*
param
,
GError
**
error_r
)
filter_configured_new
(
const
config_param
&
param
,
GError
**
error_r
)
{
const
char
*
plugin_name
;
const
struct
filter_plugin
*
plugin
;
assert
(
param
!=
NULL
);
assert
(
error_r
==
NULL
||
*
error_r
==
NULL
);
plugin_name
=
config_get_block_string
(
param
,
"plugin"
,
NULL
);
const
char
*
plugin_name
=
param
.
GetBlockValue
(
"plugin"
);
if
(
plugin_name
==
NULL
)
{
g_set_error
(
error_r
,
config_quark
(),
0
,
"No filter plugin specified"
);
...
...
src/FilterPlugin.hxx
View file @
f54bcc1f
...
...
@@ -39,7 +39,7 @@ struct filter_plugin {
/**
* Allocates and configures a filter.
*/
Filter
*
(
*
init
)(
const
struct
config_param
*
param
,
GError
**
error_r
);
Filter
*
(
*
init
)(
const
config_param
&
param
,
GError
**
error_r
);
};
/**
...
...
@@ -53,7 +53,7 @@ struct filter_plugin {
*/
Filter
*
filter_new
(
const
struct
filter_plugin
*
plugin
,
const
struct
config_param
*
param
,
GError
**
error_r
);
const
config_param
&
param
,
GError
**
error_r
);
/**
* Creates a new filter, loads configuration and the plugin name from
...
...
@@ -65,6 +65,6 @@ filter_new(const struct filter_plugin *plugin,
* @return a new filter object, or NULL on error
*/
Filter
*
filter_configured_new
(
const
struct
config_param
*
param
,
GError
**
error_r
);
filter_configured_new
(
const
config_param
&
param
,
GError
**
error_r
);
#endif
src/OutputInit.cxx
View file @
f54bcc1f
...
...
@@ -183,7 +183,8 @@ ao_base_init(struct audio_output *ao,
if
(
config_get_bool
(
CONF_VOLUME_NORMALIZATION
,
false
))
{
Filter
*
normalize_filter
=
filter_new
(
&
normalize_filter_plugin
,
NULL
,
NULL
);
filter_new
(
&
normalize_filter_plugin
,
config_param
(),
nullptr
);
assert
(
normalize_filter
!=
NULL
);
filter_chain_append
(
*
ao
->
filter
,
"normalize"
,
...
...
@@ -227,13 +228,13 @@ audio_output_setup(struct audio_output *ao, const config_param ¶m,
if
(
strcmp
(
replay_gain_handler
,
"none"
)
!=
0
)
{
ao
->
replay_gain_filter
=
filter_new
(
&
replay_gain_filter_plugin
,
&
param
,
NULL
);
param
,
NULL
);
assert
(
ao
->
replay_gain_filter
!=
NULL
);
ao
->
replay_gain_serial
=
0
;
ao
->
other_replay_gain_filter
=
filter_new
(
&
replay_gain_filter_plugin
,
&
param
,
NULL
);
param
,
NULL
);
assert
(
ao
->
other_replay_gain_filter
!=
NULL
);
ao
->
other_replay_gain_serial
=
0
;
...
...
@@ -271,7 +272,8 @@ audio_output_setup(struct audio_output *ao, const config_param ¶m,
/* the "convert" filter must be the last one in the chain */
ao
->
convert_filter
=
filter_new
(
&
convert_filter_plugin
,
NULL
,
NULL
);
ao
->
convert_filter
=
filter_new
(
&
convert_filter_plugin
,
config_param
(),
nullptr
);
assert
(
ao
->
convert_filter
!=
NULL
);
filter_chain_append
(
*
ao
->
filter
,
"convert"
,
ao
->
convert_filter
);
...
...
src/filter/AutoConvertFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -24,6 +24,7 @@
#include "FilterInternal.hxx"
#include "FilterRegistry.hxx"
#include "AudioFormat.hxx"
#include "ConfigData.hxx"
#include <assert.h>
...
...
@@ -68,7 +69,8 @@ AutoConvertFilter::Open(AudioFormat &in_audio_format, GError **error_r)
if
(
in_audio_format
!=
child_audio_format
)
{
/* yes - create a convert_filter */
convert
=
filter_new
(
&
convert_filter_plugin
,
nullptr
,
error_r
);
const
config_param
empty
;
convert
=
filter_new
(
&
convert_filter_plugin
,
empty
,
error_r
);
if
(
convert
==
nullptr
)
{
filter
->
Close
();
return
AudioFormat
::
Undefined
();
...
...
src/filter/ChainFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -73,7 +73,7 @@ filter_quark(void)
}
static
Filter
*
chain_filter_init
(
gcc_unused
const
struct
config_param
*
param
,
chain_filter_init
(
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
ChainFilter
();
...
...
src/filter/ConvertFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -63,7 +63,7 @@ public:
};
static
Filter
*
convert_filter_init
(
gcc_unused
const
struct
config_param
*
param
,
convert_filter_init
(
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
ConvertFilter
();
...
...
src/filter/NormalizeFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -41,7 +41,7 @@ public:
};
static
Filter
*
normalize_filter_init
(
gcc_unused
const
struct
config_param
*
param
,
normalize_filter_init
(
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
NormalizeFilter
();
...
...
src/filter/NullFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -49,7 +49,7 @@ public:
};
static
Filter
*
null_filter_init
(
gcc_unused
const
struct
config_param
*
param
,
null_filter_init
(
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
NullFilter
();
...
...
src/filter/ReplayGainFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -153,7 +153,7 @@ ReplayGainFilter::Update()
}
static
Filter
*
replay_gain_filter_init
(
gcc_unused
const
struct
config_param
*
param
,
replay_gain_filter_init
(
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
ReplayGainFilter
();
...
...
src/filter/RouteFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -118,7 +118,7 @@ public:
* @param filter a route_filter whose min_channels and sources[] to set
* @return true on success, false on error
*/
bool
Configure
(
const
config_param
*
param
,
GError
**
error_r
);
bool
Configure
(
const
config_param
&
param
,
GError
**
error_r
);
virtual
AudioFormat
Open
(
AudioFormat
&
af
,
GError
**
error_r
)
override
;
virtual
void
Close
();
...
...
@@ -127,7 +127,7 @@ public:
};
bool
RouteFilter
::
Configure
(
const
config_param
*
param
,
GError
**
error_r
)
{
RouteFilter
::
Configure
(
const
config_param
&
param
,
GError
**
error_r
)
{
/* TODO:
* With a more clever way of marking "don't copy to output N",
...
...
@@ -139,8 +139,7 @@ RouteFilter::Configure(const config_param *param, GError **error_r) {
int
number_of_copies
;
// A cowardly default, just passthrough stereo
const
char
*
routes
=
config_get_block_string
(
param
,
"routes"
,
"0>0, 1>1"
);
const
char
*
const
routes
=
param
.
GetBlockValue
(
"routes"
,
"0>0, 1>1"
);
min_input_channels
=
0
;
min_output_channels
=
0
;
...
...
@@ -163,7 +162,7 @@ RouteFilter::Configure(const config_param *param, GError **error_r) {
if
(
g_strv_length
(
sd
)
!=
2
)
{
g_set_error
(
error_r
,
config_quark
(),
1
,
"Invalid copy around %d in routes spec: %s"
,
param
->
line
,
tokens
[
c
]);
param
.
line
,
tokens
[
c
]);
g_strfreev
(
sd
);
g_strfreev
(
tokens
);
return
false
;
...
...
@@ -210,7 +209,7 @@ RouteFilter::Configure(const config_param *param, GError **error_r) {
if
(
g_strv_length
(
sd
)
!=
2
)
{
g_set_error
(
error_r
,
config_quark
(),
1
,
"Invalid copy around %d in routes spec: %s"
,
param
->
line
,
tokens
[
c
]);
param
.
line
,
tokens
[
c
]);
g_strfreev
(
sd
);
g_strfreev
(
tokens
);
return
false
;
...
...
@@ -230,7 +229,7 @@ RouteFilter::Configure(const config_param *param, GError **error_r) {
}
static
Filter
*
route_filter_init
(
const
config_param
*
param
,
GError
**
error_r
)
route_filter_init
(
const
config_param
&
param
,
GError
**
error_r
)
{
RouteFilter
*
filter
=
new
RouteFilter
();
if
(
!
filter
->
Configure
(
param
,
error_r
))
{
...
...
src/filter/VolumeFilterPlugin.cxx
View file @
f54bcc1f
...
...
@@ -69,7 +69,7 @@ volume_quark(void)
}
static
Filter
*
volume_filter_init
(
gcc_unused
const
struct
config_param
*
param
,
volume_filter_init
(
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
VolumeFilter
();
...
...
src/mixer/SoftwareMixerPlugin.cxx
View file @
f54bcc1f
...
...
@@ -25,6 +25,7 @@
#include "FilterInternal.hxx"
#include "filter/VolumeFilterPlugin.hxx"
#include "pcm/PcmVolume.hxx"
#include "ConfigData.hxx"
#include <assert.h>
#include <math.h>
...
...
@@ -36,7 +37,8 @@ struct SoftwareMixer final : public Mixer {
SoftwareMixer
()
:
Mixer
(
software_mixer_plugin
),
filter
(
filter_new
(
&
volume_filter_plugin
,
nullptr
,
nullptr
)),
filter
(
filter_new
(
&
volume_filter_plugin
,
config_param
(),
nullptr
)),
volume
(
100
)
{
assert
(
filter
!=
nullptr
);
...
...
test/run_filter.cxx
View file @
f54bcc1f
...
...
@@ -58,8 +58,7 @@ 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
=
config_get_block_string
(
param
,
"name"
,
NULL
);
const
char
*
current_name
=
param
->
GetBlockValue
(
"name"
);
if
(
current_name
!=
NULL
&&
strcmp
(
current_name
,
name
)
==
0
)
return
param
;
}
...
...
@@ -79,7 +78,7 @@ load_filter(const char *name)
return
nullptr
;
}
Filter
*
filter
=
filter_configured_new
(
param
,
&
error
);
Filter
*
filter
=
filter_configured_new
(
*
param
,
&
error
);
if
(
filter
==
NULL
)
{
g_printerr
(
"Failed to load filter: %s
\n
"
,
error
->
message
);
g_error_free
(
error
);
...
...
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