From: Carl Hetherington Date: Sun, 10 Dec 2023 15:20:02 +0000 (+0100) Subject: Cleanup: use a lambda. X-Git-Tag: v2.16.71~13 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=37b29fdf9028e6848470a19d189697fc58278990 Cleanup: use a lambda. --- diff --git a/src/lib/filter.cc b/src/lib/filter.cc index 18faa747a..5a94c0b43 100644 --- a/src/lib/filter.cc +++ b/src/lib/filter.cc @@ -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. */ diff --git a/src/lib/filter.h b/src/lib/filter.h index a24d0e0d6..bcc40dad7 100644 --- a/src/lib/filter.h +++ b/src/lib/filter.h @@ -81,7 +81,6 @@ private: /** all available filters */ static std::vector _filters; - static void maybe_add (std::string, std::string, std::string, std::string); };