2 Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "frame_interval_checker.h"
25 using namespace dcpomatic;
28 int const FrameIntervalChecker::_frames = 16;
32 FrameIntervalChecker::feed (ContentTime time, double frame_rate)
34 /* The caller isn't meant to feed too much data before
35 calling guess() and destroying the FrameIntervalChecker.
37 DCPOMATIC_ASSERT (_intervals.size() < _frames);
40 _intervals.push_back ((time - *_last).seconds() * frame_rate);
47 FrameIntervalChecker::Guess
48 FrameIntervalChecker::guess () const
50 if (_intervals.size() < _frames) {
51 /* How soon can you land?
53 * You can tell me, I'm a doctor.
54 * No I mean I'm just not sure.
55 * Can't you take a guess?
56 * Well, not for another two hours.
57 * You can't take a guess for another two hours?
63 for (auto i: _intervals) {
69 return (near_1 < 3 * _frames / 4) ? PROBABLY_3D : PROBABLY_NOT_3D;