X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fvideo_content.cc;h=a59e9669d62de990b6f4b9359476ee17bededcb4;hb=a8a0dfd1b21de6c0facf965ab119833ff6f790bf;hp=fce90ad7bded1913f8bf0a93a5d62a93f85e32df;hpb=29fe2d3a4c347e15b987f9e61e56d22a21d4678f;p=dcpomatic.git diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index fce90ad7b..a59e9669d 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -1,19 +1,20 @@ /* Copyright (C) 2013-2016 Carl Hetherington - This program is free software; you can redistribute it and/or modify + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + DCP-o-matic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with DCP-o-matic. If not, see . */ @@ -98,7 +99,33 @@ VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int versio } _length = node->number_child ("VideoLength"); - _frame_type = static_cast (node->number_child ("VideoFrameType")); + + if (version <= 34) { + /* Snapshot of the VideoFrameType enum at version 34 */ + switch (node->number_child ("VideoFrameType")) { + case 0: + _frame_type = VIDEO_FRAME_TYPE_2D; + break; + case 1: + _frame_type = VIDEO_FRAME_TYPE_3D_LEFT_RIGHT; + break; + case 2: + _frame_type = VIDEO_FRAME_TYPE_3D_TOP_BOTTOM; + break; + case 3: + _frame_type = VIDEO_FRAME_TYPE_3D_ALTERNATE; + break; + case 4: + _frame_type = VIDEO_FRAME_TYPE_3D_LEFT; + break; + case 5: + _frame_type = VIDEO_FRAME_TYPE_3D_RIGHT; + break; + } + } else { + _frame_type = string_to_video_frame_type (node->string_child ("VideoFrameType")); + } + _sample_aspect_ratio = node->optional_number_child ("SampleAspectRatio"); _crop.left = node->number_child ("LeftCrop"); _crop.right = node->number_child ("RightCrop"); @@ -186,7 +213,7 @@ VideoContent::as_xml (xmlpp::Node* node) const node->add_child("VideoLength")->add_child_text (raw_convert (_length)); node->add_child("VideoWidth")->add_child_text (raw_convert (_size.width)); node->add_child("VideoHeight")->add_child_text (raw_convert (_size.height)); - node->add_child("VideoFrameType")->add_child_text (raw_convert (static_cast (_frame_type))); + node->add_child("VideoFrameType")->add_child_text (video_frame_type_to_string (_frame_type)); if (_sample_aspect_ratio) { node->add_child("SampleAspectRatio")->add_child_text (raw_convert (_sample_aspect_ratio.get ())); } @@ -276,6 +303,7 @@ VideoContent::size_after_3d_split () const dcp::Size const s = size (); switch (frame_type ()) { case VIDEO_FRAME_TYPE_2D: + case VIDEO_FRAME_TYPE_3D: case VIDEO_FRAME_TYPE_3D_ALTERNATE: case VIDEO_FRAME_TYPE_3D_LEFT: case VIDEO_FRAME_TYPE_3D_RIGHT: @@ -402,14 +430,24 @@ VideoContent::processing_description () const d << " (" << fixed << setprecision(2) << container_size.ratio () << ":1)\n"; } + if (_parent->video_frame_rate()) { + double const vfr = _parent->video_frame_rate().get (); + + d << _("Content frame rate"); + d << " " << fixed << setprecision(4) << vfr << "\n"; + + FrameRateChange frc (vfr, film->video_frame_rate ()); + d << frc.description () << "\n"; + } + return d.str (); } void VideoContent::add_properties (list& p) const { - p.push_back (UserProperty (_("Video"), _("Length"), raw_convert (length ()), _("video frames"))); - p.push_back (UserProperty (_("Video"), _("Size"), raw_convert (size().width) + "x" + raw_convert (size().height))); + p.push_back (UserProperty (UserProperty::VIDEO, _("Length"), raw_convert (length ()), _("video frames"))); + p.push_back (UserProperty (UserProperty::VIDEO, _("Size"), raw_convert (size().width) + "x" + raw_convert (size().height))); } void