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
e2621d5e
Commit
e2621d5e
authored
Dec 27, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter/Plugin: return std::unique_ptr<PreparedFilter>
parent
0e3ff12d
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
87 additions
and
74 deletions
+87
-74
FilterConfig.cxx
src/filter/FilterConfig.cxx
+4
-3
FilterPlugin.cxx
src/filter/FilterPlugin.cxx
+3
-2
FilterPlugin.hxx
src/filter/FilterPlugin.hxx
+5
-3
Observer.cxx
src/filter/Observer.cxx
+8
-7
Observer.hxx
src/filter/Observer.hxx
+3
-1
AutoConvertFilterPlugin.cxx
src/filter/plugins/AutoConvertFilterPlugin.cxx
+6
-8
AutoConvertFilterPlugin.hxx
src/filter/plugins/AutoConvertFilterPlugin.hxx
+4
-2
ChainFilterPlugin.cxx
src/filter/plugins/ChainFilterPlugin.cxx
+12
-13
ChainFilterPlugin.hxx
src/filter/plugins/ChainFilterPlugin.hxx
+5
-3
ConvertFilterPlugin.cxx
src/filter/plugins/ConvertFilterPlugin.cxx
+2
-2
ConvertFilterPlugin.hxx
src/filter/plugins/ConvertFilterPlugin.hxx
+3
-1
NormalizeFilterPlugin.cxx
src/filter/plugins/NormalizeFilterPlugin.cxx
+4
-4
NormalizeFilterPlugin.hxx
src/filter/plugins/NormalizeFilterPlugin.hxx
+3
-1
NullFilterPlugin.cxx
src/filter/plugins/NullFilterPlugin.cxx
+2
-2
ReplayGainFilterPlugin.cxx
src/filter/plugins/ReplayGainFilterPlugin.cxx
+3
-3
ReplayGainFilterPlugin.hxx
src/filter/plugins/ReplayGainFilterPlugin.hxx
+4
-2
RouteFilterPlugin.cxx
src/filter/plugins/RouteFilterPlugin.cxx
+2
-2
VolumeFilterPlugin.cxx
src/filter/plugins/VolumeFilterPlugin.cxx
+2
-2
VolumeFilterPlugin.hxx
src/filter/plugins/VolumeFilterPlugin.hxx
+3
-1
Filtered.hxx
src/output/Filtered.hxx
+3
-3
Finish.cxx
src/output/Finish.cxx
+0
-4
Init.cxx
src/output/Init.cxx
+2
-1
Thread.cxx
src/output/Thread.cxx
+2
-2
run_filter.cxx
test/run_filter.cxx
+2
-2
No files found.
src/filter/FilterConfig.cxx
View file @
e2621d5e
...
@@ -19,8 +19,9 @@
...
@@ -19,8 +19,9 @@
#include "config.h"
#include "config.h"
#include "FilterConfig.hxx"
#include "FilterConfig.hxx"
#include "plugins/ChainFilterPlugin.hxx"
#include "FilterPlugin.hxx"
#include "FilterPlugin.hxx"
#include "FilterInternal.hxx"
#include "plugins/ChainFilterPlugin.hxx"
#include "config/Param.hxx"
#include "config/Param.hxx"
#include "config/ConfigOption.hxx"
#include "config/ConfigOption.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigGlobal.hxx"
...
@@ -42,11 +43,11 @@ filter_chain_append_new(PreparedFilter &chain, const char *template_name)
...
@@ -42,11 +43,11 @@ filter_chain_append_new(PreparedFilter &chain, const char *template_name)
template_name
);
template_name
);
// Instantiate one of those filter plugins with the template name as a hint
// Instantiate one of those filter plugins with the template name as a hint
PreparedFilter
*
f
=
filter_configured_new
(
*
cfg
);
auto
f
=
filter_configured_new
(
*
cfg
);
const
char
*
plugin_name
=
cfg
->
GetBlockValue
(
"plugin"
,
const
char
*
plugin_name
=
cfg
->
GetBlockValue
(
"plugin"
,
"unknown"
);
"unknown"
);
filter_chain_append
(
chain
,
plugin_name
,
f
);
filter_chain_append
(
chain
,
plugin_name
,
std
::
move
(
f
)
);
}
}
void
void
...
...
src/filter/FilterPlugin.cxx
View file @
e2621d5e
...
@@ -20,13 +20,14 @@
...
@@ -20,13 +20,14 @@
#include "config.h"
#include "config.h"
#include "FilterPlugin.hxx"
#include "FilterPlugin.hxx"
#include "FilterRegistry.hxx"
#include "FilterRegistry.hxx"
#include "FilterInternal.hxx"
#include "config/Block.hxx"
#include "config/Block.hxx"
#include "config/ConfigError.hxx"
#include "config/ConfigError.hxx"
#include "util/RuntimeError.hxx"
#include "util/RuntimeError.hxx"
#include <assert.h>
#include <assert.h>
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
filter_new
(
const
FilterPlugin
*
plugin
,
const
ConfigBlock
&
block
)
filter_new
(
const
FilterPlugin
*
plugin
,
const
ConfigBlock
&
block
)
{
{
assert
(
plugin
!=
nullptr
);
assert
(
plugin
!=
nullptr
);
...
@@ -34,7 +35,7 @@ filter_new(const FilterPlugin *plugin, const ConfigBlock &block)
...
@@ -34,7 +35,7 @@ filter_new(const FilterPlugin *plugin, const ConfigBlock &block)
return
plugin
->
init
(
block
);
return
plugin
->
init
(
block
);
}
}
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
filter_configured_new
(
const
ConfigBlock
&
block
)
filter_configured_new
(
const
ConfigBlock
&
block
)
{
{
const
char
*
plugin_name
=
block
.
GetBlockValue
(
"plugin"
);
const
char
*
plugin_name
=
block
.
GetBlockValue
(
"plugin"
);
...
...
src/filter/FilterPlugin.hxx
View file @
e2621d5e
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
#ifndef MPD_FILTER_PLUGIN_HXX
#ifndef MPD_FILTER_PLUGIN_HXX
#define MPD_FILTER_PLUGIN_HXX
#define MPD_FILTER_PLUGIN_HXX
#include <memory>
struct
ConfigBlock
;
struct
ConfigBlock
;
class
PreparedFilter
;
class
PreparedFilter
;
...
@@ -35,7 +37,7 @@ struct FilterPlugin {
...
@@ -35,7 +37,7 @@ struct FilterPlugin {
/**
/**
* Allocates and configures a filter.
* Allocates and configures a filter.
*/
*/
PreparedFilter
*
(
*
init
)(
const
ConfigBlock
&
block
);
std
::
unique_ptr
<
PreparedFilter
>
(
*
init
)(
const
ConfigBlock
&
block
);
};
};
/**
/**
...
@@ -46,7 +48,7 @@ struct FilterPlugin {
...
@@ -46,7 +48,7 @@ struct FilterPlugin {
* @param plugin the filter plugin
* @param plugin the filter plugin
* @param block configuration section
* @param block configuration section
*/
*/
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
filter_new
(
const
FilterPlugin
*
plugin
,
filter_new
(
const
FilterPlugin
*
plugin
,
const
ConfigBlock
&
block
);
const
ConfigBlock
&
block
);
...
@@ -58,7 +60,7 @@ filter_new(const FilterPlugin *plugin,
...
@@ -58,7 +60,7 @@ filter_new(const FilterPlugin *plugin,
*
*
* @param block the configuration section
* @param block the configuration section
*/
*/
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
filter_configured_new
(
const
ConfigBlock
&
block
);
filter_configured_new
(
const
ConfigBlock
&
block
);
#endif
#endif
src/filter/Observer.cxx
View file @
e2621d5e
...
@@ -27,21 +27,20 @@
...
@@ -27,21 +27,20 @@
class
FilterObserver
::
PreparedProxy
final
:
public
PreparedFilter
{
class
FilterObserver
::
PreparedProxy
final
:
public
PreparedFilter
{
FilterObserver
&
observer
;
FilterObserver
&
observer
;
PreparedFilter
*
const
prepared_filter
;
std
::
unique_ptr
<
PreparedFilter
>
prepared_filter
;
Proxy
*
child
=
nullptr
;
Proxy
*
child
=
nullptr
;
public
:
public
:
PreparedProxy
(
FilterObserver
&
_observer
,
PreparedProxy
(
FilterObserver
&
_observer
,
PreparedFilter
*
_prepared_filter
)
std
::
unique_ptr
<
PreparedFilter
>
_prepared_filter
)
:
observer
(
_observer
),
:
observer
(
_observer
),
prepared_filter
(
_prepared_filter
)
{}
prepared_filter
(
std
::
move
(
_prepared_filter
)
)
{}
~
PreparedProxy
()
{
~
PreparedProxy
()
{
assert
(
child
==
nullptr
);
assert
(
child
==
nullptr
);
assert
(
observer
.
proxy
==
this
);
assert
(
observer
.
proxy
==
this
);
observer
.
proxy
=
nullptr
;
observer
.
proxy
=
nullptr
;
delete
prepared_filter
;
}
}
void
Clear
(
gcc_unused
Proxy
*
_child
)
{
void
Clear
(
gcc_unused
Proxy
*
_child
)
{
...
@@ -95,12 +94,14 @@ FilterObserver::PreparedProxy::Open(AudioFormat &af)
...
@@ -95,12 +94,14 @@ FilterObserver::PreparedProxy::Open(AudioFormat &af)
return
child
=
new
Proxy
(
*
this
,
f
);
return
child
=
new
Proxy
(
*
this
,
f
);
}
}
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
FilterObserver
::
Set
(
PreparedFilter
*
pf
)
FilterObserver
::
Set
(
std
::
unique_ptr
<
PreparedFilter
>
pf
)
{
{
assert
(
proxy
==
nullptr
);
assert
(
proxy
==
nullptr
);
return
proxy
=
new
PreparedProxy
(
*
this
,
pf
);
auto
p
=
std
::
make_unique
<
PreparedProxy
>
(
*
this
,
std
::
move
(
pf
));
proxy
=
p
.
get
();
return
p
;
}
}
Filter
*
Filter
*
...
...
src/filter/Observer.hxx
View file @
e2621d5e
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include "check.h"
#include "check.h"
#include <memory>
class
PreparedFilter
;
class
PreparedFilter
;
class
Filter
;
class
Filter
;
...
@@ -39,7 +41,7 @@ public:
...
@@ -39,7 +41,7 @@ public:
/**
/**
* @return a proxy object
* @return a proxy object
*/
*/
PreparedFilter
*
Set
(
PreparedFilter
*
pf
);
std
::
unique_ptr
<
PreparedFilter
>
Set
(
std
::
unique_ptr
<
PreparedFilter
>
pf
);
Filter
*
Get
();
Filter
*
Get
();
};
};
...
...
src/filter/plugins/AutoConvertFilterPlugin.cxx
View file @
e2621d5e
...
@@ -62,13 +62,11 @@ class PreparedAutoConvertFilter final : public PreparedFilter {
...
@@ -62,13 +62,11 @@ class PreparedAutoConvertFilter final : public PreparedFilter {
/**
/**
* The underlying filter.
* The underlying filter.
*/
*/
PreparedFilter
*
const
filter
;
std
::
unique_ptr
<
PreparedFilter
>
filter
;
public
:
public
:
PreparedAutoConvertFilter
(
PreparedFilter
*
_filter
)
:
filter
(
_filter
)
{}
PreparedAutoConvertFilter
(
std
::
unique_ptr
<
PreparedFilter
>
_filter
)
noexcept
~
PreparedAutoConvertFilter
()
{
:
filter
(
std
::
move
(
_filter
))
{}
delete
filter
;
}
Filter
*
Open
(
AudioFormat
&
af
)
override
;
Filter
*
Open
(
AudioFormat
&
af
)
override
;
};
};
...
@@ -106,8 +104,8 @@ AutoConvertFilter::FilterPCM(ConstBuffer<void> src)
...
@@ -106,8 +104,8 @@ AutoConvertFilter::FilterPCM(ConstBuffer<void> src)
return
filter
->
FilterPCM
(
src
);
return
filter
->
FilterPCM
(
src
);
}
}
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
autoconvert_filter_new
(
PreparedFilter
*
filter
)
autoconvert_filter_new
(
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
{
{
return
new
PreparedAutoConvertFilter
(
filter
);
return
std
::
make_unique
<
PreparedAutoConvertFilter
>
(
std
::
move
(
filter
)
);
}
}
src/filter/plugins/AutoConvertFilterPlugin.hxx
View file @
e2621d5e
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#ifndef MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
#ifndef MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
#define MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
#define MPD_AUTOCONVERT_FILTER_PLUGIN_HXX
#include <memory>
class
PreparedFilter
;
class
PreparedFilter
;
/**
/**
...
@@ -28,7 +30,7 @@ class PreparedFilter;
...
@@ -28,7 +30,7 @@ class PreparedFilter;
* requests a different format, it automatically creates a
* requests a different format, it automatically creates a
* convert_filter.
* convert_filter.
*/
*/
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
autoconvert_filter_new
(
PreparedFilter
*
filter
)
;
autoconvert_filter_new
(
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
;
#endif
#endif
src/filter/plugins/ChainFilterPlugin.cxx
View file @
e2621d5e
...
@@ -67,13 +67,11 @@ public:
...
@@ -67,13 +67,11 @@ public:
class
PreparedChainFilter
final
:
public
PreparedFilter
{
class
PreparedChainFilter
final
:
public
PreparedFilter
{
struct
Child
{
struct
Child
{
const
char
*
name
;
const
char
*
name
;
PreparedFilter
*
filter
;
std
::
unique_ptr
<
PreparedFilter
>
filter
;
Child
(
const
char
*
_name
,
PreparedFilter
*
_filter
)
Child
(
const
char
*
_name
,
:
name
(
_name
),
filter
(
_filter
)
{}
std
::
unique_ptr
<
PreparedFilter
>
_filter
)
~
Child
()
{
:
name
(
_name
),
filter
(
std
::
move
(
_filter
))
{}
delete
filter
;
}
Child
(
const
Child
&
)
=
delete
;
Child
(
const
Child
&
)
=
delete
;
Child
&
operator
=
(
const
Child
&
)
=
delete
;
Child
&
operator
=
(
const
Child
&
)
=
delete
;
...
@@ -84,8 +82,9 @@ class PreparedChainFilter final : public PreparedFilter {
...
@@ -84,8 +82,9 @@ class PreparedChainFilter final : public PreparedFilter {
std
::
list
<
Child
>
children
;
std
::
list
<
Child
>
children
;
public
:
public
:
void
Append
(
const
char
*
name
,
PreparedFilter
*
filter
)
{
void
Append
(
const
char
*
name
,
children
.
emplace_back
(
name
,
filter
);
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
{
children
.
emplace_back
(
name
,
std
::
move
(
filter
));
}
}
/* virtual methods from class PreparedFilter */
/* virtual methods from class PreparedFilter */
...
@@ -143,17 +142,17 @@ ChainFilter::FilterPCM(ConstBuffer<void> src)
...
@@ -143,17 +142,17 @@ ChainFilter::FilterPCM(ConstBuffer<void> src)
return
src
;
return
src
;
}
}
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
filter_chain_new
(
void
)
filter_chain_new
(
)
noexcept
{
{
return
new
PreparedChainFilter
();
return
std
::
make_unique
<
PreparedChainFilter
>
();
}
}
void
void
filter_chain_append
(
PreparedFilter
&
_chain
,
const
char
*
name
,
filter_chain_append
(
PreparedFilter
&
_chain
,
const
char
*
name
,
PreparedFilter
*
filter
)
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
{
{
PreparedChainFilter
&
chain
=
(
PreparedChainFilter
&
)
_chain
;
PreparedChainFilter
&
chain
=
(
PreparedChainFilter
&
)
_chain
;
chain
.
Append
(
name
,
filter
);
chain
.
Append
(
name
,
std
::
move
(
filter
)
);
}
}
src/filter/plugins/ChainFilterPlugin.hxx
View file @
e2621d5e
...
@@ -27,13 +27,15 @@
...
@@ -27,13 +27,15 @@
#ifndef MPD_FILTER_CHAIN_HXX
#ifndef MPD_FILTER_CHAIN_HXX
#define MPD_FILTER_CHAIN_HXX
#define MPD_FILTER_CHAIN_HXX
#include <memory>
class
PreparedFilter
;
class
PreparedFilter
;
/**
/**
* Creates a new filter chain.
* Creates a new filter chain.
*/
*/
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
filter_chain_new
();
filter_chain_new
()
noexcept
;
/**
/**
* Appends a new filter at the end of the filter chain. You must call
* Appends a new filter at the end of the filter chain. You must call
...
@@ -44,6 +46,6 @@ filter_chain_new();
...
@@ -44,6 +46,6 @@ filter_chain_new();
*/
*/
void
void
filter_chain_append
(
PreparedFilter
&
chain
,
const
char
*
name
,
filter_chain_append
(
PreparedFilter
&
chain
,
const
char
*
name
,
PreparedFilter
*
filter
)
;
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
;
#endif
#endif
src/filter/plugins/ConvertFilterPlugin.cxx
View file @
e2621d5e
...
@@ -119,10 +119,10 @@ ConvertFilter::FilterPCM(ConstBuffer<void> src)
...
@@ -119,10 +119,10 @@ ConvertFilter::FilterPCM(ConstBuffer<void> src)
return
state
.
Convert
(
src
);
return
state
.
Convert
(
src
);
}
}
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
convert_filter_prepare
()
noexcept
convert_filter_prepare
()
noexcept
{
{
return
new
PreparedConvertFilter
();
return
std
::
make_unique
<
PreparedConvertFilter
>
();
}
}
Filter
*
Filter
*
...
...
src/filter/plugins/ConvertFilterPlugin.hxx
View file @
e2621d5e
...
@@ -20,11 +20,13 @@
...
@@ -20,11 +20,13 @@
#ifndef MPD_CONVERT_FILTER_PLUGIN_HXX
#ifndef MPD_CONVERT_FILTER_PLUGIN_HXX
#define MPD_CONVERT_FILTER_PLUGIN_HXX
#define MPD_CONVERT_FILTER_PLUGIN_HXX
#include <memory>
class
PreparedFilter
;
class
PreparedFilter
;
class
Filter
;
class
Filter
;
struct
AudioFormat
;
struct
AudioFormat
;
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
convert_filter_prepare
()
noexcept
;
convert_filter_prepare
()
noexcept
;
Filter
*
Filter
*
...
...
src/filter/plugins/NormalizeFilterPlugin.cxx
View file @
e2621d5e
...
@@ -53,10 +53,10 @@ public:
...
@@ -53,10 +53,10 @@ public:
Filter
*
Open
(
AudioFormat
&
af
)
override
;
Filter
*
Open
(
AudioFormat
&
af
)
override
;
};
};
static
PreparedFilter
*
static
std
::
unique_ptr
<
PreparedFilter
>
normalize_filter_init
(
gcc_unused
const
ConfigBlock
&
block
)
normalize_filter_init
(
gcc_unused
const
ConfigBlock
&
block
)
{
{
return
new
PreparedNormalizeFilter
();
return
std
::
make_unique
<
PreparedNormalizeFilter
>
();
}
}
Filter
*
Filter
*
...
@@ -82,8 +82,8 @@ const FilterPlugin normalize_filter_plugin = {
...
@@ -82,8 +82,8 @@ const FilterPlugin normalize_filter_plugin = {
normalize_filter_init
,
normalize_filter_init
,
};
};
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
normalize_filter_prepare
()
noexcept
normalize_filter_prepare
()
noexcept
{
{
return
new
PreparedNormalizeFilter
();
return
std
::
make_unique
<
PreparedNormalizeFilter
>
();
}
}
src/filter/plugins/NormalizeFilterPlugin.hxx
View file @
e2621d5e
...
@@ -20,11 +20,13 @@
...
@@ -20,11 +20,13 @@
#ifndef MPD_NORMALIZE_FILTER_PLUGIN_HXX
#ifndef MPD_NORMALIZE_FILTER_PLUGIN_HXX
#define MPD_NORMALIZE_FILTER_PLUGIN_HXX
#define MPD_NORMALIZE_FILTER_PLUGIN_HXX
#include <memory>
class
PreparedFilter
;
class
PreparedFilter
;
class
Filter
;
class
Filter
;
struct
AudioFormat
;
struct
AudioFormat
;
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
normalize_filter_prepare
()
noexcept
;
normalize_filter_prepare
()
noexcept
;
#endif
#endif
src/filter/plugins/NullFilterPlugin.cxx
View file @
e2621d5e
...
@@ -48,10 +48,10 @@ public:
...
@@ -48,10 +48,10 @@ public:
}
}
};
};
static
PreparedFilter
*
static
std
::
unique_ptr
<
PreparedFilter
>
null_filter_init
(
gcc_unused
const
ConfigBlock
&
block
)
null_filter_init
(
gcc_unused
const
ConfigBlock
&
block
)
{
{
return
new
PreparedNullFilter
();
return
std
::
make_unique
<
PreparedNullFilter
>
();
}
}
const
FilterPlugin
null_filter_plugin
=
{
const
FilterPlugin
null_filter_plugin
=
{
...
...
src/filter/plugins/ReplayGainFilterPlugin.cxx
View file @
e2621d5e
...
@@ -171,10 +171,10 @@ ReplayGainFilter::Update()
...
@@ -171,10 +171,10 @@ ReplayGainFilter::Update()
pv
.
SetVolume
(
volume
);
pv
.
SetVolume
(
volume
);
}
}
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
NewReplayGainFilter
(
const
ReplayGainConfig
&
config
)
NewReplayGainFilter
(
const
ReplayGainConfig
&
config
)
noexcept
{
{
return
new
PreparedReplayGainFilter
(
config
);
return
std
::
make_unique
<
PreparedReplayGainFilter
>
(
config
);
}
}
Filter
*
Filter
*
...
...
src/filter/plugins/ReplayGainFilterPlugin.hxx
View file @
e2621d5e
...
@@ -22,14 +22,16 @@
...
@@ -22,14 +22,16 @@
#include "ReplayGainMode.hxx"
#include "ReplayGainMode.hxx"
#include <memory>
class
Filter
;
class
Filter
;
class
PreparedFilter
;
class
PreparedFilter
;
class
Mixer
;
class
Mixer
;
struct
ReplayGainConfig
;
struct
ReplayGainConfig
;
struct
ReplayGainInfo
;
struct
ReplayGainInfo
;
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
NewReplayGainFilter
(
const
ReplayGainConfig
&
config
);
NewReplayGainFilter
(
const
ReplayGainConfig
&
config
)
noexcept
;
/**
/**
* Enables or disables the hardware mixer for applying replay gain.
* Enables or disables the hardware mixer for applying replay gain.
...
...
src/filter/plugins/RouteFilterPlugin.cxx
View file @
e2621d5e
...
@@ -196,10 +196,10 @@ PreparedRouteFilter::PreparedRouteFilter(const ConfigBlock &block)
...
@@ -196,10 +196,10 @@ PreparedRouteFilter::PreparedRouteFilter(const ConfigBlock &block)
}
}
}
}
static
PreparedFilter
*
static
std
::
unique_ptr
<
PreparedFilter
>
route_filter_init
(
const
ConfigBlock
&
block
)
route_filter_init
(
const
ConfigBlock
&
block
)
{
{
return
new
PreparedRouteFilter
(
block
);
return
std
::
make_unique
<
PreparedRouteFilter
>
(
block
);
}
}
RouteFilter
::
RouteFilter
(
const
AudioFormat
&
audio_format
,
RouteFilter
::
RouteFilter
(
const
AudioFormat
&
audio_format
,
...
...
src/filter/plugins/VolumeFilterPlugin.cxx
View file @
e2621d5e
...
@@ -65,10 +65,10 @@ VolumeFilter::FilterPCM(ConstBuffer<void> src)
...
@@ -65,10 +65,10 @@ VolumeFilter::FilterPCM(ConstBuffer<void> src)
return
pv
.
Apply
(
src
);
return
pv
.
Apply
(
src
);
}
}
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
volume_filter_prepare
()
noexcept
volume_filter_prepare
()
noexcept
{
{
return
new
PreparedVolumeFilter
();
return
std
::
make_unique
<
PreparedVolumeFilter
>
();
}
}
unsigned
unsigned
...
...
src/filter/plugins/VolumeFilterPlugin.hxx
View file @
e2621d5e
...
@@ -20,10 +20,12 @@
...
@@ -20,10 +20,12 @@
#ifndef MPD_VOLUME_FILTER_PLUGIN_HXX
#ifndef MPD_VOLUME_FILTER_PLUGIN_HXX
#define MPD_VOLUME_FILTER_PLUGIN_HXX
#define MPD_VOLUME_FILTER_PLUGIN_HXX
#include <memory>
class
PreparedFilter
;
class
PreparedFilter
;
class
Filter
;
class
Filter
;
PreparedFilter
*
std
::
unique_ptr
<
PreparedFilter
>
volume_filter_prepare
()
noexcept
;
volume_filter_prepare
()
noexcept
;
unsigned
unsigned
...
...
src/output/Filtered.hxx
View file @
e2621d5e
...
@@ -93,7 +93,7 @@ public:
...
@@ -93,7 +93,7 @@ public:
* The filter object of this audio output. This is an
* The filter object of this audio output. This is an
* instance of chain_filter_plugin.
* instance of chain_filter_plugin.
*/
*/
PreparedFilter
*
prepared_filter
=
nullpt
r
;
std
::
unique_ptr
<
PreparedFilter
>
prepared_filte
r
;
/**
/**
* The #VolumeFilter instance of this audio output. It is
* The #VolumeFilter instance of this audio output. It is
...
@@ -105,14 +105,14 @@ public:
...
@@ -105,14 +105,14 @@ public:
* The replay_gain_filter_plugin instance of this audio
* The replay_gain_filter_plugin instance of this audio
* output.
* output.
*/
*/
PreparedFilter
*
prepared_replay_gain_filter
=
nullpt
r
;
std
::
unique_ptr
<
PreparedFilter
>
prepared_replay_gain_filte
r
;
/**
/**
* The replay_gain_filter_plugin instance of this audio
* The replay_gain_filter_plugin instance of this audio
* output, to be applied to the second chunk during
* output, to be applied to the second chunk during
* cross-fading.
* cross-fading.
*/
*/
PreparedFilter
*
prepared_other_replay_gain_filter
=
nullpt
r
;
std
::
unique_ptr
<
PreparedFilter
>
prepared_other_replay_gain_filte
r
;
/**
/**
* The convert_filter_plugin instance of this audio output.
* The convert_filter_plugin instance of this audio output.
...
...
src/output/Finish.cxx
View file @
e2621d5e
...
@@ -27,10 +27,6 @@ FilteredAudioOutput::~FilteredAudioOutput()
...
@@ -27,10 +27,6 @@ FilteredAudioOutput::~FilteredAudioOutput()
{
{
if
(
mixer
!=
nullptr
)
if
(
mixer
!=
nullptr
)
mixer_free
(
mixer
);
mixer_free
(
mixer
);
delete
prepared_replay_gain_filter
;
delete
prepared_other_replay_gain_filter
;
delete
prepared_filter
;
}
}
void
void
...
...
src/output/Init.cxx
View file @
e2621d5e
...
@@ -22,12 +22,13 @@
...
@@ -22,12 +22,13 @@
#include "Registry.hxx"
#include "Registry.hxx"
#include "Domain.hxx"
#include "Domain.hxx"
#include "OutputAPI.hxx"
#include "OutputAPI.hxx"
#include "filter/FilterConfig.hxx"
#include "AudioParser.hxx"
#include "AudioParser.hxx"
#include "mixer/MixerList.hxx"
#include "mixer/MixerList.hxx"
#include "mixer/MixerType.hxx"
#include "mixer/MixerType.hxx"
#include "mixer/MixerControl.hxx"
#include "mixer/MixerControl.hxx"
#include "mixer/plugins/SoftwareMixerPlugin.hxx"
#include "mixer/plugins/SoftwareMixerPlugin.hxx"
#include "filter/FilterConfig.hxx"
#include "filter/FilterInternal.hxx"
#include "filter/plugins/AutoConvertFilterPlugin.hxx"
#include "filter/plugins/AutoConvertFilterPlugin.hxx"
#include "filter/plugins/ConvertFilterPlugin.hxx"
#include "filter/plugins/ConvertFilterPlugin.hxx"
#include "filter/plugins/ReplayGainFilterPlugin.hxx"
#include "filter/plugins/ReplayGainFilterPlugin.hxx"
...
...
src/output/Thread.cxx
View file @
e2621d5e
...
@@ -146,8 +146,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
...
@@ -146,8 +146,8 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
try
{
try
{
try
{
try
{
f
=
source
.
Open
(
in_audio_format
,
pipe
,
f
=
source
.
Open
(
in_audio_format
,
pipe
,
output
->
prepared_replay_gain_filter
,
output
->
prepared_replay_gain_filter
.
get
()
,
output
->
prepared_other_replay_gain_filter
,
output
->
prepared_other_replay_gain_filter
.
get
()
,
*
output
->
prepared_filter
);
*
output
->
prepared_filter
);
}
catch
(...)
{
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open filter for %s"
,
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open filter for %s"
,
...
...
test/run_filter.cxx
View file @
e2621d5e
...
@@ -48,7 +48,7 @@ mixer_set_volume(gcc_unused Mixer *mixer,
...
@@ -48,7 +48,7 @@ mixer_set_volume(gcc_unused Mixer *mixer,
{
{
}
}
static
PreparedFilter
*
static
std
::
unique_ptr
<
PreparedFilter
>
load_filter
(
const
char
*
name
)
load_filter
(
const
char
*
name
)
{
{
const
auto
*
param
=
config_find_block
(
ConfigBlockOption
::
AUDIO_FILTER
,
const
auto
*
param
=
config_find_block
(
ConfigBlockOption
::
AUDIO_FILTER
,
...
@@ -86,7 +86,7 @@ try {
...
@@ -86,7 +86,7 @@ try {
/* initialize the filter */
/* initialize the filter */
std
::
unique_ptr
<
PreparedFilter
>
prepared_filter
(
load_filter
(
argv
[
2
])
);
auto
prepared_filter
=
load_filter
(
argv
[
2
]
);
if
(
!
prepared_filter
)
if
(
!
prepared_filter
)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
...
...
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