diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-05-24 23:16:07 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-05-25 21:35:12 +0200 |
| commit | cc0f518888dcb750018458d784cc844aef478854 (patch) | |
| tree | a5368e559d8a7777b186342c8fce48d909e0d343 /test | |
| parent | 5c80bd735ebf02ad476c335adbb8ad9ebd8d27a6 (diff) | |
Use decoder_factory() and a lambda to clean things up a bit.
Diffstat (limited to 'test')
| -rw-r--r-- | test/video_level_test.cc | 37 |
1 files changed, 7 insertions, 30 deletions
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<ContentVideo> content_video; - - -static -void -video_handler (ContentVideo cv) -{ - content_video = cv; -} - - static pair<int, int> pixel_range (shared_ptr<const Image> image) @@ -197,26 +187,13 @@ pixel_range (shared_ptr<const Image> image) static pair<int, int> -pixel_range (shared_ptr<Film> film, shared_ptr<const FFmpegContent> content) -{ - auto decoder = make_shared<FFmpegDecoder>(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<int, int> -pixel_range (shared_ptr<Film> film, shared_ptr<const ImageContent> content) +pixel_range (shared_ptr<const Film> film, shared_ptr<const Content> content) { - auto decoder = make_shared<ImageDecoder>(film, content); - decoder->video->Data.connect (bind(&video_handler, _1)); - content_video = boost::none; + auto decoder = decoder_factory(film, content, false, false, shared_ptr<Decoder>()); + optional<ContentVideo> content_video; + decoder->video->Data.connect ([&content_video](ContentVideo cv) { + content_video = cv; + }); while (!content_video) { BOOST_REQUIRE (!decoder->pass()); } |
