2 Copyright (C) 2016-2020 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_content.h"
22 #include "atmos_mxf_content.h"
25 #include "compose.hpp"
26 #include <asdcp/KM_log.h>
27 #include <dcp/atmos_asset.h>
28 #include <dcp/exceptions.h>
29 #include <dcp/raw_convert.h>
30 #include <libxml++/libxml++.h>
36 using std::shared_ptr;
37 using namespace dcpomatic;
39 AtmosMXFContent::AtmosMXFContent (boost::filesystem::path path)
45 AtmosMXFContent::AtmosMXFContent (cxml::ConstNodePtr node, int)
48 atmos = AtmosContent::from_xml (this, node);
52 AtmosMXFContent::valid_mxf (boost::filesystem::path path)
54 Kumu::DefaultLogSink().UnsetFilterFlag(Kumu::LOG_ALLOW_ALL);
57 shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path));
59 } catch (dcp::MXFFileError& e) {
61 } catch (dcp::ReadError& e) {
65 Kumu::DefaultLogSink().SetFilterFlag(Kumu::LOG_ALLOW_ALL);
71 AtmosMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
73 job->set_progress_unknown ();
74 Content::examine (film, job);
75 shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path(0)));
78 boost::mutex::scoped_lock lm (_mutex);
79 atmos.reset (new AtmosContent(this));
80 atmos->set_length (a->intrinsic_duration());
81 atmos->set_edit_rate (a->edit_rate());
86 AtmosMXFContent::summary () const
88 return String::compose (_("%1 [Atmos]"), path_summary());
92 AtmosMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
94 node->add_child("Type")->add_child_text ("AtmosMXF");
95 Content::as_xml (node, with_paths);
100 AtmosMXFContent::full_length (shared_ptr<const Film> film) const
102 FrameRateChange const frc (film, shared_from_this());
103 return DCPTime::from_frames (llrint (atmos->length() * frc.factor()), film->video_frame_rate());
107 AtmosMXFContent::approximate_length () const
109 return DCPTime::from_frames (atmos->length(), 24);