2 Copyright (C) 2016-2021 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/>.
22 #include "video_mxf_examiner.h"
23 #include "video_mxf_content.h"
24 #include "video_content.h"
27 #include "compose.hpp"
28 #include <asdcp/KM_log.h>
29 #include <dcp/mono_picture_asset.h>
30 #include <dcp/stereo_picture_asset.h>
31 #include <dcp/exceptions.h>
32 #include <libxml++/libxml++.h>
39 using std::shared_ptr;
40 using std::make_shared;
41 using namespace dcpomatic;
44 VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
51 VideoMXFContent::VideoMXFContent (cxml::ConstNodePtr node, int version)
54 video = VideoContent::from_xml (this, node, version);
59 VideoMXFContent::valid_mxf (boost::filesystem::path path)
61 Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
64 dcp::MonoPictureAsset mp (path);
66 } catch (dcp::MXFFileError& e) {
68 } catch (dcp::ReadError& e) {
73 Kumu::DefaultLogSink().SetFilterFlag(0);
74 dcp::StereoPictureAsset sp (path);
76 } catch (dcp::MXFFileError& e) {
78 } catch (dcp::ReadError& e) {
82 Kumu::DefaultLogSink().SetFilterFlag(Kumu::LOG_ALLOW_ALL);
89 VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
91 job->set_progress_unknown ();
93 Content::examine (film, job);
95 video.reset (new VideoContent (this));
96 auto examiner = make_shared<VideoMXFExaminer>(shared_from_this());
97 video->take_from_examiner (examiner);
98 video->unset_colour_conversion ();
103 VideoMXFContent::summary () const
105 return String::compose (_("%1 [video]"), path_summary());
110 VideoMXFContent::technical_summary () const
112 return Content::technical_summary() + " - " + video->technical_summary();
117 VideoMXFContent::identifier () const
119 return Content::identifier() + "_" + video->identifier();
124 VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
126 node->add_child("Type")->add_child_text("VideoMXF");
127 Content::as_xml (node, with_paths);
128 video->as_xml (node);
133 VideoMXFContent::full_length (shared_ptr<const Film> film) const
135 FrameRateChange const frc (film, shared_from_this());
136 return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
141 VideoMXFContent::approximate_length () const
143 return DCPTime::from_frames (video->length_after_3d_combine(), 24);
148 VideoMXFContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
150 Content::add_properties (film, p);
151 video->add_properties (p);