X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_content.cc;h=94d5c010bd0b7202c79b48fb1dc4e809373c06fc;hb=736745c86cefc6d5d4d8098799efc86f0f639061;hp=52ac6132c2dc12de27e7c4345cd80507097816c4;hpb=f525fad0c38e198f35055e639184fa983a3d5d56;p=dcpomatic.git diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 52ac6132c..94d5c010b 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2018 Carl Hetherington + Copyright (C) 2014-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -49,6 +49,7 @@ using std::distance; using std::pair; using std::vector; using std::list; +using std::map; using boost::shared_ptr; using boost::scoped_ptr; using boost::optional; @@ -146,6 +147,10 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version) BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("ReelLength")) { _reel_lengths.push_back (raw_convert (i->content ())); } + + BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Marker")) { + _markers[dcp::marker_from_string(i->string_attribute("type"))] = ContentTime(raw_convert(i->content())); + } } void @@ -240,6 +245,10 @@ DCPContent::examine (shared_ptr film, shared_ptr job) _content_kind = examiner->content_kind (); _cpl = examiner->cpl (); _reel_lengths = examiner->reel_lengths (); + map markers = examiner->markers(); + for (map::const_iterator i = markers.begin(); i != markers.end(); ++i) { + _markers[i->first] = ContentTime(i->second.as_editable_units(DCPTime::HZ)); + } } if (old_texts == texts) { @@ -339,6 +348,12 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const BOOST_FOREACH (int64_t i, _reel_lengths) { node->add_child("ReelLength")->add_child_text (raw_convert (i)); } + + for (map::const_iterator i = _markers.begin(); i != _markers.end(); ++i) { + xmlpp::Element* marker = node->add_child("Marker"); + marker->set_attribute("type", dcp::marker_to_string(i->first)); + marker->add_child_text(raw_convert(i->second.get())); + } } DCPTime