cxml::Document f ("CompositionPlaylist");
f.read_file (file);
- _id = f.string_child ("Id");
- if (_id.length() > 9) {
- _id = _id.substr (9);
- }
+ _id = remove_urn_uuid (f.string_child ("Id"));
_annotation_text = f.optional_string_child ("AnnotationText").get_value_or ("");
_metadata.issuer = f.optional_string_child ("Issuer").get_value_or ("");
_metadata.creator = f.optional_string_child ("Creator").get_value_or ("");
if (starts_with (p, "file://")) {
p = p.substr (7);
}
- paths.insert (make_pair (i->string_child ("Id"), p));
+ paths.insert (make_pair (remove_urn_uuid (i->string_child ("Id")), p));
}
/* Read all the assets from the asset map */
TypedKeyId (shared_ptr<const cxml::Node> node)
: key_type (node->string_child ("KeyType"))
- , key_id (node->string_child ("KeyId").substr (9))
+ , key_id (remove_urn_uuid (node->string_child ("KeyId")))
{
}
AuthorizedDeviceInfo () {}
AuthorizedDeviceInfo (shared_ptr<const cxml::Node> node)
- : device_list_identifier (node->string_child ("DeviceListIdentifier").substr (9))
+ : device_list_identifier (remove_urn_uuid (node->string_child ("DeviceListIdentifier")))
, device_list_description (node->optional_string_child ("DeviceListDescription"))
{
BOOST_FOREACH (cxml::ConstNodePtr i, node->node_child("DeviceList")->node_children("CertificateThumbprint")) {
KDMRequiredExtensions (shared_ptr<const cxml::Node> node)
: recipient (node->node_child ("Recipient"))
- , composition_playlist_id (node->string_child ("CompositionPlaylistId").substr (9))
+ , composition_playlist_id (remove_urn_uuid (node->string_child ("CompositionPlaylistId")))
, content_title_text (node->string_child ("ContentTitleText"))
, not_valid_before (node->string_child ("ContentKeysNotValidBefore"))
, not_valid_after (node->string_child ("ContentKeysNotValidAfter"))
{}
AuthenticatedPublic (shared_ptr<const cxml::Node> node)
- : message_id (node->string_child ("MessageId").substr (9))
+ : message_id (remove_urn_uuid (node->string_child ("MessageId")))
, annotation_text (node->string_child ("AnnotationText"))
, issue_date (node->string_child ("IssueDate"))
, signer (node->node_child ("Signer"))
*/
#include "object.h"
+#include "dcp_assert.h"
#include "util.h"
using std::string;
Object::Object (string id)
: _id (id)
{
-
+ DCP_ASSERT (_id.substr(0, 9) != "urn:uuid:");
}
using namespace dcp;
Reel::Reel (boost::shared_ptr<const cxml::Node> node)
- : Object (node->string_child ("Id"))
+ : Object (remove_urn_uuid (node->string_child ("Id")))
{
shared_ptr<cxml::Node> asset_list = node->node_child ("AssetList");
}
ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
- : Object (node->string_child ("Id"))
+ : Object (remove_urn_uuid (node->string_child ("Id")))
, _asset_ref (_id)
, _annotation_text (node->optional_string_child ("AnnotationText").get_value_or (""))
, _edit_rate (Fraction (node->string_child ("EditRate")))
, _duration (node->number_child<int64_t> ("Duration"))
, _hash (node->optional_string_child ("Hash").get_value_or (""))
{
- if (_id.length() > 9) {
- _id = _id.substr (9);
- _asset_ref.set_id (_id);
- }
+
}
void
*/
#include "reel_mxf.h"
+#include "util.h"
#include "mxf.h"
#include "dcp_assert.h"
#include <libcxml/cxml.h>
ReelMXF::ReelMXF (shared_ptr<const cxml::Node> node)
: _key_id (node->optional_string_child ("KeyId"))
{
- if (_key_id && _key_id.get().length() > 9) {
- _key_id = _key_id.get().substr (9);
+ if (_key_id) {
+ _key_id = remove_urn_uuid (*_key_id);
}
}
*/
#include "smpte_load_font_node.h"
+#include "util.h"
#include <libcxml/cxml.h>
using std::string;
SMPTELoadFontNode::SMPTELoadFontNode (shared_ptr<const cxml::Node> node)
: LoadFontNode (node->string_attribute ("ID"))
- , urn (node->content().substr (9))
+ , urn (remove_urn_uuid (node->content()))
{
}
reader.reset ();
try {
xml->read_file (file);
- _id = xml->string_child ("Id").substr (9);
+ _id = remove_urn_uuid (xml->string_child ("Id"));
} catch (cxml::Error& e) {
boost::throw_exception (
DCPReadError (
DCP_ASSERT (i != c.end ());
return *i;
}
+
+string
+dcp::remove_urn_uuid (string raw)
+{
+ DCP_ASSERT (raw.substr(0, 9) == "urn:uuid:");
+ return raw.substr (9);
+}
extern ContentKind content_kind_from_string (std::string kind);
extern bool empty_or_white_space (std::string s);
extern bool ids_equal (std::string a, std::string b);
-
+extern std::string remove_urn_uuid (std::string raw);
extern void init ();
extern int base64_decode (std::string const & in, unsigned char* out, int out_length);