summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-02-26 18:41:41 +0000
committerCarl Hetherington <cth@carlh.net>2014-02-26 18:41:41 +0000
commit2e93ca3670e5581b5523f60130b38594de10d6c3 (patch)
tree6ed18ed07bccf77b2d172ef7681fce981956815f /src
parent9ed550de7b98ca2f8467dd134a9c0ad7f1868f23 (diff)
parent447cc7ddec5ace7bb47df35192ef02e7c19bf9b3 (diff)
Merge master; MXF subtitle stuff not included.
Diffstat (limited to 'src')
-rw-r--r--src/asset.cc4
-rw-r--r--src/asset.h5
-rw-r--r--src/content.h2
-rw-r--r--src/cpl.cc15
-rw-r--r--src/cpl.h4
-rw-r--r--src/dcp.cc55
-rw-r--r--src/mxf.cc14
-rw-r--r--src/mxf.h5
-rw-r--r--src/picture_mxf.h3
-rw-r--r--src/signer_chain.cc1
-rw-r--r--src/sound_mxf.h3
-rw-r--r--src/subtitle_content.cc5
-rw-r--r--src/subtitle_content.h6
13 files changed, 98 insertions, 24 deletions
diff --git a/src/asset.cc b/src/asset.cc
index f8de10b6..aaa79dc7 100644
--- a/src/asset.cc
+++ b/src/asset.cc
@@ -60,7 +60,7 @@ Asset::Asset (string id)
}
void
-Asset::write_to_pkl (xmlpp::Node* node) const
+Asset::write_to_pkl (xmlpp::Node* node, Standard standard) const
{
assert (!_file.empty ());
@@ -69,7 +69,7 @@ Asset::write_to_pkl (xmlpp::Node* node) const
asset->add_child("AnnotationText")->add_child_text (_id);
asset->add_child("Hash")->add_child_text (hash ());
asset->add_child("Size")->add_child_text (lexical_cast<string> (boost::filesystem::file_size (_file)));
- asset->add_child("Type")->add_child_text (pkl_type ());
+ asset->add_child("Type")->add_child_text (pkl_type (standard));
}
void
diff --git a/src/asset.h b/src/asset.h
index 57143310..bad982f1 100644
--- a/src/asset.h
+++ b/src/asset.h
@@ -62,8 +62,9 @@ public:
/** Write details of the asset to a PKL AssetList node.
* @param node Parent node.
+ * @param standard Standard to use.
*/
- void write_to_pkl (xmlpp::Node* node) const;
+ void write_to_pkl (xmlpp::Node* node, Standard standard) const;
boost::filesystem::path file () const {
return _file;
@@ -75,7 +76,7 @@ public:
std::string hash (boost::function<void (float)> progress = 0) const;
protected:
- virtual std::string pkl_type () const = 0;
+ virtual std::string pkl_type (Standard standard) const = 0;
/** The disk file that represents this asset, if one exists */
mutable boost::filesystem::path _file;
diff --git a/src/content.h b/src/content.h
index e7445d47..2059c8f5 100644
--- a/src/content.h
+++ b/src/content.h
@@ -71,6 +71,8 @@ public:
protected:
friend class MXFWriter;
+
+ virtual std::string asdcp_kind () const = 0;
Fraction _edit_rate;
int64_t _intrinsic_duration;
diff --git a/src/cpl.cc b/src/cpl.cc
index cd255309..9eae09ad 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -158,6 +158,7 @@ list<shared_ptr<const Content> >
CPL::content () const
{
list<shared_ptr<const Content> > c;
+
for (list<shared_ptr<Reel> >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) {
if ((*i)->main_picture ()) {
c.push_back ((*i)->main_picture()->mxf ());
@@ -251,3 +252,17 @@ CPL::resolve_refs (list<shared_ptr<Object> > objects)
(*i)->resolve_refs (objects);
}
}
+
+string
+CPL::pkl_type (Standard standard) const
+{
+ switch (standard) {
+ case INTEROP:
+ return "text/xml;asdcpKind=CPL";
+ case SMPTE:
+ return "text/xml";
+ default:
+ assert (false);
+ }
+}
+
diff --git a/src/cpl.h b/src/cpl.h
index 6ef992fd..8458a028 100644
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -111,9 +111,7 @@ public:
protected:
/** @return type string for PKLs for this asset */
- std::string pkl_type () const {
- return "text/xml";
- }
+ std::string pkl_type (Standard standard) const;
private:
std::string _annotation_text; ///< &lt;AnnotationText&gt;
diff --git a/src/dcp.cc b/src/dcp.cc
index 36eedcf7..88e36506 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -240,7 +240,7 @@ DCP::write_pkl (Standard standard, string pkl_uuid, XMLMetadata metadata, shared
xmlpp::Element* asset_list = pkl->add_child("AssetList");
for (list<shared_ptr<Asset> >::const_iterator i = _assets.begin(); i != _assets.end(); ++i) {
- (*i)->write_to_pkl (asset_list);
+ (*i)->write_to_pkl (asset_list, standard);
}
if (signer) {
@@ -258,14 +258,31 @@ void
DCP::write_volindex (Standard standard) const
{
boost::filesystem::path p = _directory;
- if (standard == INTEROP) {
+ switch (standard) {
+ case INTEROP:
p /= "VOLINDEX";
- } else {
+ break;
+ case SMPTE:
p /= "VOLINDEX.xml";
+ break;
+ default:
+ assert (false);
}
xmlpp::Document doc;
- xmlpp::Element* root = doc.create_root_node ("VolumeIndex", "http://www.smpte-ra.org/schemas/429-9/2007/AM");
+ xmlpp::Element* root;
+
+ switch (standard) {
+ case INTEROP:
+ root = doc.create_root_node ("VolumeIndex", "http://www.digicine.com/PROTO-ASDCP-AM-20040311#");
+ break;
+ case SMPTE:
+ root = doc.create_root_node ("VolumeIndex", "http://www.smpte-ra.org/schemas/429-9/2007/AM");
+ break;
+ default:
+ assert (false);
+ }
+
root->add_child("Index")->add_child_text ("1");
doc.write_to_file (p.string (), "UTF-8");
}
@@ -274,32 +291,50 @@ void
DCP::write_assetmap (Standard standard, string pkl_uuid, int pkl_length, XMLMetadata metadata) const
{
boost::filesystem::path p = _directory;
- if (standard == INTEROP) {
+
+ switch (standard) {
+ case INTEROP:
p /= "ASSETMAP";
- } else {
+ break;
+ case SMPTE:
p /= "ASSETMAP.xml";
+ break;
+ default:
+ assert (false);
}
xmlpp::Document doc;
xmlpp::Element* root;
- if (standard == INTEROP) {
+
+ switch (standard) {
+ case INTEROP:
root = doc.create_root_node ("AssetMap", "http://www.digicine.com/PROTO-ASDCP-AM-20040311#");
- } else {
+ break;
+ case SMPTE:
root = doc.create_root_node ("AssetMap", "http://www.smpte-ra.org/schemas/429-9/2007/AM");
+ break;
+ default:
+ assert (false);
}
root->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid());
root->add_child("AnnotationText")->add_child_text ("Created by " + metadata.creator);
- if (standard == INTEROP) {
+
+ switch (standard) {
+ case INTEROP:
root->add_child("VolumeCount")->add_child_text ("1");
root->add_child("IssueDate")->add_child_text (metadata.issue_date);
root->add_child("Issuer")->add_child_text (metadata.issuer);
root->add_child("Creator")->add_child_text (metadata.creator);
- } else {
+ break;
+ case SMPTE:
root->add_child("Creator")->add_child_text (metadata.creator);
root->add_child("VolumeCount")->add_child_text ("1");
root->add_child("IssueDate")->add_child_text (metadata.issue_date);
root->add_child("Issuer")->add_child_text (metadata.issuer);
+ break;
+ default:
+ assert (false);
}
xmlpp::Node* asset_list = root->add_child ("AssetList");
diff --git a/src/mxf.cc b/src/mxf.cc
index 3c75997b..e1ed9650 100644
--- a/src/mxf.cc
+++ b/src/mxf.cc
@@ -29,6 +29,7 @@
#include "metadata.h"
#include "exceptions.h"
#include "kdm.h"
+#include "compose.hpp"
#include <libxml++/nodes/element.h>
#include <boost/filesystem.hpp>
#include <iostream>
@@ -152,3 +153,16 @@ MXF::read_writer_info (ASDCP::WriterInfo const & info)
Kumu::bin2UUIDhex (info.AssetUUID, 16, buffer, 64);
_id = buffer;
}
+
+string
+MXF::pkl_type (Standard standard) const
+{
+ switch (standard) {
+ case INTEROP:
+ return String::compose ("application/x-smpte-mxf;asdcpKind=%1", asdcp_kind ());
+ case SMPTE:
+ return "application/x-smpte-mxf";
+ default:
+ assert (false);
+ }
+}
diff --git a/src/mxf.h b/src/mxf.h
index 525ac701..48a1f64e 100644
--- a/src/mxf.h
+++ b/src/mxf.h
@@ -102,10 +102,7 @@ public:
}
protected:
- std::string pkl_type () const {
- return "application/x-smpte-mxf";
- }
-
+ std::string pkl_type (Standard standard) const;
void read_writer_info (ASDCP::WriterInfo const &);
ASDCP::AESEncContext* _encryption_context;
diff --git a/src/picture_mxf.h b/src/picture_mxf.h
index 38a1819e..1ce2e7de 100644
--- a/src/picture_mxf.h
+++ b/src/picture_mxf.h
@@ -103,6 +103,9 @@ protected:
private:
std::string key_type () const;
+ std::string asdcp_kind () const {
+ return "Picture";
+ }
};
diff --git a/src/signer_chain.cc b/src/signer_chain.cc
index 87bacc53..3b75b06c 100644
--- a/src/signer_chain.cc
+++ b/src/signer_chain.cc
@@ -78,6 +78,7 @@ command (string cmd)
delete[] buffer;
#else
+ cmd += " 2> /dev/null";
int const r = system (cmd.c_str ());
int const code = WEXITSTATUS (r);
#endif
diff --git a/src/sound_mxf.h b/src/sound_mxf.h
index 8d1f8db3..50d10957 100644
--- a/src/sound_mxf.h
+++ b/src/sound_mxf.h
@@ -65,6 +65,9 @@ public:
private:
std::string key_type () const;
+ std::string asdcp_kind () const {
+ return "Sound";
+ }
int _channels; ///< number of channels
int _sampling_rate; ///< sampling rate in Hz
diff --git a/src/subtitle_content.cc b/src/subtitle_content.cc
index e32118c4..f338517e 100644
--- a/src/subtitle_content.cc
+++ b/src/subtitle_content.cc
@@ -34,6 +34,7 @@ using std::list;
using std::ostream;
using std::ofstream;
using std::stringstream;
+using std::cout;
using boost::shared_ptr;
using boost::lexical_cast;
using boost::optional;
@@ -59,7 +60,7 @@ SubtitleContent::SubtitleContent (boost::filesystem::path file)
/* Now make Subtitle objects to represent the raw XML nodes
in a sane way.
*/
-
+
ParseState parse_state;
examine_font_nodes (xml, font_nodes, parse_state);
}
@@ -230,7 +231,7 @@ SubtitleContent::xml_as_string () const
if (!_load_font_nodes.empty ()) {
xmlpp::Element* load_font = root->add_child("LoadFont");
load_font->set_attribute("Id", _load_font_nodes.front()->id);
- load_font->set_attribute("URI", _load_font_nodes.front()->uri);
+ load_font->set_attribute("URI", _load_font_nodes.front()->uri);
}
list<shared_ptr<SubtitleString> > sorted = _subtitles;
diff --git a/src/subtitle_content.h b/src/subtitle_content.h
index c4d0012b..410c5934 100644
--- a/src/subtitle_content.h
+++ b/src/subtitle_content.h
@@ -67,9 +67,13 @@ public:
Glib::ustring xml_as_string () const;
protected:
- std::string pkl_type () const {
+ std::string pkl_type (Standard) const {
return "text/xml";
}
+
+ std::string asdcp_kind () const {
+ return "Subtitle";
+ }
private:
std::string font_id_to_name (std::string id) const;