summaryrefslogtreecommitdiff
path: root/src/reel_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-03-15 00:49:41 +0000
committerCarl Hetherington <cth@carlh.net>2019-03-17 00:24:27 +0000
commit2d60083498861ac30c751dbf0ca387573df6dc68 (patch)
treee98e7631415074b492d1422149f10f6e55367a42 /src/reel_asset.cc
parentea487953c7e51ec5c16087d739a42981ec9d0ff9 (diff)
Move asset refs and hash from ReelAsset to ReelMXF.
Diffstat (limited to 'src/reel_asset.cc')
-rw-r--r--src/reel_asset.cc26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/reel_asset.cc b/src/reel_asset.cc
index 797d1c40..22583223 100644
--- a/src/reel_asset.cc
+++ b/src/reel_asset.cc
@@ -46,6 +46,7 @@ using std::pair;
using std::string;
using std::make_pair;
using boost::shared_ptr;
+using boost::optional;
using namespace dcp;
/** Construct a ReelAsset.
@@ -56,12 +57,10 @@ using namespace dcp;
*/
ReelAsset::ReelAsset (shared_ptr<Asset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: Object (asset->id ())
- , _asset_ref (asset)
, _edit_rate (edit_rate)
, _intrinsic_duration (intrinsic_duration)
, _entry_point (entry_point)
, _duration (intrinsic_duration - entry_point)
- , _hash (asset->hash ())
{
/* default _annotation_text to the leaf name of our file */
if (asset->file ()) {
@@ -71,19 +70,17 @@ ReelAsset::ReelAsset (shared_ptr<Asset> asset, Fraction edit_rate, int64_t intri
ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
: Object (remove_urn_uuid (node->string_child ("Id")))
- , _asset_ref (_id)
, _annotation_text (node->optional_string_child ("AnnotationText").get_value_or (""))
, _edit_rate (Fraction (node->string_child ("EditRate")))
, _intrinsic_duration (node->number_child<int64_t> ("IntrinsicDuration"))
, _entry_point (node->number_child<int64_t> ("EntryPoint"))
, _duration (node->number_child<int64_t> ("Duration"))
- , _hash (node->optional_string_child ("Hash"))
{
}
xmlpp::Node*
-ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+ReelAsset::write_to_cpl_base (xmlpp::Node* node, Standard standard, optional<string> hash) const
{
xmlpp::Element* a = node->add_child (cpl_node_name (standard));
pair<string, string> const attr = cpl_node_attribute (standard);
@@ -100,8 +97,8 @@ ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
a->add_child("IntrinsicDuration")->add_child_text (raw_convert<string> (_intrinsic_duration));
a->add_child("EntryPoint")->add_child_text (raw_convert<string> (_entry_point));
a->add_child("Duration")->add_child_text (raw_convert<string> (_duration));
- if (_hash) {
- a->add_child("Hash")->add_child_text (_hash.get());
+ if (hash) {
+ a->add_child("Hash")->add_child_text (hash.get());
}
return a;
}
@@ -119,7 +116,7 @@ ReelAsset::cpl_node_namespace (Standard) const
}
bool
-ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
+ReelAsset::asset_equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
{
if (_annotation_text != other->_annotation_text) {
string const s = "Reel: annotation texts differ (" + _annotation_text + " vs " + other->_annotation_text + ")\n";
@@ -151,18 +148,5 @@ ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteH
return false;
}
- if (_hash != other->_hash) {
- if (!opt.reel_hashes_can_differ) {
- note (DCP_ERROR, "Reel: hashes differ");
- return false;
- } else {
- note (DCP_NOTE, "Reel: hashes differ");
- }
- }
-
- if (_asset_ref.resolved () && other->_asset_ref.resolved ()) {
- return _asset_ref->equals (other->_asset_ref.asset(), opt, note);
- }
-
return true;
}