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 "atmos_mxf_content.h"
24 #include "compose.hpp"
25 #include <dcp/atmos_asset.h>
26 #include <dcp/exceptions.h>
27 #include <libxml++/libxml++.h>
33 using boost::shared_ptr;
35 AtmosMXFContent::AtmosMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
36 : Content (film, path)
41 AtmosMXFContent::AtmosMXFContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int)
42 : Content (film, node)
48 AtmosMXFContent::valid_mxf (boost::filesystem::path path)
51 shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path));
53 } catch (dcp::MXFFileError& e) {
55 } catch (dcp::DCPReadError& e) {
63 AtmosMXFContent::examine (shared_ptr<Job> job)
65 job->set_progress_unknown ();
66 Content::examine (job);
67 shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path(0)));
70 boost::mutex::scoped_lock lm (_mutex);
71 _length = a->intrinsic_duration ();
76 AtmosMXFContent::summary () const
78 return String::compose (_("%1 [Atmos]"), path_summary());
82 AtmosMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
84 node->add_child("Type")->add_child_text ("AtmosMXF");
85 Content::as_xml (node, with_paths);
89 AtmosMXFContent::full_length () const
91 FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
92 return DCPTime::from_frames (llrint (_length * frc.factor()), film()->video_frame_rate());