Try to fix application of namespace to MainStereoscopicPicture nodes.
authorCarl Hetherington <cth@carlh.net>
Thu, 29 Aug 2013 11:19:28 +0000 (12:19 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 29 Aug 2013 11:19:28 +0000 (12:19 +0100)
src/asset.h
src/cpl.cc
src/mxf_asset.cc
src/mxf_asset.h
src/picture_asset.cc
src/picture_asset.h
src/reel.cc
src/reel.h
src/subtitle_asset.cc
src/subtitle_asset.h

index a2202cd68f658172c4d9168deb8c14ce7673a000..44d088a3121695f9bba809fa0775c3f396b398b0 100644 (file)
@@ -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.
index b45e5892e3cd9af34ee9530acbdc9f9da059488b..e4f36fed092f907af48c1985134104bdb54c04df 100644 (file)
@@ -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);
index f8f54861b9c13d60f7da71255ca3c176ef5b4ba2..f8fe8ac5eebb31be47d43a1bd36f2a8d1b80201b 100644 (file)
@@ -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");
index 3a0c107175638e27370e30fabb46773ec0a02a1e..308d2a98857c5630cdf62fc6193b2955e25759ba 100644 (file)
@@ -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 */
index 07cc195dd1ca4ba5334b98e66ab459752b0a7b6d..2c35e9f9702269feafd082c9ae3acb89036b6c02 100644 (file)
@@ -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);
        
index bd5770b72cae05b0347ffe1576ea2d2388c32e31..2af1f69ad0a940c2f270256eb5805fb3b2312a7b 100644 (file)
@@ -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;
 };
        
index 3b49042a144cd10e148e780880f8bd2f79e0ff7c..43c934ea2f91ad7d28a8220eb1b494cf25b41380 100644 (file)
@@ -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);
index 916c01930f14304c424ce49530beb6e26d9dc4b3..a5e79331a3fa4732bdd05704ff4be60c0f22d7a8 100644 (file)
@@ -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;
        
index 44f2f74a2ffebed75fa201e894663d7968af3d3d..d7cb94a501c33597d1f445b586386cc1cfa26425 100644 (file)
@@ -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? */
 
index fc0d932c0790aa788044cb59112b48432f1b9526..4ef0794e7677a8cf245f4d6b5536caa51ef3274c 100644 (file)
@@ -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");