41 #include "compose.hpp"
46 #include <libcxml/cxml.h>
47 LIBDCP_DISABLE_WARNINGS
48 #include <libxml++/libxml++.h>
49 LIBDCP_ENABLE_WARNINGS
55 using std::shared_ptr;
56 using boost::optional;
62 , _intrinsic_duration (intrinsic_duration)
63 , _duration (intrinsic_duration - entry_point)
64 , _edit_rate (edit_rate)
65 , _entry_point (entry_point)
72 :
Object (remove_urn_uuid (node->string_child (
"Id")))
73 , _intrinsic_duration (node->number_child<int64_t> (
"IntrinsicDuration"))
74 , _duration (node->optional_number_child<int64_t>(
"Duration"))
75 , _annotation_text (node->optional_string_child(
"AnnotationText"))
76 , _edit_rate (
Fraction (node->string_child (
"EditRate")))
77 , _entry_point (node->optional_number_child<int64_t>(
"EntryPoint"))
84 ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard)
const
88 if (!attr.first.empty ()) {
89 a->set_attribute (attr.first, attr.second);
92 if (!ns.first.empty()) {
93 a->set_namespace_declaration (ns.first, ns.second);
95 a->add_child(
"Id")->add_child_text (
"urn:uuid:" + _id);
100 a->add_child(
"EditRate")->add_child_text (
_edit_rate.as_string());
101 a->add_child(
"IntrinsicDuration")->add_child_text (raw_convert<string> (
_intrinsic_duration));
103 a->add_child(
"EntryPoint")->add_child_text(raw_convert<string>(*
_entry_point));
106 a->add_child(
"Duration")->add_child_text(raw_convert<string>(*
_duration));
115 return make_pair (
"",
"");
122 return make_pair (
"",
"");
127 ReelAsset::asset_equals (shared_ptr<const ReelAsset> other,
EqualityOptions opt, NoteHandler note)
const
130 string const s =
"Reel: annotation texts differ (" +
_annotation_text.get_value_or(
"") +
" vs " + other->_annotation_text.get_value_or(
"") +
")\n";
132 note (NoteType::ERROR, s);
135 note (NoteType::NOTE, s);
140 note (NoteType::ERROR,
"Reel: edit rates differ");
145 note (NoteType::ERROR, String::compose (
"Reel: intrinsic durations differ (%1 vs %2)",
_intrinsic_duration, other->_intrinsic_duration));
150 note (NoteType::ERROR,
"Reel: entry points differ");
155 note (NoteType::ERROR,
"Reel: durations differ");
A fraction (i.e. a thing with an integer numerator and an integer denominator).
Some part of a DCP that has a UUID.
virtual std::pair< std::string, std::string > cpl_node_attribute(Standard) const
virtual std::string cpl_node_name(Standard) const =0
boost::optional< int64_t > _entry_point
The <EntryPoint> from the reel's entry for this asset.
ReelAsset(std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
virtual std::pair< std::string, std::string > cpl_node_namespace() const
Fraction _edit_rate
The <EditRate> from the reel's entry for this asset.
boost::optional< std::string > _annotation_text
The <AnnotationText> from the reel's entry for this asset.
int64_t actual_duration() const
int64_t _intrinsic_duration
The <IntrinsicDuration> from the reel's entry for this asset.
boost::optional< int64_t > _duration
The <Duration> from the reel's entry for this asset, if present.
Namespace for everything in libdcp.
Methods for conversion to/from string.
A class to describe what "equality" means for a particular test.
bool reel_annotation_texts_can_differ