Fix video information with 3D.
authorCarl Hetherington <cth@carlh.net>
Wed, 24 Jul 2013 22:27:09 +0000 (23:27 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 24 Jul 2013 22:27:09 +0000 (23:27 +0100)
src/lib/video_content.cc
src/lib/video_content.h
src/wx/film_editor.cc
src/wx/video_panel.cc

index d70ece3404dcad3308583ea63e2c2207f9b54493..f61518ec0f5b72f80a8ec936bcebc92ece04cdad 100644 (file)
@@ -243,3 +243,17 @@ VideoContent::technical_summary () const
 {
        return String::compose ("video: length %1, size %2x%3, rate %4", video_length(), video_size().width, video_size().height, video_frame_rate());
 }
+
+libdcp::Size
+VideoContent::video_size_after_3d_split () const
+{
+       libdcp::Size const s = video_size ();
+       switch (video_frame_type ()) {
+       case VIDEO_FRAME_TYPE_2D:
+               return s;
+       case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
+               return libdcp::Size (s.width / 2, s.height);
+       }
+
+       assert (false);
+}
index 513e1f598afc502bef634547897b6b531a9f9b68..97ef6a9fae710fba1b5e7482542b817514d6490a 100644 (file)
@@ -88,6 +88,8 @@ public:
                return _ratio;
        }
 
+       libdcp::Size video_size_after_3d_split () const;
+
 protected:
        void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
 
index 5839244a4be98e5ddb9d66bd60d26a4f44d4c689..cb14f70e786676af544b46afea0737eae26a2778 100644 (file)
@@ -531,9 +531,9 @@ FilmEditor::set_film (shared_ptr<Film> f)
 
        if (!_film->content().empty ()) {
                set_selection (_film->content().front ());
-       } else {
-               content_selection_changed ();
        }
+
+       content_selection_changed ();
 }
 
 void
index f5306e67fd8e532609893ea1a0557c83e4bc10cf..edf4505c91e936c43a39ddfe170144015fef4be6 100644 (file)
@@ -183,6 +183,7 @@ VideoPanel::film_content_changed (shared_ptr<Content> c, int property)
 
        if (property == VideoContentProperty::VIDEO_FRAME_TYPE) {
                checked_set (_frame_type, vc ? vc->video_frame_type () : VIDEO_FRAME_TYPE_2D);
+               setup_description ();
        } else if (property == VideoContentProperty::VIDEO_CROP) {
                checked_set (_left_crop,   vc ? vc->crop().left : 0);
                checked_set (_right_crop,  vc ? vc->crop().right        : 0);
@@ -259,15 +260,15 @@ VideoPanel::setup_description ()
        if (vc->video_size().width && vc->video_size().height) {
                d << wxString::Format (
                        _("Content video is %dx%d (%.2f:1)\n"),
-                       vc->video_size().width, vc->video_size().height,
-                       float (vc->video_size().width) / vc->video_size().height
+                       vc->video_size_after_3d_split().width, vc->video_size_after_3d_split().height,
+                       float (vc->video_size_after_3d_split().width) / vc->video_size_after_3d_split().height
                        );
                ++lines;
        }
 
        Crop const crop = vc->crop ();
        if ((crop.left || crop.right || crop.top || crop.bottom) && vc->video_size() != libdcp::Size (0, 0)) {
-               libdcp::Size cropped = vc->video_size ();
+               libdcp::Size cropped = vc->video_size_after_3d_split ();
                cropped.width -= crop.left + crop.right;
                cropped.height -= crop.top + crop.bottom;
                d << wxString::Format (