projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add bind().
[dcpomatic.git]
/
src
/
lib
/
filter.cc
diff --git
a/src/lib/filter.cc
b/src/lib/filter.cc
index 663d1454742e63f388af460430f048cf68abd4b0..9158cba5c10b6741995433ea767c2a3899611920 100644
(file)
--- a/
src/lib/filter.cc
+++ b/
src/lib/filter.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012
-2021
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,22
+18,28
@@
*/
*/
+
/** @file src/filter.cc
* @brief A class to describe one of FFmpeg's video or audio filters.
*/
/** @file src/filter.cc
* @brief A class to describe one of FFmpeg's video or audio filters.
*/
+
#include "filter.h"
#include "filter.h"
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
extern "C" {
#include <libavfilter/avfilter.h>
}
extern "C" {
#include <libavfilter/avfilter.h>
}
-#include <boost/foreach.hpp>
-#include <iostream>
+LIBDCP_ENABLE_WARNINGS
#include "i18n.h"
#include "i18n.h"
+
using namespace std;
using namespace std;
-vector<Filter const *> Filter::_filters;
+
+vector<Filter> Filter::_filters;
+
/** @param i Our id.
* @param n User-visible name.
/** @param i Our id.
* @param n User-visible name.
@@
-49,13
+55,19
@@
Filter::Filter (string i, string n, string c, string f)
}
}
+
/** @return All available filters */
vector<Filter const *>
Filter::all ()
{
/** @return All available filters */
vector<Filter const *>
Filter::all ()
{
- return _filters;
+ vector<Filter const *> raw;
+ for (auto& filter: _filters) {
+ raw.push_back (&filter);
+ }
+ return raw;
}
}
+
/** Set up the static _filters vector; must be called before from_*
* methods are used.
*/
/** Set up the static _filters vector; must be called before from_*
* methods are used.
*/
@@
-81,6
+93,7
@@
Filter::setup_filters ()
maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"));
}
maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"));
}
+
void
Filter::maybe_add (string i, string n, string c, string f)
{
void
Filter::maybe_add (string i, string n, string c, string f)
{
@@
-90,11
+103,12
@@
Filter::maybe_add (string i, string n, string c, string f)
check_name = check_name.substr (0, end);
}
check_name = check_name.substr (0, end);
}
- if (avfilter_get_by_name
(check_name.c_str())) {
- _filters.push_back (
new Filter
(i, n, c, f));
+ if (avfilter_get_by_name(check_name.c_str())) {
+ _filters.push_back (
Filter
(i, n, c, f));
}
}
}
}
+
/** @param filters Set of filters.
* @return String to pass to FFmpeg for the video filters.
*/
/** @param filters Set of filters.
* @return String to pass to FFmpeg for the video filters.
*/
@@
-103,7
+117,7
@@
Filter::ffmpeg_string (vector<Filter const *> const & filters)
{
string ff;
{
string ff;
-
BOOST_FOREACH (Filter const * i,
filters) {
+
for (auto const i:
filters) {
if (!ff.empty ()) {
ff += N_(",");
}
if (!ff.empty ()) {
ff += N_(",");
}
@@
-113,20
+127,21
@@
Filter::ffmpeg_string (vector<Filter const *> const & filters)
return ff;
}
return ff;
}
+
/** @param d Our id.
* @return Corresponding Filter, or 0.
*/
Filter const *
Filter::from_id (string d)
{
/** @param d Our id.
* @return Corresponding Filter, or 0.
*/
Filter const *
Filter::from_id (string d)
{
-
vector<Filter const *>::iterator
i = _filters.begin ();
- while (i != _filters.end() &&
(*i)
->id() != d) {
+
auto
i = _filters.begin ();
+ while (i != _filters.end() &&
i
->id() != d) {
++i;
}
if (i == _filters.end ()) {
++i;
}
if (i == _filters.end ()) {
- return
0
;
+ return
nullptr
;
}
}
- return
*i
;
+ return
&(*i)
;
}
}