Add and use new write_to_cpl_mxf().
authorCarl Hetherington <cth@carlh.net>
Fri, 19 Jun 2020 11:14:38 +0000 (13:14 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 19 Jun 2020 11:15:34 +0000 (13:15 +0200)
src/reel_closed_caption_asset.cc
src/reel_mxf.cc
src/reel_mxf.h
src/reel_picture_asset.cc
src/reel_sound_asset.cc
src/reel_subtitle_asset.cc

index c9162a48cd8abe4d4e0aa5eb2b6d0ff879bb89d7..9ddd81a6602a2e1cddf586d86b2dfec051df05b6 100644 (file)
@@ -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);
index f170157ec0465b4cf464f4d0139b01e492028c5f..fbc55cf7496225ac81da30f7e833265b2d0dda33 100644 (file)
@@ -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());
+        }
+}
index 7bc8f75b3dea771115d99498ba7cf7f7fcf61d8b..732cddbd64f54f6f93942f8d0920fc339fcef727 100644 (file)
@@ -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.
         */
index 8c82e01bb6acafa61bd68f229ab90f0689635c45..3052c616c67533fe6f5384a2b6313b38706199db 100644 (file)
@@ -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;
 }
index 4073472e5ff4dff8d671361dc7007f927dcc0589..40466ff31d69a56af93f7e46a20a5c26184a8524 100644 (file)
@@ -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;
 }
 
index 49ac033ca6167a32fbf1170d47cdeb55fd3e6fec..4fa9fd0a26aa3cee4ed76911784b522503ceafaf 100644 (file)
@@ -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;
 }