Split ReelSubtitleAsset into Interop and SMPTE classes.
authorCarl Hetherington <cth@carlh.net>
Sun, 11 Apr 2021 18:49:44 +0000 (20:49 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Apr 2021 23:22:10 +0000 (01:22 +0200)
21 files changed:
src/cpl.cc
src/reel.cc
src/reel.h
src/reel_atmos_asset.cc
src/reel_closed_caption_asset.cc
src/reel_encryptable_asset.cc
src/reel_encryptable_asset.h
src/reel_file_asset.h
src/reel_interop_subtitle_asset.cc [new file with mode: 0644]
src/reel_interop_subtitle_asset.h [new file with mode: 0644]
src/reel_picture_asset.cc
src/reel_smpte_subtitle_asset.cc [new file with mode: 0644]
src/reel_smpte_subtitle_asset.h [new file with mode: 0644]
src/reel_sound_asset.cc
src/reel_subtitle_asset.cc
src/reel_subtitle_asset.h
src/verify.cc
src/wscript
test/reel_asset_test.cc
test/verify_test.cc
test/write_subtitle_test.cc

index 39e78baa89a723b89d9a23352aeaf7a3a29f3588..3b5497576b5cef71808af84f3399420e93c4e738 100644 (file)
@@ -137,7 +137,10 @@ CPL::CPL (boost::filesystem::path file)
                        _ratings.push_back (Rating(i));
                }
        }
-       _reels = type_grand_children<Reel> (f, "ReelList", "Reel");
+
+       for (auto i: f.node_child("ReelList")->node_children("Reel")) {
+               _reels.push_back (make_shared<Reel>(i, *_standard));
+       }
 
        auto reel_list = f.node_child ("ReelList");
        if (reel_list) {
@@ -546,7 +549,9 @@ add_encryptable_assets (vector<shared_ptr<T>>& assets, vector<shared_ptr<Reel>>
                        assets.push_back (i->main_sound());
                }
                if (i->main_subtitle ()) {
-                       assets.push_back (i->main_subtitle());
+                       if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(i->main_subtitle())) {
+                               assets.push_back (enc);
+                       }
                }
                for (auto j: i->closed_captions()) {
                        assets.push_back (j);
index 74107ed05e883e5af051c2522122e67ca4d625b5..becac8983c02b328155adc087c09cfd91f8d00d9 100644 (file)
@@ -47,6 +47,8 @@
 #include "reel_mono_picture_asset.h"
 #include "reel_stereo_picture_asset.h"
 #include "reel_sound_asset.h"
+#include "reel_interop_subtitle_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include "reel_subtitle_asset.h"
 #include "reel_markers_asset.h"
 #include "decrypted_kdm_key.h"
@@ -69,7 +71,7 @@ using std::vector;
 using namespace dcp;
 
 
-Reel::Reel (std::shared_ptr<const cxml::Node> node)
+Reel::Reel (std::shared_ptr<const cxml::Node> node, dcp::Standard standard)
        : Object (remove_urn_uuid (node->string_child ("Id")))
 {
        auto asset_list = node->node_child ("AssetList");
@@ -91,7 +93,14 @@ Reel::Reel (std::shared_ptr<const cxml::Node> node)
 
        auto main_subtitle = asset_list->optional_node_child ("MainSubtitle");
        if (main_subtitle) {
-               _main_subtitle = make_shared<ReelSubtitleAsset>(main_subtitle);
+               switch (standard) {
+                       case Standard::INTEROP:
+                               _main_subtitle = make_shared<ReelInteropSubtitleAsset>(main_subtitle);
+                               break;
+                       case Standard::SMPTE:
+                               _main_subtitle = make_shared<ReelSMPTESubtitleAsset>(main_subtitle);
+                               break;
+               }
        }
 
        auto main_markers = asset_list->optional_node_child ("MainMarkers");
@@ -186,7 +195,31 @@ Reel::equals (std::shared_ptr<const Reel> other, EqualityOptions opt, NoteHandle
                return false;
        }
 
-       if (_main_subtitle && !_main_subtitle->equals (other->_main_subtitle, opt, note)) {
+       bool same_type = false;
+
+       {
+               auto interop = dynamic_pointer_cast<ReelInteropSubtitleAsset>(_main_subtitle);
+               auto interop_other = dynamic_pointer_cast<ReelInteropSubtitleAsset>(other->_main_subtitle);
+               if (interop && interop_other) {
+                       same_type = true;
+                       if (!interop->equals(interop_other, opt, note)) {
+                               return false;
+                       }
+               }
+       }
+
+       {
+               auto smpte = dynamic_pointer_cast<ReelSMPTESubtitleAsset>(_main_subtitle);
+               auto smpte_other = dynamic_pointer_cast<ReelSMPTESubtitleAsset>(other->_main_subtitle);
+               if (smpte && smpte_other) {
+                       same_type = true;
+                       if (!smpte->equals(smpte_other, opt, note)) {
+                               return false;
+                       }
+               }
+       }
+
+       if ((_main_subtitle || other->_main_subtitle) && !same_type) {
                return false;
        }
 
@@ -237,10 +270,17 @@ Reel::any_encrypted () const
                }
        }
 
+       bool esub = false;
+       if (_main_subtitle) {
+               if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(_main_picture)) {
+                       esub = enc->encrypted();
+               }
+       }
+
        return (
                (_main_picture && _main_picture->encrypted()) ||
                (_main_sound && _main_sound->encrypted()) ||
-               (_main_subtitle && _main_subtitle->encrypted()) ||
+               esub ||
                ecc ||
                (_atmos && _atmos->encrypted())
                );
@@ -257,10 +297,18 @@ Reel::all_encrypted () const
                }
        }
 
+       /* It's ok if there's no subtitle, or it's not encryptable */
+       bool esub = true;
+       if (_main_subtitle) {
+               if (auto enc = dynamic_pointer_cast<ReelEncryptableAsset>(_main_picture)) {
+                       esub = enc->encrypted();
+               }
+       }
+
        return (
                (!_main_picture || _main_picture->encrypted()) &&
                (!_main_sound || _main_sound->encrypted()) &&
-               (!_main_subtitle || _main_subtitle->encrypted()) &&
+               esub &&
                ecc &&
                (!_atmos || _atmos->encrypted())
               );
@@ -279,10 +327,10 @@ Reel::add (DecryptedKDM const & kdm)
                if (_main_sound && i.id() == _main_sound->key_id()) {
                        _main_sound->asset()->set_key (i.key());
                }
-               if (_main_subtitle && i.id() == _main_subtitle->key_id()) {
-                       shared_ptr<SMPTESubtitleAsset> s = dynamic_pointer_cast<SMPTESubtitleAsset> (_main_subtitle->asset());
-                       if (s) {
-                               s->set_key (i.key());
+               if (_main_subtitle) {
+                       auto smpte = dynamic_pointer_cast<ReelSMPTESubtitleAsset>(_main_picture);
+                       if (smpte && i.id() == smpte->key_id()) {
+                               smpte->smpte_asset()->set_key(i.key());
                        }
                }
                for (auto j: _closed_captions) {
index c81724cb7387575541f868a43ef3b96d8c90db8f..d3ea7f0c10b90cb25bdf75f7b9302ceb4d5a6065 100644 (file)
@@ -92,7 +92,7 @@ public:
                , _atmos (atmos)
        {}
 
-       explicit Reel (std::shared_ptr<const cxml::Node>);
+       explicit Reel (std::shared_ptr<const cxml::Node>, dcp::Standard standard);
 
        std::shared_ptr<ReelPictureAsset> main_picture () const {
                return _main_picture;
index 50581aff2c56f62b36081c3fd0d539de4a6aa88c..bd354bf79f91f9d24374ab3007987658c6526c17 100644 (file)
@@ -94,7 +94,7 @@ xmlpp::Node *
 ReelAtmosAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
 {
        auto asset = write_to_cpl_asset (node, standard, hash());
-       write_to_cpl_mxf (asset);
+       write_to_cpl_encryptable (asset);
        asset->add_child("axd:DataType")->add_child_text("urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
        return asset;
 }
index fe0945e3ce1c0eaa61113c41b5b5ec7f22a77023..b751efaf9225fc50ccf8417680ef9739a58c5571 100644 (file)
@@ -111,7 +111,7 @@ xmlpp::Node *
 ReelClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
 {
        auto asset = write_to_cpl_asset (node, standard, hash());
-       write_to_cpl_mxf (asset);
+       write_to_cpl_encryptable (asset);
 
        if (_language) {
                switch (standard) {
index 82dc9c8921f73b0cabf328d671267bf7ff54fd92..f8e8303f21d4972385973889ae89dd0da14efcd8 100644 (file)
@@ -68,7 +68,7 @@ ReelEncryptableAsset::ReelEncryptableAsset (shared_ptr<const cxml::Node> node)
 
 
 void
-ReelEncryptableAsset::write_to_cpl_mxf (xmlpp::Node* node) const
+ReelEncryptableAsset::write_to_cpl_encryptable (xmlpp::Node* node) const
 {
         if (key_id()) {
                auto hash = find_child (node, "Hash");
index 978b2255fb9ba5f6bb9892e27274acbdb6282fdb..0eeb9640144caa1b6bf3eed2efa2027c45f9b959 100644 (file)
@@ -84,7 +84,7 @@ public:
        }
 
 protected:
-       void write_to_cpl_mxf (xmlpp::Node* node) const;
+       void write_to_cpl_encryptable (xmlpp::Node* node) const;
 
 private:
        boost::optional<std::string> _key_id; ///< The &lt;KeyId&gt; from the reel's entry for this asset, if there is one
index de9921d58e27c5ea57dc1fd75e651696777dad1c..070a3e0f5c552d9f7f0abeae712788a4bb1ebbf2 100644 (file)
@@ -95,7 +95,6 @@ protected:
         */
        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;
 };
diff --git a/src/reel_interop_subtitle_asset.cc b/src/reel_interop_subtitle_asset.cc
new file mode 100644 (file)
index 0000000..5b8cfcd
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+    Copyright (C) 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_interop_subtitle_asset.cc
+ *  @brief ReelInteropSubtitleAsset class
+ */
+
+
+#include "reel_interop_subtitle_asset.h"
+#include <libxml++/libxml++.h>
+
+
+using std::shared_ptr;
+using std::string;
+using boost::optional;
+using namespace dcp;
+
+
+ReelInteropSubtitleAsset::ReelInteropSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+       : ReelSubtitleAsset (asset, edit_rate, intrinsic_duration, entry_point)
+{
+
+}
+
+
+ReelInteropSubtitleAsset::ReelInteropSubtitleAsset (std::shared_ptr<const cxml::Node> node)
+       : ReelSubtitleAsset (node)
+{
+       node->done ();
+}
+
+
+xmlpp::Node *
+ReelInteropSubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+{
+       auto asset = write_to_cpl_asset (node, standard, _hash);
+       if (_language) {
+               asset->add_child("Language")->add_child_text(*_language);
+       }
+       return asset;
+}
+
+
diff --git a/src/reel_interop_subtitle_asset.h b/src/reel_interop_subtitle_asset.h
new file mode 100644 (file)
index 0000000..41c4fa6
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+    Copyright (C) 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_interop_subtitle_asset.h
+ *  @brief ReelInteropSubtitleAsset class
+ */
+
+
+#include "interop_subtitle_asset.h"
+#include "reel_file_asset.h"
+#include "reel_subtitle_asset.h"
+
+
+namespace dcp {
+
+
+/** @class ReelInteropSubtitleAsset
+ *  @brief Part of a Reel's description which refers to an Interop subtitle XML file
+ */
+class ReelInteropSubtitleAsset : public ReelSubtitleAsset
+{
+public:
+       ReelInteropSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+       explicit ReelInteropSubtitleAsset (std::shared_ptr<const cxml::Node>);
+
+       std::shared_ptr<InteropSubtitleAsset> interop_asset () const {
+               return std::dynamic_pointer_cast<InteropSubtitleAsset>(asset());
+       }
+
+       xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
+};
+
+
+}
+
index cc5e23993bee207de6d06fdbd29cee2a978670d4..8b4390039cf6f8694871969aca51c55e8abc3b69 100644 (file)
@@ -120,7 +120,7 @@ ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
                        );
        }
 
-       write_to_cpl_mxf (asset);
+       write_to_cpl_encryptable (asset);
 
        return asset;
 }
diff --git a/src/reel_smpte_subtitle_asset.cc b/src/reel_smpte_subtitle_asset.cc
new file mode 100644 (file)
index 0000000..0cd38c2
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+    Copyright (C) 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_interop_subtitle_asset.cc
+ *  @brief ReelInteropSubtitleAsset class
+ */
+
+
+#include "reel_smpte_subtitle_asset.h"
+#include "smpte_subtitle_asset.h"
+#include <libxml++/libxml++.h>
+
+
+using std::shared_ptr;
+using std::string;
+using boost::optional;
+using namespace dcp;
+
+
+ReelSMPTESubtitleAsset::ReelSMPTESubtitleAsset (shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+       : ReelSubtitleAsset (asset, edit_rate, intrinsic_duration, entry_point)
+       , ReelEncryptableAsset (asset->key_id())
+{
+
+}
+
+
+ReelSMPTESubtitleAsset::ReelSMPTESubtitleAsset (shared_ptr<const cxml::Node> node)
+       : ReelSubtitleAsset (node)
+       , ReelEncryptableAsset (node)
+{
+       node->done ();
+}
+
+
+xmlpp::Node *
+ReelSMPTESubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+{
+       auto asset = write_to_cpl_asset (node, standard, _hash);
+       write_to_cpl_encryptable (asset);
+       if (_language) {
+               asset->add_child("Language")->add_child_text(*_language);
+       }
+       return asset;
+}
+
diff --git a/src/reel_smpte_subtitle_asset.h b/src/reel_smpte_subtitle_asset.h
new file mode 100644 (file)
index 0000000..8a7e0c2
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+    Copyright (C) 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_interop_subtitle_asset.h
+ *  @brief ReelInteropSubtitleAsset class
+ */
+
+
+#include "reel_encryptable_asset.h"
+#include "reel_subtitle_asset.h"
+#include "smpte_subtitle_asset.h"
+
+
+namespace dcp {
+
+
+class SMPTESubtitleAsset;
+
+
+/** @class ReelSMPTESubtitleAsset
+ *  @brief Part of a Reel's description which refers to an SMPTE subtitle MXF file
+ */
+class ReelSMPTESubtitleAsset : public ReelSubtitleAsset, public ReelEncryptableAsset
+{
+public:
+       ReelSMPTESubtitleAsset (std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+       explicit ReelSMPTESubtitleAsset (std::shared_ptr<const cxml::Node>);
+
+       xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+
+       std::shared_ptr<SMPTESubtitleAsset> smpte_asset () const {
+               return std::dynamic_pointer_cast<SMPTESubtitleAsset>(asset());
+       }
+
+private:
+       std::string key_type () const {
+               return "MDSK";
+       }
+};
+
+
+}
+
+
index 216eb1f7ac055ff2887ab44d74cd3acaab7cbcfb..7ca2b2da014e032f2b17022c1e9a91bfb4b24280 100644 (file)
@@ -85,7 +85,7 @@ xmlpp::Node *
 ReelSoundAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
 {
        auto asset = write_to_cpl_asset (node, standard, hash());
-       write_to_cpl_mxf (asset);
+       write_to_cpl_encryptable (asset);
        return asset;
 }
 
index cccda50a4a23bcadd3f92a68a7e4d155bd4b5bc8..0981d1c02c3e21f63f5f96de9aab0f2de05b05cc 100644 (file)
@@ -54,7 +54,6 @@ 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)
        , ReelFileAsset (asset)
-       , ReelEncryptableAsset (dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : optional<string>())
 {
 
 }
@@ -63,10 +62,8 @@ 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");
-       node->done ();
 }
 
 
@@ -77,22 +74,10 @@ ReelSubtitleAsset::cpl_node_name (Standard) const
 }
 
 
-string
-ReelSubtitleAsset::key_type () const
-{
-       return "MDSK";
-}
-
-
-xmlpp::Node *
-ReelSubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+void
+ReelSubtitleAsset::set_language (dcp::LanguageTag language)
 {
-       auto asset = write_to_cpl_asset (node, standard, hash());
-       write_to_cpl_mxf (asset);
-       if (_language) {
-               asset->add_child("Language")->add_child_text(*_language);
-       }
-       return asset;
+       _language = language.to_string();
 }
 
 
@@ -102,17 +87,11 @@ ReelSubtitleAsset::equals (shared_ptr<const ReelSubtitleAsset> other, EqualityOp
        if (!asset_equals (other, opt, note)) {
                return false;
        }
-       if (!file_asset_equals (other, opt, note)) {
-               return false;
+
+       if (_asset_ref.resolved() && other->_asset_ref.resolved()) {
+               return _asset_ref->equals (other->_asset_ref.asset(), opt, note);
        }
 
        return true;
 }
 
-
-void
-ReelSubtitleAsset::set_language (dcp::LanguageTag language)
-{
-       _language = language.to_string();
-}
-
index b8dcf6d782ca1b6ad3dd447a7f6f3314503f9d70..ad1ea6cda0d8262c8c7e44f11a25807a09d117a6 100644 (file)
@@ -43,7 +43,6 @@
 
 #include "language_tag.h"
 #include "reel_asset.h"
-#include "reel_encryptable_asset.h"
 #include "reel_file_asset.h"
 #include "subtitle_asset.h"
 
@@ -60,17 +59,16 @@ class SubtitleAsset;
 /** @class ReelSubtitleAsset
  *  @brief Part of a Reel's description which refers to a subtitle XML/MXF file
  */
-class ReelSubtitleAsset : public ReelAsset, public ReelFileAsset, public ReelEncryptableAsset
+class ReelSubtitleAsset : public ReelAsset, public ReelFileAsset
 {
 public:
        ReelSubtitleAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
        explicit ReelSubtitleAsset (std::shared_ptr<const cxml::Node>);
 
-       xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
        bool equals (std::shared_ptr<const ReelSubtitleAsset>, EqualityOptions, NoteHandler) const;
 
        std::shared_ptr<SubtitleAsset> asset () const {
-               return asset_of_type<SubtitleAsset> ();
+               return std::dynamic_pointer_cast<SubtitleAsset>(_asset_ref.asset());
        }
 
        void set_language (dcp::LanguageTag language);
@@ -79,17 +77,17 @@ public:
                return _language;
        }
 
-private:
-       friend struct ::verify_invalid_language1;
-
-       std::string key_type () const;
-       std::string cpl_node_name (Standard standard) const;
-
+protected:
        /** As in other places, this is stored and returned as a string so that
         *  we can tolerate non-RFC-5646 strings, but must be set as a dcp::LanguageTag
         *  to try to ensure that we create compliant output.
         */
        boost::optional<std::string> _language;
+
+private:
+       friend struct ::verify_invalid_language1;
+
+       std::string cpl_node_name (Standard standard) const;
 };
 
 
index 6adab99d3b16fdc4b9476f5c7fd846f96bc1170e..e176362aeae3a78e98056eb9842cb6c409607211 100644 (file)
 #include "raw_convert.h"
 #include "reel.h"
 #include "reel_closed_caption_asset.h"
+#include "reel_interop_subtitle_asset.h"
 #include "reel_markers_asset.h"
 #include "reel_picture_asset.h"
 #include "reel_sound_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include "reel_subtitle_asset.h"
 #include "smpte_subtitle_asset.h"
 #include "stereo_picture_asset.h"
@@ -991,7 +993,13 @@ verify_text_timing (vector<shared_ptr<Reel>> reels, vector<VerificationNote>& no
                                return static_cast<bool>(reel->main_subtitle());
                        },
                        [](shared_ptr<Reel> reel) {
-                               return reel->main_subtitle()->asset()->raw_xml();
+                               auto interop = dynamic_pointer_cast<ReelInteropSubtitleAsset>(reel->main_subtitle());
+                               if (interop) {
+                                       return interop->asset()->raw_xml();
+                               }
+                               auto smpte = dynamic_pointer_cast<ReelSMPTESubtitleAsset>(reel->main_subtitle());
+                               DCP_ASSERT (smpte);
+                               return smpte->asset()->raw_xml();
                        },
                        [](shared_ptr<Reel> reel) {
                                return reel->main_subtitle()->actual_duration();
@@ -1234,7 +1242,7 @@ dcp::verify (
                                                notes.push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_INTRINSIC_DURATION, i->id()});
                                        }
                                        auto file_asset = dynamic_pointer_cast<ReelFileAsset>(i);
-                                       if (file_asset && !file_asset->hash()) {
+                                       if (dynamic_pointer_cast<ReelEncryptableAsset>(i) && !file_asset->hash()) {
                                                notes.push_back ({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_HASH, i->id()});
                                        }
                                }
index 25a4dadb869abfd4b56bf7a7abb24ce0d627fa62..b50966e77c36fc408ce28d066abaf10105ba22e3 100644 (file)
@@ -84,9 +84,11 @@ def build(bld):
              reel_closed_caption_asset.cc
              reel_encryptable_asset.cc
              reel_file_asset.cc
+             reel_interop_subtitle_asset.cc
              reel_mono_picture_asset.cc
              reel_picture_asset.cc
              reel_markers_asset.cc
+             reel_smpte_subtitle_asset.cc
              reel_sound_asset.cc
              reel_stereo_picture_asset.cc
              reel_subtitle_asset.cc
@@ -172,10 +174,12 @@ def build(bld):
               reel_closed_caption_asset.h
               reel_encryptable_asset.h
               reel_file_asset.h
+              reel_interop_subtitle_asset.h
               reel_markers_asset.h
               reel_mono_picture_asset.h
               reel_picture_asset.h
               reel_sound_asset.h
+              reel_smpte_subtitle_asset.h
               reel_stereo_picture_asset.h
               reel_subtitle_asset.h
               ref.h
index 8d7a89712958650bf43d97e19e0a477217764278..94f9c2653927f2ade7fbb52e28708cb5f5f1972e 100644 (file)
@@ -78,10 +78,10 @@ BOOST_AUTO_TEST_CASE (reel_picture_asset_test)
 }
 
 
-/** Test the XML constructor of ReelSubtitleAsset */
-BOOST_AUTO_TEST_CASE (reel_subtitle_asset_test)
+/** Test the XML constructor of ReelSMPTESubtitleAsset */
+BOOST_AUTO_TEST_CASE (reel_smpte_subtitle_asset_test)
 {
-       shared_ptr<cxml::Document> doc (new cxml::Document("MainSubtitle"));
+       auto doc = make_shared<cxml::Document>("MainSubtitle");
 
        doc->read_string (
                "<MainSubtitle>"
@@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE (reel_subtitle_asset_test)
                "</MainSubtitle>"
                );
 
-       dcp::ReelSubtitleAsset ps (doc);
+       dcp::ReelSMPTESubtitleAsset ps (doc);
        BOOST_CHECK_EQUAL (ps.id(), "8bca1489-aab1-9259-a4fd-8150abc1de12");
        BOOST_CHECK_EQUAL (ps.annotation_text(), "Goodbye world!");
        BOOST_CHECK_EQUAL (ps.edit_rate(), dcp::Fraction(25, 1));
index 35c087e7f08891e09e4b744b72c59ac28d47c2ea..78e264a73c09c2ac99ff05c9cfc7f0fa8f9fb388 100644 (file)
 #include "raw_convert.h"
 #include "reel.h"
 #include "reel_closed_caption_asset.h"
+#include "reel_interop_subtitle_asset.h"
 #include "reel_markers_asset.h"
 #include "reel_mono_picture_asset.h"
 #include "reel_sound_asset.h"
 #include "reel_stereo_picture_asset.h"
-#include "reel_subtitle_asset.h"
+#include "reel_smpte_subtitle_asset.h"
 #include "smpte_subtitle_asset.h"
 #include "stereo_picture_asset.h"
 #include "stream_operators.h"
@@ -646,7 +647,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_interop_subtitles)
        prepare_directory (dir);
        copy_file ("test/data/subs1.xml", dir / "subs.xml");
        auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
-       auto reel_asset = make_shared<dcp::ReelSubtitleAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+       auto reel_asset = make_shared<dcp::ReelInteropSubtitleAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
        write_dcp_with_single_asset (dir, reel_asset, dcp::Standard::INTEROP);
 
        check_verify_result ({dir}, {{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_STANDARD }});
@@ -661,7 +662,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_interop_subtitles)
        prepare_directory (dir);
        copy_file ("test/data/subs1.xml", dir / "subs.xml");
        auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
-       auto reel_asset = make_shared<dcp::ReelSubtitleAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+       auto reel_asset = make_shared<dcp::ReelInteropSubtitleAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
        write_dcp_with_single_asset (dir, reel_asset, dcp::Standard::INTEROP);
 
        {
@@ -691,7 +692,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_smpte_subtitles)
        prepare_directory (dir);
        copy_file ("test/data/subs.mxf", dir / "subs.mxf");
        auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf");
-       auto reel_asset = make_shared<dcp::ReelSubtitleAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
+       auto reel_asset = make_shared<dcp::ReelSMPTESubtitleAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
        auto cpl = write_dcp_with_single_asset (dir, reel_asset);
 
        check_verify_result ({dir}, {{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get() }});
@@ -706,7 +707,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_smpte_subtitles)
        prepare_directory (dir);
        copy_file ("test/data/broken_smpte.mxf", dir / "subs.mxf");
        auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf");
-       auto reel_asset = make_shared<dcp::ReelSubtitleAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
+       auto reel_asset = make_shared<dcp::ReelSMPTESubtitleAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
        auto cpl = write_dcp_with_single_asset (dir, reel_asset);
 
        check_verify_result (
@@ -761,7 +762,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_cpl_metadata)
 
        copy_file ("test/data/subs.mxf", dir / "subs.mxf");
        auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf");
-       auto reel_asset = make_shared<dcp::ReelSubtitleAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+       auto reel_asset = make_shared<dcp::ReelSMPTESubtitleAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
 
        auto reel = make_shared<dcp::Reel>();
        reel->add (reel_asset);
@@ -904,7 +905,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language1)
        auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf");
        asset->_language = "wrong-andbad";
        asset->write (dir / "subs.mxf");
-       auto reel_asset = make_shared<dcp::ReelSubtitleAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
+       auto reel_asset = make_shared<dcp::ReelSMPTESubtitleAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
        reel_asset->_language = "badlang";
        auto cpl = write_dcp_with_single_asset (dir, reel_asset);
 
@@ -1242,7 +1243,7 @@ verify_timed_text_asset_too_large (string name)
 
 BOOST_AUTO_TEST_CASE (verify_subtitle_asset_too_large)
 {
-       verify_timed_text_asset_too_large<dcp::ReelSubtitleAsset>("verify_subtitle_asset_too_large");
+       verify_timed_text_asset_too_large<dcp::ReelSMPTESubtitleAsset>("verify_subtitle_asset_too_large");
        verify_timed_text_asset_too_large<dcp::ReelClosedCaptionAsset>("verify_closed_caption_asset_too_large");
 }
 
@@ -1281,7 +1282,7 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_language)
        auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
        subs->write (dir / "subs.mxf");
 
-       auto reel_subs = make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0);
+       auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0);
        dcp->cpls().front()->reels().front()->add(reel_subs);
        dcp->write_xml (
                dcp::Standard::SMPTE,
@@ -1312,7 +1313,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages)
                subs->set_language (dcp::LanguageTag("de-DE"));
                subs->add (simple_subtitle());
                subs->write (path / "subs1.mxf");
-               auto reel_subs = make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
+               auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
                cpl->reels()[0]->add(reel_subs);
        }
 
@@ -1321,7 +1322,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages)
                subs->set_language (dcp::LanguageTag("en-US"));
                subs->add (simple_subtitle());
                subs->write (path / "subs2.mxf");
-               auto reel_subs = make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
+               auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
                cpl->reels()[1]->add(reel_subs);
        }
 
@@ -1419,7 +1420,7 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_start_time)
        auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
        subs->write (dir / "subs.mxf");
 
-       auto reel_subs = make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0);
+       auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0);
        dcp->cpls().front()->reels().front()->add(reel_subs);
        dcp->write_xml (
                dcp::Standard::SMPTE,
@@ -1473,7 +1474,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_start_time)
        auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
        subs->write (dir / "subs.mxf");
 
-       auto reel_subs = make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0);
+       auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), 106, 0);
        dcp->cpls().front()->reels().front()->add(reel_subs);
        dcp->write_xml (
                dcp::Standard::SMPTE,
@@ -1531,7 +1532,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_first_text_time)
 {
        auto const dir = path("build/test/verify_invalid_subtitle_first_text_time");
        /* Just too early */
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (dir, {{ 4 * 24 - 1, 5 * 24 }});
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (dir, {{ 4 * 24 - 1, 5 * 24 }});
        check_verify_result (
                { dir },
                {
@@ -1546,7 +1547,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time)
 {
        auto const dir = path("build/test/verify_valid_subtitle_first_text_time");
        /* Just late enough */
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (dir, {{ 4 * 24, 5 * 24 }});
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (dir, {{ 4 * 24, 5 * 24 }});
        check_verify_result ({dir}, {{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get() }});
 }
 
@@ -1562,7 +1563,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel)
        add_test_subtitle (asset1, 4 * 24, 5 * 24);
        asset1->set_language (dcp::LanguageTag("de-DE"));
        asset1->write (dir / "subs1.mxf");
-       auto reel_asset1 = make_shared<dcp::ReelSubtitleAsset>(asset1, dcp::Fraction(24, 1), 5 * 24, 0);
+       auto reel_asset1 = make_shared<dcp::ReelSMPTESubtitleAsset>(asset1, dcp::Fraction(24, 1), 5 * 24, 0);
        auto reel1 = make_shared<dcp::Reel>();
        reel1->add (reel_asset1);
        auto markers1 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), 5 * 24, 0);
@@ -1575,7 +1576,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel)
        add_test_subtitle (asset2, 3, 4 * 24);
        asset2->set_language (dcp::LanguageTag("de-DE"));
        asset2->write (dir / "subs2.mxf");
-       auto reel_asset2 = make_shared<dcp::ReelSubtitleAsset>(asset2, dcp::Fraction(24, 1), 4 * 24, 0);
+       auto reel_asset2 = make_shared<dcp::ReelSMPTESubtitleAsset>(asset2, dcp::Fraction(24, 1), 4 * 24, 0);
        auto reel2 = make_shared<dcp::Reel>();
        reel2->add (reel_asset2);
        auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), 4 * 24, 0);
@@ -1603,7 +1604,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel)
 BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_spacing)
 {
        auto const dir = path("build/test/verify_invalid_subtitle_spacing");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 4 * 24,     5 * 24 },
@@ -1621,7 +1622,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_spacing)
 BOOST_AUTO_TEST_CASE (verify_valid_subtitle_spacing)
 {
        auto const dir = path("build/test/verify_valid_subtitle_spacing");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 4 * 24,      5 * 24 },
@@ -1634,7 +1635,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_spacing)
 BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_duration)
 {
        auto const dir = path("build/test/verify_invalid_subtitle_duration");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (dir, {{ 4 * 24, 4 * 24 + 1 }});
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (dir, {{ 4 * 24, 4 * 24 + 1 }});
        check_verify_result (
                {dir},
                {
@@ -1647,7 +1648,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_duration)
 BOOST_AUTO_TEST_CASE (verify_valid_subtitle_duration)
 {
        auto const dir = path("build/test/verify_valid_subtitle_duration");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (dir, {{ 4 * 24, 4 * 24 + 17 }});
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (dir, {{ 4 * 24, 4 * 24 + 17 }});
        check_verify_result ({dir}, {{ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::MISSING_CPL_METADATA, cpl->id(), cpl->file().get() }});
 }
 
@@ -1662,7 +1663,7 @@ BOOST_AUTO_TEST_CASE (verify_subtitle_overlapping_reel_boundary)
        asset->set_language (dcp::LanguageTag("de-DE"));
        asset->write (dir / "subs.mxf");
 
-       auto reel_asset = make_shared<dcp::ReelSubtitleAsset>(asset, dcp::Fraction(24, 1), 3 * 24, 0);
+       auto reel_asset = make_shared<dcp::ReelSMPTESubtitleAsset>(asset, dcp::Fraction(24, 1), 3 * 24, 0);
        auto cpl = write_dcp_with_single_asset (dir, reel_asset);
        check_verify_result (
                {dir},
@@ -1679,7 +1680,7 @@ BOOST_AUTO_TEST_CASE (verify_subtitle_overlapping_reel_boundary)
 BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_count1)
 {
        auto const dir = path ("build/test/invalid_subtitle_line_count1");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 96, 200, 0.0, "We" },
@@ -1699,7 +1700,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_count1)
 BOOST_AUTO_TEST_CASE (verify_valid_subtitle_line_count1)
 {
        auto const dir = path ("build/test/verify_valid_subtitle_line_count1");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 96, 200, 0.0, "We" },
@@ -1713,7 +1714,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_line_count1)
 BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_count2)
 {
        auto const dir = path ("build/test/verify_invalid_subtitle_line_count2");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 96, 300, 0.0, "We" },
@@ -1733,7 +1734,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_count2)
 BOOST_AUTO_TEST_CASE (verify_valid_subtitle_line_count2)
 {
        auto const dir = path ("build/test/verify_valid_subtitle_line_count2");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 96, 300, 0.0, "We" },
@@ -1748,7 +1749,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_line_count2)
 BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_length1)
 {
        auto const dir = path ("build/test/verify_invalid_subtitle_line_length1");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 96, 300, 0.0, "012345678901234567890123456789012345678901234567890123" }
@@ -1765,7 +1766,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_length1)
 BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_length2)
 {
        auto const dir = path ("build/test/verify_invalid_subtitle_line_length2");
-       auto cpl = dcp_with_text<dcp::ReelSubtitleAsset> (
+       auto cpl = dcp_with_text<dcp::ReelSMPTESubtitleAsset> (
                dir,
                {
                        { 96, 300, 0.0, "012345678901234567890123456789012345678901234567890123456789012345678901234567890" }
@@ -2012,7 +2013,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a
        subs->set_start_time (dcp::Time());
        subs->add (simple_subtitle());
        subs->write (dir / "subs.mxf");
-       auto reel_subs = make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
+       auto reel_subs = make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
 
        auto reel1 = make_shared<dcp::Reel>(
                make_shared<dcp::ReelMonoPictureAsset>(simple_picture(dir, "", reel_length), 0),
@@ -2020,7 +2021,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a
                );
 
        if (add_to_reel1) {
-               reel1->add (make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
+               reel1->add (make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
        }
 
        auto markers1 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length, 0);
@@ -2035,7 +2036,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a
                );
 
        if (add_to_reel2) {
-               reel2->add (make_shared<dcp::ReelSubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
+               reel2->add (make_shared<dcp::ReelSMPTESubtitleAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
        }
 
        auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length, 0);
@@ -2220,18 +2221,18 @@ verify_text_entry_point_check (path dir, dcp::VerificationNote::Code code, boost
 
 BOOST_AUTO_TEST_CASE (verify_text_entry_point)
 {
-       verify_text_entry_point_check<dcp::ReelSubtitleAsset> (
+       verify_text_entry_point_check<dcp::ReelSMPTESubtitleAsset> (
                "build/test/verify_subtitle_entry_point_must_be_present",
                dcp::VerificationNote::Code::MISSING_SUBTITLE_ENTRY_POINT,
-               [](shared_ptr<dcp::ReelSubtitleAsset> asset) {
+               [](shared_ptr<dcp::ReelSMPTESubtitleAsset> asset) {
                        asset->unset_entry_point ();
                        }
                );
 
-       verify_text_entry_point_check<dcp::ReelSubtitleAsset> (
+       verify_text_entry_point_check<dcp::ReelSMPTESubtitleAsset> (
                "build/test/verify_subtitle_entry_point_must_be_zero",
                dcp::VerificationNote::Code::INCORRECT_SUBTITLE_ENTRY_POINT,
-               [](shared_ptr<dcp::ReelSubtitleAsset> asset) {
+               [](shared_ptr<dcp::ReelSMPTESubtitleAsset> asset) {
                        asset->set_entry_point (4);
                        }
                );
@@ -2902,7 +2903,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_resource_id)
        writer.Finalize();
 
        auto subs_asset = make_shared<dcp::SMPTESubtitleAsset>(subs_mxf);
-       auto subs_reel = make_shared<dcp::ReelSubtitleAsset>(subs_asset, dcp::Fraction(24, 1), 240, 0);
+       auto subs_reel = make_shared<dcp::ReelSMPTESubtitleAsset>(subs_asset, dcp::Fraction(24, 1), 240, 0);
 
        auto cpl = write_dcp_with_single_asset (dir, subs_reel);
 
@@ -2966,7 +2967,7 @@ BOOST_AUTO_TEST_CASE (verify_incorrect_timed_text_id)
        writer.Finalize();
 
        auto subs_asset = make_shared<dcp::SMPTESubtitleAsset>(subs_mxf);
-       auto subs_reel = make_shared<dcp::ReelSubtitleAsset>(subs_asset, dcp::Fraction(24, 1), 240, 0);
+       auto subs_reel = make_shared<dcp::ReelSMPTESubtitleAsset>(subs_asset, dcp::Fraction(24, 1), 240, 0);
 
        auto cpl = write_dcp_with_single_asset (dir, subs_reel);
 
index 10d39f11b841f503fc89e2b74982351ad13076e3..f7c9ae25e2010be43961f708587d86e36bb5e6dc 100644 (file)
@@ -36,7 +36,7 @@
 #include "subtitle_string.h"
 #include "subtitle_image.h"
 #include "subtitle_asset_internal.h"
-#include "reel_subtitle_asset.h"
+#include "reel_interop_subtitle_asset.h"
 #include "reel.h"
 #include "cpl.h"
 #include "dcp.h"
@@ -360,8 +360,8 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3)
        boost::filesystem::create_directories ("build/test/write_interop_subtitle_test3");
        c->write ("build/test/write_interop_subtitle_test3/subs.xml");
 
-       shared_ptr<dcp::Reel> reel (new dcp::Reel());
-       reel->add(shared_ptr<dcp::ReelSubtitleAsset>(new dcp::ReelSubtitleAsset(c, dcp::Fraction(24, 1), 6046, 0)));
+       auto reel = make_shared<dcp::Reel>();
+       reel->add(make_shared<dcp::ReelInteropSubtitleAsset>(c, dcp::Fraction(24, 1), 6046, 0));
 
        string const issue_date = "2018-09-02T04:45:18+00:00";
        string const issuer = "libdcp";