From: Carl Hetherington Date: Wed, 18 Dec 2013 14:49:57 +0000 (+0000) Subject: Repeat frames rather than using black for missing frames when we're inside some content. X-Git-Tag: v2.0.48~922^2~48 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=c226f90a2c113b8bbc270f29e6aa035ae1229d57 Repeat frames rather than using black for missing frames when we're inside some content. --- diff --git a/src/lib/player.cc b/src/lib/player.cc index d60dfb6a9..a79a4fc5e 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -158,8 +158,20 @@ Player::pass () if (dv) { if (!_just_did_inaccurate_seek && earliest_time > _video_position) { - /* XXX: if we're inside some content, repeat the last frame... otherwise emit black */ - emit_black (); + + /* See if we're inside some video content */ + list >::iterator i = _pieces.begin(); + while (i != _pieces.end() && ((*i)->content->position() >= _video_position || _video_position >= (*i)->content->end())) { + ++i; + } + + if (i == _pieces.end() || !_last_incoming_video.video || !_have_valid_pieces) { + /* We're outside all video content */ + emit_black (); + } else { + _last_incoming_video.video->dcp_time = _video_position; + emit_video (_last_incoming_video.weak_piece, _last_incoming_video.video); + } } else { emit_video (earliest_piece, dv); earliest_piece->decoder->get (); diff --git a/test/test.cc b/test/test.cc index 92ce95656..df2cb1c4b 100644 --- a/test/test.cc +++ b/test/test.cc @@ -95,10 +95,10 @@ new_test_film (string name) } static void -check_file (string ref, string check) +check_file (boost::filesystem::path ref, boost::filesystem::path check) { uintmax_t N = boost::filesystem::file_size (ref); - BOOST_CHECK_EQUAL (N, boost::filesystem::file_size(check)); + BOOST_CHECK_EQUAL (N, boost::filesystem::file_size (check)); FILE* ref_file = fopen (ref.c_str(), "rb"); BOOST_CHECK (ref_file); FILE* check_file = fopen (check.c_str(), "rb"); @@ -135,7 +135,7 @@ note (libdcp::NoteType t, string n) } void -check_dcp (string ref, string check) +check_dcp (boost::filesystem::path ref, boost::filesystem::path check) { libdcp::DCP ref_dcp (ref); ref_dcp.read (); diff --git a/test/test.h b/test/test.h index e49dfc276..c58296665 100644 --- a/test/test.h +++ b/test/test.h @@ -23,6 +23,6 @@ class Film; extern void wait_for_jobs (); extern boost::shared_ptr new_test_film (std::string); -extern void check_dcp (std::string, std::string); +extern void check_dcp (boost::filesystem::path, boost::filesystem::path); extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list); extern boost::filesystem::path test_film_dir (std::string); diff --git a/test/wscript b/test/wscript index df9aa88d3..1a924ba0d 100644 --- a/test/wscript +++ b/test/wscript @@ -36,6 +36,7 @@ def build(bld): pixel_formats_test.cc play_test.cc ratio_test.cc + repeat_frame_test.cc resampler_test.cc scaling_test.cc silence_padding_test.cc