summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-08-29 12:19:28 +0100
committerCarl Hetherington <cth@carlh.net>2013-08-29 12:19:28 +0100
commitd697e7bedb1e42f5167c92fd9ab363f496d718f5 (patch)
treef4d5fd9ff280cc24373315045a26183eecaf78ba
parent01ee80bda7dad42809407a0c94bc542f560c363e (diff)
Try to fix application of namespace to MainStereoscopicPicture nodes.
-rw-r--r--src/asset.h4
-rw-r--r--src/cpl.cc2
-rw-r--r--src/mxf_asset.cc9
-rw-r--r--src/mxf_asset.h6
-rw-r--r--src/picture_asset.cc14
-rw-r--r--src/picture_asset.h4
-rw-r--r--src/reel.cc6
-rw-r--r--src/reel.h2
-rw-r--r--src/subtitle_asset.cc2
-rw-r--r--src/subtitle_asset.h2
10 files changed, 28 insertions, 23 deletions
diff --git a/src/asset.h b/src/asset.h
index a2202cd6..44d088a3 100644
--- a/src/asset.h
+++ b/src/asset.h
@@ -58,10 +58,10 @@ public:
virtual ~Asset() {}
/** Write details of the asset to a CPL AssetList node.
- * @param p Parent node.
+ * @param p Parent element.
* @param i true to use the Interop standard, false for SMPTE.
*/
- virtual void write_to_cpl (xmlpp::Node* p, bool i) const = 0;
+ virtual void write_to_cpl (xmlpp::Element* p, bool i) const = 0;
/** Write details of the asset to a PKL AssetList node.
* @param p Parent node.
diff --git a/src/cpl.cc b/src/cpl.cc
index b45e5892..e4f36fed 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -240,7 +240,7 @@ CPL::write_xml (bool interop, XMLMetadata const & metadata, shared_ptr<Encryptio
}
root->add_child("RatingList");
- xmlpp::Node* reel_list = root->add_child ("ReelList");
+ xmlpp::Element* reel_list = root->add_child ("ReelList");
for (list<shared_ptr<Reel> >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) {
(*i)->write_to_cpl (reel_list, interop);
diff --git a/src/mxf_asset.cc b/src/mxf_asset.cc
index f8f54861..f8fe8ac5 100644
--- a/src/mxf_asset.cc
+++ b/src/mxf_asset.cc
@@ -37,6 +37,7 @@
using std::string;
using std::list;
+using std::pair;
using boost::shared_ptr;
using boost::lexical_cast;
using boost::dynamic_pointer_cast;
@@ -144,9 +145,13 @@ MXFAsset::add_typed_key_id (xmlpp::Element* parent) const
}
void
-MXFAsset::write_to_cpl (xmlpp::Node* node, bool interop) const
+MXFAsset::write_to_cpl (xmlpp::Element* node, bool interop) const
{
- xmlpp::Node* a = node->add_child (cpl_node_name (), cpl_node_namespace (interop));
+ pair<string, string> const attr = cpl_node_attribute (interop);
+ xmlpp::Element* a = node->add_child (cpl_node_name ());
+ if (!attr.first.empty ()) {
+ a->set_attribute (attr.first, attr.second);
+ }
a->add_child ("Id")->add_child_text ("urn:uuid:" + _uuid);
a->add_child ("AnnotationText")->add_child_text (_file_name);
a->add_child ("EditRate")->add_child_text (lexical_cast<string> (_edit_rate) + " 1");
diff --git a/src/mxf_asset.h b/src/mxf_asset.h
index 3a0c1071..308d2a98 100644
--- a/src/mxf_asset.h
+++ b/src/mxf_asset.h
@@ -61,7 +61,7 @@ public:
virtual bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const;
- virtual void write_to_cpl (xmlpp::Node *, bool interop) const;
+ virtual void write_to_cpl (xmlpp::Element *, bool interop) const;
/** Fill in a ADSCP::WriteInfo struct.
* @param w struct to fill in.
@@ -89,8 +89,8 @@ public:
protected:
virtual std::string key_type () const = 0;
virtual std::string cpl_node_name () const = 0;
- virtual std::string cpl_node_namespace (bool) const {
- return "";
+ virtual std::pair<std::string, std::string> cpl_node_attribute (bool) const {
+ return std::make_pair ("", "");
}
/** Signal to emit to report progress, or 0 */
diff --git a/src/picture_asset.cc b/src/picture_asset.cc
index 07cc195d..2c35e9f9 100644
--- a/src/picture_asset.cc
+++ b/src/picture_asset.cc
@@ -82,19 +82,19 @@ MonoPictureAsset::edit_rate_factor () const
string
StereoPictureAsset::cpl_node_name () const
{
- return "MainStereoscopicPicture";
+ return "msp-cpl:MainStereoscopicPicture";
}
-string
-StereoPictureAsset::cpl_node_namespace (bool interop) const
+pair<string, string>
+StereoPictureAsset::cpl_node_attribute (bool interop) const
{
if (interop) {
- return "http://www.digicine.com/schemas/437-Y/2007/Main-Stereo-Picture-CPL";
+ return make_pair ("xmlns:msp-cpl", "http://www.digicine.com/schemas/437-Y/2007/Main-Stereo-Picture-CPL");
} else {
- return "http://www.smpte-ra.org/schemas/429-10/2008/Main-Stereo-Picture-CPL";
+ return make_pair ("xmlns:msp-cpl", "http://www.smpte-ra.org/schemas/429-10/2008/Main-Stereo-Picture-CPL");
}
- return "";
+ return make_pair ("", "");
}
int
@@ -104,7 +104,7 @@ StereoPictureAsset::edit_rate_factor () const
}
void
-PictureAsset::write_to_cpl (xmlpp::Node* node, bool interop) const
+PictureAsset::write_to_cpl (xmlpp::Element* node, bool interop) const
{
MXFAsset::write_to_cpl (node, interop);
diff --git a/src/picture_asset.h b/src/picture_asset.h
index bd5770b7..2af1f69a 100644
--- a/src/picture_asset.h
+++ b/src/picture_asset.h
@@ -81,7 +81,7 @@ public:
return _size;
}
- void write_to_cpl (xmlpp::Node *, bool) const;
+ void write_to_cpl (xmlpp::Element *, bool) const;
protected:
@@ -205,7 +205,7 @@ public:
private:
std::string cpl_node_name () const;
- std::string cpl_node_namespace (bool) const;
+ std::pair<std::string, std::string> cpl_node_attribute (bool) const;
int edit_rate_factor () const;
};
diff --git a/src/reel.cc b/src/reel.cc
index 3b49042a..43c934ea 100644
--- a/src/reel.cc
+++ b/src/reel.cc
@@ -32,11 +32,11 @@ using boost::shared_ptr;
using namespace libdcp;
void
-Reel::write_to_cpl (xmlpp::Node* node, bool interop) const
+Reel::write_to_cpl (xmlpp::Element* node, bool interop) const
{
- xmlpp::Node* reel = node->add_child ("Reel");
+ xmlpp::Element* reel = node->add_child ("Reel");
reel->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid());
- xmlpp::Node* asset_list = reel->add_child ("AssetList");
+ xmlpp::Element* asset_list = reel->add_child ("AssetList");
if (_main_picture) {
_main_picture->write_to_cpl (asset_list, interop);
diff --git a/src/reel.h b/src/reel.h
index 916c0193..a5e79331 100644
--- a/src/reel.h
+++ b/src/reel.h
@@ -63,7 +63,7 @@ public:
return _main_subtitle;
}
- void write_to_cpl (xmlpp::Node *, bool) const;
+ void write_to_cpl (xmlpp::Element *, bool) const;
bool encrypted () const;
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index 44f2f74a..d7cb94a5 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -278,7 +278,7 @@ SubtitleAsset::add (shared_ptr<Subtitle> s)
}
void
-SubtitleAsset::write_to_cpl (xmlpp::Node* node, bool) const
+SubtitleAsset::write_to_cpl (xmlpp::Element* node, bool) const
{
/* XXX: should EditRate, Duration and IntrinsicDuration be in here? */
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h
index fc0d932c..4ef0794e 100644
--- a/src/subtitle_asset.h
+++ b/src/subtitle_asset.h
@@ -130,7 +130,7 @@ public:
SubtitleAsset (std::string directory, std::string xml_file);
SubtitleAsset (std::string directory, std::string movie_title, std::string language);
- void write_to_cpl (xmlpp::Node *, bool) const;
+ void write_to_cpl (xmlpp::Element *, bool) const;
virtual bool equals (boost::shared_ptr<const Asset>, EqualityOptions, boost::function<void (NoteType, std::string)> note) const {
/* XXX */
note (ERROR, "subtitle assets not compared yet");