summaryrefslogtreecommitdiff
path: root/src/lib/video_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-22 16:23:23 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-22 16:23:23 +0100
commit8349f0c97d98c0b7550ff4c76ad25f8f06270d6a (patch)
treebf441e13142b2810ac4e46cf94d4204ec4e037d5 /src/lib/video_decoder.cc
parent75712cfaf2a8ec8904d7d9552c542a2245bbbc17 (diff)
Basics of front-end 3D (as far as viewer, at least).
Diffstat (limited to 'src/lib/video_decoder.cc')
-rw-r--r--src/lib/video_decoder.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc
index 38d5dfcb8..eaa4534e4 100644
--- a/src/lib/video_decoder.cc
+++ b/src/lib/video_decoder.cc
@@ -25,8 +25,9 @@
using std::cout;
using boost::shared_ptr;
-VideoDecoder::VideoDecoder (shared_ptr<const Film> f)
+VideoDecoder::VideoDecoder (shared_ptr<const Film> f, shared_ptr<const VideoContent> c)
: Decoder (f)
+ , _video_content (c)
, _video_position (0)
{
@@ -35,7 +36,19 @@ VideoDecoder::VideoDecoder (shared_ptr<const Film> f)
void
VideoDecoder::video (shared_ptr<const Image> image, bool same, VideoContent::Frame frame)
{
- Video (image, same, frame);
+ switch (_video_content->video_frame_type ()) {
+ case VIDEO_FRAME_TYPE_2D:
+ Video (image, EYES_BOTH, same, frame);
+ break;
+ case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
+ {
+ int const half = image->size().width / 2;
+ Video (image->crop (Crop (0, half, 0, 0), true), EYES_LEFT, same, frame);
+ Video (image->crop (Crop (half, 0, 0, 0), true), EYES_RIGHT, same, frame);
+ break;
+ }
+ }
+
_video_position = frame + 1;
}