Respect _no_video and _no_audio when filling.
authorCarl Hetherington <cth@carlh.net>
Wed, 17 May 2017 21:47:04 +0000 (22:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 17 May 2017 21:47:04 +0000 (22:47 +0100)
src/lib/player.cc
test/vf_test.cc

index ddf585ef11de79ef2f5914da3a57d919d7ac6d4a..bd33963a0234d0cb430c1106733a9d895914a4fc 100644 (file)
@@ -553,10 +553,12 @@ Player::pass ()
        /* Fill some black if we would emit before the earliest piece of content.  This is so we act like a phantom
           Piece which emits black in spaces (we only emit if we are the earliest thing)
        */
-       /* XXX: this should take _no_video into account */
        if (video_fill_from && (!earliest || *video_fill_from < earliest_content) && ((fill_towards - *video_fill_from)) >= one_video_frame()) {
-               emit_video (black_player_video_frame(), *video_fill_from);
-               filled = true;
+               list<DCPTimePeriod> p = subtract(DCPTimePeriod(*video_fill_from, *video_fill_from + one_video_frame()), _no_video);
+               if (!p.empty ()) {
+                       emit_video (black_player_video_frame(), p.front().from);
+                       filled = true;
+               }
        } else if (_playlist->length() == DCPTime()) {
                /* Special case of an empty Film; just give one black frame */
                emit_video (black_player_video_frame(), DCPTime());
@@ -575,7 +577,10 @@ Player::pass ()
                if (period.duration() > one_video_frame()) {
                        period.to = period.from + one_video_frame();
                }
-               fill_audio (period);
+               list<DCPTimePeriod> p = subtract(period, _no_video);
+               if (!p.empty ()) {
+                       fill_audio (period);
+               }
                filled = true;
        }
 
index ac8256be37fa0d9e15a03ced55d88b76f540668e..4abd12635918c51fa24a74a6b18c5ec7150844fe 100644 (file)
@@ -112,8 +112,9 @@ BOOST_AUTO_TEST_CASE (vf_test2)
        dcp->set_reference_audio (true);
        shared_ptr<Content> sub = content_factory(vf, "test/data/subrip4.srt").front();
        vf->examine_and_add_content (sub);
+       DCPOMATIC_ASSERT (!wait_for_jobs ());
        vf->make_dcp ();
-       wait_for_jobs ();
+       DCPOMATIC_ASSERT (!wait_for_jobs ());
        vf->write_metadata ();
 
        dcp::DCP ov_c (ov->dir (ov->dcp_name ()));