diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-08-17 23:00:12 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-08-17 23:00:12 +0100 |
| commit | d184945d41ea7d6e489621dc6492a93b5d91f7de (patch) | |
| tree | d464fc4d700a2bee193ea0d0bf584700af07e692 /src/lib | |
| parent | 59dd3e3f06efb6249c1e4105ca746f877bc8ca93 (diff) | |
Do filling correctly for separate-content L/R 3D; before it was
trying to fill each individual piece of content as if it was providing
both L and R frames.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/video_decoder.cc | 34 | ||||
| -rw-r--r-- | src/lib/video_decoder.h | 4 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 2b9b13689..1b4a625d6 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -130,9 +130,12 @@ VideoDecoder::get_video (Frame frame, bool accurate) return dec; } -/** Fill _decoded_video from `from' up to, but not including, `to' */ +/** Fill _decoded_video from `from' up to, but not including, `to' with + * a frame for one particular Eyes value (which could be EYES_BOTH, + * EYES_LEFT or EYES_RIGHT) + */ void -VideoDecoder::fill_2d (Frame from, Frame to) +VideoDecoder::fill_one_eye (Frame from, Frame to, Eyes eye) { if (to == 0) { /* Already OK */ @@ -154,14 +157,16 @@ VideoDecoder::fill_2d (Frame from, Frame to) test_gaps++; #endif _decoded_video.push_back ( - ContentVideo (filler_image, EYES_BOTH, filler_part, i) + ContentVideo (filler_image, eye, filler_part, i) ); } } -/** Fill _decoded_video from `from' up to, but not including, `to' */ +/** Fill _decoded_video from `from' up to, but not including, `to' + * adding both left and right eye frames. + */ void -VideoDecoder::fill_3d (Frame from, Frame to, Eyes eye) +VideoDecoder::fill_both_eyes (Frame from, Frame to, Eyes eye) { if (to == 0 && eye == EYES_LEFT) { /* Already OK */ @@ -236,6 +241,7 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, Frame frame) } _video_content->film()->log()->log (String::compose ("VD receives %1", frame), Log::TYPE_DEBUG_DECODE); + cout << "receive " << frame << " for " << _video_content->path(0) << "\n"; /* We may receive the same frame index twice for 3D, and we need to know when that happens. @@ -294,10 +300,20 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, Frame frame) } if (from) { - if (_video_content->video_frame_type() == VIDEO_FRAME_TYPE_2D) { - fill_2d (from.get(), to.get ()); - } else { - fill_3d (from.get(), to.get(), to_push.front().eyes); + switch (_video_content->video_frame_type ()) { + case VIDEO_FRAME_TYPE_2D: + fill_one_eye (from.get(), to.get (), EYES_BOTH); + break; + case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT: + case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM: + case VIDEO_FRAME_TYPE_3D_ALTERNATE: + fill_both_eyes (from.get(), to.get(), to_push.front().eyes); + break; + case VIDEO_FRAME_TYPE_3D_LEFT: + fill_one_eye (from.get(), to.get (), EYES_LEFT); + break; + case VIDEO_FRAME_TYPE_3D_RIGHT: + fill_one_eye (from.get(), to.get (), EYES_RIGHT); } } diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h index 5266604c5..42cfc4906 100644 --- a/src/lib/video_decoder.h +++ b/src/lib/video_decoder.h @@ -62,8 +62,8 @@ protected: void seek (ContentTime time, bool accurate); void video (boost::shared_ptr<const ImageProxy>, Frame frame); std::list<ContentVideo> decoded_video (Frame frame); - void fill_2d (Frame from, Frame to); - void fill_3d (Frame from, Frame to, Eyes); + void fill_one_eye (Frame from, Frame to, Eyes); + void fill_both_eyes (Frame from, Frame to, Eyes); boost::shared_ptr<const VideoContent> _video_content; std::list<ContentVideo> _decoded_video; |
