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.
}
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);
using std::string;
using std::list;
+using std::pair;
using boost::shared_ptr;
using boost::lexical_cast;
using boost::dynamic_pointer_cast;
}
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");
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.
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 */
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
}
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);
return _size;
}
- void write_to_cpl (xmlpp::Node *, bool) const;
+ void write_to_cpl (xmlpp::Element *, bool) const;
protected:
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;
};
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);
return _main_subtitle;
}
- void write_to_cpl (xmlpp::Node *, bool) const;
+ void write_to_cpl (xmlpp::Element *, bool) const;
bool encrypted () const;
}
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? */
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");