summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-09-13 10:33:27 +0100
committerCarl Hetherington <cth@carlh.net>2016-09-13 10:33:27 +0100
commitf40c9704ce44234558bba1ad15de42a50475f1e3 (patch)
tree23b9351c4996fe19a3f455ffc0915bcea58b6830 /src
parentf7c73615a49d308040a4a5d40677ecab08c21841 (diff)
Various fixes to incorrect Atmos read/write wrt XML namespaces.
Diffstat (limited to 'src')
-rw-r--r--src/reel.cc2
-rw-r--r--src/reel_asset.cc12
-rw-r--r--src/reel_asset.h7
-rw-r--r--src/reel_atmos_asset.cc9
-rw-r--r--src/reel_atmos_asset.h1
5 files changed, 26 insertions, 5 deletions
diff --git a/src/reel.cc b/src/reel.cc
index 50c780f4..b94197d0 100644
--- a/src/reel.cc
+++ b/src/reel.cc
@@ -82,7 +82,7 @@ Reel::Reel (boost::shared_ptr<const cxml::Node> node)
_main_subtitle.reset (new ReelSubtitleAsset (main_subtitle));
}
- shared_ptr<cxml::Node> atmos = asset_list->optional_node_child ("axd:AuxData");
+ shared_ptr<cxml::Node> atmos = asset_list->optional_node_child ("AuxData");
if (atmos) {
_atmos.reset (new ReelAtmosAsset (atmos));
}
diff --git a/src/reel_asset.cc b/src/reel_asset.cc
index 60c3242c..bed05dfa 100644
--- a/src/reel_asset.cc
+++ b/src/reel_asset.cc
@@ -95,11 +95,15 @@ ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
void
ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
- pair<string, string> const attr = cpl_node_attribute (standard);
xmlpp::Element* a = node->add_child (cpl_node_name ());
+ pair<string, string> const attr = cpl_node_attribute (standard);
if (!attr.first.empty ()) {
a->set_attribute (attr.first, attr.second);
}
+ pair<string, string> const ns = cpl_node_namespace ();
+ if (!ns.first.empty ()) {
+ a->set_namespace_declaration (ns.first, ns.second);
+ }
a->add_child("Id")->add_child_text ("urn:uuid:" + _id);
a->add_child("AnnotationText")->add_child_text (_annotation_text);
a->add_child("EditRate")->add_child_text (String::compose ("%1 %2", _edit_rate.numerator, _edit_rate.denominator));
@@ -117,6 +121,12 @@ ReelAsset::cpl_node_attribute (Standard) const
return make_pair ("", "");
}
+pair<string, string>
+ReelAsset::cpl_node_namespace () const
+{
+ return make_pair ("", "");
+}
+
bool
ReelAsset::equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
{
diff --git a/src/reel_asset.h b/src/reel_asset.h
index c7c9f73e..1e826a33 100644
--- a/src/reel_asset.h
+++ b/src/reel_asset.h
@@ -122,11 +122,12 @@ protected:
*/
virtual std::string cpl_node_name () const = 0;
- /** @return Any attribute that should be used on the asset's node in the
- * CPL.
- */
+ /** @return Any attribute that should be used on the asset's node in the CPL */
virtual std::pair<std::string, std::string> cpl_node_attribute (Standard) const;
+ /** @return Any namespace that should be used on the asset's node in the CPL */
+ virtual std::pair<std::string, std::string> cpl_node_namespace () const;
+
/** Reference to the asset (MXF or XML file) that this reel entry
* applies to.
*/
diff --git a/src/reel_atmos_asset.cc b/src/reel_atmos_asset.cc
index f1f7d7f6..8726b39c 100644
--- a/src/reel_atmos_asset.cc
+++ b/src/reel_atmos_asset.cc
@@ -41,6 +41,8 @@
#include <libxml++/libxml++.h>
using std::string;
+using std::pair;
+using std::make_pair;
using boost::shared_ptr;
using namespace dcp;
@@ -53,6 +55,7 @@ ReelAtmosAsset::ReelAtmosAsset (boost::shared_ptr<AtmosAsset> asset, int64_t ent
ReelAtmosAsset::ReelAtmosAsset (boost::shared_ptr<const cxml::Node> node)
: ReelAsset (node)
{
+ node->ignore_child ("DataType");
node->done ();
}
@@ -62,6 +65,12 @@ ReelAtmosAsset::cpl_node_name () const
return "axd:AuxData";
}
+pair<string, string>
+ReelAtmosAsset::cpl_node_namespace () const
+{
+ return make_pair ("http://www.dolby.com/schemas/2012/AD", "axd");
+}
+
string
ReelAtmosAsset::key_type () const
{
diff --git a/src/reel_atmos_asset.h b/src/reel_atmos_asset.h
index 75e50e8d..e7ea51aa 100644
--- a/src/reel_atmos_asset.h
+++ b/src/reel_atmos_asset.h
@@ -64,6 +64,7 @@ public:
private:
std::string key_type () const;
std::string cpl_node_name () const;
+ std::pair<std::string, std::string> cpl_node_namespace () const;
};
}