summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-23 15:35:24 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-23 15:35:24 +0100
commit6c37cc1979b2a01205a888c4c98f3334685ee8dd (patch)
tree9de52a3053e57bdf79a7986319cb097b33e46b5c /src/dcp.cc
parentb75d977a38f039fd68ed5d4055ae70b4bf631603 (diff)
Tidying.
Diffstat (limited to 'src/dcp.cc')
-rw-r--r--src/dcp.cc43
1 files changed, 16 insertions, 27 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index de02f8fb..47abd65e 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -66,6 +66,7 @@
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
+
using std::string;
using std::list;
using std::vector;
@@ -81,11 +82,13 @@ using boost::optional;
using boost::algorithm::starts_with;
using namespace dcp;
+
static string const assetmap_interop_ns = "http://www.digicine.com/PROTO-ASDCP-AM-20040311#";
static string const assetmap_smpte_ns = "http://www.smpte-ra.org/schemas/429-9/2007/AM";
static string const volindex_interop_ns = "http://www.digicine.com/PROTO-ASDCP-VL-20040311#";
static string const volindex_smpte_ns = "http://www.smpte-ra.org/schemas/429-9/2007/AM";
+
DCP::DCP (boost::filesystem::path directory)
: _directory (directory)
{
@@ -96,17 +99,7 @@ DCP::DCP (boost::filesystem::path directory)
_directory = boost::filesystem::canonical (_directory);
}
-/** Read a DCP. This method does not do any deep checking of the DCP's validity, but
- * if it comes across any bad things it will do one of two things.
- *
- * Errors that are so serious that they prevent the method from working will result
- * in an exception being thrown. For example, a missing ASSETMAP means that the DCP
- * can't be read without a lot of guesswork, so this will throw.
- *
- * Errors that are not fatal will be added to notes, if it's non-0. For example,
- * if the DCP contains a mixture of Interop and SMPTE elements this will result
- * in a note being added to the vector.
- */
+
void
DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_mxf_type)
{
@@ -147,7 +140,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m
if (i->optional_node_child("PackingList")) {
pkl_paths.push_back (p);
} else {
- paths.insert (make_pair (remove_urn_uuid (i->string_child ("Id")), p));
+ paths.insert (make_pair(remove_urn_uuid(i->string_child("Id")), p));
}
break;
case Standard::SMPTE:
@@ -156,7 +149,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m
if (pkl_bool && *pkl_bool == "true") {
pkl_paths.push_back (p);
} else {
- paths.insert (make_pair (remove_urn_uuid (i->string_child ("Id")), p));
+ paths.insert (make_pair(remove_urn_uuid(i->string_child("Id")), p));
}
break;
}
@@ -229,7 +222,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m
throw ReadError(String::compose("XML error in %1", path.string()), e.what());
}
- auto const root = p->get_document()->get_root_node()->get_name ();
+ auto const root = p->get_document()->get_root_node()->get_name();
delete p;
if (root == "CompositionPlaylist") {
@@ -275,6 +268,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m
}
}
+
void
DCP::resolve_refs (vector<shared_ptr<Asset>> assets)
{
@@ -283,6 +277,7 @@ DCP::resolve_refs (vector<shared_ptr<Asset>> assets)
}
}
+
bool
DCP::equals (DCP const & other, EqualityOptions opt, NoteHandler note) const
{
@@ -310,6 +305,7 @@ DCP::equals (DCP const & other, EqualityOptions opt, NoteHandler note) const
return r;
}
+
void
DCP::add (std::shared_ptr<CPL> cpl)
{
@@ -343,10 +339,6 @@ DCP::all_encrypted () const
}
-/** Add a KDM to decrypt this DCP. This method must be called after DCP::read()
- * or the KDM you specify will be ignored.
- * @param kdm KDM to use.
- */
void
DCP::add (DecryptedKDM const & kdm)
{
@@ -361,6 +353,7 @@ DCP::add (DecryptedKDM const & kdm)
}
}
+
/** Write the VOLINDEX file.
* @param standard DCP standard to use (INTEROP or SMPTE)
*/
@@ -397,6 +390,7 @@ DCP::write_volindex (Standard standard) const
doc.write_to_file_formatted (p.string (), "UTF-8");
}
+
void
DCP::write_assetmap (
Standard standard, string pkl_uuid, boost::filesystem::path pkl_path,
@@ -470,11 +464,7 @@ DCP::write_assetmap (
_asset_map = p;
}
-/** Write all the XML files for this DCP.
- * @param standand INTEROP or SMPTE.
- * @param metadata Metadata to use for PKL and asset map files.
- * @param signer Signer to use, or 0.
- */
+
void
DCP::write_xml (
Standard standard,
@@ -513,16 +503,14 @@ DCP::write_xml (
write_assetmap (standard, pkl->id(), pkl_path, issuer, creator, issue_date, annotation_text);
}
+
vector<shared_ptr<CPL>>
DCP::cpls () const
{
return _cpls;
}
-/** @param ignore_unresolved true to silently ignore unresolved assets, otherwise
- * an exception is thrown if they are found.
- * @return All assets (including CPLs).
- */
+
vector<shared_ptr<Asset>>
DCP::assets (bool ignore_unresolved) const
{
@@ -557,6 +545,7 @@ DCP::assets (bool ignore_unresolved) const
return assets;
}
+
/** Given a list of files that make up 1 or more DCPs, return the DCP directories */
vector<boost::filesystem::path>
DCP::directories_from_files (vector<boost::filesystem::path> files)