Fix missing subtitle when it is at the same time as some video in different content.
authorCarl Hetherington <cth@carlh.net>
Tue, 11 Jul 2017 09:12:25 +0000 (10:12 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 11 Jul 2017 09:12:25 +0000 (10:12 +0100)
src/lib/player.cc

index be6ff2bb44a00db1fd8472d2c50d1b775f65b796..fb9e208fa7d8992b0a9d99a91e41ed0cab316edb 100644 (file)
@@ -511,7 +511,10 @@ Player::pass ()
        BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
                if (!i->done) {
                        DCPTime const t = content_time_to_dcp (i, i->decoder->position());
-                       if (!earliest || t < earliest_content) {
+                       /* Given two choices at the same time, pick the one with a subtitle so we see it before
+                          the video.
+                       */
+                       if (!earliest || t < earliest_content || (t == earliest_content && i->decoder->subtitle)) {
                                earliest_content = t;
                                earliest = i;
                        }
@@ -520,7 +523,7 @@ Player::pass ()
 
        bool done = false;
 
-       if (!_black.done() && (!earliest ||_black.position() < earliest_content)) {
+       if (!_black.done() && (!earliest || _black.position() < earliest_content)) {
                /* There is some black that must be emitted */
                emit_video (black_player_video_frame(), _black.position());
                _black.set_position (_black.position() + one_video_frame());