/*
- 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.
*/
+
#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) {
}
};
+
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);
!_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) {
}
}
+
void
Shuffler::clear ()
{
_last = optional<ContentVideo>();
}
+
void
Shuffler::flush ()
{