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 <asdcp/KM_log.h>
28 #include <dcp/mono_picture_asset.h>
29 #include <dcp/stereo_picture_asset.h>
30 #include <dcp/exceptions.h>
31 #include <libxml++/libxml++.h>
37 using boost::shared_ptr;
38 using namespace dcpomatic;
40 VideoMXFContent::VideoMXFContent (boost::filesystem::path path)
46 VideoMXFContent::VideoMXFContent (cxml::ConstNodePtr node, int version)
49 video = VideoContent::from_xml (this, node, version);
53 VideoMXFContent::valid_mxf (boost::filesystem::path path)
55 Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
58 shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (path));
60 } catch (dcp::MXFFileError& e) {
62 } catch (dcp::ReadError& e) {
67 Kumu::DefaultLogSink().SetFilterFlag(0);
68 shared_ptr<dcp::StereoPictureAsset> sp (new dcp::StereoPictureAsset (path));
70 } catch (dcp::MXFFileError& e) {
72 } catch (dcp::ReadError& e) {
76 Kumu::DefaultLogSink().SetFilterFlag(Kumu::LOG_ALLOW_ALL);
82 VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
84 job->set_progress_unknown ();
86 Content::examine (film, job);
88 video.reset (new VideoContent (this));
89 shared_ptr<VideoMXFExaminer> examiner (new VideoMXFExaminer (shared_from_this ()));
90 video->take_from_examiner (examiner);
91 video->unset_colour_conversion ();
95 VideoMXFContent::summary () const
97 return String::compose (_("%1 [video]"), path_summary());
101 VideoMXFContent::technical_summary () const
103 return Content::technical_summary() + " - " + video->technical_summary ();
107 VideoMXFContent::identifier () const
109 return Content::identifier() + "_" + video->identifier();
113 VideoMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
115 node->add_child("Type")->add_child_text ("VideoMXF");
116 Content::as_xml (node, with_paths);
117 video->as_xml (node);
121 VideoMXFContent::full_length (shared_ptr<const Film> film) const
123 FrameRateChange const frc (film, shared_from_this());
124 return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
128 VideoMXFContent::approximate_length () const
130 return DCPTime::from_frames (video->length_after_3d_combine(), 24);
134 VideoMXFContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p) const
136 Content::add_properties (film, p);
137 video->add_properties (p);