summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-11-09 15:05:22 +0000
committerCarl Hetherington <cth@carlh.net>2015-11-18 20:51:16 +0000
commit67705b5665715abebfdd33e9f36797f040bc3e79 (patch)
treee76484da8e36501f48600a7760f181144b28edb0 /src/lib
parent61fe776a5e04044ca28e5bbd63ce746be580f29b (diff)
Make Filter applicable to audio or video filters.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/filter.cc45
-rw-r--r--src/lib/filter.h16
2 files changed, 30 insertions, 31 deletions
diff --git a/src/lib/filter.cc b/src/lib/filter.cc
index c9876c05b..d0e8c8fa4 100644
--- a/src/lib/filter.cc
+++ b/src/lib/filter.cc
@@ -18,13 +18,14 @@
*/
/** @file src/filter.cc
- * @brief A class to describe one of FFmpeg's video or post-processing filters.
+ * @brief A class to describe one of FFmpeg's video or audio filters.
*/
#include "filter.h"
extern "C" {
#include <libavfilter/avfilter.h>
}
+#include <boost/foreach.hpp>
#include "i18n.h"
@@ -35,13 +36,13 @@ vector<Filter const *> Filter::_filters;
/** @param i Our id.
* @param n User-visible name.
* @param c User-visible category.
- * @param v String for a FFmpeg video filter descriptor.
+ * @param f String for a FFmpeg filter descriptor.
*/
-Filter::Filter (string i, string n, string c, string v)
+Filter::Filter (string i, string n, string c, string f)
: _id (i)
, _name (n)
, _category (c)
- , _vf (v)
+ , _ffmpeg (f)
{
}
@@ -53,7 +54,6 @@ Filter::all ()
return _filters;
}
-
/** Set up the static _filters vector; must be called before from_*
* methods are used.
*/
@@ -62,22 +62,22 @@ Filter::setup_filters ()
{
/* Note: "none" is a magic id name, so don't use it here */
- maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint"));
- maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint"));
- maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif"));
- maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun"));
- maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp"));
- maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d"));
- maybe_add (N_("hqdn3d"), _("High quality 3D denoiser"), _("Noise reduction"), N_("hqdn3d"));
- maybe_add (N_("telecine"), _("Telecine filter"), _("Misc"), N_("telecine"));
- maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"));
+ maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint"));
+ maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint"));
+ maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif"));
+ maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun"));
+ maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp"));
+ maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d"));
+ maybe_add (N_("hqdn3d"), _("High quality 3D denoiser"), _("Noise reduction"), N_("hqdn3d"));
+ maybe_add (N_("telecine"), _("Telecine filter"), _("Misc"), N_("telecine"));
+ maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"));
}
void
-Filter::maybe_add (string i, string n, string c, string v)
+Filter::maybe_add (string i, string n, string c, string f)
{
if (avfilter_get_by_name (i.c_str())) {
- _filters.push_back (new Filter (i, n, c, v));
+ _filters.push_back (new Filter (i, n, c, f));
}
}
@@ -87,16 +87,16 @@ Filter::maybe_add (string i, string n, string c, string v)
string
Filter::ffmpeg_string (vector<Filter const *> const & filters)
{
- string vf;
+ string ff;
- for (vector<Filter const *>::const_iterator i = filters.begin(); i != filters.end(); ++i) {
- if (!vf.empty ()) {
- vf += N_(",");
+ BOOST_FOREACH (Filter const * i, filters) {
+ if (!ff.empty ()) {
+ ff += N_(",");
}
- vf += (*i)->vf ();
+ ff += i->ffmpeg ();
}
- return vf;
+ return ff;
}
/** @param d Our id.
@@ -116,4 +116,3 @@ Filter::from_id (string d)
return *i;
}
-
diff --git a/src/lib/filter.h b/src/lib/filter.h
index 39687fcd4..b132398d0 100644
--- a/src/lib/filter.h
+++ b/src/lib/filter.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
*/
/** @file src/filter.h
- * @brief A class to describe one of FFmpeg's video or post-processing filters.
+ * @brief A class to describe one of FFmpeg's video or audio filters.
*/
#ifndef DCPOMATIC_FILTER_H
@@ -29,7 +29,7 @@
#include <vector>
/** @class Filter
- * @brief A class to describe one of FFmpeg's video filters.
+ * @brief A class to describe one of FFmpeg's video or audio filters.
*
* We don't support FFmpeg's post-processing filters here as they cannot cope with greater than
* 8bpp. FFmpeg quantizes e.g. yuv422p10le down to yuv422p before running such filters, which
@@ -50,9 +50,9 @@ public:
return _name;
}
- /** @return string for a FFmpeg video filter descriptor */
- std::string vf () const {
- return _vf;
+ /** @return string for a FFmpeg filter descriptor */
+ std::string ffmpeg () const {
+ return _ffmpeg;
}
std::string category () const {
@@ -71,8 +71,8 @@ private:
/** user-visible name */
std::string _name;
std::string _category;
- /** string for a FFmpeg video filter descriptor */
- std::string _vf;
+ /** string for a FFmpeg filter descriptor */
+ std::string _ffmpeg;
/** all available filters */
static std::vector<Filter const *> _filters;