X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fshuffler.cc;h=5a4faf4d15fa4c0f74617bd2bd03ecd57f1ba114;hb=94d5ba335224db075a95a76654f732ef54a4eabd;hp=2b3c5ba84c4c72da4a1687b3ec60201dece1c95c;hpb=4985d87750c87019dfe5dc7ef44e12c45326dd0e;p=dcpomatic.git diff --git a/src/lib/shuffler.cc b/src/lib/shuffler.cc index 2b3c5ba84..5a4faf4d1 100644 --- a/src/lib/shuffler.cc +++ b/src/lib/shuffler.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018-2020 Carl Hetherington + Copyright (C) 2018-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,6 +18,7 @@ */ + #include "shuffler.h" #include "content_video.h" #include "dcpomatic_assert.h" @@ -25,14 +26,17 @@ #include #include + 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 weak_piece, ContentVideo video) { LOG_DEBUG_THREE_D ("Shuffler::video frame=%1 eyes=%2 part=%3", video.frame, static_cast(video.eyes), static_cast(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 = 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 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 weak_piece, ContentVideo video) } } + void Shuffler::clear () { @@ -111,6 +117,7 @@ Shuffler::clear () _last = optional(); } + void Shuffler::flush () {