summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-06-19 13:14:38 +0200
committerCarl Hetherington <cth@carlh.net>2020-06-19 13:15:34 +0200
commitdab4fb9e3d2e828c98e33f9be45a92757fc41095 (patch)
treeab67de1b6e062211337bb7fed05bd2a0f1dee838 /src
parent5665c52ad16aaba050c34b8b391a3212e8cf85a8 (diff)
Add and use new write_to_cpl_mxf().
Diffstat (limited to 'src')
-rw-r--r--src/reel_closed_caption_asset.cc7
-rw-r--r--src/reel_mxf.cc10
-rw-r--r--src/reel_mxf.h2
-rw-r--r--src/reel_picture_asset.cc6
-rw-r--r--src/reel_sound_asset.cc8
-rw-r--r--src/reel_subtitle_asset.cc8
6 files changed, 16 insertions, 25 deletions
diff --git a/src/reel_closed_caption_asset.cc b/src/reel_closed_caption_asset.cc
index c9162a48..9ddd81a6 100644
--- a/src/reel_closed_caption_asset.cc
+++ b/src/reel_closed_caption_asset.cc
@@ -99,13 +99,8 @@ ReelClosedCaptionAsset::key_type () const
xmlpp::Node *
ReelClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
-
- if (key_id()) {
- /* Find <Hash> */
- xmlpp::Node* hash = find_child (asset, "Hash");
- asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
- }
xmlpp::Node* asset = write_to_cpl_asset (node, standard, hash());
+ write_to_cpl_mxf (asset);
if (_language) {
asset->add_child("Language")->add_child_text(*_language);
diff --git a/src/reel_mxf.cc b/src/reel_mxf.cc
index f170157e..fbc55cf7 100644
--- a/src/reel_mxf.cc
+++ b/src/reel_mxf.cc
@@ -79,3 +79,13 @@ ReelMXF::mxf_equals (shared_ptr<const ReelMXF> other, EqualityOptions opt, NoteH
return true;
}
+
+
+void
+ReelMXF::write_to_cpl_mxf (xmlpp::Node* node) const
+{
+ if (key_id ()) {
+ xmlpp::Node* hash = find_child (node, "Hash");
+ node->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
+ }
+}
diff --git a/src/reel_mxf.h b/src/reel_mxf.h
index 7bc8f75b..732cddbd 100644
--- a/src/reel_mxf.h
+++ b/src/reel_mxf.h
@@ -107,6 +107,8 @@ protected:
return boost::dynamic_pointer_cast<T> (_asset_ref.asset ());
}
+ void write_to_cpl_mxf (xmlpp::Node* node) const;
+
/** Reference to the asset (MXF or XML file) that this reel entry
* applies to.
*/
diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc
index 8c82e01b..3052c616 100644
--- a/src/reel_picture_asset.cc
+++ b/src/reel_picture_asset.cc
@@ -112,11 +112,7 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
);
}
- if (key_id ()) {
- /* Find <Hash> */
- xmlpp::Node* hash = find_child (asset, "Hash");
- asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
- }
+ write_to_cpl_mxf (asset);
return asset;
}
diff --git a/src/reel_sound_asset.cc b/src/reel_sound_asset.cc
index 4073472e..40466ff3 100644
--- a/src/reel_sound_asset.cc
+++ b/src/reel_sound_asset.cc
@@ -74,14 +74,8 @@ ReelSoundAsset::key_type () const
xmlpp::Node *
ReelSoundAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
-
- if (key_id ()) {
- /* Find <Hash> */
- xmlpp::Node* hash = find_child (asset, "Hash");
- asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
- }
-
xmlpp::Node* asset = write_to_cpl_asset (node, standard, hash());
+ write_to_cpl_mxf (asset);
return asset;
}
diff --git a/src/reel_subtitle_asset.cc b/src/reel_subtitle_asset.cc
index 49ac033c..4fa9fd0a 100644
--- a/src/reel_subtitle_asset.cc
+++ b/src/reel_subtitle_asset.cc
@@ -76,14 +76,8 @@ ReelSubtitleAsset::key_type () const
xmlpp::Node *
ReelSubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
{
-
- if (key_id ()) {
- /* Find <Hash> */
- xmlpp::Node* hash = find_child (asset, "Hash");
- asset->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
- }
-
xmlpp::Node* asset = write_to_cpl_asset (node, standard, hash());
+ write_to_cpl_mxf (asset);
return asset;
}