X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fvideo_content.cc;h=ae6cb64dd9889820ec060ea61781651267903ed0;hb=5a5324ed3a381a86dfe0a6e3932c1d58fdcd596f;hp=cef543387dcbb8fda7fcbae9dc201e9794a2cfa1;hpb=3828baf56467224f5d44049bf1e7a7ed11f43a05;p=dcpomatic.git diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index cef543387..ae6cb64dd 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -83,6 +83,7 @@ VideoContent::from_xml (Content* parent, cxml::ConstNodePtr node, int version) return shared_ptr (); } + /* Can't use make_shared here as the constructor is private */ return shared_ptr (new VideoContent (parent, node, version)); } @@ -99,7 +100,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"); @@ -187,7 +214,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 ())); } @@ -277,6 +304,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: @@ -403,14 +431,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