diff options
| -rw-r--r-- | src/cpl.cc | 9 | ||||
| -rw-r--r-- | src/reel.cc | 66 | ||||
| -rw-r--r-- | src/reel.h | 2 | ||||
| -rw-r--r-- | src/reel_atmos_asset.cc | 2 | ||||
| -rw-r--r-- | src/reel_closed_caption_asset.cc | 2 | ||||
| -rw-r--r-- | src/reel_encryptable_asset.cc | 2 | ||||
| -rw-r--r-- | src/reel_encryptable_asset.h | 2 | ||||
| -rw-r--r-- | src/reel_file_asset.h | 1 | ||||
| -rw-r--r-- | src/reel_interop_subtitle_asset.cc | 74 | ||||
| -rw-r--r-- | src/reel_interop_subtitle_asset.h | 66 | ||||
| -rw-r--r-- | src/reel_picture_asset.cc | 2 | ||||
| -rw-r--r-- | src/reel_smpte_subtitle_asset.cc | 77 | ||||
| -rw-r--r-- | src/reel_smpte_subtitle_asset.h | 75 | ||||
| -rw-r--r-- | src/reel_sound_asset.cc | 2 | ||||
| -rw-r--r-- | src/reel_subtitle_asset.cc | 33 | ||||
| -rw-r--r-- | src/reel_subtitle_asset.h | 18 | ||||
| -rw-r--r-- | src/verify.cc | 12 | ||||
| -rw-r--r-- | src/wscript | 4 | ||||
| -rw-r--r-- | test/reel_asset_test.cc | 8 | ||||
| -rw-r--r-- | test/verify_test.cc | 75 | ||||
| -rw-r--r-- | test/write_subtitle_test.cc | 6 |
21 files changed, 436 insertions, 102 deletions
@@ -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) { @@ -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 <KeyId> 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 diff --git a/test/reel_asset_test.cc b/test/reel_asset_test.cc index 8d7a8971..94f9c265 100644 --- a/test/reel_asset_test.cc +++ b/test/reel_asset_test.cc @@ -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)); diff --git a/test/verify_test.cc b/test/verify_test.cc index 35c087e7..78e264a7 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -42,11 +42,12 @@ #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); diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc index 10d39f11..f7c9ae25 100644 --- a/test/write_subtitle_test.cc +++ b/test/write_subtitle_test.cc @@ -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"; |
