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 "atmos_mxf_content.h"
23 #include "compose.hpp"
24 #include <dcp/atmos_asset.h>
25 #include <dcp/exceptions.h>
26 #include <libxml++/libxml++.h>
32 using boost::shared_ptr;
34 AtmosMXFContent::AtmosMXFContent (shared_ptr<const Film> film, boost::filesystem::path path)
35 : Content (film, path)
40 AtmosMXFContent::AtmosMXFContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int)
41 : Content (film, node)
47 AtmosMXFContent::valid_mxf (boost::filesystem::path path)
50 shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path));
52 } catch (dcp::MXFFileError& e) {
54 } catch (dcp::DCPReadError& e) {
62 AtmosMXFContent::examine (shared_ptr<Job> job)
64 job->set_progress_unknown ();
65 Content::examine (job);
66 shared_ptr<dcp::AtmosAsset> a (new dcp::AtmosAsset (path(0)));
69 boost::mutex::scoped_lock lm (_mutex);
70 _length = a->intrinsic_duration ();
75 AtmosMXFContent::summary () const
77 return String::compose (_("%1 [Atmos]"), path_summary());
81 AtmosMXFContent::as_xml (xmlpp::Node* node) const
83 node->add_child("Type")->add_child_text ("AtmosMXF");
84 Content::as_xml (node);
88 AtmosMXFContent::full_length () const
90 FrameRateChange const frc (active_video_frame_rate(), film()->video_frame_rate());
91 return DCPTime::from_frames (llrint (_length * frc.factor()), film()->video_frame_rate());