+
+ if (_frame_interval_checker->guess() != FrameIntervalChecker::AGAIN) {
+ _frame_interval_checker.reset ();
+ }
+ }
+
+ Frame frame;
+ Eyes eyes = Eyes::BOTH;
+ if (!_position) {
+ /* This is the first data we have received since initialisation or seek. Set
+ the position based on the frame that was given. After this first time
+ we just cound frames, since (as with audio) it seems that ContentTimes
+ are unreliable from FFmpegDecoder. They are much better than audio times
+ but still we get the occasional one which is duplicated. In this case
+ ffmpeg seems to carry on regardless, processing the video frame as normal.
+ If we drop the frame with the duplicated timestamp we obviously lose sync.
+ */
+ _position = ContentTime::from_frames (decoder_frame, afr);
+ if (vft == VideoFrameType::THREE_D_ALTERNATE) {
+ frame = decoder_frame / 2;
+ _last_emitted_eyes = Eyes::RIGHT;
+ } else {
+ frame = decoder_frame;
+ }
+ } else {
+ if (vft == VideoFrameType::THREE_D || vft == VideoFrameType::THREE_D_ALTERNATE) {
+ DCPOMATIC_ASSERT (_last_emitted_eyes);
+ if (_last_emitted_eyes.get() == Eyes::RIGHT) {
+ frame = _position->frames_round(afr) + 1;
+ eyes = Eyes::LEFT;
+ } else {
+ frame = _position->frames_round(afr);
+ eyes = Eyes::RIGHT;
+ }
+ } else {
+ frame = _position->frames_round(afr) + 1;
+ }
+ }
+
+ switch (vft) {
+ case VideoFrameType::TWO_D:
+ Data (ContentVideo (image, frame, Eyes::BOTH, Part::WHOLE));
+ break;
+ case VideoFrameType::THREE_D:
+ {
+ Data (ContentVideo (image, frame, eyes, Part::WHOLE));