diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-08-26 23:34:19 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-08-26 23:34:19 +0200 |
| commit | a482cc933299b015f4f108a3d7b19ee1fd9eb205 (patch) | |
| tree | 8479de1bd71777de3f4b683259d4b61fd89aab23 | |
| parent | c818f03cded6bff22b6d1096080375fbc013568f (diff) | |
Cleanup: use some lambdas.
| -rw-r--r-- | src/lib/dcp_content.cc | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 442b5bd40..8c268140e 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -664,11 +664,6 @@ DCPContent::can_reference (shared_ptr<const Film> film, function<bool (shared_pt return true; } -static -bool check_video (shared_ptr<const Content> c) -{ - return static_cast<bool>(c->video) && c->video->use(); -} bool DCPContent::can_reference_video (shared_ptr<const Film> film, string& why_not) const @@ -694,14 +689,16 @@ DCPContent::can_reference_video (shared_ptr<const Film> film, string& why_not) c } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (film, bind (&check_video, _1), _("it overlaps other video content; remove the other content."), why_not); + return can_reference( + film, + [](shared_ptr<const Content> c) { + return static_cast<bool>(c->video) && c->video->use(); + }, + _("it overlaps other video content; remove the other content."), + why_not + ); } -static -bool check_audio (shared_ptr<const Content> c) -{ - return static_cast<bool>(c->audio) && !c->audio->mapping().mapped_output_channels().empty(); -} bool DCPContent::can_reference_audio (shared_ptr<const Film> film, string& why_not) const @@ -729,14 +726,15 @@ DCPContent::can_reference_audio (shared_ptr<const Film> film, string& why_not) c } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (film, bind (&check_audio, _1), _("it overlaps other audio content; remove the other content."), why_not); + return can_reference( + film, [](shared_ptr<const Content> c) { + return static_cast<bool>(c->audio) && !c->audio->mapping().mapped_output_channels().empty(); + }, + _("it overlaps other audio content; remove the other content."), + why_not + ); } -static -bool check_text (shared_ptr<const Content> c) -{ - return !c->text.empty(); -} bool DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, string& why_not) const @@ -787,7 +785,14 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (film, bind (&check_text, _1), _("it overlaps other text content; remove the other content."), why_not); + return can_reference( + film, + [](shared_ptr<const Content> c) { + return !c->text.empty(); + }, + _("it overlaps other text content; remove the other content."), + why_not + ); } void |
