diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-25 16:49:14 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-05-07 09:29:59 +0200 |
| commit | fd49966b7fb987f074c703441d5bb1f2d2a75fcf (patch) | |
| tree | cd794f7747226496e486769642caf159f00c8803 | |
| parent | fdb5601d6551eb60d835bc03896d9799d0707d9f (diff) | |
Add and use Piece::has_text().
| -rw-r--r-- | src/lib/piece.cc | 8 | ||||
| -rw-r--r-- | src/lib/piece.h | 1 | ||||
| -rw-r--r-- | src/lib/player.cc | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/piece.cc b/src/lib/piece.cc index 6dddc798c..2a3adcd40 100644 --- a/src/lib/piece.cc +++ b/src/lib/piece.cc @@ -216,3 +216,11 @@ Piece::reference_dcp_audio () const auto dcp = dynamic_pointer_cast<DCPContent>(_content); return dcp && dcp->reference_audio(); } + + +bool +Piece::has_text () const +{ + return !decoder->text.empty(); +} + diff --git a/src/lib/piece.h b/src/lib/piece.h index 527f65c62..6c0df23c2 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -71,6 +71,7 @@ public: std::shared_ptr<Decoder> decoder_for (std::shared_ptr<Content> content) const; dcpomatic::DCPTime decoder_position () const; + bool has_text () const; std::shared_ptr<Decoder> decoder; boost::optional<dcpomatic::DCPTimePeriod> ignore_video; diff --git a/src/lib/player.cc b/src/lib/player.cc index e99eb9dae..23db8433f 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -610,7 +610,7 @@ Player::pass () /* 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())) { + if (!earliest_time || t < *earliest_time || (t == *earliest_time && i->has_text())) { earliest_time = t; earliest_content = i; } |
