Try to fix missing icons in OS X .dmg.
[dcpomatic.git] / src / lib / video_decoder.cc
index 0616cd43778f3ade0238bd1933516487699f47d3..3ae963a202f7081322f8e9bab5ab525d0d7309cc 100644 (file)
 */
 
 #include "video_decoder.h"
-#include "subtitle.h"
-#include "film.h"
 #include "image.h"
-#include "ratio.h"
 
 #include "i18n.h"
 
 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)
 {
 
@@ -38,7 +36,29 @@ 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_ALTERNATE:
+               Video (image, (frame % 2) ? EYES_RIGHT : EYES_LEFT, same, frame / 2);
+               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;
+       }
+       case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
+       {
+               int const half = image->size().height / 2;
+               Video (image->crop (Crop (0, 0, 0, half), true), EYES_LEFT, same, frame);
+               Video (image->crop (Crop (0, 0, half, 0), true), EYES_RIGHT, same, frame);
+               break;
+       }
+       }
+       
        _video_position = frame + 1;
 }