summaryrefslogtreecommitdiff
path: root/src/lib/video_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-02-19 16:17:39 +0000
committerCarl Hetherington <cth@carlh.net>2020-02-19 16:17:39 +0000
commit30e2e5feda0319f9c3209bb0871cbd4e3357151e (patch)
tree5169efc73c221ed71b57fb4c085f2da90f904ce9 /src/lib/video_decoder.cc
parent3443fdbc38f56f4c83776d000f6aa61d00305cc8 (diff)
Cleanups to normalise master and 2.15.x better.v2.14.27
Diffstat (limited to 'src/lib/video_decoder.cc')
-rw-r--r--src/lib/video_decoder.cc19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc
index e817c4754..b88a827c6 100644
--- a/src/lib/video_decoder.cc
+++ b/src/lib/video_decoder.cc
@@ -72,7 +72,7 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
*/
if (_frame_interval_checker) {
_frame_interval_checker->feed (frame_time, afr);
- if (_frame_interval_checker->guess() == FrameIntervalChecker::PROBABLY_NOT_3D && _content->video->frame_type() == VIDEO_FRAME_TYPE_3D) {
+ if (_frame_interval_checker->guess() == FrameIntervalChecker::PROBABLY_NOT_3D && vft == VIDEO_FRAME_TYPE_3D) {
boost::throw_exception (
DecodeError(
String::compose(
@@ -90,6 +90,7 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
}
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
@@ -100,10 +101,7 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
If we drop the frame with the duplicated timestamp we obviously lose sync.
*/
_position = ContentTime::from_frames (decoder_frame, afr);
- if (vft == VIDEO_FRAME_TYPE_3D) {
- frame = decoder_frame;
- _last_emitted_eyes = EYES_RIGHT;
- } else if (vft == VIDEO_FRAME_TYPE_3D_ALTERNATE) {
+ if (vft == VIDEO_FRAME_TYPE_3D_ALTERNATE) {
frame = decoder_frame / 2;
_last_emitted_eyes = EYES_RIGHT;
} else {
@@ -114,25 +112,22 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
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 (_content->video->frame_type ()) {
+ switch (vft) {
case VIDEO_FRAME_TYPE_2D:
Data (ContentVideo (image, frame, EYES_BOTH, PART_WHOLE));
break;
case VIDEO_FRAME_TYPE_3D:
{
- /* We should receive the same frame index twice for 3D; hence we know which
- frame this one is.
- */
- bool const same = (_last_emitted_frame && _last_emitted_frame.get() == frame);
- Eyes const eyes = same ? EYES_RIGHT : EYES_LEFT;
Data (ContentVideo (image, frame, eyes, PART_WHOLE));
_last_emitted_frame = frame;
_last_emitted_eyes = eyes;
@@ -140,8 +135,6 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im
}
case VIDEO_FRAME_TYPE_3D_ALTERNATE:
{
- DCPOMATIC_ASSERT (_last_emitted_eyes);
- Eyes const eyes = _last_emitted_eyes.get() == EYES_LEFT ? EYES_RIGHT : EYES_LEFT;
Data (ContentVideo (image, frame, eyes, PART_WHOLE));
_last_emitted_eyes = eyes;
break;