Cleanup: use a lambda.
authorCarl Hetherington <cth@carlh.net>
Sun, 10 Dec 2023 15:20:02 +0000 (16:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 12 Dec 2023 14:03:23 +0000 (15:03 +0100)
src/lib/filter.cc
src/lib/filter.h

index 18faa747a4b4adbca2326cdbe87f76b620d7b577..5a94c0b43ecd5a8c7d1a6aa39bab4c46d7a3d897 100644 (file)
@@ -75,6 +75,19 @@ Filter::setup_filters ()
 {
        /* Note: "none" is a magic id name, so don't use it here */
 
+       auto maybe_add = [](string id, string name, string category, string ffmpeg)
+       {
+               string check_name = ffmpeg;
+               size_t end = check_name.find("=");
+               if (end != string::npos) {
+                       check_name = check_name.substr(0, end);
+               }
+
+               if (avfilter_get_by_name(check_name.c_str())) {
+                       _filters.push_back(Filter(id, name, category, ffmpeg));
+               }
+       };
+
        maybe_add (N_("vflip"),       _("Vertical flip"),                    _("Orientation"),     N_("vflip"));
        maybe_add (N_("hflip"),       _("Horizontal flip"),                  _("Orientation"),     N_("hflip"));
        maybe_add (N_("90clock"),     _("Rotate 90 degrees clockwise"),      _("Orientation"),     N_("transpose=dir=clock"));
@@ -93,21 +106,6 @@ Filter::setup_filters ()
 }
 
 
-void
-Filter::maybe_add (string i, string n, string c, string f)
-{
-       string check_name = f;
-       size_t end = check_name.find("=");
-       if (end != string::npos) {
-               check_name = check_name.substr (0, end);
-       }
-
-       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.
  */
index a24d0e0d6f392fb4c285a75bb12220a51070fc7d..bcc40dad7c88fa162b63a893f9a804de4e50e1d1 100644 (file)
@@ -81,7 +81,6 @@ private:
 
        /** all available filters */
        static std::vector<Filter> _filters;
-       static void maybe_add (std::string, std::string, std::string, std::string);
 };