_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) {
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);
#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"
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");
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");
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;
}
}
}
+ 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())
);
}
}
+ /* 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())
);
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) {
, _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;
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;
}
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) {
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");
}
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
*/
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;
};
--- /dev/null
+/*
+ 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;
+}
+
+
--- /dev/null
+/*
+ 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;
+};
+
+
+}
+
);
}
- write_to_cpl_mxf (asset);
+ write_to_cpl_encryptable (asset);
return asset;
}
--- /dev/null
+/*
+ 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;
+}
+
--- /dev/null
+/*
+ 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";
+ }
+};
+
+
+}
+
+
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;
}
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>())
{
}
ReelSubtitleAsset::ReelSubtitleAsset (std::shared_ptr<const cxml::Node> node)
: ReelAsset (node)
, ReelFileAsset (node)
- , ReelEncryptableAsset (node)
{
_language = node->optional_string_child("Language");
- node->done ();
}
}
-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();
}
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();
-}
-
#include "language_tag.h"
#include "reel_asset.h"
-#include "reel_encryptable_asset.h"
#include "reel_file_asset.h"
#include "subtitle_asset.h"
/** @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);
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;
};
#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"
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();
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()});
}
}
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
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
}
-/** 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>"
"</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));
#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"
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 }});
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);
{
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() }});
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 (
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);
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);
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");
}
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,
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);
}
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);
}
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,
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,
{
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 },
{
{
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() }});
}
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);
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);
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 },
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 },
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},
{
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() }});
}
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},
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" },
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" },
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" },
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" },
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" }
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" }
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),
);
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);
);
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);
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);
}
);
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);
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);
#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"
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";