Extract some parts of ReelEncryptableAsset into ReelFileAsset
authorCarl Hetherington <cth@carlh.net>
Sat, 10 Apr 2021 22:10:30 +0000 (00:10 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Apr 2021 18:50:08 +0000 (20:50 +0200)
19 files changed:
src/cpl.cc
src/cpl.h
src/decrypted_kdm.cc
src/reel_atmos_asset.cc
src/reel_atmos_asset.h
src/reel_closed_caption_asset.cc
src/reel_closed_caption_asset.h
src/reel_encryptable_asset.cc
src/reel_encryptable_asset.h
src/reel_file_asset.cc [new file with mode: 0644]
src/reel_file_asset.h [new file with mode: 0644]
src/reel_picture_asset.cc
src/reel_picture_asset.h
src/reel_sound_asset.cc
src/reel_sound_asset.h
src/reel_subtitle_asset.cc
src/reel_subtitle_asset.h
src/verify.cc
src/wscript

index b18197559324b58a0d3bbdf1561c0262e65988da..8766cf76d9c4c34d4a20a5a10ab9fca2c2c1375f 100644 (file)
@@ -515,23 +515,66 @@ add_file_assets (vector<shared_ptr<T>>& assets, vector<shared_ptr<Reel>> reels)
 }
 
 
-vector<shared_ptr<ReelEncryptableAsset>>
+vector<shared_ptr<ReelFileAsset>>
 CPL::reel_file_assets ()
 {
-       vector<shared_ptr<ReelEncryptableAsset>> c;
+       vector<shared_ptr<ReelFileAsset>> c;
        add_file_assets (c, _reels);
        return c;
 }
 
-vector<shared_ptr<const ReelEncryptableAsset>>
+
+vector<shared_ptr<const ReelFileAsset>>
 CPL::reel_file_assets () const
 {
-       vector<shared_ptr<const ReelEncryptableAsset>> c;
+       vector<shared_ptr<const ReelFileAsset>> c;
        add_file_assets (c, _reels);
        return c;
 }
 
 
+template <class T>
+void
+add_encryptable_assets (vector<shared_ptr<T>>& assets, vector<shared_ptr<Reel>> reels)
+{
+       for (auto i: reels) {
+               if (i->main_picture ()) {
+                       assets.push_back (i->main_picture());
+               }
+               if (i->main_sound ()) {
+                       assets.push_back (i->main_sound());
+               }
+               if (i->main_subtitle ()) {
+                       assets.push_back (i->main_subtitle());
+               }
+               for (auto j: i->closed_captions()) {
+                       assets.push_back (j);
+               }
+               if (i->atmos ()) {
+                       assets.push_back (i->atmos());
+               }
+       }
+}
+
+
+vector<shared_ptr<ReelEncryptableAsset>>
+CPL::reel_encryptable_assets ()
+{
+       vector<shared_ptr<ReelEncryptableAsset>> c;
+       add_encryptable_assets (c, _reels);
+       return c;
+}
+
+
+vector<shared_ptr<const ReelEncryptableAsset>>
+CPL::reel_encryptable_assets () const
+{
+       vector<shared_ptr<const ReelEncryptableAsset>> c;
+       add_encryptable_assets (c, _reels);
+       return c;
+}
+
+
 bool
 CPL::equals (shared_ptr<const Asset> other, EqualityOptions opt, NoteHandler note) const
 {
index 586beb818336e4b2810518cd16003d16747e428e..84dbd9ff52d7e784cc2e09a5d845c243c57f28a8 100644 (file)
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -60,6 +60,7 @@ namespace dcp {
 
 
 class ReelEncryptableAsset;
+class ReelFileAsset;
 class Reel;
 class MXFMetadata;
 class CertificateChain;
@@ -99,9 +100,13 @@ public:
                return _reels;
        }
 
+       /** @return the ReelFileAssets in this CPL in all reels */
+       std::vector<std::shared_ptr<const ReelFileAsset>> reel_file_assets () const;
+       std::vector<std::shared_ptr<ReelFileAsset>> reel_file_assets ();
+
        /** @return the ReelEncryptableAssets in this CPL in all reels */
-       std::vector<std::shared_ptr<const ReelEncryptableAsset>> reel_file_assets () const;
-       std::vector<std::shared_ptr<ReelEncryptableAsset>> reel_file_assets ();
+       std::vector<std::shared_ptr<const ReelEncryptableAsset>> reel_encryptable_assets () const;
+       std::vector<std::shared_ptr<ReelEncryptableAsset>> reel_encryptable_assets ();
 
        /** @return true if we have any encrypted content */
        bool any_encrypted () const;
index 9a9f2c2268bb1cd9a769321df83baee16c286f0d..447a0a12ee95a0d0fe93b65ca21d15747ee11e57 100644 (file)
@@ -287,7 +287,7 @@ DecryptedKDM::DecryptedKDM (
 {
        /* Create DecryptedKDMKey objects for each encryptable asset */
        bool did_one = false;
-       for (auto i: cpl->reel_file_assets()) {
+       for (auto i: cpl->reel_encryptable_assets()) {
                if (i->key_id()) {
                        add_key (i->key_type(), i->key_id().get(), key, cpl->id(), Standard::SMPTE);
                        did_one = true;
index dca434d2c0e143c89e40206a0a009e7bf91ab665..50581aff2c56f62b36081c3fd0d539de4a6aa88c 100644 (file)
@@ -52,7 +52,8 @@ using namespace dcp;
 
 ReelAtmosAsset::ReelAtmosAsset (std::shared_ptr<AtmosAsset> asset, int64_t entry_point)
        : ReelAsset (asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
-       , ReelEncryptableAsset (asset, asset->key_id())
+       , ReelFileAsset (asset)
+       , ReelEncryptableAsset (asset->key_id())
 {
 
 }
@@ -60,6 +61,7 @@ ReelAtmosAsset::ReelAtmosAsset (std::shared_ptr<AtmosAsset> asset, int64_t entry
 
 ReelAtmosAsset::ReelAtmosAsset (std::shared_ptr<const cxml::Node> node)
        : ReelAsset (node)
+       , ReelFileAsset (node)
        , ReelEncryptableAsset (node)
 {
        node->ignore_child ("DataType");
@@ -105,7 +107,7 @@ ReelAtmosAsset::equals (shared_ptr<const ReelAtmosAsset> other, EqualityOptions
                return false;
        }
 
-       if (!mxf_equals (other, opt, note)) {
+       if (!file_asset_equals (other, opt, note)) {
                return false;
        }
 
index 51af48fd64ed52c9c0b04ee2f25b31a95117e438..1fd6ce49c9288a7612d8af497d68458d0304de87 100644 (file)
@@ -55,7 +55,7 @@ class AtmosAsset;
 /** @class ReelAtmosAsset
  *  @brief Part of a Reel's description which refers to a Atmos MXF
  */
-class ReelAtmosAsset : public ReelAsset, public ReelEncryptableAsset
+class ReelAtmosAsset : public ReelAsset, public ReelFileAsset, public ReelEncryptableAsset
 {
 public:
        ReelAtmosAsset (std::shared_ptr<AtmosAsset> asset, int64_t entry_point);
index 2bc5f3e063167b9701be32b1d5d7ab66f3ff55e8..fe0945e3ce1c0eaa61113c41b5b5ec7f22a77023 100644 (file)
@@ -55,7 +55,8 @@ using namespace dcp;
 
 ReelClosedCaptionAsset::ReelClosedCaptionAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
        : ReelAsset (asset->id(), edit_rate, intrinsic_duration, entry_point)
-       , ReelEncryptableAsset (asset, dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : optional<string>())
+       , ReelFileAsset (asset)
+       , ReelEncryptableAsset (dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : optional<string>())
 {
 
 }
@@ -63,6 +64,7 @@ ReelClosedCaptionAsset::ReelClosedCaptionAsset (std::shared_ptr<SubtitleAsset> a
 
 ReelClosedCaptionAsset::ReelClosedCaptionAsset (std::shared_ptr<const cxml::Node> node)
        : ReelAsset (node)
+       , ReelFileAsset (node)
        , ReelEncryptableAsset (node)
 {
        _language = node->optional_string_child ("Language");
@@ -132,7 +134,7 @@ ReelClosedCaptionAsset::equals (shared_ptr<const ReelClosedCaptionAsset> other,
        if (!asset_equals (other, opt, note)) {
                return false;
        }
-       if (!mxf_equals (other, opt, note)) {
+       if (!file_asset_equals (other, opt, note)) {
                return false;
        }
 
index 2c943f7fe01527f895387049e1d57024826b4c81..80421ca22479295ab8d305fd98a97957b3456688 100644 (file)
@@ -59,7 +59,7 @@ class SubtitleAsset;
 /** @class ReelClosedCaptionAsset
  *  @brief Part of a Reel's description which refers to a closed caption XML/MXF file
  */
-class ReelClosedCaptionAsset : public ReelAsset, public ReelEncryptableAsset
+class ReelClosedCaptionAsset : public ReelAsset, public ReelFileAsset, public ReelEncryptableAsset
 {
 public:
        ReelClosedCaptionAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t instrinsic_duration, int64_t entry_point);
index 73f589d70ff5c07351a7cdcd0cf6fcdb019f1e00..feb71b59c5c2d65fb7319a5f02b79736eed56783 100644 (file)
@@ -51,19 +51,15 @@ using boost::optional;
 using namespace dcp;
 
 
-ReelEncryptableAsset::ReelEncryptableAsset (shared_ptr<Asset> asset, optional<string> key_id)
-       : _asset_ref (asset)
-       , _key_id (key_id)
-       , _hash (asset->hash())
+ReelEncryptableAsset::ReelEncryptableAsset (optional<string> key_id)
+       : _key_id (key_id)
 {
 
 }
 
 
 ReelEncryptableAsset::ReelEncryptableAsset (shared_ptr<const cxml::Node> node)
-       : _asset_ref (remove_urn_uuid(node->string_child("Id")))
-       , _key_id (node->optional_string_child ("KeyId"))
-       , _hash (node->optional_string_child ("Hash"))
+       : _key_id (node->optional_string_child ("KeyId"))
 {
        if (_key_id) {
                _key_id = remove_urn_uuid (*_key_id);
@@ -71,30 +67,10 @@ ReelEncryptableAsset::ReelEncryptableAsset (shared_ptr<const cxml::Node> node)
 }
 
 
-bool
-ReelEncryptableAsset::mxf_equals (shared_ptr<const ReelEncryptableAsset> other, EqualityOptions opt, NoteHandler note) const
-{
-       if (_hash != other->_hash) {
-               if (!opt.reel_hashes_can_differ) {
-                       note (NoteType::ERROR, "Reel: hashes differ");
-                       return false;
-               } else {
-                       note (NoteType::NOTE, "Reel: hashes differ");
-               }
-       }
-
-       if (_asset_ref.resolved() && other->_asset_ref.resolved()) {
-               return _asset_ref->equals (other->_asset_ref.asset(), opt, note);
-       }
-
-       return true;
-}
-
-
 void
 ReelEncryptableAsset::write_to_cpl_mxf (xmlpp::Node* node) const
 {
-        if (key_id ()) {
+        if (key_id()) {
                auto hash = find_child (node, "Hash");
                node->add_child_before(hash, "KeyId")->add_child_text("urn:uuid:" + key_id().get());
         }
index 56a697cc41a6e3977ad8065c80ca91900f127a19..978b2255fb9ba5f6bb9892e27274acbdb6282fdb 100644 (file)
@@ -41,6 +41,7 @@
 #define LIBDCP_REEL_ENCRYPTABLE_ASSET_H
 
 
+#include "reel_file_asset.h"
 #include "ref.h"
 #include <boost/optional.hpp>
 #include <memory>
@@ -61,34 +62,13 @@ namespace dcp {
 class ReelEncryptableAsset
 {
 public:
-       explicit ReelEncryptableAsset (std::shared_ptr<Asset> asset, boost::optional<std::string> key_id);
+       explicit ReelEncryptableAsset (boost::optional<std::string> key_id);
        explicit ReelEncryptableAsset (std::shared_ptr<const cxml::Node>);
        virtual ~ReelEncryptableAsset () {}
 
        /** @return the 4-character key type for this MXF (MDIK, MDAK, etc.) */
        virtual std::string key_type () const = 0;
 
-       /** @return a Ref to our actual asset */
-       Ref const & asset_ref () const {
-               return _asset_ref;
-       }
-
-       /** @return a Ref to our actual asset */
-       Ref & asset_ref () {
-               return _asset_ref;
-       }
-
-       /** @return the asset's hash, if this ReelEncryptableAsset has been created from one,
-        *  otherwise the hash written to the CPL for this asset (if present).
-        */
-       boost::optional<std::string> hash () const {
-               return _hash;
-       }
-
-       void set_hash (std::string h) {
-               _hash = h;
-       }
-
        /** @return true if a KeyId is specified for this asset, implying
         *  that its content is encrypted.
         */
@@ -103,31 +83,11 @@ public:
                return _key_id;
        }
 
-       bool mxf_equals (std::shared_ptr<const ReelEncryptableAsset> other, EqualityOptions opt, NoteHandler note) const;
-
 protected:
-
-       template <class T>
-       std::shared_ptr<T> asset_of_type () const {
-               return std::dynamic_pointer_cast<T> (_asset_ref.asset ());
-       }
-
-       template <class T>
-       std::shared_ptr<T> asset_of_type () {
-               return std::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.
-        */
-       Ref _asset_ref;
-
 private:
        boost::optional<std::string> _key_id; ///< The &lt;KeyId&gt; from the reel's entry for this asset, if there is one
-       /** Either our asset's computed hash or the hash read in from the CPL, if it's present */
-       boost::optional<std::string> _hash;
 };
 
 
diff --git a/src/reel_file_asset.cc b/src/reel_file_asset.cc
new file mode 100644 (file)
index 0000000..a55e084
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
+
+    This file is part of libdcp.
+
+    libdcp is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    libdcp is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of portions of this program with the
+    OpenSSL library under certain conditions as described in each
+    individual source file, and distribute linked combinations
+    including the two.
+
+    You must obey the GNU General Public License in all respects
+    for all of the code used other than OpenSSL.  If you modify
+    file(s) with this exception, you may extend this exception to your
+    version of the file(s), but you are not obligated to do so.  If you
+    do not wish to do so, delete this exception statement from your
+    version.  If you delete this exception statement from all source
+    files in the program, then also delete it here.
+*/
+
+
+/** @file  src/reel_file_asset.cc
+ *  @brief ReelFileAsset class
+ */
+
+
+#include "asset.h"
+#include "reel_file_asset.h"
+
+
+using std::shared_ptr;
+using namespace dcp;
+
+
+ReelFileAsset::ReelFileAsset (shared_ptr<Asset> asset)
+       : _asset_ref (asset)
+       , _hash (asset->hash())
+{
+
+}
+
+
+ReelFileAsset::ReelFileAsset (shared_ptr<const cxml::Node> node)
+       : _asset_ref (remove_urn_uuid(node->string_child("Id")))
+       , _hash (node->optional_string_child ("Hash"))
+{
+
+}
+
+
+bool
+ReelFileAsset::file_asset_equals (shared_ptr<const ReelFileAsset> other, EqualityOptions opt, NoteHandler note) const
+{
+       if (_hash != other->_hash) {
+               if (!opt.reel_hashes_can_differ) {
+                       note (NoteType::ERROR, "Reel: hashes differ");
+                       return false;
+               } else {
+                       note (NoteType::NOTE, "Reel: hashes differ");
+               }
+       }
+
+       if (_asset_ref.resolved() && other->_asset_ref.resolved()) {
+               return _asset_ref->equals (other->_asset_ref.asset(), opt, note);
+       }
+
+       return true;
+}
+
diff --git a/src/reel_file_asset.h b/src/reel_file_asset.h
new file mode 100644 (file)
index 0000000..de9921d
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
+
+    This file is part of libdcp.
+
+    libdcp is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    libdcp is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with libdcp.  If not, see <http://www.gnu.org/licenses/>.
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of portions of this program with the
+    OpenSSL library under certain conditions as described in each
+    individual source file, and distribute linked combinations
+    including the two.
+
+    You must obey the GNU General Public License in all respects
+    for all of the code used other than OpenSSL.  If you modify
+    file(s) with this exception, you may extend this exception to your
+    version of the file(s), but you are not obligated to do so.  If you
+    do not wish to do so, delete this exception statement from your
+    version.  If you delete this exception statement from all source
+    files in the program, then also delete it here.
+*/
+
+
+/** @file  src/reel_file_asset.h
+ *  @brief ReelFileAsset class
+ */
+
+
+#ifndef LIBDCP_REEL_FILE_ASSET_H
+#define LIBDCP_REEL_FILE_ASSET_H
+
+
+#include "ref.h"
+#include <boost/optional.hpp>
+#include <string>
+
+
+namespace dcp {
+
+
+class ReelFileAsset
+{
+public:
+       explicit ReelFileAsset (std::shared_ptr<Asset> asset);
+       explicit ReelFileAsset (std::shared_ptr<const cxml::Node> node);
+
+       /** @return a Ref to our actual asset */
+       Ref const & asset_ref () const {
+               return _asset_ref;
+       }
+
+       /** @return a Ref to our actual asset */
+       Ref & asset_ref () {
+               return _asset_ref;
+       }
+
+       /** @return the asset's hash, if this ReelFileAsset has been created from one,
+        *  otherwise the hash written to the CPL for this asset (if present).
+        */
+       boost::optional<std::string> hash () const {
+               return _hash;
+       }
+
+       void set_hash (std::string h) {
+               _hash = h;
+       }
+
+       bool file_asset_equals (std::shared_ptr<const ReelFileAsset> other, EqualityOptions opt, NoteHandler note) const;
+
+protected:
+
+       template <class T>
+       std::shared_ptr<T> asset_of_type () const {
+               return std::dynamic_pointer_cast<T> (_asset_ref.asset ());
+       }
+
+       template <class T>
+       std::shared_ptr<T> asset_of_type () {
+               return std::dynamic_pointer_cast<T> (_asset_ref.asset ());
+       }
+
+       /** Reference to the asset (MXF or XML file) that this reel entry
+        *  applies to.
+        */
+       Ref _asset_ref;
+
+private:
+       /** Either our asset's computed hash or the hash read in from the CPL, if it's present */
+       boost::optional<std::string> _hash;
+};
+
+
+}
+
+
+#endif
index 8a8b52197899e991bb679b50759457d798c080bc..cc5e23993bee207de6d06fdbd29cee2a978670d4 100644 (file)
@@ -58,7 +58,8 @@ using namespace dcp;
 
 ReelPictureAsset::ReelPictureAsset (shared_ptr<PictureAsset> asset, int64_t entry_point)
        : ReelAsset (asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
-       , ReelEncryptableAsset (asset, asset->key_id())
+       , ReelFileAsset (asset)
+       , ReelEncryptableAsset (asset->key_id())
        , _frame_rate (asset->frame_rate ())
        , _screen_aspect_ratio (asset->screen_aspect_ratio ())
 {
@@ -68,6 +69,7 @@ ReelPictureAsset::ReelPictureAsset (shared_ptr<PictureAsset> asset, int64_t entr
 
 ReelPictureAsset::ReelPictureAsset (shared_ptr<const cxml::Node> node)
        : ReelAsset (node)
+       , ReelFileAsset (node)
        , ReelEncryptableAsset (node)
 {
        _frame_rate = Fraction (node->string_child ("FrameRate"));
@@ -137,7 +139,7 @@ ReelPictureAsset::equals (shared_ptr<const ReelPictureAsset> other, EqualityOpti
        if (!asset_equals (other, opt, note)) {
                return false;
        }
-       if (!mxf_equals (other, opt, note)) {
+       if (!file_asset_equals (other, opt, note)) {
                return false;
        }
 
index 3b65abd245ddc375dc0088a6fa70e3dd38b861ae..3d98b09d7ddbd35f74bfd39de75c587f9d564264 100644 (file)
@@ -52,7 +52,7 @@ namespace dcp {
 /** @class ReelPictureAsset
  *  @brief Part of a Reel's description which refers to a picture asset
  */
-class ReelPictureAsset : public ReelAsset, public ReelEncryptableAsset
+class ReelPictureAsset : public ReelAsset, public ReelFileAsset, public ReelEncryptableAsset
 {
 public:
        ReelPictureAsset (std::shared_ptr<PictureAsset> asset, int64_t entry_point);
index 73fc7f4e6278dc41a29b46f4769fa86a2c64b287..216eb1f7ac055ff2887ab44d74cd3acaab7cbcfb 100644 (file)
@@ -50,7 +50,8 @@ using namespace dcp;
 
 ReelSoundAsset::ReelSoundAsset (shared_ptr<SoundAsset> asset, int64_t entry_point)
        : ReelAsset (asset->id(), asset->edit_rate(), asset->intrinsic_duration(), entry_point)
-       , ReelEncryptableAsset (asset, asset->key_id())
+       , ReelFileAsset (asset)
+       , ReelEncryptableAsset (asset->key_id())
 {
 
 }
@@ -58,6 +59,7 @@ ReelSoundAsset::ReelSoundAsset (shared_ptr<SoundAsset> asset, int64_t entry_poin
 
 ReelSoundAsset::ReelSoundAsset (shared_ptr<const cxml::Node> node)
        : ReelAsset (node)
+       , ReelFileAsset (node)
        , ReelEncryptableAsset (node)
 {
        node->ignore_child ("Language");
@@ -94,7 +96,7 @@ ReelSoundAsset::equals (shared_ptr<const ReelSoundAsset> other, EqualityOptions
        if (!asset_equals (other, opt, note)) {
                return false;
        }
-       if (!mxf_equals (other, opt, note)) {
+       if (!file_asset_equals (other, opt, note)) {
                return false;
        }
 
index 3048fd03a83e46d24e8503c51b2c6bd8c614e3c6..c5619ad9655e1d05195b40f541c88aae8c7f9c4c 100644 (file)
@@ -50,7 +50,7 @@ namespace dcp {
 /** @class ReelSoundAsset
  *  @brief Part of a Reel's description which refers to a sound asset
  */
-class ReelSoundAsset : public ReelAsset, public ReelEncryptableAsset
+class ReelSoundAsset : public ReelAsset, public ReelFileAsset, public ReelEncryptableAsset
 {
 public:
        ReelSoundAsset (std::shared_ptr<dcp::SoundAsset> content, int64_t entry_point);
index 7636782f94b9b6fbf8d5a29dacb67cc9f5d067cb..cccda50a4a23bcadd3f92a68a7e4d155bd4b5bc8 100644 (file)
@@ -53,7 +53,8 @@ using namespace dcp;
 
 ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
        : ReelAsset (asset->id(), edit_rate, intrinsic_duration, entry_point)
-       , ReelEncryptableAsset (asset, dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : optional<string>())
+       , ReelFileAsset (asset)
+       , ReelEncryptableAsset (dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : optional<string>())
 {
 
 }
@@ -61,6 +62,7 @@ ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Frac
 
 ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<const cxml::Node> node)
        : ReelAsset (node)
+       , ReelFileAsset (node)
        , ReelEncryptableAsset (node)
 {
        _language = node->optional_string_child("Language");
@@ -100,7 +102,7 @@ ReelSubtitleAsset::equals (shared_ptr<const ReelSubtitleAsset> other, EqualityOp
        if (!asset_equals (other, opt, note)) {
                return false;
        }
-       if (!mxf_equals (other, opt, note)) {
+       if (!file_asset_equals (other, opt, note)) {
                return false;
        }
 
index 8126547734ec512493b837b36709a6b20bba4554..b8dcf6d782ca1b6ad3dd447a7f6f3314503f9d70 100644 (file)
@@ -44,6 +44,7 @@
 #include "language_tag.h"
 #include "reel_asset.h"
 #include "reel_encryptable_asset.h"
+#include "reel_file_asset.h"
 #include "subtitle_asset.h"
 
 
@@ -59,7 +60,7 @@ class SubtitleAsset;
 /** @class ReelSubtitleAsset
  *  @brief Part of a Reel's description which refers to a subtitle XML/MXF file
  */
-class ReelSubtitleAsset : public ReelAsset, public ReelEncryptableAsset
+class ReelSubtitleAsset : public ReelAsset, public ReelFileAsset, public ReelEncryptableAsset
 {
 public:
        ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
index e27f6f3606c256fe7437d28131ad15aaca91ea92..6adab99d3b16fdc4b9476f5c7fd846f96bc1170e 100644 (file)
@@ -377,7 +377,7 @@ enum class VerifyAssetResult {
 
 
 static VerifyAssetResult
-verify_asset (shared_ptr<const DCP> dcp, shared_ptr<const ReelEncryptableAsset> reel_file_asset, function<void (float)> progress)
+verify_asset (shared_ptr<const DCP> dcp, shared_ptr<const ReelFileAsset> reel_file_asset, function<void (float)> progress)
 {
        auto const actual_hash = reel_file_asset->asset_ref()->hash(progress);
 
@@ -422,7 +422,7 @@ verify_language_tag (string tag, vector<VerificationNote>& notes)
 
 
 static void
-verify_picture_asset (shared_ptr<const ReelEncryptableAsset> reel_file_asset, boost::filesystem::path file, vector<VerificationNote>& notes, function<void (float)> progress)
+verify_picture_asset (shared_ptr<const ReelFileAsset> reel_file_asset, boost::filesystem::path file, vector<VerificationNote>& notes, function<void (float)> progress)
 {
        int biggest_frame = 0;
        auto asset = dynamic_pointer_cast<PictureAsset>(reel_file_asset->asset_ref().asset());
@@ -1233,7 +1233,7 @@ dcp::verify (
                                        if ((i->intrinsic_duration() * i->edit_rate().denominator / i->edit_rate().numerator) < 1) {
                                                notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_INTRINSIC_DURATION, i->id()});
                                        }
-                                       auto file_asset = dynamic_pointer_cast<ReelEncryptableAsset>(i);
+                                       auto file_asset = dynamic_pointer_cast<ReelFileAsset>(i);
                                        if (file_asset && !file_asset->hash()) {
                                                notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_HASH, i->id()});
                                        }
index 0143667d37cda77c65338a2ca56f9a2db90441e1..25a4dadb869abfd4b56bf7a7abb24ce0d627fa62 100644 (file)
@@ -83,6 +83,7 @@ def build(bld):
              reel_atmos_asset.cc
              reel_closed_caption_asset.cc
              reel_encryptable_asset.cc
+             reel_file_asset.cc
              reel_mono_picture_asset.cc
              reel_picture_asset.cc
              reel_markers_asset.cc
@@ -170,6 +171,7 @@ def build(bld):
               reel_atmos_asset.h
               reel_closed_caption_asset.h
               reel_encryptable_asset.h
+              reel_file_asset.h
               reel_markers_asset.h
               reel_mono_picture_asset.h
               reel_picture_asset.h