summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-02-08 13:30:42 +0000
committerCarl Hetherington <cth@carlh.net>2014-02-08 13:30:42 +0000
commit71de90f74085744d1c5ca35253eec003e41497a2 (patch)
tree637e6c2b6c2fa04da3d64864e0adcef30a0847dd /src
parent054cc86d5ba734c72780b07a772a55e3a7000a4f (diff)
Fix a couple of errors in Interop XML
Reported-by: Ivan Pullman
Diffstat (limited to 'src')
-rw-r--r--src/asset.cc9
-rw-r--r--src/asset.h5
-rw-r--r--src/cpl.cc8
-rw-r--r--src/cpl.h2
-rw-r--r--src/dcp.cc11
-rw-r--r--src/picture_asset.h6
-rw-r--r--src/sound_asset.h6
-rw-r--r--src/subtitle_asset.h6
8 files changed, 43 insertions, 10 deletions
diff --git a/src/asset.cc b/src/asset.cc
index 91a19e69..f6642d9c 100644
--- a/src/asset.cc
+++ b/src/asset.cc
@@ -31,6 +31,7 @@
#include "asset.h"
#include "util.h"
#include "metadata.h"
+#include "compose.hpp"
using namespace std;
using namespace boost;
@@ -51,14 +52,18 @@ Asset::Asset (boost::filesystem::path directory, boost::filesystem::path file_na
}
void
-Asset::write_to_pkl (xmlpp::Node* node) const
+Asset::write_to_pkl (xmlpp::Node* node, bool interop) const
{
xmlpp::Node* asset = node->add_child ("Asset");
asset->add_child("Id")->add_child_text ("urn:uuid:" + _uuid);
asset->add_child("AnnotationText")->add_child_text (_file_name.string ());
asset->add_child("Hash")->add_child_text (digest ());
asset->add_child("Size")->add_child_text (lexical_cast<string> (filesystem::file_size(path())));
- asset->add_child("Type")->add_child_text ("application/mxf");
+ if (interop) {
+ asset->add_child("Type")->add_child (String::compose ("application/x-smpte-mxf;asdcpKind=%1", asdcp_kind ()));
+ } else {
+ asset->add_child("Type")->add_child_text ("application/mxf");
+ }
}
void
diff --git a/src/asset.h b/src/asset.h
index 269d5c4b..773e3d48 100644
--- a/src/asset.h
+++ b/src/asset.h
@@ -65,7 +65,7 @@ public:
/** Write details of the asset to a PKL AssetList node.
* @param p Parent node.
*/
- void write_to_pkl (xmlpp::Node *) const;
+ void write_to_pkl (xmlpp::Node *, bool interop) const;
/** Write details of the asset to a ASSETMAP stream.
* @param s Stream.
@@ -129,6 +129,9 @@ public:
virtual bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, boost::function<void (NoteType, std::string)>) const;
protected:
+
+ /** @return Interop PKL asdcpKind for the &lt;Type&gt; tag e.g. Picture, Sound etc. */
+ virtual std::string asdcp_kind () const = 0;
std::string digest () const;
diff --git a/src/cpl.cc b/src/cpl.cc
index dcb730ff..e333df0d 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -243,13 +243,17 @@ CPL::write_xml (bool interop, XMLMetadata const & metadata, shared_ptr<const Sig
}
void
-CPL::write_to_pkl (xmlpp::Node* node) const
+CPL::write_to_pkl (xmlpp::Node* node, bool interop) const
{
xmlpp::Node* asset = node->add_child ("Asset");
asset->add_child("Id")->add_child_text ("urn:uuid:" + _id);
asset->add_child("Hash")->add_child_text (_digest);
asset->add_child("Size")->add_child_text (lexical_cast<string> (_length));
- asset->add_child("Type")->add_child_text ("text/xml");
+ if (interop) {
+ asset->add_child("Type")->add_child_text ("text/xml;asdcpKind=CPL");
+ } else {
+ asset->add_child("Type")->add_child_text ("text/xml");
+ }
}
list<shared_ptr<const Asset> >
diff --git a/src/cpl.h b/src/cpl.h
index aadc7347..c50d8f90 100644
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -96,7 +96,7 @@ public:
void write_xml (bool, XMLMetadata const &, boost::shared_ptr<const Signer>) const;
void write_to_assetmap (xmlpp::Node *) const;
- void write_to_pkl (xmlpp::Node *) const;
+ void write_to_pkl (xmlpp::Node *, bool) const;
void add_kdm (KDM const &);
diff --git a/src/dcp.cc b/src/dcp.cc
index f80726fc..ae692256 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -111,11 +111,11 @@ DCP::write_pkl (string pkl_uuid, bool interop, XMLMetadata const & metadata, sha
xmlpp::Element* asset_list = pkl->add_child("AssetList");
list<shared_ptr<const Asset> > a = assets ();
for (list<shared_ptr<const Asset> >::const_iterator i = a.begin(); i != a.end(); ++i) {
- (*i)->write_to_pkl (asset_list);
+ (*i)->write_to_pkl (asset_list, interop);
}
for (list<shared_ptr<CPL> >::const_iterator i = _cpls.begin(); i != _cpls.end(); ++i) {
- (*i)->write_to_pkl (asset_list);
+ (*i)->write_to_pkl (asset_list, interop);
}
if (signer) {
@@ -138,7 +138,12 @@ DCP::write_volindex (bool interop) const
}
xmlpp::Document doc;
- xmlpp::Element* root = doc.create_root_node ("VolumeIndex", "http://www.smpte-ra.org/schemas/429-9/2007/AM");
+ xmlpp::Element* root;
+ if (interop) {
+ root = doc.create_root_node ("VolumeIndex", "http://www.digicine.com/PROTO-ASDCP-AM-20040311#");
+ } else {
+ root = doc.create_root_node ("VolumeIndex", "http://www.smpte-ra.org/schemas/429-9/2007/AM");
+ }
root->add_child("Index")->add_child_text ("1");
doc.write_to_file (p.string (), "UTF-8");
}
diff --git a/src/picture_asset.h b/src/picture_asset.h
index b8dab052..c09808e2 100644
--- a/src/picture_asset.h
+++ b/src/picture_asset.h
@@ -78,7 +78,11 @@ public:
void write_to_cpl (xmlpp::Element *) const;
-protected:
+protected:
+
+ std::string asdcp_kind () const {
+ return "Picture";
+ }
bool frame_buffer_equals (
int frame, EqualityOptions opt, boost::function<void (NoteType, std::string)> note,
diff --git a/src/sound_asset.h b/src/sound_asset.h
index d2e49bd1..c52a5436 100644
--- a/src/sound_asset.h
+++ b/src/sound_asset.h
@@ -112,6 +112,12 @@ public:
return _sampling_rate;
}
+protected:
+
+ std::string asdcp_kind () const {
+ return "Sound";
+ }
+
private:
std::string key_type () const;
void construct (boost::function<boost::filesystem::path (Channel)> get_path);
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h
index 74ab9873..0598a296 100644
--- a/src/subtitle_asset.h
+++ b/src/subtitle_asset.h
@@ -161,6 +161,12 @@ public:
void write_xml () const;
Glib::ustring xml_as_string () const;
+protected:
+
+ std::string asdcp_kind () const {
+ return "Subtitle";
+ }
+
private:
std::string font_id_to_name (std::string id) const;