Include audio mapping in the digest used to distinguish different
[dcpomatic.git] / src / lib / filter.cc
index 9a662f90fd2b2d990adbc931dc74d6a804187f32..a7dd9c5cee61c1f2e935705681f574a2a847ce17 100644 (file)
 #include "filter.h"
 extern "C" {
 #include <libavfilter/avfilter.h>
-#include <libpostproc/postprocess.h>
 }
 
+#include "i18n.h"
+
 using namespace std;
 
 vector<Filter const *> Filter::_filters;
@@ -34,15 +35,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, or "".
- *  @param p String for a FFmpeg post-processing descriptor, or "".
+ *  @param v String for a FFmpeg video filter descriptor.
  */
-Filter::Filter (string i, string n, string c, string v, string p)
+Filter::Filter (string i, string n, string c, string v)
        : _id (i)
        , _name (n)
        , _category (c)
        , _vf (v)
-       , _pp (p)
 {
 
 }
@@ -63,75 +62,41 @@ Filter::setup_filters ()
 {
        /* Note: "none" is a magic id name, so don't use it here */
           
-       maybe_add ("pphb",      "Horizontal deblocking filter",                "De-blocking",     "",          "hb");
-       maybe_add ("ppvb",      "Vertical deblocking filter",                  "De-blocking",     "",          "vb");
-       maybe_add ("ppha",      "Horizontal deblocking filter A",              "De-blocking",     "",          "ha");
-       maybe_add ("ppva",      "Vertical deblocking filter A",                "De-blocking",     "",          "va");
-       maybe_add ("pph1",      "Experimental horizontal deblocking filter 1", "De-blocking",     "",          "h1");
-       maybe_add ("pphv",      "Experimental vertical deblocking filter 1",   "De-blocking",     "",          "v1");
-       maybe_add ("ppdr",      "Deringing filter",                            "Misc",            "",          "dr");
-       maybe_add ("pplb",      "Linear blend deinterlacer",                   "De-interlacing",  "",          "lb");
-       maybe_add ("ppli",      "Linear interpolating deinterlacer",           "De-interlacing",  "",          "li");
-       maybe_add ("ppci",      "Cubic interpolating deinterlacer",            "De-interlacing",  "",          "ci");
-       maybe_add ("ppmd",      "Median deinterlacer",                         "De-interlacing",  "",          "md");
-       maybe_add ("ppfd",      "FFMPEG deinterlacer",                         "De-interlacing",  "",          "fd");
-       maybe_add ("ppl5",      "FIR low-pass deinterlacer",                   "De-interlacing",  "",          "l5");
-       maybe_add ("mcdeint",   "Motion compensating deinterlacer",            "De-interlacing",  "mcdeint",   "");
-       maybe_add ("kerndeint", "Kernel deinterlacer",                         "De-interlacing",  "kerndeint", "");
-       maybe_add ("yadif",     "Yet Another Deinterlacing Filter",            "De-interlacing",  "yadif",     "");
-       maybe_add ("pptn",      "Temporal noise reducer",                      "Noise reduction", "",          "tn");
-       maybe_add ("ppfq",      "Force quantizer",                             "Misc",            "",          "fq");
-       maybe_add ("gradfun",   "Gradient debander",                           "Misc",            "gradfun",   "");
-       maybe_add ("unsharp",   "Unsharp mask and Gaussian blur",              "Misc",            "unsharp",   "");
-       maybe_add ("denoise3d", "3D denoiser",                                 "Noise reduction", "denoise3d", "");
-       maybe_add ("hqdn3d",    "High quality 3D denoiser",                    "Noise reduction", "hqdn3d",    "");
-       maybe_add ("telecine",  "Telecine filter",                             "Misc",            "telecine",  "");
-       maybe_add ("ow",        "Overcomplete wavelet denoiser",               "Noise reduction", "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, string p)
+Filter::maybe_add (string i, string n, string c, string v)
 {
-       if (!v.empty ()) {
-               if (avfilter_get_by_name (i.c_str())) {
-                       _filters.push_back (new Filter (i, n, c, v, p));
-               }
-       } else if (!p.empty ()) {
-               pp_mode* m = pp_get_mode_by_name_and_quality (p.c_str(), PP_QUALITY_MAX);
-               if (m) {
-                       _filters.push_back (new Filter (i, n, c, v, p));
-                       pp_free_mode (m);
-               }
+       if (avfilter_get_by_name (i.c_str())) {
+               _filters.push_back (new Filter (i, n, c, v));
        }
 }
 
 /** @param filters Set of filters.
- *  @return A pair; .first is a string to pass to FFmpeg for the video filters,
- *  .second is a string to pass for the post-processors.
+ *  @return String to pass to FFmpeg for the video filters.
  */
-pair<string, string>
-Filter::ffmpeg_strings (vector<Filter const *> const & filters)
+string
+Filter::ffmpeg_string (vector<Filter const *> const & filters)
 {
        string vf;
-       string pp;
 
        for (vector<Filter const *>::const_iterator i = filters.begin(); i != filters.end(); ++i) {
-               if (!(*i)->vf().empty ()) {
-                       if (!vf.empty ()) {
-                               vf += ",";
-                       }
-                       vf += (*i)->vf ();
-               }
-               
-               if (!(*i)->pp().empty ()) {
-                       if (!pp.empty()) {
-                               pp += ",";
-                       }
-                       pp += (*i)->pp ();
+               if (!vf.empty ()) {
+                       vf += N_(",");
                }
+               vf += (*i)->vf ();
        }
 
-       return make_pair (vf, pp);
+       return vf;
 }
 
 /** @param d Our id.