2 Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "video_mxf_examiner.h"
21 #include "video_mxf_content.h"
22 #include "video_content.h"
25 #include "compose.hpp"
26 #include <dcp/mono_picture_asset.h>
27 #include <dcp/stereo_picture_asset.h>
28 #include <dcp/exceptions.h>
29 #include <libxml++/libxml++.h>
35 using boost::shared_ptr;
37 VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
38 : Content (film, path)
43 VideoMXFContent::VideoMXFContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
44 : Content (film, node)
46 video = VideoContent::from_xml (this, node, version);
50 VideoMXFContent::valid_mxf (boost::filesystem::path path)
53 shared_ptr<dcp::MonoPictureAsset> mp (new dcp::MonoPictureAsset (path));
55 } catch (dcp::MXFFileError& e) {
57 } catch (dcp::DCPReadError& e) {
62 shared_ptr<dcp::StereoPictureAsset> sp (new dcp::StereoPictureAsset (path));
64 } catch (dcp::MXFFileError& e) {
66 } catch (dcp::DCPReadError& e) {
74 VideoMXFContent::examine (shared_ptr<Job> job)
76 job->set_progress_unknown ();
78 Content::examine (job);
80 video.reset (new VideoContent (this));
81 shared_ptr<VideoMXFExaminer> examiner (new VideoMXFExaminer (shared_from_this ()));
82 video->take_from_examiner (examiner);
86 VideoMXFContent::summary () const
88 return String::compose (_("%1 [video]"), path_summary());
92 VideoMXFContent::technical_summary () const
94 return Content::technical_summary() + " - " + video->technical_summary ();
98 VideoMXFContent::identifier () const
100 return Content::identifier() + "_" + video->identifier();
104 VideoMXFContent::as_xml (xmlpp::Node* node) const
106 node->add_child("Type")->add_child_text ("VideoMXF");
107 Content::as_xml (node);
108 video->as_xml (node);
112 VideoMXFContent::full_length () const
114 FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
115 return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate());
119 VideoMXFContent::add_properties (list<UserProperty>& p) const
121 video->add_properties (p);
125 VideoMXFContent::set_default_colour_conversion ()
127 video->unset_colour_conversion ();