2 Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "video_mxf_examiner.h"
22 #include "video_mxf_content.h"
23 #include "video_content.h"
26 #include "compose.hpp"
27 #include <dcp/mono_picture_asset.h>
28 #include <dcp/stereo_picture_asset.h>
29 #include <dcp/exceptions.h>
30 #include <libxml++/libxml++.h>
36 using boost::shared_ptr;
38 VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
39 : Content (film, path)
44 VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
45 : Content (film, node)
47 video = VideoContent::from_xml (this, node, version);
51 VideoMXFContent::valid_mxf (boost::filesystem::path path)
54 shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (path));
56 } catch (dcp::MXFFileError& e) {
58 } catch (dcp::DCPReadError& e) {
63 shared_ptr<dcp::StereoPictureAsset> sp (new dcp::StereoPictureAsset (path));
65 } catch (dcp::MXFFileError& e) {
67 } catch (dcp::DCPReadError& e) {
75 VideoMXFContent::examine (shared_ptr<Job> job)
77 job->set_progress_unknown ();
79 Content::examine (job);
81 video.reset (new VideoContent (this));
82 shared_ptr<VideoMXFExaminer> examiner (new VideoMXFExaminer (shared_from_this ()));
83 video->take_from_examiner (examiner);
84 video->unset_colour_conversion ();
88 VideoMXFContent::summary () const
90 return String::compose (_("%1 [video]"), path_summary());
94 VideoMXFContent::technical_summary () const
96 return Content::technical_summary() + " - " + video->technical_summary ();
100 VideoMXFContent::identifier () const
102 return Content::identifier() + "_" + video->identifier();
106 VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
108 node->add_child("Type")->add_child_text ("VideoMXF");
109 Content::as_xml (node, with_paths);
110 video->as_xml (node);
114 VideoMXFContent::full_length () const
116 FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
117 return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate());
121 VideoMXFContent::add_properties (list<UserProperty>& p) const
123 video->add_properties (p);