2 Copyright (C) 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/>.
22 #include "atmos_content.h"
23 #include <dcp/raw_convert.h>
24 #include <libxml++/libxml++.h>
28 using boost::shared_ptr;
31 int const AtmosContentProperty::EDIT_RATE = 700;
34 AtmosContent::AtmosContent (Content* parent)
35 : ContentPart (parent)
42 AtmosContent::AtmosContent (Content* parent, cxml::ConstNodePtr node)
43 : ContentPart (parent)
45 _length = node->number_child<Frame>("Length");
46 _edit_rate = dcp::Fraction (node->string_child("EditRate"));
50 shared_ptr<AtmosContent>
51 AtmosContent::from_xml (Content* parent, cxml::ConstNodePtr node)
53 return shared_ptr<AtmosContent> (new AtmosContent(parent, node));
58 AtmosContent::as_xml (xmlpp::Node* node) const
60 node->add_child("Length")->add_child_text(dcp::raw_convert<string>(_length));
61 node->add_child("EditRate")->add_child_text(_edit_rate.as_string());
66 AtmosContent::set_length (Frame len)
68 maybe_set (_length, len, ContentProperty::LENGTH);
73 AtmosContent::set_edit_rate (dcp::Fraction rate)
75 maybe_set (_edit_rate, rate, AtmosContentProperty::EDIT_RATE);