Add Piece::reference_dcp_audio().
[dcpomatic.git] / src / lib / player.cc
index dfd005c9c32aa1b89d93ab1e7ad52340f8f7ab14..086cfbbbd7b259d447a5e68d01abe364b5b8d8c6 100644 (file)
@@ -259,7 +259,7 @@ Player::setup_pieces_unlocked ()
        }
 
        for (auto i = _pieces.begin(); i != _pieces.end(); ++i) {
-               if ((*i)->use_video() && (*i)->content->video->frame_type() != VideoFrameType::THREE_D_LEFT && (*i)->content->video->frame_type() != VideoFrameType::THREE_D_RIGHT) {
+               if ((*i)->use_video() && (*i)->video_frame_type() != VideoFrameType::THREE_D_LEFT && (*i)->video_frame_type() != VideoFrameType::THREE_D_RIGHT) {
                        /* Look for content later in the content list with in-use video that overlaps this */
                        auto period = DCPTimePeriod((*i)->position(), (*i)->end(_film));
                        auto j = i;
@@ -585,7 +585,7 @@ Player::pass ()
                        continue;
                }
 
-               auto const t = i->content_time_to_dcp (max(i->decoder->position(), i->content->trim_start()));
+               auto const t = i->decoder_position ();
                if (t > i->end(_film)) {
                        i->done = true;
                } else {
@@ -626,15 +626,13 @@ Player::pass ()
        switch (which) {
        case CONTENT:
        {
-               LOG_DEBUG_PLAYER ("Calling pass() on %1", earliest_content->content->path(0));
-               earliest_content->done = earliest_content->decoder->pass ();
-               auto dcp = dynamic_pointer_cast<DCPContent>(earliest_content->content);
-               if (dcp && !_play_referenced && dcp->reference_audio()) {
+               earliest_content->pass();
+               if (!_play_referenced && earliest_content->reference_dcp_audio()) {
                        /* We are skipping some referenced DCP audio content, so we need to update _last_audio_time
                           to `hide' the fact that no audio was emitted during the referenced DCP (though
                           we need to behave as though it was).
                        */
-                       _last_audio_time = dcp->end (_film);
+                       _last_audio_time = earliest_content->end (_film);
                }
                break;
        }