summaryrefslogtreecommitdiff
path: root/src/reel_file_asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-13 23:36:22 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-13 23:36:22 +0200
commit488e3d1bd5e6b17d49f6db4df14c64f4b64db89b (patch)
tree641fcf167b845df6eca68c54fdf1110a7a07a739 /src/reel_file_asset.cc
parent51ae14c7e304d4fbc8d7524d584f3f4762d51f67 (diff)
Remove ReelEncryptableAsset and tidy up a bit.
Diffstat (limited to 'src/reel_file_asset.cc')
-rw-r--r--src/reel_file_asset.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/reel_file_asset.cc b/src/reel_file_asset.cc
index 85bf9de7..1ca77b4d 100644
--- a/src/reel_file_asset.cc
+++ b/src/reel_file_asset.cc
@@ -39,16 +39,20 @@
#include "asset.h"
#include "reel_file_asset.h"
+#include <libxml++/libxml++.h>
using std::shared_ptr;
+using std::string;
+using boost::optional;
using namespace dcp;
-ReelFileAsset::ReelFileAsset (shared_ptr<Asset> asset, std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ReelFileAsset::ReelFileAsset (shared_ptr<Asset> asset, optional<string> key_id, std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: ReelAsset (id, edit_rate, intrinsic_duration, entry_point)
, _asset_ref (asset)
, _hash (asset->hash())
+ , _key_id (key_id)
{
}
@@ -57,9 +61,12 @@ ReelFileAsset::ReelFileAsset (shared_ptr<Asset> asset, std::string id, Fraction
ReelFileAsset::ReelFileAsset (shared_ptr<const cxml::Node> node)
: ReelAsset (node)
, _asset_ref (remove_urn_uuid(node->string_child("Id")))
- , _hash (node->optional_string_child ("Hash"))
+ , _hash (node->optional_string_child("Hash"))
+ , _key_id (node->optional_string_child("KeyId"))
{
-
+ if (_key_id) {
+ _key_id = remove_urn_uuid (*_key_id);
+ }
}
@@ -82,3 +89,17 @@ ReelFileAsset::file_asset_equals (shared_ptr<const ReelFileAsset> other, Equalit
return true;
}
+
+xmlpp::Node *
+ReelFileAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+{
+ auto asset = ReelAsset::write_to_cpl (node, standard);
+ if (_key_id) {
+ asset->add_child("KeyId")->add_child_text("urn:uuid:" + *_key_id);
+ }
+ if (_hash) {
+ asset->add_child("Hash")->add_child_text(*_hash);
+ }
+ return asset;
+}
+