From 6097970d8015995ef36bfdde479515ff3bc83930 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 23 Jun 2020 23:01:10 +0200 Subject: Move some stuff for position checking. --- src/lib/piece.h | 3 +++ src/lib/player.cc | 21 +++++++-------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/lib/piece.h b/src/lib/piece.h index 31fbfc256..f150dfe53 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -22,6 +22,7 @@ #define DCPOMATIC_PIECE_H #include "audio_stream.h" +#include "dcpomatic_font.h" #include "dcpomatic_time.h" #include "frame_rate_change.h" #include "types.h" @@ -36,6 +37,8 @@ public: void update_pull_to (dcpomatic::DCPTime& pull_to) const; void set_last_push_end (AudioStreamPtr stream, dcpomatic::DCPTime last_push_end); + boost::optional position (boost::shared_ptr film); + bool has_text () const; dcpomatic::DCPTime position () const; dcpomatic::DCPTime end (boost::shared_ptr film) const; diff --git a/src/lib/player.cc b/src/lib/player.cc index 9445d63b8..a0bd257be 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -557,21 +557,14 @@ Player::pass () optional earliest_time; BOOST_FOREACH (shared_ptr i, _pieces) { - if (i->done) { - continue; - } - - DCPTime const t = content_time_to_dcp (i, max(i->decoder->position(), i->content->trim_start())); - if (t > i->end(_film)) { - i->done = true; - } else { - - /* Given two choices at the same time, pick the one with texts so we see it before - the video. - */ - if (!earliest_time || t < *earliest_time || (t == *earliest_time && !i->decoder->text.empty())) { - earliest_time = t; + optional t = i->position (); + /* Given two choices at the same time, pick the one with texts so we see it before + the video. + */ + if (t) { + if (!earliest_time || *t < *earliest_time || (*t == *earliest_time && i->has_text())) { earliest_content = i; + earliest_time = *t; } } } -- cgit v1.2.3