Fix equals() with image subtitles to not compare unique IDs.
[libdcp.git] / src / reel_atmos_asset.cc
index f1f7d7f672e39631ad18aec98b42cc7989f2f154..958bc72cba13fbdca84c0cdb3965bb8c35f6e34d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
 #include <libxml++/libxml++.h>
 
 using std::string;
+using std::pair;
+using std::make_pair;
 using boost::shared_ptr;
 using namespace dcp;
 
 ReelAtmosAsset::ReelAtmosAsset (boost::shared_ptr<AtmosAsset> asset, int64_t entry_point)
-       : ReelAsset (asset, asset->edit_rate(), asset->intrinsic_duration(), entry_point)
+       : ReelAsset (asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
+       , ReelMXF (asset, asset->key_id())
 {
 
 }
 
 ReelAtmosAsset::ReelAtmosAsset (boost::shared_ptr<const cxml::Node> node)
        : ReelAsset (node)
+       , ReelMXF (node)
 {
+       node->ignore_child ("DataType");
        node->done ();
 }
 
 string
-ReelAtmosAsset::cpl_node_name () const
+ReelAtmosAsset::cpl_node_name (Standard) const
 {
        return "axd:AuxData";
 }
 
+pair<string, string>
+ReelAtmosAsset::cpl_node_namespace (Standard) const
+{
+       return make_pair ("http://www.dolby.com/schemas/2012/AD", "axd");
+}
+
 string
 ReelAtmosAsset::key_type () const
 {
        return "MDEK";
 }
 
-void
+xmlpp::Node *
 ReelAtmosAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
 {
-       ReelAsset::write_to_cpl (node, standard);
+       xmlpp::Node* asset = write_to_cpl_asset (node, standard, hash());
+       write_to_cpl_mxf (asset);
+       asset->add_child("axd:DataType")->add_child_text("urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
+       return asset;
+}
 
-       /* Find <axd:AuxData> */
-       xmlpp::Node* mp = find_child (node, cpl_node_name ());
-       mp->add_child("axd:DataType")->add_child_text ("urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
+bool
+ReelAtmosAsset::equals (shared_ptr<const ReelAtmosAsset> other, EqualityOptions opt, NoteHandler note) const
+{
+       if (!asset_equals (other, opt, note)) {
+               return false;
+       }
+       if (!mxf_equals (other, opt, note)) {
+               return false;
+       }
+
+       return true;
 }