From: Carl Hetherington Date: Mon, 24 May 2021 21:16:07 +0000 (+0200) Subject: Use decoder_factory() and a lambda to clean things up a bit. X-Git-Tag: v2.15.152~15 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=cc0f518888dcb750018458d784cc844aef478854 Use decoder_factory() and a lambda to clean things up a bit. --- diff --git a/test/video_level_test.cc b/test/video_level_test.cc index acf7fb4e2..c7e255394 100644 --- a/test/video_level_test.cc +++ b/test/video_level_test.cc @@ -28,6 +28,7 @@ #include "lib/content_factory.h" #include "lib/content_video.h" #include "lib/dcp_content.h" +#include "lib/decoder_factory.h" #include "lib/film.h" #include "lib/ffmpeg_content.h" #include "lib/ffmpeg_decoder.h" @@ -125,17 +126,6 @@ BOOST_AUTO_TEST_CASE (ffmpeg_image_video_range_expanded) } -static optional content_video; - - -static -void -video_handler (ContentVideo cv) -{ - content_video = cv; -} - - static pair pixel_range (shared_ptr image) @@ -197,26 +187,13 @@ pixel_range (shared_ptr image) static pair -pixel_range (shared_ptr film, shared_ptr content) -{ - auto decoder = make_shared(film, content, false); - decoder->video->Data.connect (bind(&video_handler, _1)); - content_video = boost::none; - while (!content_video) { - BOOST_REQUIRE (!decoder->pass()); - } - - return pixel_range (content_video->image->image().image); -} - - -static -pair -pixel_range (shared_ptr film, shared_ptr content) +pixel_range (shared_ptr film, shared_ptr content) { - auto decoder = make_shared(film, content); - decoder->video->Data.connect (bind(&video_handler, _1)); - content_video = boost::none; + auto decoder = decoder_factory(film, content, false, false, shared_ptr()); + optional content_video; + decoder->video->Data.connect ([&content_video](ContentVideo cv) { + content_video = cv; + }); while (!content_video) { BOOST_REQUIRE (!decoder->pass()); }