Make similar changes to the previous commit for _xml_id.
[libdcp.git] / src / reel_asset.cc
index 4d26e4f4b25ff714ef495771697e330555359e52..d233ee649ee20a7e8e598e69940bb15491586d8b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 /** @file  src/reel_asset.cc
- *  @brief ReelAsset class.
+ *  @brief ReelAsset class
  */
 
-#include "raw_convert.h"
-#include "reel_asset.h"
+
 #include "asset.h"
 #include "compose.hpp"
 #include "dcp_assert.h"
+#include "raw_convert.h"
+#include "reel_asset.h"
+#include "warnings.h"
 #include <libcxml/cxml.h>
+LIBDCP_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
+LIBDCP_ENABLE_WARNINGS
+
 
 using std::pair;
 using std::string;
@@ -50,12 +56,7 @@ using std::shared_ptr;
 using boost::optional;
 using namespace dcp;
 
-/** Construct a ReelAsset.
- *  @param id ID of this ReelAsset (which is that of the MXF, if there is one)
- *  @param edit_rate Edit rate for the asset.
- *  @param intrinsic_duration Intrinsic duration of this asset.
- *  @param entry_point Entry point to use in that asset.
- */
+
 ReelAsset::ReelAsset (string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
        : Object (id)
        , _intrinsic_duration (intrinsic_duration)
@@ -66,6 +67,7 @@ ReelAsset::ReelAsset (string id, Fraction edit_rate, int64_t intrinsic_duration,
        DCP_ASSERT (_entry_point <= _intrinsic_duration);
 }
 
+
 ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
        : Object (remove_urn_uuid (node->string_child ("Id")))
        , _intrinsic_duration (node->number_child<int64_t> ("IntrinsicDuration"))
@@ -77,16 +79,17 @@ ReelAsset::ReelAsset (shared_ptr<const cxml::Node> node)
 
 }
 
+
 xmlpp::Node*
-ReelAsset::write_to_cpl_asset (xmlpp::Node* node, Standard standard, optional<string> hash) const
+ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
 {
-       xmlpp::Element* a = node->add_child (cpl_node_name (standard));
-       pair<string, string> const attr = cpl_node_attribute (standard);
+       auto a = node->add_child (cpl_node_name (standard));
+       auto const attr = cpl_node_attribute (standard);
        if (!attr.first.empty ()) {
                a->set_attribute (attr.first, attr.second);
        }
-       pair<string, string> const ns = cpl_node_namespace (standard);
-       if (!ns.first.empty ()) {
+       auto const ns = cpl_node_namespace ();
+       if (!ns.first.empty()) {
                a->set_namespace_declaration (ns.first, ns.second);
        }
        a->add_child("Id")->add_child_text ("urn:uuid:" + _id);
@@ -99,24 +102,24 @@ ReelAsset::write_to_cpl_asset (xmlpp::Node* node, Standard standard, optional<st
        if (_duration) {
                a->add_child("Duration")->add_child_text(raw_convert<string>(*_duration));
        }
-       if (hash) {
-               a->add_child("Hash")->add_child_text (hash.get());
-       }
        return a;
 }
 
+
 pair<string, string>
 ReelAsset::cpl_node_attribute (Standard) const
 {
        return make_pair ("", "");
 }
 
+
 pair<string, string>
-ReelAsset::cpl_node_namespace (Standard) const
+ReelAsset::cpl_node_namespace () const
 {
        return make_pair ("", "");
 }
 
+
 bool
 ReelAsset::asset_equals (shared_ptr<const ReelAsset> other, EqualityOptions opt, NoteHandler note) const
 {
@@ -153,7 +156,7 @@ ReelAsset::asset_equals (shared_ptr<const ReelAsset> other, EqualityOptions opt,
        return true;
 }
 
-/** @return <Duration>, or <IntrinsicDuration> - <EntryPoint> if <Duration> is not present */
+
 int64_t
 ReelAsset::actual_duration () const
 {