Add accessor for _text.
[dcpomatic.git] / src / lib / shuffler.cc
index 2b3c5ba84c4c72da4a1687b3ec60201dece1c95c..5a4faf4d15fa4c0f74617bd2bd03ecd57f1ba114 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,6 +18,7 @@
 
 */
 
+
 #include "shuffler.h"
 #include "content_video.h"
 #include "dcpomatic_assert.h"
 #include <string>
 #include <iostream>
 
+
 using std::make_pair;
+using std::shared_ptr;
 using std::string;
 using std::weak_ptr;
-using std::shared_ptr;
 using boost::optional;
 
+
 int const Shuffler::_max_size = 64;
 
+
 struct Comparator
 {
        bool operator()(Shuffler::Store const & a, Shuffler::Store const & b) {
@@ -43,21 +47,22 @@ struct Comparator
        }
 };
 
+
 void
 Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
 {
        LOG_DEBUG_THREE_D ("Shuffler::video frame=%1 eyes=%2 part=%3", video.frame, static_cast<int>(video.eyes), static_cast<int>(video.part));
 
-       if (video.eyes != EYES_LEFT && video.eyes != EYES_RIGHT) {
+       if (video.eyes != Eyes::LEFT && video.eyes != Eyes::RIGHT) {
                /* Pass through anything that we don't care about */
                Video (weak_piece, video);
                return;
        }
 
-       shared_ptr<Piece> piece = weak_piece.lock ();
+       auto piece = weak_piece.lock ();
        DCPOMATIC_ASSERT (piece);
 
-       if (!_last && video.eyes == EYES_LEFT) {
+       if (!_last && video.eyes == Eyes::LEFT) {
                LOG_DEBUG_THREE_D_NC ("Shuffler first after clear");
                /* We haven't seen anything since the last clear() and we have some eyes-left so assume everything is OK */
                Video (weak_piece, video);
@@ -74,8 +79,8 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
                        !_store.empty() &&
                        _last &&
                        (
-                               (_store.front().second.frame == _last->frame       && _store.front().second.eyes == EYES_RIGHT && _last->eyes == EYES_LEFT) ||
-                               (_store.front().second.frame >= (_last->frame + 1) && _store.front().second.eyes == EYES_LEFT  && _last->eyes == EYES_RIGHT)
+                               (_store.front().second.frame == _last->frame       && _store.front().second.eyes == Eyes::RIGHT && _last->eyes == Eyes::LEFT) ||
+                               (_store.front().second.frame >= (_last->frame + 1) && _store.front().second.eyes == Eyes::LEFT  && _last->eyes == Eyes::RIGHT)
                                );
 
                if (!store_front_in_sequence) {
@@ -103,6 +108,7 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video)
        }
 }
 
+
 void
 Shuffler::clear ()
 {
@@ -111,6 +117,7 @@ Shuffler::clear ()
        _last = optional<ContentVideo>();
 }
 
+
 void
 Shuffler::flush ()
 {