summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-28 20:12:51 +0200
committerCarl Hetherington <cth@carlh.net>2024-08-17 12:57:31 +0200
commit06c28c700f0a398a3289c4adfa83ceb2d0fc999d (patch)
tree00b58dcb854767d037e166a804360b4c19e034e9
parentb64644327bff333569bf4a60f1d7c3d46f058b48 (diff)
Merge ReelClosedCaptionAsset into ReelTextAsset.
-rw-r--r--src/cpl.cc1
-rw-r--r--src/reel.cc17
-rw-r--r--src/reel.h4
-rw-r--r--src/reel_closed_caption_asset.cc90
-rw-r--r--src/reel_closed_caption_asset.h97
-rw-r--r--src/reel_interop_closed_caption_asset.cc86
-rw-r--r--src/reel_interop_text_asset.cc49
-rw-r--r--src/reel_interop_text_asset.h8
-rw-r--r--src/reel_smpte_closed_caption_asset.cc91
-rw-r--r--src/reel_smpte_closed_caption_asset.h83
-rw-r--r--src/reel_smpte_text_asset.cc50
-rw-r--r--src/reel_smpte_text_asset.h8
-rw-r--r--src/reel_text_asset.cc30
-rw-r--r--src/reel_text_asset.h19
-rw-r--r--src/text_type.h (renamed from src/reel_interop_closed_caption_asset.h)42
-rw-r--r--src/verify.cc3
-rw-r--r--src/wscript7
-rw-r--r--test/combine_test.cc4
-rw-r--r--test/dcp_font_test.cc4
-rw-r--r--test/decryption_test.cc2
-rw-r--r--test/interop_subtitle_test.cc2
-rw-r--r--test/kdm_test.cc2
-rw-r--r--test/test.cc10
-rw-r--r--test/verify_test.cc152
24 files changed, 244 insertions, 617 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index c41a86eb..79aedc4c 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -48,7 +48,6 @@
#include "raw_convert.h"
#include "reel.h"
#include "reel_atmos_asset.h"
-#include "reel_closed_caption_asset.h"
#include "reel_picture_asset.h"
#include "reel_sound_asset.h"
#include "reel_text_asset.h"
diff --git a/src/reel.cc b/src/reel.cc
index 6a7043f0..3eb81e1d 100644
--- a/src/reel.cc
+++ b/src/reel.cc
@@ -45,12 +45,9 @@
#include "j2k_picture_asset.h"
#include "reel.h"
#include "reel_atmos_asset.h"
-#include "reel_closed_caption_asset.h"
-#include "reel_interop_closed_caption_asset.h"
#include "reel_interop_text_asset.h"
#include "reel_markers_asset.h"
#include "reel_mono_picture_asset.h"
-#include "reel_smpte_closed_caption_asset.h"
#include "reel_smpte_text_asset.h"
#include "reel_sound_asset.h"
#include "reel_stereo_picture_asset.h"
@@ -120,10 +117,10 @@ Reel::Reel (std::shared_ptr<const cxml::Node> node, dcp::Standard standard)
for (auto i: closed_captions) {
switch (standard) {
case Standard::INTEROP:
- _closed_captions.push_back (make_shared<ReelInteropClosedCaptionAsset>(i));
+ _closed_captions.push_back (make_shared<ReelInteropTextAsset>(i));
break;
case Standard::SMPTE:
- _closed_captions.push_back (make_shared<ReelSMPTEClosedCaptionAsset>(i));
+ _closed_captions.push_back (make_shared<ReelSMPTETextAsset>(i));
break;
}
}
@@ -358,12 +355,14 @@ Reel::add (shared_ptr<ReelAsset> asset)
_main_picture = p;
} else if (auto so = dynamic_pointer_cast<ReelSoundAsset>(asset)) {
_main_sound = so;
- } else if (auto su = dynamic_pointer_cast<ReelTextAsset>(asset)) {
- _main_subtitle = su;
+ } else if (auto te = dynamic_pointer_cast<ReelTextAsset>(asset)) {
+ if (te->type() == TextType::SUBTITLE) {
+ _main_subtitle = te;
+ } else {
+ _closed_captions.push_back(te);
+ }
} else if (auto m = dynamic_pointer_cast<ReelMarkersAsset>(asset)) {
_main_markers = m;
- } else if (auto c = dynamic_pointer_cast<ReelClosedCaptionAsset>(asset)) {
- _closed_captions.push_back (c);
} else if (auto a = dynamic_pointer_cast<ReelAtmosAsset>(asset)) {
_atmos = a;
} else {
diff --git a/src/reel.h b/src/reel.h
index 7c9ba0d4..28e574ea 100644
--- a/src/reel.h
+++ b/src/reel.h
@@ -113,7 +113,7 @@ public:
return _main_markers;
}
- std::vector<std::shared_ptr<ReelClosedCaptionAsset>> closed_captions () const {
+ std::vector<std::shared_ptr<ReelTextAsset>> closed_captions () const {
return _closed_captions;
}
@@ -147,7 +147,7 @@ private:
std::shared_ptr<ReelSoundAsset> _main_sound;
std::shared_ptr<ReelTextAsset> _main_subtitle;
std::shared_ptr<ReelMarkersAsset> _main_markers;
- std::vector<std::shared_ptr<ReelClosedCaptionAsset>> _closed_captions;
+ std::vector<std::shared_ptr<ReelTextAsset>> _closed_captions;
std::shared_ptr<ReelAtmosAsset> _atmos;
std::vector<dcp::DecryptedKDM> _kdms;
diff --git a/src/reel_closed_caption_asset.cc b/src/reel_closed_caption_asset.cc
deleted file mode 100644
index e5649d6a..00000000
--- a/src/reel_closed_caption_asset.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
-
- This file is part of libdcp.
-
- libdcp is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libdcp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations
- including the two.
-
- You must obey the GNU General Public License in all respects
- for all of the code used other than OpenSSL. If you modify
- file(s) with this exception, you may extend this exception to your
- version of the file(s), but you are not obligated to do so. If you
- do not wish to do so, delete this exception statement from your
- version. If you delete this exception statement from all source
- files in the program, then also delete it here.
-*/
-
-
-/** @file src/reel_closed_caption_asset.cc
- * @brief ReelClosedCaptionAsset class
- */
-
-
-#include "dcp_assert.h"
-#include "reel_closed_caption_asset.h"
-#include "smpte_subtitle_asset.h"
-#include "subtitle_asset.h"
-#include "warnings.h"
-LIBDCP_DISABLE_WARNINGS
-#include <libxml++/libxml++.h>
-LIBDCP_ENABLE_WARNINGS
-
-
-using std::string;
-using std::shared_ptr;
-using std::dynamic_pointer_cast;
-using namespace dcp;
-
-
-ReelClosedCaptionAsset::ReelClosedCaptionAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelFileAsset (
- asset,
- dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : boost::none,
- asset->id(),
- edit_rate,
- intrinsic_duration,
- entry_point
- )
-{
-
-}
-
-
-ReelClosedCaptionAsset::ReelClosedCaptionAsset (std::shared_ptr<const cxml::Node> node)
- : ReelFileAsset (node)
-{
- _language = node->optional_string_child ("Language");
-}
-
-
-bool
-ReelClosedCaptionAsset::equals(shared_ptr<const ReelClosedCaptionAsset> other, EqualityOptions const& opt, NoteHandler note) const
-{
- if (!asset_equals (other, opt, note)) {
- return false;
- }
- if (!file_asset_equals (other, opt, note)) {
- return false;
- }
-
- return true;
-}
-
-
diff --git a/src/reel_closed_caption_asset.h b/src/reel_closed_caption_asset.h
deleted file mode 100644
index 405de34b..00000000
--- a/src/reel_closed_caption_asset.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
-
- This file is part of libdcp.
-
- libdcp is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libdcp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations
- including the two.
-
- You must obey the GNU General Public License in all respects
- for all of the code used other than OpenSSL. If you modify
- file(s) with this exception, you may extend this exception to your
- version of the file(s), but you are not obligated to do so. If you
- do not wish to do so, delete this exception statement from your
- version. If you delete this exception statement from all source
- files in the program, then also delete it here.
-*/
-
-
-/** @file src/reel_closed_caption_asset.h
- * @brief ReelClosedCaptionAsset class
- */
-
-
-#ifndef LIBDCP_REEL_CLOSED_CAPTION_ASSET_H
-#define LIBDCP_REEL_CLOSED_CAPTION_ASSET_H
-
-
-#include "language_tag.h"
-#include "reel_asset.h"
-#include "reel_file_asset.h"
-#include "subtitle_asset.h"
-
-
-struct verify_invalid_language2;
-
-
-namespace dcp {
-
-
-/** @class ReelClosedCaptionAsset
- * @brief Part of a Reel's description which refers to a closed caption XML/MXF file
- */
-class ReelClosedCaptionAsset : public ReelFileAsset
-{
-public:
- ReelClosedCaptionAsset (std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
- explicit ReelClosedCaptionAsset (std::shared_ptr<const cxml::Node>);
-
- std::shared_ptr<const SubtitleAsset> asset () const {
- return asset_of_type<const SubtitleAsset>();
- }
-
- std::shared_ptr<SubtitleAsset> asset () {
- return asset_of_type<SubtitleAsset>();
- }
-
- bool equals(std::shared_ptr<const ReelClosedCaptionAsset>, EqualityOptions const&, NoteHandler) const;
-
- void set_language (dcp::LanguageTag l) {
- _language = l.to_string();
- }
-
- void unset_language () {
- _language = boost::optional<std::string> ();
- }
-
- boost::optional<std::string> language () const {
- return _language;
- }
-
-protected:
- friend struct ::verify_invalid_language2;
-
- boost::optional<std::string> _language;
-};
-
-
-}
-
-
-#endif
diff --git a/src/reel_interop_closed_caption_asset.cc b/src/reel_interop_closed_caption_asset.cc
deleted file mode 100644
index c4539fd7..00000000
--- a/src/reel_interop_closed_caption_asset.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- 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.
-*/
-
-
-#include "reel_interop_closed_caption_asset.h"
-#include "warnings.h"
-LIBDCP_DISABLE_WARNINGS
-#include <libxml++/libxml++.h>
-LIBDCP_ENABLE_WARNINGS
-
-
-using std::make_pair;
-using std::pair;
-using std::shared_ptr;
-using std::string;
-using namespace dcp;
-
-
-ReelInteropClosedCaptionAsset::ReelInteropClosedCaptionAsset (shared_ptr<InteropSubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelClosedCaptionAsset (asset, edit_rate, intrinsic_duration, entry_point)
-{
-
-}
-
-
-
-ReelInteropClosedCaptionAsset::ReelInteropClosedCaptionAsset (shared_ptr<const cxml::Node> node)
- : ReelClosedCaptionAsset (node)
-{
- node->done ();
-}
-
-
-string
-ReelInteropClosedCaptionAsset::cpl_node_name (Standard) const
-{
- return "cc-cpl:MainClosedCaption";
-}
-
-
-pair<string, string>
-ReelInteropClosedCaptionAsset::cpl_node_namespace () const
-{
- return make_pair("http://www.digicine.com/PROTO-ASDCP-CC-CPL-20070926#", "cc-cpl");
-}
-
-
-xmlpp::Element*
-ReelInteropClosedCaptionAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
-{
- auto asset = ReelClosedCaptionAsset::write_to_cpl (node, standard);
- if (_language) {
- cxml::add_text_child(asset, "Language", *_language);
- }
- return asset;
-}
diff --git a/src/reel_interop_text_asset.cc b/src/reel_interop_text_asset.cc
index 4bd030aa..b5e20f78 100644
--- a/src/reel_interop_text_asset.cc
+++ b/src/reel_interop_text_asset.cc
@@ -37,6 +37,7 @@
*/
+#include "dcp_assert.h"
#include "reel_interop_text_asset.h"
#include "warnings.h"
LIBDCP_DISABLE_WARNINGS
@@ -44,13 +45,15 @@ LIBDCP_DISABLE_WARNINGS
LIBDCP_ENABLE_WARNINGS
+using std::make_pair;
+using std::pair;
using std::string;
using boost::optional;
using namespace dcp;
-ReelInteropTextAsset::ReelInteropTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelTextAsset(asset, edit_rate, intrinsic_duration, entry_point)
+ReelInteropTextAsset::ReelInteropTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ : ReelTextAsset(type, asset, edit_rate, intrinsic_duration, entry_point)
{
}
@@ -62,3 +65,45 @@ ReelInteropTextAsset::ReelInteropTextAsset(std::shared_ptr<const cxml::Node> nod
node->done ();
}
+
+string
+ReelInteropTextAsset::cpl_node_name(Standard) const
+{
+ switch (_type) {
+ case TextType::SUBTITLE:
+ return "MainSubtitle";
+ case TextType::CAPTION:
+ return "cc-cpl:MainClosedCaption";
+ }
+
+ DCP_ASSERT(false);
+ return "";
+}
+
+
+pair<string, string>
+ReelInteropTextAsset::cpl_node_namespace() const
+{
+ switch (_type) {
+ case TextType::SUBTITLE:
+ return {};
+ case TextType::CAPTION:
+ return make_pair("http://www.digicine.com/PROTO-ASDCP-CC-CPL-20070926#", "cc-cpl");
+ }
+
+ DCP_ASSERT(false);
+ return {};
+}
+
+
+xmlpp::Element *
+ReelInteropTextAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
+{
+ auto asset = ReelFileAsset::write_to_cpl (node, standard);
+ if (_language) {
+ cxml::add_text_child(asset, "Language", *_language);
+ }
+ return asset;
+}
+
+
diff --git a/src/reel_interop_text_asset.h b/src/reel_interop_text_asset.h
index cedc2ae5..88cdeaae 100644
--- a/src/reel_interop_text_asset.h
+++ b/src/reel_interop_text_asset.h
@@ -50,7 +50,7 @@ namespace dcp {
class ReelInteropTextAsset : public ReelTextAsset
{
public:
- ReelInteropTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+ ReelInteropTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelInteropTextAsset (std::shared_ptr<const cxml::Node>);
std::shared_ptr<const InteropSubtitleAsset> interop_asset () const {
@@ -60,6 +60,12 @@ public:
std::shared_ptr<InteropSubtitleAsset> interop_asset () {
return asset_of_type<InteropSubtitleAsset>();
}
+
+ xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
+
+protected:
+ std::string cpl_node_name (Standard standard) const override;
+ std::pair<std::string, std::string> cpl_node_namespace() const override;
};
diff --git a/src/reel_smpte_closed_caption_asset.cc b/src/reel_smpte_closed_caption_asset.cc
deleted file mode 100644
index 70e5eb36..00000000
--- a/src/reel_smpte_closed_caption_asset.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- 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_smpte_closed_caption_asset.cc
- * @brief ReelSMPTEClosedCaptionAsset class
- */
-
-
-#include "reel_smpte_closed_caption_asset.h"
-#include "warnings.h"
-LIBDCP_DISABLE_WARNINGS
-#include <libxml++/libxml++.h>
-LIBDCP_ENABLE_WARNINGS
-
-
-using std::make_pair;
-using std::pair;
-using std::shared_ptr;
-using std::string;
-using namespace dcp;
-
-
-ReelSMPTEClosedCaptionAsset::ReelSMPTEClosedCaptionAsset (shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelClosedCaptionAsset (asset, edit_rate, intrinsic_duration, entry_point)
-{
-
-}
-
-
-ReelSMPTEClosedCaptionAsset::ReelSMPTEClosedCaptionAsset (shared_ptr<const cxml::Node> node)
- : ReelClosedCaptionAsset (node)
-{
- node->done ();
-}
-
-
-xmlpp::Element*
-ReelSMPTEClosedCaptionAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
-{
- auto asset = ReelClosedCaptionAsset::write_to_cpl (node, standard);
- if (_language) {
- cxml::add_child(asset, "Language", string("tt"))->add_child_text(*_language);
- }
- return asset;
-}
-
-
-string
-ReelSMPTEClosedCaptionAsset::cpl_node_name (Standard) const
-{
- return "tt:ClosedCaption";
-}
-
-
-pair<string, string>
-ReelSMPTEClosedCaptionAsset::cpl_node_namespace () const
-{
- return make_pair("http://www.smpte-ra.org/schemas/429-12/2008/TT", "tt");
-}
-
diff --git a/src/reel_smpte_closed_caption_asset.h b/src/reel_smpte_closed_caption_asset.h
deleted file mode 100644
index e7a26f65..00000000
--- a/src/reel_smpte_closed_caption_asset.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- 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_smpte_closed_caption_asset.h
- * @brief ReelSMPTEClosedCaptionAsset class
- */
-
-
-#ifndef LIBDCP_REEL_SMPTE_CLOSED_CAPTION_ASSET_H
-#define LIBDCP_REEL_SMPTE_CLOSED_CAPTION_ASSET_H
-
-
-#include "reel_file_asset.h"
-#include "reel_closed_caption_asset.h"
-#include "smpte_subtitle_asset.h"
-
-
-namespace dcp {
-
-
-class ReelSMPTEClosedCaptionAsset : public ReelClosedCaptionAsset
-{
-public:
- ReelSMPTEClosedCaptionAsset (std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
- explicit ReelSMPTEClosedCaptionAsset (std::shared_ptr<const cxml::Node>);
-
- std::shared_ptr<SMPTESubtitleAsset> smpte_asset () {
- return asset_of_type<SMPTESubtitleAsset>();
- }
-
- std::shared_ptr<const SMPTESubtitleAsset> smpte_asset () const {
- return asset_of_type<const SMPTESubtitleAsset>();
- }
-
- xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
-
-
-private:
- boost::optional<std::string> key_type () const override {
- return std::string("MDSK");
- }
-
- std::string cpl_node_name (Standard) const override;
- std::pair<std::string, std::string> cpl_node_namespace () const override;
-};
-
-
-};
-
-
-#endif
-
diff --git a/src/reel_smpte_text_asset.cc b/src/reel_smpte_text_asset.cc
index bbfa1b39..68f85586 100644
--- a/src/reel_smpte_text_asset.cc
+++ b/src/reel_smpte_text_asset.cc
@@ -45,14 +45,16 @@ LIBDCP_DISABLE_WARNINGS
LIBDCP_ENABLE_WARNINGS
+using std::make_pair;
+using std::pair;
using std::shared_ptr;
using std::string;
using boost::optional;
using namespace dcp;
-ReelSMPTETextAsset::ReelSMPTETextAsset(shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
- : ReelTextAsset(asset, edit_rate, intrinsic_duration, entry_point)
+ReelSMPTETextAsset::ReelSMPTETextAsset(TextType type, shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ : ReelTextAsset(type, asset, edit_rate, intrinsic_duration, entry_point)
{
}
@@ -64,3 +66,47 @@ ReelSMPTETextAsset::ReelSMPTETextAsset(shared_ptr<const cxml::Node> node)
node->done ();
}
+
+
+string
+ReelSMPTETextAsset::cpl_node_name(Standard) const
+{
+ switch (_type) {
+ case TextType::SUBTITLE:
+ return "MainSubtitle";
+ case TextType::CAPTION:
+ return "tt:ClosedCaption";
+ }
+
+ DCP_ASSERT(false);
+ return "";
+}
+
+
+pair<string, string>
+ReelSMPTETextAsset::cpl_node_namespace() const
+{
+ switch (_type) {
+ case TextType::SUBTITLE:
+ return {};
+ case TextType::CAPTION:
+ return make_pair("http://www.smpte-ra.org/schemas/429-12/2008/TT", "tt");
+ }
+
+ DCP_ASSERT(false);
+ return {};
+}
+
+
+xmlpp::Element *
+ReelSMPTETextAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
+{
+ auto asset = ReelFileAsset::write_to_cpl (node, standard);
+ string const ns = _type == TextType::CAPTION ? "tt" : "";
+ if (_language) {
+ cxml::add_child(asset, "Language", ns)->add_child_text(*_language);
+ }
+ return asset;
+}
+
+
diff --git a/src/reel_smpte_text_asset.h b/src/reel_smpte_text_asset.h
index 6eb3260d..24344a3a 100644
--- a/src/reel_smpte_text_asset.h
+++ b/src/reel_smpte_text_asset.h
@@ -53,7 +53,7 @@ class SMPTESubtitleAsset;
class ReelSMPTETextAsset : public ReelTextAsset
{
public:
- ReelSMPTETextAsset(std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+ ReelSMPTETextAsset(TextType type, std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelSMPTETextAsset(std::shared_ptr<const cxml::Node>);
std::shared_ptr<const SMPTESubtitleAsset> smpte_asset () const {
@@ -64,6 +64,12 @@ public:
return asset_of_type<SMPTESubtitleAsset>();
}
+ xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
+
+protected:
+ std::string cpl_node_name (Standard standard) const override;
+ std::pair<std::string, std::string> cpl_node_namespace() const override;
+
private:
boost::optional<std::string> key_type () const override {
return std::string("MDSK");
diff --git a/src/reel_text_asset.cc b/src/reel_text_asset.cc
index 1802ad51..87a8ae58 100644
--- a/src/reel_text_asset.cc
+++ b/src/reel_text_asset.cc
@@ -54,7 +54,7 @@ using boost::optional;
using namespace dcp;
-ReelTextAsset::ReelTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
+ReelTextAsset::ReelTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point)
: ReelFileAsset (
asset,
dynamic_pointer_cast<SMPTESubtitleAsset>(asset) ? dynamic_pointer_cast<SMPTESubtitleAsset>(asset)->key_id() : boost::none,
@@ -63,6 +63,7 @@ ReelTextAsset::ReelTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit
intrinsic_duration,
entry_point
)
+ , _type(type)
{
}
@@ -71,14 +72,15 @@ ReelTextAsset::ReelTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit
ReelTextAsset::ReelTextAsset(std::shared_ptr<const cxml::Node> node)
: ReelFileAsset (node)
{
- _language = node->optional_string_child("Language");
-}
-
+ if (node->name() == "MainSubtitle") {
+ _type = TextType::SUBTITLE;
+ } else if (node->name() == "MainClosedCaption" || node->name() == "ClosedCaption") {
+ _type = TextType::CAPTION;
+ } else {
+ DCP_ASSERT(false);
+ }
-string
-ReelTextAsset::cpl_node_name(Standard) const
-{
- return "MainSubtitle";
+ _language = node->optional_string_child("Language");
}
@@ -102,15 +104,3 @@ ReelTextAsset::equals(shared_ptr<const ReelTextAsset> other, EqualityOptions con
return true;
}
-
-xmlpp::Element *
-ReelTextAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
-{
- auto asset = ReelFileAsset::write_to_cpl (node, standard);
- if (_language) {
- cxml::add_text_child(asset, "Language", *_language);
- }
- return asset;
-}
-
-
diff --git a/src/reel_text_asset.h b/src/reel_text_asset.h
index 63962155..cf904921 100644
--- a/src/reel_text_asset.h
+++ b/src/reel_text_asset.h
@@ -45,9 +45,11 @@
#include "reel_asset.h"
#include "reel_file_asset.h"
#include "subtitle_asset.h"
+#include "text_type.h"
struct verify_invalid_language1;
+struct verify_invalid_language2;
namespace dcp {
@@ -62,7 +64,7 @@ class SubtitleAsset;
class ReelTextAsset : public ReelFileAsset
{
public:
- ReelTextAsset(std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
+ ReelTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelTextAsset(std::shared_ptr<const cxml::Node>);
std::shared_ptr<const SubtitleAsset> asset () const {
@@ -73,8 +75,6 @@ public:
return asset_of_type<SubtitleAsset>();
}
- xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
-
bool equals(std::shared_ptr<const ReelTextAsset>, EqualityOptions const&, NoteHandler) const;
void set_language (dcp::LanguageTag language);
@@ -83,17 +83,20 @@ public:
return _language;
}
+ TextType type() const {
+ return _type;
+ }
+
protected:
+ friend struct ::verify_invalid_language1;
+ friend struct ::verify_invalid_language2;
+
/** 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 override;
+ TextType _type;
};
diff --git a/src/reel_interop_closed_caption_asset.h b/src/text_type.h
index 5a074357..daac36c8 100644
--- a/src/reel_interop_closed_caption_asset.h
+++ b/src/text_type.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2021 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2024 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
@@ -32,46 +32,14 @@
*/
-/** @file src/reel_interop_closed_caption_asset.h
- * @brief ReelInteropClosedCaptionAsset class
- */
-
-
-#ifndef LIBDCP_REEL_INTEROP_CLOSED_CAPTION_ASSET_H
-#define LIBDCP_REEL_INTEROP_CLOSED_CAPTION_ASSET_H
-
-
-#include "interop_subtitle_asset.h"
-#include "reel_closed_caption_asset.h"
-
-
namespace dcp {
-class ReelInteropClosedCaptionAsset : public ReelClosedCaptionAsset
+enum class TextType
{
-public:
- ReelInteropClosedCaptionAsset (std::shared_ptr<InteropSubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
- explicit ReelInteropClosedCaptionAsset (std::shared_ptr<const cxml::Node>);
-
- std::shared_ptr<const InteropSubtitleAsset> interop_asset () const {
- return asset_of_type<const InteropSubtitleAsset>();
- }
-
- std::shared_ptr<InteropSubtitleAsset> interop_asset () {
- return asset_of_type<InteropSubtitleAsset>();
- }
-
- xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
-
-private:
- std::string cpl_node_name (Standard) const override;
- std::pair<std::string, std::string> cpl_node_namespace () const override;
+ SUBTITLE,
+ CAPTION
};
-};
-
-
-#endif
-
+}
diff --git a/src/verify.cc b/src/verify.cc
index 067ebfd2..b921375c 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -47,7 +47,6 @@
#include "mono_j2k_picture_frame.h"
#include "raw_convert.h"
#include "reel.h"
-#include "reel_closed_caption_asset.h"
#include "reel_interop_text_asset.h"
#include "reel_markers_asset.h"
#include "reel_picture_asset.h"
@@ -738,7 +737,7 @@ verify_main_subtitle_reel(Context& context, shared_ptr<const ReelTextAsset> reel
static void
-verify_closed_caption_reel(Context& context, shared_ptr<const ReelClosedCaptionAsset> reel_asset)
+verify_closed_caption_reel(Context& context, shared_ptr<const ReelTextAsset> reel_asset)
{
/* XXX: is Language compulsory? */
if (reel_asset->language()) {
diff --git a/src/wscript b/src/wscript
index f7bced72..2320fe0d 100644
--- a/src/wscript
+++ b/src/wscript
@@ -95,14 +95,11 @@ def build(bld):
reel.cc
reel_asset.cc
reel_atmos_asset.cc
- reel_closed_caption_asset.cc
reel_file_asset.cc
- reel_interop_closed_caption_asset.cc
reel_interop_text_asset.cc
reel_markers_asset.cc
reel_mono_picture_asset.cc
reel_picture_asset.cc
- reel_smpte_closed_caption_asset.cc
reel_smpte_text_asset.cc
reel_sound_asset.cc
reel_stereo_picture_asset.cc
@@ -212,14 +209,11 @@ def build(bld):
reel.h
reel_asset.h
reel_atmos_asset.h
- reel_closed_caption_asset.h
reel_file_asset.h
- reel_interop_closed_caption_asset.h
reel_interop_text_asset.h
reel_markers_asset.h
reel_mono_picture_asset.h
reel_picture_asset.h
- reel_smpte_closed_caption_asset.h
reel_smpte_text_asset.h
reel_sound_asset.h
reel_stereo_picture_asset.h
@@ -245,6 +239,7 @@ def build(bld):
subtitle_image.h
subtitle_standard.h
subtitle_string.h
+ text_type.h
transfer_function.h
types.h
utc_offset.h
diff --git a/test/combine_test.cc b/test/combine_test.cc
index 26f2be3e..725a4f6b 100644
--- a/test/combine_test.cc
+++ b/test/combine_test.cc
@@ -465,10 +465,10 @@ BOOST_AUTO_TEST_CASE(combine_multi_reel_subtitles)
subs2->add_font("afont2", data2);
subs2->write(in / "subs2" / "subs2.xml");
- auto reel_subs1 = make_shared<dcp::ReelInteropTextAsset>(subs1, dcp::Fraction(24, 1), 240, 0);
+ auto reel_subs1 = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, subs1, dcp::Fraction(24, 1), 240, 0);
dcp->cpls()[0]->reels()[0]->add(reel_subs1);
- auto reel_subs2 = make_shared<dcp::ReelInteropTextAsset>(subs2, dcp::Fraction(24, 1), 240, 0);
+ auto reel_subs2 = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, subs2, dcp::Fraction(24, 1), 240, 0);
dcp->cpls()[0]->reels()[1]->add(reel_subs2);
dcp->write_xml();
diff --git a/test/dcp_font_test.cc b/test/dcp_font_test.cc
index b81248f0..d2cfacca 100644
--- a/test/dcp_font_test.cc
+++ b/test/dcp_font_test.cc
@@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test)
check_file ("test/data/dummy.ttf", "build/test/interop_dcp_font_test/font_0.ttf");
auto reel = make_shared<dcp::Reel>();
- reel->add (make_shared<dcp::ReelInteropTextAsset>(subs, dcp::Fraction (24, 1), 24, 0));
+ reel->add(make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction (24, 1), 24, 0));
auto cpl = make_shared<dcp::CPL>("", dcp::ContentKind::TRAILER, dcp::Standard::INTEROP);
cpl->add (reel);
@@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test)
subs->write (directory / "frobozz.mxf");
auto reel = make_shared<dcp::Reel>();
- reel->add (make_shared<dcp::ReelSMPTETextAsset>(subs, dcp::Fraction (24, 1), 24, 0));
+ reel->add(make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction (24, 1), 24, 0));
auto cpl = make_shared<dcp::CPL>("", dcp::ContentKind::TRAILER, dcp::Standard::SMPTE);
cpl->add (reel);
diff --git a/test/decryption_test.cc b/test/decryption_test.cc
index af5ba91b..62b25500 100644
--- a/test/decryption_test.cc
+++ b/test/decryption_test.cc
@@ -203,7 +203,7 @@ BOOST_AUTO_TEST_CASE (decryption_test2)
auto reel = std::make_shared<dcp::Reel>();
auto reel_picture_asset = std::make_shared<dcp::ReelMonoPictureAsset>(picture_asset, 0);
auto reel_sound_asset = std::make_shared<dcp::ReelSoundAsset>(sound_asset, 0);
- auto reel_subs_asset = std::make_shared<dcp::ReelSMPTETextAsset>(subs_asset, dcp::Fraction(24, 1), 120, 0);
+ auto reel_subs_asset = std::make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs_asset, dcp::Fraction(24, 1), 120, 0);
reel->add(reel_picture_asset);
reel->add(reel_sound_asset);
reel->add(reel_subs_asset);
diff --git a/test/interop_subtitle_test.cc b/test/interop_subtitle_test.cc
index d7d7b7f7..ac63d098 100644
--- a/test/interop_subtitle_test.cc
+++ b/test/interop_subtitle_test.cc
@@ -955,7 +955,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3)
c->write ("build/test/write_interop_subtitle_test3/subs.xml");
auto reel = std::make_shared<dcp::Reel>();
- reel->add(std::make_shared<dcp::ReelInteropTextAsset>(c, dcp::Fraction(24, 1), 6046, 0));
+ reel->add(std::make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, c, dcp::Fraction(24, 1), 6046, 0));
string const issue_date = "2018-09-02T04:45:18+00:00";
string const issuer = "libdcp";
diff --git a/test/kdm_test.cc b/test/kdm_test.cc
index 4ab1a204..91db326f 100644
--- a/test/kdm_test.cc
+++ b/test/kdm_test.cc
@@ -335,7 +335,7 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test)
subs->add_font ("afont", data);
subs->write (vf_path / "subs.xml");
- auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), 192, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 192, 0);
auto reel = make_shared<dcp::Reel>(ov_reel_picture, ov_reel_sound, reel_subs);
diff --git a/test/test.cc b/test/test.cc
index ef5424b6..8e30878d 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -46,12 +46,10 @@
#include "j2k_picture_asset_writer.h"
#include "reel.h"
#include "reel_asset.h"
-#include "reel_interop_closed_caption_asset.h"
#include "reel_interop_text_asset.h"
#include "reel_markers_asset.h"
#include "reel_mono_picture_asset.h"
#include "reel_mono_picture_asset.h"
-#include "reel_smpte_closed_caption_asset.h"
#include "reel_smpte_text_asset.h"
#include "reel_sound_asset.h"
#include "smpte_subtitle_asset.h"
@@ -447,7 +445,7 @@ make_simple_with_interop_subs (boost::filesystem::path path)
subs->add_font ("afont", data);
subs->write (path / "subs" / "subs.xml");
- auto reel_subs = make_shared<dcp::ReelInteropTextAsset>(subs, dcp::Fraction(24, 1), 240, 0);
+ auto reel_subs = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 240, 0);
dcp->cpls().front()->reels().front()->add (reel_subs);
return dcp;
@@ -468,7 +466,7 @@ make_simple_with_smpte_subs (boost::filesystem::path path)
subs->write (path / "subs.mxf");
- auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), 192, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 192, 0);
dcp->cpls().front()->reels().front()->add (reel_subs);
return dcp;
@@ -484,7 +482,7 @@ make_simple_with_interop_ccaps (boost::filesystem::path path)
subs->add (simple_subtitle());
subs->write (path / "ccap.xml");
- auto reel_caps = make_shared<dcp::ReelInteropClosedCaptionAsset>(subs, dcp::Fraction(24, 1), 240, 0);
+ auto reel_caps = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::CAPTION, subs, dcp::Fraction(24, 1), 240, 0);
dcp->cpls()[0]->reels()[0]->add (reel_caps);
return dcp;
@@ -504,7 +502,7 @@ make_simple_with_smpte_ccaps (boost::filesystem::path path)
subs->add_font("font", fake_font);
subs->write (path / "ccap.mxf");
- auto reel_caps = make_shared<dcp::ReelSMPTEClosedCaptionAsset>(subs, dcp::Fraction(24, 1), 192, 0);
+ auto reel_caps = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, subs, dcp::Fraction(24, 1), 192, 0);
dcp->cpls()[0]->reels()[0]->add(reel_caps);
return dcp;
diff --git a/test/verify_test.cc b/test/verify_test.cc
index ddd4a8cd..0b6ac4d5 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -43,13 +43,11 @@
#include "openjpeg_image.h"
#include "raw_convert.h"
#include "reel.h"
-#include "reel_interop_closed_caption_asset.h"
#include "reel_interop_text_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_smpte_closed_caption_asset.h"
#include "reel_smpte_text_asset.h"
#include "smpte_subtitle_asset.h"
#include "stereo_j2k_picture_asset.h"
@@ -1180,7 +1178,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::ReelInteropTextAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 16 * 24, 0);
auto cpl = write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
check_verify_result (
@@ -1206,7 +1204,7 @@ BOOST_AUTO_TEST_CASE(verify_catch_missing_font_file_with_interop_ccap)
prepare_directory(dir);
copy_file("test/data/subs1.xml", dir / "ccap.xml");
auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "ccap.xml");
- auto reel_asset = make_shared<dcp::ReelInteropClosedCaptionAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::CAPTION, asset, dcp::Fraction(24, 1), 16 * 24, 0);
auto cpl = write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
check_verify_result (
@@ -1234,7 +1232,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::ReelInteropTextAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 16 * 24, 0);
auto cpl = write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
{
@@ -1275,7 +1273,7 @@ BOOST_AUTO_TEST_CASE(verify_interop_subtitle_asset_with_no_subtitles)
prepare_directory(dir);
copy_file("test/data/subs4.xml", dir / "subs.xml");
auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
- auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 16 * 24, 0);
auto cpl = write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
check_verify_result (
@@ -1305,7 +1303,7 @@ BOOST_AUTO_TEST_CASE(verify_interop_subtitle_asset_with_single_space_subtitle)
prepare_directory(dir);
copy_file("test/data/subs5.xml", dir / "subs.xml");
auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
- auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 16 * 24, 0);
auto cpl = write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
check_verify_result (
@@ -1332,7 +1330,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::ReelSMPTETextAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 6046, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
check_verify_result(
@@ -1367,7 +1365,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_smpte_subtitles)
/* This broken_smpte.mxf does not use urn:uuid: for its subtitle ID, which we tolerate (rightly or wrongly) */
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::ReelSMPTETextAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 6046, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
check_verify_result (
@@ -1412,7 +1410,7 @@ BOOST_AUTO_TEST_CASE (verify_empty_text_node_in_subtitles)
prepare_directory (dir);
copy_file ("test/data/empty_text.mxf", dir / "subs.mxf");
auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf");
- auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(asset, dcp::Fraction(24, 1), 192, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 192, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
check_verify_result (
@@ -1454,7 +1452,7 @@ BOOST_AUTO_TEST_CASE (verify_empty_text_node_in_subtitles_with_child_nodes)
prepare_directory (dir);
copy_file ("test/data/empty_but_with_children.xml", dir / "subs.xml");
auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
- auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(asset, dcp::Fraction(24, 1), 192, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 192, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset, dcp::Standard::INTEROP);
check_verify_result (
@@ -1481,7 +1479,7 @@ BOOST_AUTO_TEST_CASE (verify_empty_text_node_in_subtitles_with_empty_child_nodes
prepare_directory (dir);
copy_file ("test/data/empty_with_empty_children.xml", dir / "subs.xml");
auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
- auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(asset, dcp::Fraction(24, 1), 192, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 192, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset, dcp::Standard::INTEROP);
check_verify_result (
@@ -1551,7 +1549,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::ReelSMPTETextAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 16 * 24, 0);
auto reel = make_shared<dcp::Reel>();
reel->add (reel_asset);
@@ -1688,7 +1686,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::ReelSMPTETextAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 6046, 0);
reel_asset->_language = "badlang";
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
@@ -1724,7 +1722,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language2)
auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf");
asset->_language = "wrong-andbad";
asset->write (dir / "subs.mxf");
- auto reel_asset = make_shared<dcp::ReelSMPTEClosedCaptionAsset>(asset, dcp::Fraction(24, 1), 6046, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, asset, dcp::Fraction(24, 1), 6046, 0);
reel_asset->_language = "badlang";
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
@@ -2115,7 +2113,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_xml_size_in_bytes)
add_font(asset);
asset->set_language (dcp::LanguageTag("de-DE"));
asset->write (dir / "subs.mxf");
- auto reel_asset = make_shared<dcp::ReelSMPTEClosedCaptionAsset>(asset, dcp::Fraction(24, 1), 49148, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, asset, dcp::Fraction(24, 1), 49148, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
check_verify_result (
@@ -2172,7 +2170,7 @@ verify_timed_text_asset_too_large (string name)
asset->set_language (dcp::LanguageTag("de-DE"));
asset->write (dir / "subs.mxf");
- auto reel_asset = make_shared<T>(asset, dcp::Fraction(24, 1), 240, 0);
+ auto reel_asset = make_shared<T>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 240, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
check_verify_result (
@@ -2210,7 +2208,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::ReelSMPTETextAsset>("verify_subtitle_asset_too_large");
- verify_timed_text_asset_too_large<dcp::ReelSMPTEClosedCaptionAsset>("verify_closed_caption_asset_too_large");
+ verify_timed_text_asset_too_large<dcp::ReelSMPTETextAsset>("verify_closed_caption_asset_too_large");
}
@@ -2248,7 +2246,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::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), 106, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 106, 0);
auto cpl = dcp->cpls()[0];
cpl->reels()[0]->add(reel_subs);
dcp->write_xml();
@@ -2294,7 +2292,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages)
subs->add (simple_subtitle());
add_font(subs);
subs->write (path / "subs1.mxf");
- auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), reel_length, 0);
cpl->reels()[0]->add(reel_subs);
}
@@ -2304,7 +2302,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages)
subs->add (simple_subtitle());
add_font(subs);
subs->write (path / "subs2.mxf");
- auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), reel_length, 0);
cpl->reels()[1]->add(reel_subs);
}
@@ -2356,7 +2354,7 @@ BOOST_AUTO_TEST_CASE (verify_multiple_closed_caption_languages_allowed)
ccaps->add (simple_subtitle());
add_font(ccaps);
ccaps->write (path / "subs1.mxf");
- auto reel_ccaps = make_shared<dcp::ReelSMPTEClosedCaptionAsset>(ccaps, dcp::Fraction(24, 1), reel_length, 0);
+ auto reel_ccaps = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, ccaps, dcp::Fraction(24, 1), reel_length, 0);
cpl->reels()[0]->add(reel_ccaps);
}
@@ -2366,7 +2364,7 @@ BOOST_AUTO_TEST_CASE (verify_multiple_closed_caption_languages_allowed)
ccaps->add (simple_subtitle());
add_font(ccaps);
ccaps->write (path / "subs2.mxf");
- auto reel_ccaps = make_shared<dcp::ReelSMPTEClosedCaptionAsset>(ccaps, dcp::Fraction(24, 1), reel_length, 0);
+ auto reel_ccaps = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, ccaps, dcp::Fraction(24, 1), reel_length, 0);
cpl->reels()[1]->add(reel_ccaps);
}
@@ -2436,7 +2434,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::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), 106, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 106, 0);
auto cpl = dcp->cpls()[0];
cpl->reels()[0]->add(reel_subs);
dcp->write_xml();
@@ -2504,7 +2502,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::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), 106, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 106, 0);
auto cpl = dcp->cpls()[0];
cpl->reels().front()->add(reel_subs);
dcp->write_xml();
@@ -2558,7 +2556,7 @@ public:
template <class T>
shared_ptr<dcp::CPL>
-dcp_with_text(path dir, vector<TestText> subs, optional<dcp::Key> key = boost::none, optional<string> key_id = boost::none)
+dcp_with_text(dcp::TextType type, path dir, vector<TestText> subs, optional<dcp::Key> key = boost::none, optional<string> key_id = boost::none)
{
prepare_directory (dir);
auto asset = make_shared<dcp::SMPTESubtitleAsset>();
@@ -2574,14 +2572,14 @@ dcp_with_text(path dir, vector<TestText> subs, optional<dcp::Key> key = boost::n
add_font(asset);
asset->write (dir / "subs.mxf");
- auto reel_asset = make_shared<T>(asset, dcp::Fraction(24, 1), asset->intrinsic_duration(), 0);
+ auto reel_asset = make_shared<T>(type, asset, dcp::Fraction(24, 1), asset->intrinsic_duration(), 0);
return write_dcp_with_single_asset (dir, reel_asset);
}
template <class T>
shared_ptr<dcp::CPL>
-dcp_with_text_from_file (path dir, boost::filesystem::path subs_xml)
+dcp_with_text_from_file(dcp::TextType type, path dir, boost::filesystem::path subs_xml)
{
prepare_directory (dir);
auto asset = make_shared<dcp::SMPTESubtitleAsset>(subs_xml);
@@ -2611,7 +2609,7 @@ dcp_with_text_from_file (path dir, boost::filesystem::path subs_xml)
BOOST_REQUIRE (!ASDCP_FAILURE(r));
writer.Finalize ();
- auto reel_asset = make_shared<T>(asset, dcp::Fraction(24, 1), asset->intrinsic_duration(), 0);
+ auto reel_asset = make_shared<T>(type, asset, dcp::Fraction(24, 1), asset->intrinsic_duration(), 0);
return write_dcp_with_single_asset (dir, reel_asset);
}
@@ -2620,7 +2618,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::ReelSMPTETextAsset> (dir, {{ 4 * 24 - 1, 5 * 24 }});
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, dir, {{ 4 * 24 - 1, 5 * 24 }});
check_verify_result (
{ dir },
{},
@@ -2646,7 +2644,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::ReelSMPTETextAsset> (dir, {{ 4 * 24, 5 * 24 }});
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, dir, {{ 4 * 24, 5 * 24 }});
check_verify_result(
{dir},
{},
@@ -2676,7 +2674,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel)
asset1->set_language (dcp::LanguageTag("de-DE"));
add_font(asset1);
asset1->write (dir / "subs1.mxf");
- auto reel_asset1 = make_shared<dcp::ReelSMPTETextAsset>(asset1, dcp::Fraction(24, 1), 5 * 24, 0);
+ auto reel_asset1 = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, 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);
@@ -2690,7 +2688,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::ReelSMPTETextAsset>(asset2, dcp::Fraction(24, 1), 4 * 24, 0);
+ auto reel_asset2 = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, 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);
@@ -2726,6 +2724,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_spacing)
{
auto const dir = path("build/test/verify_invalid_subtitle_spacing");
auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 4 * 24, 5 * 24 },
@@ -2755,6 +2754,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_spacing)
{
auto const dir = path("build/test/verify_valid_subtitle_spacing");
auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 4 * 24, 5 * 24 },
@@ -2781,7 +2781,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::ReelSMPTETextAsset> (dir, {{ 4 * 24, 4 * 24 + 1 }});
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, dir, {{ 4 * 24, 4 * 24 + 1 }});
check_verify_result (
{dir},
{},
@@ -2805,7 +2805,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::ReelSMPTETextAsset> (dir, {{ 4 * 24, 4 * 24 + 17 }});
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, dir, {{ 4 * 24, 4 * 24 + 17 }});
check_verify_result(
{dir},
@@ -2835,7 +2835,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::ReelSMPTETextAsset>(asset, dcp::Fraction(24, 1), 3 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 3 * 24, 0);
auto cpl = write_dcp_with_single_asset (dir, reel_asset);
check_verify_result (
{dir},
@@ -2868,6 +2868,7 @@ 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::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 96, 200, 0.0, dcp::VAlign::CENTER, "We" },
@@ -2899,6 +2900,7 @@ 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::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 96, 200, 0.0, dcp::VAlign::CENTER, "We" },
@@ -2927,6 +2929,7 @@ 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::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "We" },
@@ -2958,6 +2961,7 @@ 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::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "We" },
@@ -2987,6 +2991,7 @@ 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::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "012345678901234567890123456789012345678901234567890123" }
@@ -3015,6 +3020,7 @@ 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::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "012345678901234567890123456789012345678901234567890123456789012345678901234567890" }
@@ -3042,7 +3048,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_line_length2)
BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_count1)
{
auto const dir = path ("build/test/verify_valid_closed_caption_line_count1");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 200, 0.0, dcp::VAlign::CENTER, "We" },
@@ -3073,7 +3080,8 @@ BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_count1)
BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_count2)
{
auto const dir = path ("build/test/verify_valid_closed_caption_line_count2");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::SUBTITLE,
dir,
{
{ 96, 200, 0.0, dcp::VAlign::CENTER, "We" },
@@ -3101,7 +3109,8 @@ BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_count2)
BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_line_count3)
{
auto const dir = path ("build/test/verify_invalid_closed_caption_line_count3");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "We" },
@@ -3132,7 +3141,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_line_count3)
BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_count4)
{
auto const dir = path ("build/test/verify_valid_closed_caption_line_count4");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "We" },
@@ -3161,7 +3171,8 @@ BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_count4)
BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_length)
{
auto const dir = path ("build/test/verify_valid_closed_caption_line_length");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "01234567890123456789012345678901" }
@@ -3187,7 +3198,8 @@ BOOST_AUTO_TEST_CASE (verify_valid_closed_caption_line_length)
BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_line_length)
{
auto const dir = path ("build/test/verify_invalid_closed_caption_line_length");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::CENTER, "0123456789012345678901234567890123" }
@@ -3215,7 +3227,8 @@ BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_line_length)
BOOST_AUTO_TEST_CASE (verify_mismatched_closed_caption_valign1)
{
auto const dir = path ("build/test/verify_mismatched_closed_caption_valign1");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::TOP, "This" },
@@ -3242,7 +3255,8 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_closed_caption_valign1)
BOOST_AUTO_TEST_CASE (verify_mismatched_closed_caption_valign2)
{
auto const dir = path ("build/test/verify_mismatched_closed_caption_valign2");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::TOP, "This" },
@@ -3272,7 +3286,8 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_closed_caption_valign2)
BOOST_AUTO_TEST_CASE (verify_incorrect_closed_caption_ordering1)
{
auto const dir = path ("build/test/verify_invalid_incorrect_closed_caption_ordering1");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.0, dcp::VAlign::TOP, "This" },
@@ -3300,7 +3315,8 @@ BOOST_AUTO_TEST_CASE (verify_incorrect_closed_caption_ordering1)
BOOST_AUTO_TEST_CASE (verify_incorrect_closed_caption_ordering2)
{
auto const dir = path ("build/test/verify_invalid_incorrect_closed_caption_ordering2");
- auto cpl = dcp_with_text<dcp::ReelSMPTEClosedCaptionAsset> (
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset> (
+ dcp::TextType::CAPTION,
dir,
{
{ 96, 300, 0.2, dcp::VAlign::BOTTOM, "This" },
@@ -3328,7 +3344,7 @@ BOOST_AUTO_TEST_CASE (verify_incorrect_closed_caption_ordering2)
BOOST_AUTO_TEST_CASE (verify_incorrect_closed_caption_ordering3)
{
auto const dir = path ("build/test/verify_incorrect_closed_caption_ordering3");
- auto cpl = dcp_with_text_from_file<dcp::ReelSMPTEClosedCaptionAsset> (dir, "test/data/verify_incorrect_closed_caption_ordering3.xml");
+ auto cpl = dcp_with_text_from_file<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, dir, "test/data/verify_incorrect_closed_caption_ordering3.xml");
check_verify_result (
{dir},
{},
@@ -3352,7 +3368,7 @@ BOOST_AUTO_TEST_CASE (verify_incorrect_closed_caption_ordering3)
BOOST_AUTO_TEST_CASE (verify_incorrect_closed_caption_ordering4)
{
auto const dir = path ("build/test/verify_incorrect_closed_caption_ordering4");
- auto cpl = dcp_with_text_from_file<dcp::ReelSMPTEClosedCaptionAsset> (dir, "test/data/verify_incorrect_closed_caption_ordering4.xml");
+ auto cpl = dcp_with_text_from_file<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, dir, "test/data/verify_incorrect_closed_caption_ordering4.xml");
check_verify_result(
{dir},
@@ -3562,7 +3578,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a
subs->add (simple_subtitle());
add_font(subs);
subs->write (dir / "subs.mxf");
- auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), reel_length, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), reel_length, 0);
auto reel1 = make_shared<dcp::Reel>(
make_shared<dcp::ReelMonoPictureAsset>(simple_picture(dir, "1", reel_length), 0),
@@ -3570,7 +3586,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::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
+ reel1->add (make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), reel_length, 0));
}
auto markers1 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length);
@@ -3585,7 +3601,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::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
+ reel2->add (make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), reel_length, 0));
}
auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length);
@@ -3702,7 +3718,7 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1,
);
for (int i = 0; i < caps_in_reel1; ++i) {
- reel1->add (make_shared<dcp::ReelSMPTEClosedCaptionAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
+ reel1->add (make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, subs, dcp::Fraction(24, 1), reel_length, 0));
}
auto markers1 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length);
@@ -3717,7 +3733,7 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1,
);
for (int i = 0; i < caps_in_reel2; ++i) {
- reel2->add (make_shared<dcp::ReelSMPTEClosedCaptionAsset>(subs, dcp::Fraction(24, 1), reel_length, 0));
+ reel2->add (make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, subs, dcp::Fraction(24, 1), reel_length, 0));
}
auto markers2 = make_shared<dcp::ReelMarkersAsset>(dcp::Fraction(24, 1), reel_length);
@@ -3812,7 +3828,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_closed_caption_asset_counts)
template <class T>
void
-verify_text_entry_point_check (path dir, dcp::VerificationNote::Code code, boost::function<void (shared_ptr<T>)> adjust)
+verify_text_entry_point_check(dcp::TextType type, path dir, dcp::VerificationNote::Code code, boost::function<void (shared_ptr<T>)> adjust)
{
prepare_directory (dir);
auto dcp = make_shared<dcp::DCP>(dir);
@@ -3826,7 +3842,7 @@ verify_text_entry_point_check (path dir, dcp::VerificationNote::Code code, boost
subs->add (simple_subtitle());
add_font(subs);
subs->write (dir / "subs.mxf");
- auto reel_text = make_shared<T>(subs, dcp::Fraction(24, 1), reel_length, 0);
+ auto reel_text = make_shared<T>(type, subs, dcp::Fraction(24, 1), reel_length, 0);
adjust (reel_text);
auto reel = make_shared<dcp::Reel>(
@@ -3868,7 +3884,8 @@ 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::ReelSMPTETextAsset> (
+ verify_text_entry_point_check<dcp::ReelSMPTETextAsset>(
+ dcp::TextType::SUBTITLE,
"build/test/verify_subtitle_entry_point_must_be_present",
dcp::VerificationNote::Code::MISSING_SUBTITLE_ENTRY_POINT,
[](shared_ptr<dcp::ReelSMPTETextAsset> asset) {
@@ -3876,7 +3893,8 @@ BOOST_AUTO_TEST_CASE (verify_text_entry_point)
}
);
- verify_text_entry_point_check<dcp::ReelSMPTETextAsset> (
+ verify_text_entry_point_check<dcp::ReelSMPTETextAsset>(
+ dcp::TextType::SUBTITLE,
"build/test/verify_subtitle_entry_point_must_be_zero",
dcp::VerificationNote::Code::INCORRECT_SUBTITLE_ENTRY_POINT,
[](shared_ptr<dcp::ReelSMPTETextAsset> asset) {
@@ -3884,18 +3902,20 @@ BOOST_AUTO_TEST_CASE (verify_text_entry_point)
}
);
- verify_text_entry_point_check<dcp::ReelSMPTEClosedCaptionAsset> (
+ verify_text_entry_point_check<dcp::ReelSMPTETextAsset>(
+ dcp::TextType::CAPTION,
"build/test/verify_closed_caption_entry_point_must_be_present",
dcp::VerificationNote::Code::MISSING_CLOSED_CAPTION_ENTRY_POINT,
- [](shared_ptr<dcp::ReelSMPTEClosedCaptionAsset> asset) {
+ [](shared_ptr<dcp::ReelSMPTETextAsset> asset) {
asset->unset_entry_point ();
}
);
- verify_text_entry_point_check<dcp::ReelSMPTEClosedCaptionAsset> (
+ verify_text_entry_point_check<dcp::ReelSMPTETextAsset>(
+ dcp::TextType::CAPTION,
"build/test/verify_closed_caption_entry_point_must_be_zero",
dcp::VerificationNote::Code::INCORRECT_CLOSED_CAPTION_ENTRY_POINT,
- [](shared_ptr<dcp::ReelSMPTEClosedCaptionAsset> asset) {
+ [](shared_ptr<dcp::ReelSMPTETextAsset> asset) {
asset->set_entry_point (9);
}
);
@@ -4823,7 +4843,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::ReelSMPTETextAsset>(subs_asset, dcp::Fraction(24, 1), 240, 0);
+ auto subs_reel = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs_asset, dcp::Fraction(24, 1), 240, 0);
auto cpl = write_dcp_with_single_asset (dir, subs_reel);
@@ -4903,7 +4923,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::ReelSMPTETextAsset>(subs_asset, dcp::Fraction(24, 1), 240, 0);
+ auto subs_reel = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs_asset, dcp::Fraction(24, 1), 240, 0);
auto cpl = write_dcp_with_single_asset (dir, subs_reel);
@@ -5583,7 +5603,7 @@ BOOST_AUTO_TEST_CASE(verify_missing_load_font_for_font)
editor.delete_first_line_containing("LoadFont");
}
auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml");
- auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+ auto reel_asset = make_shared<dcp::ReelInteropTextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 16 * 24, 0);
auto cpl = write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
check_verify_result (
@@ -5636,7 +5656,7 @@ BOOST_AUTO_TEST_CASE(verify_missing_load_font)
auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml");
subs->write(dir / "subs.mxf");
- auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(subs, dcp::Fraction(24, 1), 202, 0);
+ auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 202, 0);
auto cpl = dcp->cpls()[0];
cpl->reels()[0]->add(reel_subs);
dcp->write_xml();
@@ -5742,7 +5762,7 @@ BOOST_AUTO_TEST_CASE(verify_encrypted_smpte_dcp)
auto const dir = path("build/test/verify_encrypted_smpte_dcp");
dcp::Key key;
auto key_id = dcp::make_uuid();
- auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dir, {{ 4 * 24, 5 * 24 }}, key, key_id);
+ auto cpl = dcp_with_text<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, dir, {{ 4 * 24, 5 * 24 }}, key, key_id);
dcp::DecryptedKDM kdm(dcp::LocalTime(), dcp::LocalTime(), "", "", "");
kdm.add_key(dcp::DecryptedKDMKey(string{"MDIK"}, key_id, key, cpl->id(), dcp::Standard::SMPTE));