summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-11 20:49:44 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-12 01:22:10 +0200
commit7d66bda50ade8ea618f331b885f1bfa4fa0a2af9 (patch)
tree9846716f11327850e9a6bdd2cb00243be828590f /src
parent3370a67e8a9aeaec45911ba1c714a0d259781fdf (diff)
Split ReelSubtitleAsset into Interop and SMPTE classes.
Diffstat (limited to 'src')
-rw-r--r--src/cpl.cc9
-rw-r--r--src/reel.cc66
-rw-r--r--src/reel.h2
-rw-r--r--src/reel_atmos_asset.cc2
-rw-r--r--src/reel_closed_caption_asset.cc2
-rw-r--r--src/reel_encryptable_asset.cc2
-rw-r--r--src/reel_encryptable_asset.h2
-rw-r--r--src/reel_file_asset.h1
-rw-r--r--src/reel_interop_subtitle_asset.cc74
-rw-r--r--src/reel_interop_subtitle_asset.h66
-rw-r--r--src/reel_picture_asset.cc2
-rw-r--r--src/reel_smpte_subtitle_asset.cc77
-rw-r--r--src/reel_smpte_subtitle_asset.h75
-rw-r--r--src/reel_sound_asset.cc2
-rw-r--r--src/reel_subtitle_asset.cc33
-rw-r--r--src/reel_subtitle_asset.h18
-rw-r--r--src/verify.cc12
-rw-r--r--src/wscript4
18 files changed, 391 insertions, 58 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index 39e78baa..3b549757 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -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);
diff --git a/src/reel.cc b/src/reel.cc
index 74107ed0..becac898 100644
--- a/src/reel.cc
+++ b/src/reel.cc
@@ -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) {
diff --git a/src/reel.h b/src/reel.h
index c81724cb..d3ea7f0c 100644
--- a/src/reel.h
+++ b/src/reel.h
@@ -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;
diff --git a/src/reel_atmos_asset.cc b/src/reel_atmos_asset.cc
index 50581aff..bd354bf7 100644
--- a/src/reel_atmos_asset.cc
+++ b/src/reel_atmos_asset.cc
@@ -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;
}
diff --git a/src/reel_closed_caption_asset.cc b/src/reel_closed_caption_asset.cc
index fe0945e3..b751efaf 100644
--- a/src/reel_closed_caption_asset.cc
+++ b/src/reel_closed_caption_asset.cc
@@ -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) {
diff --git a/src/reel_encryptable_asset.cc b/src/reel_encryptable_asset.cc
index 82dc9c89..f8e8303f 100644
--- a/src/reel_encryptable_asset.cc
+++ b/src/reel_encryptable_asset.cc
@@ -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");
diff --git a/src/reel_encryptable_asset.h b/src/reel_encryptable_asset.h
index 978b2255..0eeb9640 100644
--- a/src/reel_encryptable_asset.h
+++ b/src/reel_encryptable_asset.h
@@ -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
diff --git a/src/reel_file_asset.h b/src/reel_file_asset.h
index de9921d5..070a3e0f 100644
--- a/src/reel_file_asset.h
+++ b/src/reel_file_asset.h
@@ -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
index 00000000..5b8cfcdd
--- /dev/null
+++ b/src/reel_interop_subtitle_asset.cc
@@ -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
index 00000000..41c4fa67
--- /dev/null
+++ b/src/reel_interop_subtitle_asset.h
@@ -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;
+};
+
+
+}
+
diff --git a/src/reel_picture_asset.cc b/src/reel_picture_asset.cc
index cc5e2399..8b439003 100644
--- a/src/reel_picture_asset.cc
+++ b/src/reel_picture_asset.cc
@@ -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
index 00000000..0cd38c21
--- /dev/null
+++ b/src/reel_smpte_subtitle_asset.cc
@@ -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
index 00000000..8a7e0c24
--- /dev/null
+++ b/src/reel_smpte_subtitle_asset.h
@@ -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";
+ }
+};
+
+
+}
+
+
diff --git a/src/reel_sound_asset.cc b/src/reel_sound_asset.cc
index 216eb1f7..7ca2b2da 100644
--- a/src/reel_sound_asset.cc
+++ b/src/reel_sound_asset.cc
@@ -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;
}
diff --git a/src/reel_subtitle_asset.cc b/src/reel_subtitle_asset.cc
index cccda50a..0981d1c0 100644
--- a/src/reel_subtitle_asset.cc
+++ b/src/reel_subtitle_asset.cc
@@ -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();
-}
-
diff --git a/src/reel_subtitle_asset.h b/src/reel_subtitle_asset.h
index b8dcf6d7..ad1ea6cd 100644
--- a/src/reel_subtitle_asset.h
+++ b/src/reel_subtitle_asset.h
@@ -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;
};
diff --git a/src/verify.cc b/src/verify.cc
index 6adab99d..e176362a 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -47,9 +47,11 @@
#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()});
}
}
diff --git a/src/wscript b/src/wscript
index 25a4dadb..b50966e7 100644
--- a/src/wscript
+++ b/src/wscript
@@ -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