Repeat frames rather than using black for missing frames when we're inside some content.
authorCarl Hetherington <cth@carlh.net>
Wed, 18 Dec 2013 14:49:57 +0000 (14:49 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 Dec 2013 14:49:57 +0000 (14:49 +0000)
src/lib/player.cc
test/test.cc
test/test.h
test/wscript

index d60dfb6a9b339508fd2bf1fb5fe1f9586674f036..a79a4fc5e350b3625f0772aeabebb2d6d059c1d8 100644 (file)
@@ -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<shared_ptr<Piece> >::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 ();
index 92ce95656dfd4ba021fb83b8bf5acbd66a951953..df2cb1c4b03b256da63861c589dc267d024f203f 100644 (file)
@@ -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 ();
index e49dfc276fb58db43109bf27cb360354e28b734a..c582966655ddc6c6ed4b6f8e2ceb0cefb14f240f 100644 (file)
@@ -23,6 +23,6 @@ class Film;
 
 extern void wait_for_jobs ();
 extern boost::shared_ptr<Film> 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<std::string>);
 extern boost::filesystem::path test_film_dir (std::string);
index df9aa88d3d8d72ff420df856d69d1f7f9d9ab5c8..1a924ba0d0c5f8ea18fff197d5f9c70223c98291 100644 (file)
@@ -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