diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-06-28 23:12:42 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-08-17 12:57:31 +0200 |
| commit | 8e43142645252daeeaccbad7b9f3ed746c4b2382 (patch) | |
| tree | 6c029caa9f0c961087ec6145da0bbbb8abf17146 | |
| parent | 06c28c700f0a398a3289c4adfa83ceb2d0fc999d (diff) | |
{,Interop,SMPTE}SubtitleAsset -> {,Interop,SMPTE}TextAsset.
| -rw-r--r-- | examples/read_dcp.cc | 10 | ||||
| -rw-r--r-- | src/asset_factory.cc | 4 | ||||
| -rw-r--r-- | src/combine.cc | 4 | ||||
| -rw-r--r-- | src/dcp.cc | 12 | ||||
| -rw-r--r-- | src/interop_text_asset.cc (renamed from src/interop_subtitle_asset.cc) | 42 | ||||
| -rw-r--r-- | src/interop_text_asset.h (renamed from src/interop_subtitle_asset.h) | 18 | ||||
| -rw-r--r-- | src/reel.cc | 10 | ||||
| -rw-r--r-- | src/reel_interop_text_asset.cc | 2 | ||||
| -rw-r--r-- | src/reel_interop_text_asset.h | 12 | ||||
| -rw-r--r-- | src/reel_smpte_text_asset.cc | 4 | ||||
| -rw-r--r-- | src/reel_smpte_text_asset.h | 14 | ||||
| -rw-r--r-- | src/reel_text_asset.cc | 7 | ||||
| -rw-r--r-- | src/reel_text_asset.h | 14 | ||||
| -rw-r--r-- | src/smpte_text_asset.cc (renamed from src/smpte_subtitle_asset.cc) | 42 | ||||
| -rw-r--r-- | src/smpte_text_asset.h (renamed from src/smpte_subtitle_asset.h) | 20 | ||||
| -rw-r--r-- | src/text_asset.cc (renamed from src/subtitle_asset.cc) | 62 | ||||
| -rw-r--r-- | src/text_asset.h (renamed from src/subtitle_asset.h) | 20 | ||||
| -rw-r--r-- | src/text_asset_internal.cc (renamed from src/subtitle_asset_internal.cc) | 6 | ||||
| -rw-r--r-- | src/text_asset_internal.h (renamed from src/subtitle_asset_internal.h) | 8 | ||||
| -rw-r--r-- | src/verify.cc | 30 | ||||
| -rw-r--r-- | src/verify.h | 4 | ||||
| -rw-r--r-- | src/wscript | 14 | ||||
| -rw-r--r-- | test/combine_test.cc | 6 | ||||
| -rw-r--r-- | test/dcp_font_test.cc | 12 | ||||
| -rw-r--r-- | test/decryption_test.cc | 6 | ||||
| -rw-r--r-- | test/encryption_test.cc | 19 | ||||
| -rw-r--r-- | test/interop_subtitle_test.cc | 14 | ||||
| -rw-r--r-- | test/kdm_test.cc | 4 | ||||
| -rw-r--r-- | test/rewrite_subs.cc | 2 | ||||
| -rw-r--r-- | test/shared_subtitle_test.cc | 20 | ||||
| -rw-r--r-- | test/smpte_subtitle_test.cc | 44 | ||||
| -rw-r--r-- | test/subs_in_out.cc | 8 | ||||
| -rw-r--r-- | test/test.cc | 12 | ||||
| -rw-r--r-- | test/verify_test.cc | 80 | ||||
| -rw-r--r-- | tools/dcpdumpsub.cc | 4 | ||||
| -rw-r--r-- | tools/dcpinfo.cc | 10 |
36 files changed, 302 insertions, 298 deletions
diff --git a/examples/read_dcp.cc b/examples/read_dcp.cc index fff02288..8917b717 100644 --- a/examples/read_dcp.cc +++ b/examples/read_dcp.cc @@ -32,7 +32,7 @@ #include "mono_j2k_picture_asset_reader.h" #include "stereo_j2k_picture_asset.h" #include "sound_asset.h" -#include "subtitle_asset.h" +#include "text_asset.h" #include "openjpeg_image.h" #include "colour_conversion.h" #include "rgb_xyz.h" @@ -77,8 +77,12 @@ main () std::cout << "3D picture\n"; } else if (std::dynamic_pointer_cast<dcp::SoundAsset>(i)) { std::cout << "Sound\n"; - } else if (std::dynamic_pointer_cast<dcp::SubtitleAsset>(i)) { - std::cout << "Subtitle\n"; + } else if (text = std::dynamic_pointer_cast<dcp::TextAsset>(i)) { + if (text->type() == dcp::TextType::SUBTITLE) { + std::cout << "Subtitle\n"; + } else { + std::cout << "Caption\n"; + } } else if (std::dynamic_pointer_cast<dcp::CPL>(i)) { std::cout << "CPL\n"; } diff --git a/src/asset_factory.cc b/src/asset_factory.cc index 26811366..652e1e31 100644 --- a/src/asset_factory.cc +++ b/src/asset_factory.cc @@ -42,7 +42,7 @@ #include "compose.hpp" #include "mono_j2k_picture_asset.h" #include "mono_mpeg2_picture_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "sound_asset.h" #include "stereo_j2k_picture_asset.h" #include "stereo_j2k_picture_asset.h" @@ -93,7 +93,7 @@ dcp::asset_factory (boost::filesystem::path path, bool ignore_incorrect_picture_ case ASDCP::ESS_JPEG_2000_S: return make_shared<StereoJ2KPictureAsset>(path); case ASDCP::ESS_TIMED_TEXT: - return make_shared<SMPTESubtitleAsset>(path); + return make_shared<SMPTETextAsset>(path); case ASDCP::ESS_DCDATA_DOLBY_ATMOS: return make_shared<AtmosAsset>(path); default: diff --git a/src/combine.cc b/src/combine.cc index b7a625f0..74456bfb 100644 --- a/src/combine.cc +++ b/src/combine.cc @@ -45,7 +45,7 @@ #include "exceptions.h" #include "filesystem.h" #include "font_asset.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "raw_convert.h" #include <boost/filesystem.hpp> #include <set> @@ -139,7 +139,7 @@ dcp::combine ( continue; } - auto sub = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(j); + auto sub = dynamic_pointer_cast<dcp::InteropTextAsset>(j); if (sub) { /* Interop fonts are really fiddly. The font files are assets (in the ASSETMAP) * and also linked from the font XML by filename. We have to fix both these things, @@ -49,7 +49,7 @@ #include "exceptions.h" #include "filesystem.h" #include "font_asset.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "metadata.h" #include "mono_j2k_picture_asset.h" #include "mono_mpeg2_picture_asset.h" @@ -58,7 +58,7 @@ #include "raw_convert.h" #include "reel_asset.h" #include "reel_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "sound_asset.h" #include "stereo_j2k_picture_asset.h" #include "util.h" @@ -222,7 +222,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m if ( pkl_type == remove_parameters(CPL::static_pkl_type(standard)) || - pkl_type == remove_parameters(InteropSubtitleAsset::static_pkl_type(standard))) { + pkl_type == remove_parameters(InteropTextAsset::static_pkl_type(standard))) { auto p = new xmlpp::DomParser; try { p->parse_file(dcp::filesystem::fix_long_path(path).string()); @@ -244,14 +244,14 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m if (standard == Standard::SMPTE && notes) { notes->push_back (VerificationNote(VerificationNote::Type::ERROR, VerificationNote::Code::MISMATCHED_STANDARD)); } - other_assets.push_back (make_shared<InteropSubtitleAsset>(path)); + other_assets.push_back (make_shared<InteropTextAsset>(path)); } } else if ( *pkl_type == remove_parameters(J2KPictureAsset::static_pkl_type(standard)) || *pkl_type == remove_parameters(MPEG2PictureAsset::static_pkl_type(standard)) || *pkl_type == remove_parameters(SoundAsset::static_pkl_type(standard)) || *pkl_type == remove_parameters(AtmosAsset::static_pkl_type(standard)) || - *pkl_type == remove_parameters(SMPTESubtitleAsset::static_pkl_type(standard)) + *pkl_type == remove_parameters(SMPTETextAsset::static_pkl_type(standard)) ) { bool found_threed_marked_as_twod = false; @@ -544,7 +544,7 @@ DCP::assets (bool ignore_unresolved) const auto o = j->asset_ref().asset(); assets.push_back (o); /* More Interop special-casing */ - auto sub = dynamic_pointer_cast<InteropSubtitleAsset>(o); + auto sub = dynamic_pointer_cast<InteropTextAsset>(o); if (sub) { add_to_container(assets, sub->font_assets()); } diff --git a/src/interop_subtitle_asset.cc b/src/interop_text_asset.cc index a4594207..31d00712 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_text_asset.cc @@ -32,8 +32,8 @@ */ -/** @file src/interop_subtitle_asset.cc - * @brief InteropSubtitleAsset class +/** @file src/interop_text_asset.cc + * @brief InteropTextAsset class */ @@ -44,9 +44,9 @@ #include "font_asset.h" #include "file.h" #include "interop_load_font_node.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "raw_convert.h" -#include "subtitle_asset_internal.h" +#include "text_asset_internal.h" #include "subtitle_image.h" #include "util.h" #include "warnings.h" @@ -70,8 +70,8 @@ using boost::optional; using namespace dcp; -InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file) - : SubtitleAsset (file) +InteropTextAsset::InteropTextAsset(boost::filesystem::path file) + : TextAsset(file) { _raw_xml = dcp::file_to_string (file); @@ -102,14 +102,14 @@ InteropSubtitleAsset::InteropSubtitleAsset (boost::filesystem::path file) } -InteropSubtitleAsset::InteropSubtitleAsset () +InteropTextAsset::InteropTextAsset() { } string -InteropSubtitleAsset::xml_as_string () const +InteropTextAsset::xml_as_string() const { xmlpp::Document doc; auto root = doc.create_root_node ("DCSubtitle"); @@ -133,7 +133,7 @@ InteropSubtitleAsset::xml_as_string () const void -InteropSubtitleAsset::add_font (string load_id, dcp::ArrayData data) +InteropTextAsset::add_font(string load_id, dcp::ArrayData data) { _fonts.push_back (Font(load_id, make_uuid(), data)); auto const uri = String::compose("font_%1.ttf", _load_font_nodes.size()); @@ -142,13 +142,13 @@ InteropSubtitleAsset::add_font (string load_id, dcp::ArrayData data) bool -InteropSubtitleAsset::equals(shared_ptr<const Asset> other_asset, EqualityOptions const& options, NoteHandler note) const +InteropTextAsset::equals(shared_ptr<const Asset> other_asset, EqualityOptions const& options, NoteHandler note) const { - if (!SubtitleAsset::equals (other_asset, options, note)) { + if (!TextAsset::equals (other_asset, options, note)) { return false; } - auto other = dynamic_pointer_cast<const InteropSubtitleAsset> (other_asset); + auto other = dynamic_pointer_cast<const InteropTextAsset> (other_asset); if (!other) { return false; } @@ -183,7 +183,7 @@ InteropSubtitleAsset::equals(shared_ptr<const Asset> other_asset, EqualityOption vector<shared_ptr<LoadFontNode>> -InteropSubtitleAsset::load_font_nodes () const +InteropTextAsset::load_font_nodes() const { vector<shared_ptr<LoadFontNode>> lf; copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf)); @@ -192,7 +192,7 @@ InteropSubtitleAsset::load_font_nodes () const void -InteropSubtitleAsset::write (boost::filesystem::path p) const +InteropTextAsset::write(boost::filesystem::path p) const { File f(p, "wb"); if (!f) { @@ -230,7 +230,7 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const * a list of font ID, load ID and data. */ void -InteropSubtitleAsset::resolve_fonts (vector<shared_ptr<Asset>> assets) +InteropTextAsset::resolve_fonts(vector<shared_ptr<Asset>> assets) { for (auto asset: assets) { auto font = dynamic_pointer_cast<FontAsset>(asset); @@ -256,7 +256,7 @@ InteropSubtitleAsset::resolve_fonts (vector<shared_ptr<Asset>> assets) vector<shared_ptr<Asset>> -InteropSubtitleAsset::font_assets() +InteropTextAsset::font_assets() { vector<shared_ptr<Asset>> assets; for (auto const& i: _fonts) { @@ -268,7 +268,7 @@ InteropSubtitleAsset::font_assets() vector<shared_ptr<const Asset>> -InteropSubtitleAsset::font_assets() const +InteropTextAsset::font_assets() const { vector<shared_ptr<const Asset>> assets; for (auto const& i: _fonts) { @@ -280,7 +280,7 @@ InteropSubtitleAsset::font_assets() const void -InteropSubtitleAsset::add_to_assetmap (AssetMap& asset_map, boost::filesystem::path root) const +InteropTextAsset::add_to_assetmap(AssetMap& asset_map, boost::filesystem::path root) const { Asset::add_to_assetmap(asset_map, root); @@ -295,7 +295,7 @@ InteropSubtitleAsset::add_to_assetmap (AssetMap& asset_map, boost::filesystem::p void -InteropSubtitleAsset::add_to_pkl (shared_ptr<PKL> pkl, boost::filesystem::path root) const +InteropTextAsset::add_to_pkl(shared_ptr<PKL> pkl, boost::filesystem::path root) const { Asset::add_to_pkl (pkl, root); @@ -310,7 +310,7 @@ InteropSubtitleAsset::add_to_pkl (shared_ptr<PKL> pkl, boost::filesystem::path r void -InteropSubtitleAsset::set_font_file (string load_id, boost::filesystem::path file) +InteropTextAsset::set_font_file(string load_id, boost::filesystem::path file) { for (auto& i: _fonts) { if (i.load_id == load_id) { @@ -327,7 +327,7 @@ InteropSubtitleAsset::set_font_file (string load_id, boost::filesystem::path fil vector<string> -InteropSubtitleAsset::unresolved_fonts() const +InteropTextAsset::unresolved_fonts() const { vector<string> unresolved; for (auto load_font_node: _load_font_nodes) { diff --git a/src/interop_subtitle_asset.h b/src/interop_text_asset.h index ad1c68a7..363b1f27 100644 --- a/src/interop_subtitle_asset.h +++ b/src/interop_text_asset.h @@ -32,16 +32,16 @@ */ -/** @file src/interop_subtitle_asset.h - * @brief InteropSubtitleAsset class +/** @file src/interop_text_asset.h + * @brief InteropTextAsset class */ -#ifndef LIBDCP_INTEROP_SUBTITLE_ASSET_H -#define LIBDCP_INTEROP_SUBTITLE_ASSET_H +#ifndef LIBDCP_INTEROP_TEXT_ASSET_H +#define LIBDCP_INTEROP_TEXT_ASSET_H -#include "subtitle_asset.h" +#include "text_asset.h" #include "subtitle_standard.h" #include <boost/filesystem.hpp> @@ -52,16 +52,16 @@ namespace dcp { class InteropLoadFontNode; -/** @class InteropSubtitleAsset +/** @class InteropTextAsset * @brief A set of subtitles to be read and/or written in the Inter-Op format * * Inter-Op subtitles are sometimes known as CineCanvas. */ -class InteropSubtitleAsset : public SubtitleAsset +class InteropTextAsset : public TextAsset { public: - InteropSubtitleAsset (); - explicit InteropSubtitleAsset (boost::filesystem::path file); + InteropTextAsset(); + explicit InteropTextAsset(boost::filesystem::path file); bool equals ( std::shared_ptr<const Asset>, diff --git a/src/reel.cc b/src/reel.cc index 3eb81e1d..fa20cba9 100644 --- a/src/reel.cc +++ b/src/reel.cc @@ -40,7 +40,7 @@ #include "decrypted_kdm.h" #include "decrypted_kdm_key.h" #include "equality_options.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "mono_j2k_picture_asset.h" #include "j2k_picture_asset.h" #include "reel.h" @@ -52,10 +52,10 @@ #include "reel_sound_asset.h" #include "reel_stereo_picture_asset.h" #include "reel_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "sound_asset.h" #include "stereo_j2k_picture_asset.h" -#include "subtitle_asset.h" +#include "text_asset.h" #include "util.h" #include <libxml++/nodes/element.h> #include <stdint.h> @@ -408,7 +408,7 @@ Reel::resolve_refs (vector<shared_ptr<Asset>> assets) /* Interop subtitle handling is all special cases */ if (_main_subtitle->asset_ref().resolved()) { - auto iop = dynamic_pointer_cast<InteropSubtitleAsset> (_main_subtitle->asset_ref().asset()); + auto iop = dynamic_pointer_cast<InteropTextAsset>(_main_subtitle->asset_ref().asset()); if (iop) { iop->resolve_fonts (assets); } @@ -420,7 +420,7 @@ Reel::resolve_refs (vector<shared_ptr<Asset>> assets) /* Interop subtitle handling is all special cases */ if (i->asset_ref().resolved()) { - auto iop = dynamic_pointer_cast<InteropSubtitleAsset> (i->asset_ref().asset()); + auto iop = dynamic_pointer_cast<InteropTextAsset>(i->asset_ref().asset()); if (iop) { iop->resolve_fonts (assets); } diff --git a/src/reel_interop_text_asset.cc b/src/reel_interop_text_asset.cc index b5e20f78..62211b6d 100644 --- a/src/reel_interop_text_asset.cc +++ b/src/reel_interop_text_asset.cc @@ -52,7 +52,7 @@ using boost::optional; using namespace dcp; -ReelInteropTextAsset::ReelInteropTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) +ReelInteropTextAsset::ReelInteropTextAsset(TextType type, std::shared_ptr<TextAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) : ReelTextAsset(type, asset, edit_rate, intrinsic_duration, entry_point) { diff --git a/src/reel_interop_text_asset.h b/src/reel_interop_text_asset.h index 88cdeaae..428f0fd5 100644 --- a/src/reel_interop_text_asset.h +++ b/src/reel_interop_text_asset.h @@ -37,7 +37,7 @@ */ -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "reel_text_asset.h" @@ -50,15 +50,15 @@ namespace dcp { class ReelInteropTextAsset : public ReelTextAsset { public: - ReelInteropTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelInteropTextAsset(TextType type, std::shared_ptr<TextAsset> 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 { - return asset_of_type<const InteropSubtitleAsset>(); + std::shared_ptr<const InteropTextAsset> interop_asset() const { + return asset_of_type<const InteropTextAsset>(); } - std::shared_ptr<InteropSubtitleAsset> interop_asset () { - return asset_of_type<InteropSubtitleAsset>(); + std::shared_ptr<InteropTextAsset> interop_asset() { + return asset_of_type<InteropTextAsset>(); } xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override; diff --git a/src/reel_smpte_text_asset.cc b/src/reel_smpte_text_asset.cc index 68f85586..48694651 100644 --- a/src/reel_smpte_text_asset.cc +++ b/src/reel_smpte_text_asset.cc @@ -38,7 +38,7 @@ #include "reel_smpte_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "warnings.h" LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> @@ -53,7 +53,7 @@ using boost::optional; using namespace dcp; -ReelSMPTETextAsset::ReelSMPTETextAsset(TextType type, shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) +ReelSMPTETextAsset::ReelSMPTETextAsset(TextType type, shared_ptr<SMPTETextAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) : ReelTextAsset(type, asset, edit_rate, intrinsic_duration, entry_point) { diff --git a/src/reel_smpte_text_asset.h b/src/reel_smpte_text_asset.h index 24344a3a..9a1c78a9 100644 --- a/src/reel_smpte_text_asset.h +++ b/src/reel_smpte_text_asset.h @@ -38,13 +38,13 @@ #include "reel_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" namespace dcp { -class SMPTESubtitleAsset; +class SMPTETextAsset; /** @class ReelSMPTETextAsset @@ -53,15 +53,15 @@ class SMPTESubtitleAsset; class ReelSMPTETextAsset : public ReelTextAsset { public: - ReelSMPTETextAsset(TextType type, std::shared_ptr<SMPTESubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelSMPTETextAsset(TextType type, std::shared_ptr<SMPTETextAsset> 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 { - return asset_of_type<const SMPTESubtitleAsset>(); + std::shared_ptr<const SMPTETextAsset> smpte_asset() const { + return asset_of_type<const SMPTETextAsset>(); } - std::shared_ptr<SMPTESubtitleAsset> smpte_asset () { - return asset_of_type<SMPTESubtitleAsset>(); + std::shared_ptr<SMPTETextAsset> smpte_asset() { + return asset_of_type<SMPTETextAsset>(); } xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override; diff --git a/src/reel_text_asset.cc b/src/reel_text_asset.cc index 87a8ae58..09749946 100644 --- a/src/reel_text_asset.cc +++ b/src/reel_text_asset.cc @@ -39,8 +39,7 @@ #include "language_tag.h" #include "reel_text_asset.h" -#include "smpte_subtitle_asset.h" -#include "subtitle_asset.h" +#include "smpte_text_asset.h" #include "warnings.h" LIBDCP_DISABLE_WARNINGS #include <libxml++/libxml++.h> @@ -54,10 +53,10 @@ using boost::optional; using namespace dcp; -ReelTextAsset::ReelTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point) +ReelTextAsset::ReelTextAsset(TextType type, std::shared_ptr<TextAsset> 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, + dynamic_pointer_cast<SMPTETextAsset>(asset) ? dynamic_pointer_cast<SMPTETextAsset>(asset)->key_id() : boost::none, asset->id(), edit_rate, intrinsic_duration, diff --git a/src/reel_text_asset.h b/src/reel_text_asset.h index cf904921..35efe941 100644 --- a/src/reel_text_asset.h +++ b/src/reel_text_asset.h @@ -44,7 +44,7 @@ #include "language_tag.h" #include "reel_asset.h" #include "reel_file_asset.h" -#include "subtitle_asset.h" +#include "text_asset.h" #include "text_type.h" @@ -55,7 +55,7 @@ struct verify_invalid_language2; namespace dcp { -class SubtitleAsset; +class TextAsset; /** @class ReelTextAsset @@ -64,15 +64,15 @@ class SubtitleAsset; class ReelTextAsset : public ReelFileAsset { public: - ReelTextAsset(TextType type, std::shared_ptr<SubtitleAsset> asset, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point); + ReelTextAsset(TextType type, std::shared_ptr<TextAsset> 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 { - return asset_of_type<const SubtitleAsset>(); + std::shared_ptr<const TextAsset> asset() const { + return asset_of_type<const TextAsset>(); } - std::shared_ptr<SubtitleAsset> asset () { - return asset_of_type<SubtitleAsset>(); + std::shared_ptr<TextAsset> asset() { + return asset_of_type<TextAsset>(); } bool equals(std::shared_ptr<const ReelTextAsset>, EqualityOptions const&, NoteHandler) const; diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_text_asset.cc index 4f611583..987715cb 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_text_asset.cc @@ -32,8 +32,8 @@ */ -/** @file src/smpte_subtitle_asset.cc - * @brief SMPTESubtitleAsset class +/** @file src/smpte_text_asset.cc + * @brief SMPTETextAsset class */ @@ -45,7 +45,7 @@ #include "filesystem.h" #include "raw_convert.h" #include "smpte_load_font_node.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "subtitle_image.h" #include "util.h" #include "warnings.h" @@ -79,7 +79,7 @@ static string const subtitle_smpte_ns_2010 = "http://www.smpte-ra.org/schemas/42 static string const subtitle_smpte_ns_2014 = "http://www.smpte-ra.org/schemas/428-7/2014/DCST"; -SMPTESubtitleAsset::SMPTESubtitleAsset(SubtitleStandard standard) +SMPTETextAsset::SMPTETextAsset(SubtitleStandard standard) : MXF(Standard::SMPTE) , _edit_rate (24, 1) , _time_code_rate (24) @@ -90,8 +90,8 @@ SMPTESubtitleAsset::SMPTESubtitleAsset(SubtitleStandard standard) } -SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) - : SubtitleAsset (file) +SMPTETextAsset::SMPTETextAsset(boost::filesystem::path file) + : TextAsset (file) { auto xml = make_shared<cxml::Document>("SubtitleReel"); @@ -169,7 +169,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file) void -SMPTESubtitleAsset::parse_xml (shared_ptr<cxml::Document> xml) +SMPTETextAsset::parse_xml(shared_ptr<cxml::Document> xml) { if (xml->namespace_uri() == subtitle_smpte_ns_2007) { _subtitle_standard = SubtitleStandard::SMPTE_2007; @@ -222,7 +222,7 @@ SMPTESubtitleAsset::parse_xml (shared_ptr<cxml::Document> xml) void -SMPTESubtitleAsset::read_mxf_resources (shared_ptr<ASDCP::TimedText::MXFReader> reader, shared_ptr<DecryptionContext> dec) +SMPTETextAsset::read_mxf_resources(shared_ptr<ASDCP::TimedText::MXFReader> reader, shared_ptr<DecryptionContext> dec) { ASDCP::TimedText::TimedTextDescriptor descriptor; reader->FillTimedTextDescriptor (descriptor); @@ -284,7 +284,7 @@ SMPTESubtitleAsset::read_mxf_resources (shared_ptr<ASDCP::TimedText::MXFReader> void -SMPTESubtitleAsset::read_mxf_descriptor (shared_ptr<ASDCP::TimedText::MXFReader> reader) +SMPTETextAsset::read_mxf_descriptor(shared_ptr<ASDCP::TimedText::MXFReader> reader) { ASDCP::TimedText::TimedTextDescriptor descriptor; reader->FillTimedTextDescriptor (descriptor); @@ -301,7 +301,7 @@ SMPTESubtitleAsset::read_mxf_descriptor (shared_ptr<ASDCP::TimedText::MXFReader> void -SMPTESubtitleAsset::set_key (Key key) +SMPTETextAsset::set_key(Key key) { /* See if we already have a key; if we do, and we have a file, we'll already have read that file. @@ -345,7 +345,7 @@ SMPTESubtitleAsset::set_key (Key key) vector<shared_ptr<LoadFontNode>> -SMPTESubtitleAsset::load_font_nodes () const +SMPTETextAsset::load_font_nodes() const { vector<shared_ptr<LoadFontNode>> lf; copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter(lf)); @@ -354,7 +354,7 @@ SMPTESubtitleAsset::load_font_nodes () const bool -SMPTESubtitleAsset::valid_mxf (boost::filesystem::path file) +SMPTETextAsset::valid_mxf(boost::filesystem::path file) { Kumu::FileReaderFactory factory; ASDCP::TimedText::MXFReader reader(factory); @@ -366,7 +366,7 @@ SMPTESubtitleAsset::valid_mxf (boost::filesystem::path file) string -SMPTESubtitleAsset::xml_as_string () const +SMPTETextAsset::xml_as_string() const { xmlpp::Document doc; auto root = doc.create_root_node ("SubtitleReel"); @@ -403,7 +403,7 @@ SMPTESubtitleAsset::xml_as_string () const void -SMPTESubtitleAsset::write (boost::filesystem::path p) const +SMPTETextAsset::write(boost::filesystem::path p) const { EncryptionContext enc (key(), Standard::SMPTE); @@ -508,13 +508,13 @@ SMPTESubtitleAsset::write (boost::filesystem::path p) const } bool -SMPTESubtitleAsset::equals(shared_ptr<const Asset> other_asset, EqualityOptions const& options, NoteHandler note) const +SMPTETextAsset::equals(shared_ptr<const Asset> other_asset, EqualityOptions const& options, NoteHandler note) const { - if (!SubtitleAsset::equals (other_asset, options, note)) { + if (!TextAsset::equals (other_asset, options, note)) { return false; } - auto other = dynamic_pointer_cast<const SMPTESubtitleAsset>(other_asset); + auto other = dynamic_pointer_cast<const SMPTETextAsset>(other_asset); if (!other) { note (NoteType::ERROR, "Subtitles are in different standards"); return false; @@ -587,7 +587,7 @@ SMPTESubtitleAsset::equals(shared_ptr<const Asset> other_asset, EqualityOptions void -SMPTESubtitleAsset::add_font (string load_id, dcp::ArrayData data) +SMPTETextAsset::add_font(string load_id, dcp::ArrayData data) { string const uuid = make_uuid (); _fonts.push_back (Font(load_id, uuid, data)); @@ -596,15 +596,15 @@ SMPTESubtitleAsset::add_font (string load_id, dcp::ArrayData data) void -SMPTESubtitleAsset::add (shared_ptr<Subtitle> s) +SMPTETextAsset::add(shared_ptr<Subtitle> s) { - SubtitleAsset::add (s); + TextAsset::add(s); _intrinsic_duration = latest_subtitle_out().as_editable_units_ceil(_edit_rate.numerator / _edit_rate.denominator); } string -SMPTESubtitleAsset::schema_namespace() const +SMPTETextAsset::schema_namespace() const { switch (_subtitle_standard) { case SubtitleStandard::SMPTE_2007: diff --git a/src/smpte_subtitle_asset.h b/src/smpte_text_asset.h index 26144fe1..b5b95c5d 100644 --- a/src/smpte_subtitle_asset.h +++ b/src/smpte_text_asset.h @@ -32,12 +32,12 @@ */ -#ifndef LIBDCP_SMPTE_SUBTITLE_ASSET_H -#define LIBDCP_SMPTE_SUBTITLE_ASSET_H +#ifndef LIBDCP_SMPTE_TEXT_ASSET_H +#define LIBDCP_SMPTE_TEXT_ASSET_H -/** @file src/smpte_subtitle_asset.h - * @brief SMPTESubtitleAsset class +/** @file src/smpte_text_asset.h + * @brief SMPTETextAsset class */ @@ -45,7 +45,7 @@ #include "language_tag.h" #include "local_time.h" #include "mxf.h" -#include "subtitle_asset.h" +#include "text_asset.h" #include "subtitle_standard.h" #include <boost/filesystem.hpp> @@ -69,18 +69,18 @@ namespace dcp { class SMPTELoadFontNode; -/** @class SMPTESubtitleAsset +/** @class SMPTETextAsset * @brief A set of subtitles to be read and/or written in the SMPTE format */ -class SMPTESubtitleAsset : public SubtitleAsset, public MXF +class SMPTETextAsset : public TextAsset, public MXF { public: - explicit SMPTESubtitleAsset(SubtitleStandard standard = SubtitleStandard::SMPTE_2014); + explicit SMPTETextAsset(SubtitleStandard standard = SubtitleStandard::SMPTE_2014); - /** Construct a SMPTESubtitleAsset by reading an MXF or XML file + /** Construct a SMPTETextAsset by reading an MXF or XML file * @param file Filename */ - explicit SMPTESubtitleAsset (boost::filesystem::path file); + explicit SMPTETextAsset(boost::filesystem::path file); bool equals ( std::shared_ptr<const Asset>, diff --git a/src/subtitle_asset.cc b/src/text_asset.cc index 1cd4fc07..4ba3b623 100644 --- a/src/subtitle_asset.cc +++ b/src/text_asset.cc @@ -32,8 +32,8 @@ */ -/** @file src/subtitle_asset.cc - * @brief SubtitleAsset class +/** @file src/text_asset.cc + * @brief TextAsset class */ @@ -42,10 +42,10 @@ #include "load_font_node.h" #include "raw_convert.h" #include "reel_asset.h" -#include "subtitle_asset.h" -#include "subtitle_asset_internal.h" #include "subtitle_image.h" #include "subtitle_string.h" +#include "text_asset.h" +#include "text_asset_internal.h" #include "util.h" #include "xml.h" #include <asdcp/AS_DCP.h> @@ -71,13 +71,13 @@ using boost::optional; using namespace dcp; -SubtitleAsset::SubtitleAsset () +TextAsset::TextAsset() { } -SubtitleAsset::SubtitleAsset (boost::filesystem::path file) +TextAsset::TextAsset(boost::filesystem::path file) : Asset (file) { @@ -133,8 +133,8 @@ optional_number_attribute (xmlpp::Element const * node, string name) } -SubtitleAsset::ParseState -SubtitleAsset::font_node_state (xmlpp::Element const * node, Standard standard) const +TextAsset::ParseState +TextAsset::font_node_state(xmlpp::Element const * node, Standard standard) const { ParseState ps; @@ -169,7 +169,7 @@ SubtitleAsset::font_node_state (xmlpp::Element const * node, Standard standard) } void -SubtitleAsset::position_align (SubtitleAsset::ParseState& ps, xmlpp::Element const * node) const +TextAsset::position_align(TextAsset::ParseState& ps, xmlpp::Element const * node) const { auto hp = optional_number_attribute<float> (node, "HPosition"); if (!hp) { @@ -210,8 +210,8 @@ SubtitleAsset::position_align (SubtitleAsset::ParseState& ps, xmlpp::Element con } -SubtitleAsset::ParseState -SubtitleAsset::text_node_state (xmlpp::Element const * node) const +TextAsset::ParseState +TextAsset::text_node_state(xmlpp::Element const * node) const { ParseState ps; @@ -228,8 +228,8 @@ SubtitleAsset::text_node_state (xmlpp::Element const * node) const } -SubtitleAsset::ParseState -SubtitleAsset::image_node_state (xmlpp::Element const * node) const +TextAsset::ParseState +TextAsset::image_node_state(xmlpp::Element const * node) const { ParseState ps; @@ -241,8 +241,8 @@ SubtitleAsset::image_node_state (xmlpp::Element const * node) const } -SubtitleAsset::ParseState -SubtitleAsset::subtitle_node_state (xmlpp::Element const * node, optional<int> tcr) const +TextAsset::ParseState +TextAsset::subtitle_node_state(xmlpp::Element const * node, optional<int> tcr) const { ParseState ps; ps.in = Time (string_attribute(node, "TimeIn"), tcr); @@ -254,7 +254,7 @@ SubtitleAsset::subtitle_node_state (xmlpp::Element const * node, optional<int> t Time -SubtitleAsset::fade_time (xmlpp::Element const * node, string name, optional<int> tcr) const +TextAsset::fade_time(xmlpp::Element const * node, string name, optional<int> tcr) const { auto const u = optional_string_attribute(node, name).get_value_or (""); Time t; @@ -276,7 +276,7 @@ SubtitleAsset::fade_time (xmlpp::Element const * node, string name, optional<int void -SubtitleAsset::parse_subtitles (xmlpp::Element const * node, vector<ParseState>& state, optional<int> tcr, Standard standard) +TextAsset::parse_subtitles(xmlpp::Element const * node, vector<ParseState>& state, optional<int> tcr, Standard standard) { if (node->get_name() == "Font") { state.push_back (font_node_state (node, standard)); @@ -393,7 +393,7 @@ SubtitleAsset::parse_subtitles (xmlpp::Element const * node, vector<ParseState>& void -SubtitleAsset::maybe_add_subtitle( +TextAsset::maybe_add_subtitle( string text, vector<ParseState> const & parse_state, float space_before, @@ -553,7 +553,7 @@ SubtitleAsset::maybe_add_subtitle( vector<shared_ptr<const Subtitle>> -SubtitleAsset::subtitles () const +TextAsset::subtitles() const { vector<shared_ptr<const Subtitle>> s; for (auto i: _subtitles) { @@ -564,7 +564,7 @@ SubtitleAsset::subtitles () const vector<shared_ptr<const Subtitle>> -SubtitleAsset::subtitles_during (Time from, Time to, bool starting) const +TextAsset::subtitles_during(Time from, Time to, bool starting) const { vector<shared_ptr<const Subtitle>> s; for (auto i: _subtitles) { @@ -578,14 +578,14 @@ SubtitleAsset::subtitles_during (Time from, Time to, bool starting) const void -SubtitleAsset::add (shared_ptr<Subtitle> s) +TextAsset::add(shared_ptr<Subtitle> s) { _subtitles.push_back (s); } Time -SubtitleAsset::latest_subtitle_out () const +TextAsset::latest_subtitle_out() const { Time t; for (auto i: _subtitles) { @@ -599,13 +599,13 @@ SubtitleAsset::latest_subtitle_out () const bool -SubtitleAsset::equals(shared_ptr<const Asset> other_asset, EqualityOptions const& options, NoteHandler note) const +TextAsset::equals(shared_ptr<const Asset> other_asset, EqualityOptions const& options, NoteHandler note) const { if (!Asset::equals (other_asset, options, note)) { return false; } - auto other = dynamic_pointer_cast<const SubtitleAsset> (other_asset); + auto other = dynamic_pointer_cast<const TextAsset> (other_asset); if (!other) { return false; } @@ -660,7 +660,7 @@ struct SubtitleSorter void -SubtitleAsset::pull_fonts (shared_ptr<order::Part> part) +TextAsset::pull_fonts(shared_ptr<order::Part> part) { if (part->children.empty ()) { return; @@ -724,7 +724,7 @@ SubtitleAsset::pull_fonts (shared_ptr<order::Part> part) * class because the differences between the two are fairly subtle. */ void -SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, Standard standard) const +TextAsset::subtitles_as_xml(xmlpp::Element* xml_root, int time_code_rate, Standard standard) const { auto sorted = _subtitles; std::stable_sort(sorted.begin(), sorted.end(), SubtitleSorter()); @@ -824,7 +824,7 @@ SubtitleAsset::subtitles_as_xml (xmlpp::Element* xml_root, int time_code_rate, S map<string, ArrayData> -SubtitleAsset::font_data () const +TextAsset::font_data() const { map<string, ArrayData> out; for (auto const& i: _fonts) { @@ -835,7 +835,7 @@ SubtitleAsset::font_data () const map<string, boost::filesystem::path> -SubtitleAsset::font_filenames () const +TextAsset::font_filenames() const { map<string, boost::filesystem::path> out; for (auto const& i: _fonts) { @@ -852,7 +852,7 @@ SubtitleAsset::font_filenames () const * (see DCP-o-matic bug #1689). */ void -SubtitleAsset::fix_empty_font_ids () +TextAsset::fix_empty_font_ids() { bool have_empty = false; vector<string> ids; @@ -965,7 +965,7 @@ format_xml_node (xmlpp::Node const* node, State& state) * to get all namespaces with the libxml++ API. */ string -SubtitleAsset::format_xml(xmlpp::Document const& document, optional<pair<string, string>> xml_namespace) +TextAsset::format_xml(xmlpp::Document const& document, optional<pair<string, string>> xml_namespace) { auto root = document.get_root_node(); @@ -997,7 +997,7 @@ SubtitleAsset::format_xml(xmlpp::Document const& document, optional<pair<string, void -SubtitleAsset::ensure_font(string load_id, dcp::ArrayData data) +TextAsset::ensure_font(string load_id, dcp::ArrayData data) { if (std::find_if(_fonts.begin(), _fonts.end(), [load_id](Font const& font) { return font.load_id == load_id; }) == _fonts.end()) { add_font(load_id, data); diff --git a/src/subtitle_asset.h b/src/text_asset.h index 25758c2e..e1cb48c7 100644 --- a/src/subtitle_asset.h +++ b/src/text_asset.h @@ -32,13 +32,13 @@ */ -/** @file src/subtitle_asset.h - * @brief SubtitleAsset class +/** @file src/text_asset.h + * @brief TextAsset class */ -#ifndef LIBDCP_SUBTITLE_ASSET_H -#define LIBDCP_SUBTITLE_ASSET_H +#ifndef LIBDCP_TEXT_ASSET_H +#define LIBDCP_TEXT_ASSET_H #include "array_data.h" @@ -85,19 +85,19 @@ namespace order { } -/** @class SubtitleAsset - * @brief A parent for classes representing a file containing subtitles +/** @class TextAsset + * @brief A parent for classes representing a file containing subtitles or captions * * This class holds a list of Subtitle objects which it can extract * from the appropriate part of either an Interop or SMPTE XML file. - * Its subclasses InteropSubtitleAsset and SMPTESubtitleAsset handle the + * Its subclasses InteropTextAsset and SMPTETextAsset handle the * differences between the two types. */ -class SubtitleAsset : public Asset +class TextAsset : public Asset { public: - SubtitleAsset (); - explicit SubtitleAsset (boost::filesystem::path file); + TextAsset(); + explicit TextAsset(boost::filesystem::path file); bool equals ( std::shared_ptr<const Asset>, diff --git a/src/subtitle_asset_internal.cc b/src/text_asset_internal.cc index 39f68624..51821c78 100644 --- a/src/subtitle_asset_internal.cc +++ b/src/text_asset_internal.cc @@ -32,12 +32,12 @@ */ -/** @file src/subtitle_asset_internal.cc - * @brief Internal SubtitleAsset helpers +/** @file src/text_asset_internal.cc + * @brief Internal TextAsset helpers */ -#include "subtitle_asset_internal.h" +#include "text_asset_internal.h" #include "subtitle_string.h" #include "compose.hpp" #include <cmath> diff --git a/src/subtitle_asset_internal.h b/src/text_asset_internal.h index 557db2e4..c8231219 100644 --- a/src/subtitle_asset_internal.h +++ b/src/text_asset_internal.h @@ -32,13 +32,13 @@ */ -/** @file src/subtitle_asset_internal.h - * @brief Internal SubtitleAsset helpers +/** @file src/text_asset_internal.h + * @brief Internal TextAsset helpers */ -#ifndef LIBDCP_SUBTITLE_ASSET_INTERNAL_H -#define LIBDCP_SUBTITLE_ASSET_INTERNAL_H +#ifndef LIBDCP_TEXT_ASSET_INTERNAL_H +#define LIBDCP_TEXT_ASSET_INTERNAL_H #include "array_data.h" diff --git a/src/verify.cc b/src/verify.cc index b921375c..ee20e106 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -42,7 +42,7 @@ #include "dcp.h" #include "exceptions.h" #include "filesystem.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "mono_j2k_picture_asset.h" #include "mono_j2k_picture_frame.h" #include "raw_convert.h" @@ -53,7 +53,7 @@ #include "reel_sound_asset.h" #include "reel_smpte_text_asset.h" #include "reel_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "stereo_j2k_picture_asset.h" #include "stereo_j2k_picture_frame.h" #include "verify.h" @@ -756,7 +756,7 @@ verify_closed_caption_reel(Context& context, shared_ptr<const ReelTextAsset> ree void verify_smpte_timed_text_asset ( Context& context, - shared_ptr<const SMPTESubtitleAsset> asset, + shared_ptr<const SMPTETextAsset> asset, optional<int64_t> reel_asset_duration ) { @@ -801,7 +801,7 @@ verify_smpte_timed_text_asset ( /** Verify Interop subtitle / CCAP stuff */ void -verify_interop_text_asset(Context& context, shared_ptr<const InteropSubtitleAsset> asset) +verify_interop_text_asset(Context& context, shared_ptr<const InteropTextAsset> asset) { if (asset->subtitles().empty()) { context.error(VerificationNote::Code::MISSING_SUBTITLE, asset->id(), asset->file().get()); @@ -815,7 +815,7 @@ verify_interop_text_asset(Context& context, shared_ptr<const InteropSubtitleAsse /** Verify SMPTE subtitle-only stuff */ void -verify_smpte_subtitle_asset(Context& context, shared_ptr<const SMPTESubtitleAsset> asset) +verify_smpte_subtitle_asset(Context& context, shared_ptr<const SMPTETextAsset> asset) { if (asset->language()) { if (!context.subtitle_language) { @@ -854,10 +854,10 @@ verify_smpte_subtitle_asset(Context& context, shared_ptr<const SMPTESubtitleAsse /** Verify all subtitle stuff */ static void -verify_subtitle_asset(Context& context, shared_ptr<const SubtitleAsset> asset, optional<int64_t> reel_asset_duration) +verify_subtitle_asset(Context& context, shared_ptr<const TextAsset> asset, optional<int64_t> reel_asset_duration) { context.stage("Checking subtitle XML", asset->file()); - /* Note: we must not use SubtitleAsset::xml_as_string() here as that will mean the data on disk + /* Note: we must not use TextAsset::xml_as_string() here as that will mean the data on disk * gets passed through libdcp which may clean up and therefore hide errors. */ if (asset->raw_xml()) { @@ -866,7 +866,7 @@ verify_subtitle_asset(Context& context, shared_ptr<const SubtitleAsset> asset, o context.warning(VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED); } - auto namespace_count = [](shared_ptr<const SubtitleAsset> asset, string root_node) { + auto namespace_count = [](shared_ptr<const TextAsset> asset, string root_node) { cxml::Document doc(root_node); doc.read_string(asset->raw_xml().get()); auto root = dynamic_cast<xmlpp::Element*>(doc.node())->cobj(); @@ -877,7 +877,7 @@ verify_subtitle_asset(Context& context, shared_ptr<const SubtitleAsset> asset, o return count; }; - auto interop = dynamic_pointer_cast<const InteropSubtitleAsset>(asset); + auto interop = dynamic_pointer_cast<const InteropTextAsset>(asset); if (interop) { verify_interop_text_asset(context, interop); if (namespace_count(asset, "DCSubtitle") > 1) { @@ -885,7 +885,7 @@ verify_subtitle_asset(Context& context, shared_ptr<const SubtitleAsset> asset, o } } - auto smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset); + auto smpte = dynamic_pointer_cast<const SMPTETextAsset>(asset); if (smpte) { verify_smpte_timed_text_asset(context, smpte, reel_asset_duration); verify_smpte_subtitle_asset(context, smpte); @@ -901,12 +901,12 @@ verify_subtitle_asset(Context& context, shared_ptr<const SubtitleAsset> asset, o static void verify_closed_caption_asset ( Context& context, - shared_ptr<const SubtitleAsset> asset, + shared_ptr<const TextAsset> asset, optional<int64_t> reel_asset_duration ) { context.stage("Checking closed caption XML", asset->file()); - /* Note: we must not use SubtitleAsset::xml_as_string() here as that will mean the data on disk + /* Note: we must not use TextAsset::xml_as_string() here as that will mean the data on disk * gets passed through libdcp which may clean up and therefore hide errors. */ auto raw_xml = asset->raw_xml(); @@ -919,12 +919,12 @@ verify_closed_caption_asset ( context.warning(VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED); } - auto interop = dynamic_pointer_cast<const InteropSubtitleAsset>(asset); + auto interop = dynamic_pointer_cast<const InteropTextAsset>(asset); if (interop) { verify_interop_text_asset(context, interop); } - auto smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset); + auto smpte = dynamic_pointer_cast<const SMPTETextAsset>(asset); if (smpte) { verify_smpte_timed_text_asset(context, smpte, reel_asset_duration); } @@ -1202,7 +1202,7 @@ verify_closed_caption_details(Context& context, vector<shared_ptr<Reel>> reels) void dcp::verify_text_lines_and_characters( - shared_ptr<const SubtitleAsset> asset, + shared_ptr<const TextAsset> asset, int warning_length, int error_length, LinesCharactersResult* result diff --git a/src/verify.h b/src/verify.h index e9a67f83..01ea0efe 100644 --- a/src/verify.h +++ b/src/verify.h @@ -59,7 +59,7 @@ namespace dcp { class DCP; -class SubtitleAsset; +class TextAsset; class VerificationNote @@ -728,7 +728,7 @@ struct LinesCharactersResult extern void verify_text_lines_and_characters( - std::shared_ptr<const dcp::SubtitleAsset> asset, + std::shared_ptr<const dcp::TextAsset> asset, int warning_length, int error_length, dcp::LinesCharactersResult* result diff --git a/src/wscript b/src/wscript index 2320fe0d..c61cd2e1 100644 --- a/src/wscript +++ b/src/wscript @@ -65,7 +65,7 @@ def build(bld): h_align.cc identity_transfer_function.cc interop_load_font_node.cc - interop_subtitle_asset.cc + interop_text_asset.cc j2k_picture_asset.cc j2k_picture_asset_writer.cc j2k_transcode.cc @@ -110,7 +110,7 @@ def build(bld): s_gamut3_transfer_function.cc search.cc smpte_load_font_node.cc - smpte_subtitle_asset.cc + smpte_text_asset.cc sound_asset.cc sound_asset_writer.cc sound_frame.cc @@ -118,8 +118,8 @@ def build(bld): stereo_j2k_picture_asset_writer.cc stereo_j2k_picture_frame.cc subtitle.cc - subtitle_asset.cc - subtitle_asset_internal.cc + text_asset.cc + text_asset_internal.cc subtitle_image.cc subtitle_standard.cc subtitle_string.cc @@ -174,7 +174,7 @@ def build(bld): h_align.h identity_transfer_function.h interop_load_font_node.h - interop_subtitle_asset.h + interop_text_asset.h ffmpeg_image.h j2k_picture_asset.h j2k_picture_asset_writer.h @@ -225,7 +225,7 @@ def build(bld): scope_guard.h search.h smpte_load_font_node.h - smpte_subtitle_asset.h + smpte_text_asset.h sound_asset.h sound_asset_reader.h sound_asset_writer.h @@ -235,7 +235,7 @@ def build(bld): stereo_j2k_picture_asset_writer.h stereo_j2k_picture_frame.h subtitle.h - subtitle_asset.h + text_asset.h subtitle_image.h subtitle_standard.h subtitle_string.h diff --git a/test/combine_test.cc b/test/combine_test.cc index 725a4f6b..05563127 100644 --- a/test/combine_test.cc +++ b/test/combine_test.cc @@ -36,7 +36,7 @@ #include "cpl.h" #include "dcp.h" #include "equality_options.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "reel_text_asset.h" #include "reel_mono_picture_asset.h" #include "reel_sound_asset.h" @@ -450,7 +450,7 @@ BOOST_AUTO_TEST_CASE(combine_multi_reel_subtitles) dcp::ArrayData data1(4096); memset(data1.data(), 0, data1.size()); - auto subs1 = make_shared<dcp::InteropSubtitleAsset>(); + auto subs1 = make_shared<dcp::InteropTextAsset>(); subs1->add(simple_subtitle()); boost::filesystem::create_directory(in / "subs1"); subs1->add_font("afont1", data1); @@ -459,7 +459,7 @@ BOOST_AUTO_TEST_CASE(combine_multi_reel_subtitles) dcp::ArrayData data2(4096); memset(data2.data(), 1, data1.size()); - auto subs2 = make_shared<dcp::InteropSubtitleAsset>(); + auto subs2 = make_shared<dcp::InteropTextAsset>(); subs2->add(simple_subtitle()); boost::filesystem::create_directory(in / "subs2"); subs2->add_font("afont2", data2); diff --git a/test/dcp_font_test.cc b/test/dcp_font_test.cc index d2cfacca..ffc638d5 100644 --- a/test/dcp_font_test.cc +++ b/test/dcp_font_test.cc @@ -35,11 +35,11 @@ #include "cpl.h" #include "dcp.h" #include "file.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "reel.h" #include "reel_interop_text_asset.h" #include "reel_smpte_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "test.h" #include "util.h" #include <boost/test/unit_test.hpp> @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test) boost::filesystem::remove_all(directory); dcp::DCP dcp (directory); - auto subs = make_shared<dcp::InteropSubtitleAsset>(); + auto subs = make_shared<dcp::InteropTextAsset>(); subs->add_font ("theFontId", dcp::ArrayData("test/data/dummy.ttf")); subs->write (directory / "frobozz.xml"); check_file ("test/data/dummy.ttf", "build/test/interop_dcp_font_test/font_0.ttf"); @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE (interop_dcp_font_test) dcp::DCP dcp2 (directory); dcp2.read (); - auto subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> ( + auto subs2 = dynamic_pointer_cast<dcp::TextAsset>( dcp2.cpls()[0]->reels()[0]->main_subtitle()->asset_ref().asset() ); BOOST_REQUIRE (subs2); @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test) boost::filesystem::path directory = "build/test/smpte_dcp_font_test"; dcp::DCP dcp (directory); - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->add_font ("theFontId", dcp::ArrayData("test/data/dummy.ttf")); subs->write (directory / "frobozz.mxf"); @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE (smpte_dcp_font_test) dcp::DCP dcp2 (directory); dcp2.read (); - auto subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> ( + auto subs2 = dynamic_pointer_cast<dcp::TextAsset>( dcp2.cpls().front()->reels().front()->main_subtitle()->asset_ref().asset() ); BOOST_REQUIRE (subs2); diff --git a/test/decryption_test.cc b/test/decryption_test.cc index 62b25500..273b4efa 100644 --- a/test/decryption_test.cc +++ b/test/decryption_test.cc @@ -48,7 +48,7 @@ #include "reel_sound_asset.h" #include "reel_smpte_text_asset.h" #include "rgb_xyz.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "sound_asset.h" #include "sound_asset_writer.h" #include "stream_operators.h" @@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE (decryption_test2) sound_writer->write(audio.data(), 2, 48000); sound_writer->finalize (); - auto subs_asset = std::make_shared<dcp::SMPTESubtitleAsset>(); + auto subs_asset = std::make_shared<dcp::SMPTETextAsset>(); subs_asset->set_key (key); subs_asset->set_context_id (context_id); subs_asset->add(std::make_shared<dcp::SubtitleString>( @@ -236,7 +236,7 @@ BOOST_AUTO_TEST_CASE (decryption_test2) BOOST_REQUIRE (reel_read->main_sound()); BOOST_CHECK (reel_read->main_sound()->asset()->key()); BOOST_REQUIRE (reel_read->main_subtitle()); - auto smpte_sub = dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(reel_read->main_subtitle()->asset()); + auto smpte_sub = dynamic_pointer_cast<dcp::SMPTETextAsset>(reel_read->main_subtitle()->asset()); BOOST_REQUIRE (smpte_sub); BOOST_CHECK (smpte_sub->key()); } diff --git a/test/encryption_test.cc b/test/encryption_test.cc index c8722907..3af0e24d 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -31,23 +31,24 @@ files in the program, then also delete it here. */ -#include "metadata.h" + #include "certificate.h" -#include "dcp.h" #include "certificate_chain.h" #include "cpl.h" +#include "dcp.h" +#include "decrypted_kdm.h" +#include "encrypted_kdm.h" #include "filesystem.h" -#include "mono_j2k_picture_asset.h" #include "j2k_picture_asset_writer.h" -#include "sound_asset_writer.h" -#include "sound_asset.h" +#include "metadata.h" +#include "mono_j2k_picture_asset.h" #include "reel.h" -#include "test.h" -#include "subtitle_asset.h" #include "reel_mono_picture_asset.h" #include "reel_sound_asset.h" -#include "encrypted_kdm.h" -#include "decrypted_kdm.h" +#include "sound_asset.h" +#include "sound_asset_writer.h" +#include "test.h" +#include "text_asset.h" #include <asdcp/KM_util.h> #include <sndfile.h> #include <boost/test/unit_test.hpp> diff --git a/test/interop_subtitle_test.cc b/test/interop_subtitle_test.cc index ac63d098..d731f10f 100644 --- a/test/interop_subtitle_test.cc +++ b/test/interop_subtitle_test.cc @@ -32,7 +32,7 @@ */ -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "interop_load_font_node.h" #include "reel_interop_text_asset.h" #include "subtitle_string.h" @@ -51,7 +51,7 @@ using std::vector; /** Load some subtitle content from Interop XML and check that it is read correctly */ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) { - dcp::InteropSubtitleAsset subs ("test/data/subs1.xml"); + dcp::InteropTextAsset subs("test/data/subs1.xml"); BOOST_CHECK_EQUAL (subs.id(), "cab5c268-222b-41d2-88ae-6d6999441b17"); BOOST_CHECK_EQUAL (subs.movie_title(), "Movie Title"); @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test1) /** And similarly for another one */ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) { - dcp::InteropSubtitleAsset subs ("test/data/subs2.xml"); + dcp::InteropTextAsset subs("test/data/subs2.xml"); auto s = subs.subtitles_during (dcp::Time (0, 0, 42, 100, 250), dcp::Time (0, 0, 42, 101, 250), false); BOOST_REQUIRE_EQUAL (s.size(), 2U); @@ -714,7 +714,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test2) /** And one with bitmap subtitles */ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test3) { - dcp::InteropSubtitleAsset subs ("test/data/subs3.xml"); + dcp::InteropTextAsset subs("test/data/subs3.xml"); BOOST_REQUIRE_EQUAL (subs.subtitles().size(), 1U); auto si = dynamic_pointer_cast<const dcp::SubtitleImage>(subs.subtitles().front()); @@ -726,7 +726,7 @@ BOOST_AUTO_TEST_CASE (read_interop_subtitle_test3) /** Write some subtitle content as Interop XML and check that it is right */ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) { - dcp::InteropSubtitleAsset c; + dcp::InteropTextAsset c; c.set_reel_number ("1"); c.set_language ("EN"); c.set_movie_title ("Test"); @@ -841,7 +841,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) */ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test2) { - dcp::InteropSubtitleAsset c; + dcp::InteropTextAsset c; c.set_reel_number ("1"); c.set_language ("EN"); c.set_movie_title ("Test"); @@ -929,7 +929,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) { RNGFixer fix; - auto c = std::make_shared<dcp::InteropSubtitleAsset>(); + auto c = std::make_shared<dcp::InteropTextAsset>(); c->set_reel_number ("1"); c->set_language ("EN"); c->set_movie_title ("Test"); diff --git a/test/kdm_test.cc b/test/kdm_test.cc index 91db326f..cf1a7fdc 100644 --- a/test/kdm_test.cc +++ b/test/kdm_test.cc @@ -42,7 +42,7 @@ #include "reel_mono_picture_asset.h" #include "reel_sound_asset.h" #include "reel_smpte_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "test.h" #include "types.h" #include "util.h" @@ -325,7 +325,7 @@ BOOST_AUTO_TEST_CASE (vf_kdm_test) /* Make VF */ - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->add(simple_subtitle()); subs->set_key(key); diff --git a/test/rewrite_subs.cc b/test/rewrite_subs.cc index ae165172..3ec94166 100644 --- a/test/rewrite_subs.cc +++ b/test/rewrite_subs.cc @@ -35,7 +35,7 @@ #include "dcp.h" #include "cpl.h" #include "reel.h" -#include "subtitle_asset.h" +#include "text_asset.h" #include "reel_text_asset.h" #include "exceptions.h" diff --git a/test/shared_subtitle_test.cc b/test/shared_subtitle_test.cc index f7273d88..4ae4f4ae 100644 --- a/test/shared_subtitle_test.cc +++ b/test/shared_subtitle_test.cc @@ -37,11 +37,11 @@ */ -#include "interop_subtitle_asset.h" -#include "smpte_subtitle_asset.h" +#include "interop_text_asset.h" +#include "smpte_text_asset.h" #include "subtitle_string.h" #include "subtitle_image.h" -#include "subtitle_asset_internal.h" +#include "text_asset_internal.h" #include "reel_interop_text_asset.h" #include "reel.h" #include "cpl.h" @@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test1) text1->font._values["font"] = "Inconsolata"; text1->font._values["size"] = "42"; - dcp::SubtitleAsset::pull_fonts (root); + dcp::TextAsset::pull_fonts (root); BOOST_REQUIRE_EQUAL (sub1->font._values.size(), 2U); BOOST_CHECK_EQUAL (sub1->font._values["font"], "Inconsolata"); @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test2) text2->font._values["font"] = "Inconsolata"; text2->font._values["size"] = "48"; - dcp::SubtitleAsset::pull_fonts (root); + dcp::TextAsset::pull_fonts (root); BOOST_REQUIRE_EQUAL (sub1->font._values.size(), 1U); BOOST_CHECK_EQUAL (sub1->font._values["font"], "Inconsolata"); @@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE (pull_fonts_test3) auto string1 = make_shared<dcp::order::String>(text1, font, "Hello world", 0); text1->children.push_back (string1); - dcp::SubtitleAsset::pull_fonts (root); + dcp::TextAsset::pull_fonts (root); BOOST_REQUIRE_EQUAL (sub1->font._values.size(), 2U); BOOST_CHECK_EQUAL (sub1->font._values["font"], "Inconsolata"); @@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE (format_xml_test1) fred->add_child_text("Fred"); cxml::add_text_child(fred, "Text", "Jim"); fred->add_child_text("Sheila"); - BOOST_REQUIRE_EQUAL (dcp::SubtitleAsset::format_xml(doc, make_pair(string{}, string{"fred"})), + BOOST_REQUIRE_EQUAL (dcp::TextAsset::format_xml(doc, make_pair(string{}, string{"fred"})), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<Foo xmlns=\"fred\">\n" " <Empty/>\n" @@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE (format_xml_test2) auto path = private_test / "DKH_UT_EN20160601def.xml"; parser.parse_file(path.string().c_str()); auto document = parser.get_document(); - check_xml (dcp::file_to_string(private_test / "DKH_UT_EN20160601def.reformatted.xml"), dcp::SubtitleAsset::format_xml(*document, {}), {}); + check_xml (dcp::file_to_string(private_test / "DKH_UT_EN20160601def.reformatted.xml"), dcp::TextAsset::format_xml(*document, {}), {}); } @@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE (format_xml_entities_test) xmlpp::Document doc; auto root = doc.create_root_node("Foo"); cxml::add_text_child(root, "Bar", "Don't panic & xml \"is\" 'great' & < > —"); - BOOST_REQUIRE_EQUAL(dcp::SubtitleAsset::format_xml(doc, {}), + BOOST_REQUIRE_EQUAL(dcp::TextAsset::format_xml(doc, {}), "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<Foo>\n" " <Bar>Don't panic &amp; xml \"is\" 'great' & < > —</Bar>\n" @@ -221,7 +221,7 @@ BOOST_AUTO_TEST_CASE (format_xml_entities_test) BOOST_AUTO_TEST_CASE(ruby_round_trip_test) { - dcp::InteropSubtitleAsset asset("test/data/ruby1.xml"); + dcp::InteropTextAsset asset("test/data/ruby1.xml"); check_xml(dcp::file_to_string("test/data/ruby1.xml"), asset.xml_as_string(), {}, false); } diff --git a/test/smpte_subtitle_test.cc b/test/smpte_subtitle_test.cc index 3bf9dc52..005a9ec7 100644 --- a/test/smpte_subtitle_test.cc +++ b/test/smpte_subtitle_test.cc @@ -33,7 +33,7 @@ #include "smpte_load_font_node.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "stream_operators.h" #include "subtitle_image.h" #include "test.h" @@ -51,7 +51,7 @@ using boost::optional; BOOST_AUTO_TEST_CASE (smpte_subtitle_id_test) { - dcp::SMPTESubtitleAsset subs; + dcp::SMPTETextAsset subs; subs.add( std::make_shared<dcp::SubtitleString>( optional<string>(), @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE (smpte_subtitle_id_test) ); subs.write("build/test/smpte_subtitle_id_test.mxf"); - dcp::SMPTESubtitleAsset check("build/test/smpte_subtitle_id_test.mxf"); + dcp::SMPTETextAsset check("build/test/smpte_subtitle_id_test.mxf"); BOOST_CHECK(check.id() != check.xml_id()); } @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE (smpte_subtitle_id_test) /** Check reading of a SMPTE subtitle file */ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test) { - dcp::SMPTESubtitleAsset sc ( + dcp::SMPTETextAsset sc ( private_test / "data" / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV" / @@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test) /** And another one featuring <Font> within <Text> and some <Space> */ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test2) { - dcp::SMPTESubtitleAsset sc (private_test / "olsson.xml"); + dcp::SMPTETextAsset sc (private_test / "olsson.xml"); auto subs = sc.subtitles(); BOOST_REQUIRE_EQUAL (subs.size(), 6U); @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE (read_smpte_subtitle_test2) /* Write some subtitle content as SMPTE XML and check that it is right */ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) { - dcp::SMPTESubtitleAsset c; + dcp::SMPTETextAsset c; c.set_reel_number (1); c.set_language (dcp::LanguageTag("en")); c.set_content_title_text ("Test"); @@ -296,7 +296,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) */ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) { - dcp::SMPTESubtitleAsset c; + dcp::SMPTETextAsset c; c.set_reel_number (1); c.set_language (dcp::LanguageTag("en")); c.set_content_title_text ("Test"); @@ -493,7 +493,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) /* Write some subtitle content as SMPTE using bitmaps and check that it is right */ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3) { - dcp::SMPTESubtitleAsset c; + dcp::SMPTETextAsset c; c.set_reel_number (1); c.set_language (dcp::LanguageTag("en")); c.set_content_title_text ("Test"); @@ -522,7 +522,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3) boost::filesystem::create_directories (path); c.write (path / "subs.mxf"); - dcp::SMPTESubtitleAsset read_back (path / "subs.mxf"); + dcp::SMPTETextAsset read_back (path / "subs.mxf"); auto subs = read_back.subtitles (); BOOST_REQUIRE_EQUAL (subs.size(), 1U); auto image = dynamic_pointer_cast<const dcp::SubtitleImage>(subs[0]); @@ -546,7 +546,7 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test3) */ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_top_alignment) { - dcp::SMPTESubtitleAsset c; + dcp::SMPTETextAsset c; c.set_reel_number (1); c.set_language (dcp::LanguageTag("en")); c.set_content_title_text ("Test"); @@ -636,7 +636,7 @@ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_top_alignment) /* See the test above */ BOOST_AUTO_TEST_CASE (write_subtitles_in_vertical_order_with_bottom_alignment) { - dcp::SMPTESubtitleAsset c; + dcp::SMPTETextAsset c; c.set_reel_number (1); c.set_language (dcp::LanguageTag("en")); c.set_content_title_text ("Test"); @@ -733,39 +733,39 @@ BOOST_AUTO_TEST_CASE(smpte_subtitle_standard_written_correctly) boost::filesystem::remove_all(out); boost::filesystem::create_directories(out); - dcp::SMPTESubtitleAsset test_2014; + dcp::SMPTETextAsset test_2014; test_2014.set_issue_date(dcp::LocalTime("2020-01-01T14:00:00")); test_2014.write(out / "2014.mxf"); - BOOST_CHECK_EQUAL(dcp::SMPTESubtitleAsset(ref / "2014.mxf").raw_xml(), dcp::SMPTESubtitleAsset(out / "2014.mxf").raw_xml()); + BOOST_CHECK_EQUAL(dcp::SMPTETextAsset(ref / "2014.mxf").raw_xml(), dcp::SMPTETextAsset(out / "2014.mxf").raw_xml()); - dcp::SMPTESubtitleAsset test_2010(dcp::SubtitleStandard::SMPTE_2010); + dcp::SMPTETextAsset test_2010(dcp::SubtitleStandard::SMPTE_2010); test_2010.set_issue_date(dcp::LocalTime("2020-01-01T14:00:00")); test_2010.write(out / "2010.mxf"); - BOOST_CHECK_EQUAL(dcp::SMPTESubtitleAsset(ref / "2010.mxf").raw_xml(), dcp::SMPTESubtitleAsset(out / "2010.mxf").raw_xml()); + BOOST_CHECK_EQUAL(dcp::SMPTETextAsset(ref / "2010.mxf").raw_xml(), dcp::SMPTETextAsset(out / "2010.mxf").raw_xml()); - dcp::SMPTESubtitleAsset test_2007(dcp::SubtitleStandard::SMPTE_2007); + dcp::SMPTETextAsset test_2007(dcp::SubtitleStandard::SMPTE_2007); test_2007.set_issue_date(dcp::LocalTime("2020-01-01T14:00:00")); test_2007.write(out / "2007.mxf"); - BOOST_CHECK_EQUAL(dcp::SMPTESubtitleAsset(ref / "2007.mxf").raw_xml(), dcp::SMPTESubtitleAsset(out / "2007.mxf").raw_xml()); + BOOST_CHECK_EQUAL(dcp::SMPTETextAsset(ref / "2007.mxf").raw_xml(), dcp::SMPTETextAsset(out / "2007.mxf").raw_xml()); } BOOST_AUTO_TEST_CASE(smpte_subtitle_standard_read_correctly) { - dcp::SMPTESubtitleAsset test_2007("test/data/2007.mxf"); + dcp::SMPTETextAsset test_2007("test/data/2007.mxf"); BOOST_CHECK(test_2007.subtitle_standard() == dcp::SubtitleStandard::SMPTE_2007); - dcp::SMPTESubtitleAsset test_2010("test/data/2010.mxf"); + dcp::SMPTETextAsset test_2010("test/data/2010.mxf"); BOOST_CHECK(test_2010.subtitle_standard() == dcp::SubtitleStandard::SMPTE_2010); - dcp::SMPTESubtitleAsset test_2014("test/data/2014.mxf"); + dcp::SMPTETextAsset test_2014("test/data/2014.mxf"); BOOST_CHECK(test_2014.subtitle_standard() == dcp::SubtitleStandard::SMPTE_2014); } BOOST_AUTO_TEST_CASE(smpte_subtitle_intrinsic_duration_read_correctly) { - dcp::SMPTESubtitleAsset ref("test/data/verify_incorrect_closed_caption_ordering3.xml"); + dcp::SMPTETextAsset ref("test/data/verify_incorrect_closed_caption_ordering3.xml"); dcp::Key key; ref.set_key(key); @@ -777,7 +777,7 @@ BOOST_AUTO_TEST_CASE(smpte_subtitle_intrinsic_duration_read_correctly) auto const path = boost::filesystem::path("build/test/smpte_subtitle_instrinsic_duration_read_correctly.mxf"); ref.write(path); - auto check = dcp::SMPTESubtitleAsset(path); + auto check = dcp::SMPTETextAsset(path); check.set_key(key); BOOST_CHECK_EQUAL(check.intrinsic_duration(), duration); } diff --git a/test/subs_in_out.cc b/test/subs_in_out.cc index 7ca45f35..84f4de06 100644 --- a/test/subs_in_out.cc +++ b/test/subs_in_out.cc @@ -31,8 +31,8 @@ files in the program, then also delete it here. */ -#include "interop_subtitle_asset.h" -#include "smpte_subtitle_asset.h" +#include "interop_text_asset.h" +#include "smpte_text_asset.h" #include <iostream> using namespace std; @@ -46,12 +46,12 @@ main (int argc, char* argv[]) } try { - dcp::InteropSubtitleAsset sc (argv[1]); + dcp::InteropTextAsset sc(argv[1]); cout << sc.xml_as_string (); } catch (exception& e) { cerr << "Could not load as interop: " << e.what() << "\n"; try { - dcp::SMPTESubtitleAsset sc (argv[1]); + dcp::SMPTETextAsset sc(argv[1]); cout << sc.xml_as_string(); } catch (exception& e) { cerr << "Could not load as SMPTE (" << e.what() << ")\n"; diff --git a/test/test.cc b/test/test.cc index 8e30878d..e1d5ce77 100644 --- a/test/test.cc +++ b/test/test.cc @@ -36,7 +36,7 @@ #include "compose.hpp" #include "cpl.h" #include "dcp.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "file.h" #include "j2k_transcode.h" #include "mono_j2k_picture_asset.h" @@ -52,7 +52,7 @@ #include "reel_mono_picture_asset.h" #include "reel_smpte_text_asset.h" #include "reel_sound_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "sound_asset.h" #include "sound_asset_writer.h" #include "test.h" @@ -436,7 +436,7 @@ make_simple_with_interop_subs (boost::filesystem::path path) { auto dcp = make_simple (path, 1, 24, dcp::Standard::INTEROP); - auto subs = make_shared<dcp::InteropSubtitleAsset>(); + auto subs = make_shared<dcp::InteropTextAsset>(); subs->add (simple_subtitle()); boost::filesystem::create_directory (path / "subs"); @@ -457,7 +457,7 @@ make_simple_with_smpte_subs (boost::filesystem::path path) { auto dcp = make_simple (path, 1, 192); - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->set_language (dcp::LanguageTag("de-DE")); subs->set_start_time (dcp::Time()); subs->add (simple_subtitle()); @@ -478,7 +478,7 @@ make_simple_with_interop_ccaps (boost::filesystem::path path) { auto dcp = make_simple (path, 1, 24, dcp::Standard::INTEROP); - auto subs = make_shared<dcp::InteropSubtitleAsset>(); + auto subs = make_shared<dcp::InteropTextAsset>(); subs->add (simple_subtitle()); subs->write (path / "ccap.xml"); @@ -494,7 +494,7 @@ make_simple_with_smpte_ccaps (boost::filesystem::path path) { auto dcp = make_simple (path, 1, 192); - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->set_language (dcp::LanguageTag("de-DE")); subs->set_start_time (dcp::Time()); subs->add (simple_subtitle()); diff --git a/test/verify_test.cc b/test/verify_test.cc index 0b6ac4d5..81d31c72 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -36,7 +36,7 @@ #include "cpl.h" #include "dcp.h" #include "file.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "j2k_transcode.h" #include "mono_j2k_picture_asset.h" #include "mono_j2k_picture_asset_writer.h" @@ -49,7 +49,7 @@ #include "reel_sound_asset.h" #include "reel_stereo_picture_asset.h" #include "reel_smpte_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "stereo_j2k_picture_asset.h" #include "stream_operators.h" #include "test.h" @@ -323,7 +323,7 @@ replace(string suffix, boost::function<path (string)> file, string from, string static void -add_font(shared_ptr<dcp::SubtitleAsset> asset) +add_font(shared_ptr<dcp::TextAsset> asset) { dcp::ArrayData fake_font(1024); asset->add_font("font", fake_font); @@ -1177,7 +1177,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_interop_subtitles) path const dir("build/test/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 asset = make_shared<dcp::InteropTextAsset>(dir / "subs.xml"); 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); @@ -1203,7 +1203,7 @@ BOOST_AUTO_TEST_CASE(verify_catch_missing_font_file_with_interop_ccap) path const dir("build/test/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 asset = make_shared<dcp::InteropTextAsset>(dir / "ccap.xml"); 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); @@ -1231,7 +1231,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_interop_subtitles) path const dir("build/test/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 asset = make_shared<dcp::InteropTextAsset>(dir / "subs.xml"); 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); @@ -1272,7 +1272,7 @@ BOOST_AUTO_TEST_CASE(verify_interop_subtitle_asset_with_no_subtitles) path const dir("build/test/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 asset = make_shared<dcp::InteropTextAsset>(dir / "subs.xml"); 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); @@ -1302,7 +1302,7 @@ BOOST_AUTO_TEST_CASE(verify_interop_subtitle_asset_with_single_space_subtitle) path const dir("build/test/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 asset = make_shared<dcp::InteropTextAsset>(dir / "subs.xml"); 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); @@ -1329,7 +1329,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_smpte_subtitles) path const dir("build/test/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 asset = make_shared<dcp::SMPTETextAsset>(dir / "subs.mxf"); 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); @@ -1364,7 +1364,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_smpte_subtitles) prepare_directory (dir); /* 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 asset = make_shared<dcp::SMPTETextAsset>(dir / "subs.mxf"); 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); @@ -1409,7 +1409,7 @@ BOOST_AUTO_TEST_CASE (verify_empty_text_node_in_subtitles) path const dir("build/test/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 asset = make_shared<dcp::SMPTETextAsset>(dir / "subs.mxf"); 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); @@ -1451,7 +1451,7 @@ BOOST_AUTO_TEST_CASE (verify_empty_text_node_in_subtitles_with_child_nodes) path const dir("build/test/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 asset = make_shared<dcp::InteropTextAsset>(dir / "subs.xml"); 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); @@ -1478,7 +1478,7 @@ BOOST_AUTO_TEST_CASE (verify_empty_text_node_in_subtitles_with_empty_child_nodes path const dir("build/test/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 asset = make_shared<dcp::InteropTextAsset>(dir / "subs.xml"); 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); @@ -1548,7 +1548,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_cpl_metadata) prepare_directory (dir); copy_file ("test/data/subs.mxf", dir / "subs.mxf"); - auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf"); + auto asset = make_shared<dcp::SMPTETextAsset>(dir / "subs.mxf"); auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 16 * 24, 0); auto reel = make_shared<dcp::Reel>(); @@ -1683,7 +1683,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language1) path const dir("build/test/verify_invalid_language1"); prepare_directory (dir); copy_file ("test/data/subs.mxf", dir / "subs.mxf"); - auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf"); + auto asset = make_shared<dcp::SMPTETextAsset>(dir / "subs.mxf"); asset->_language = "wrong-andbad"; asset->write (dir / "subs.mxf"); auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, asset, dcp::Fraction(24, 1), 6046, 0); @@ -1719,7 +1719,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_language2) path const dir("build/test/verify_invalid_language2"); prepare_directory (dir); copy_file ("test/data/subs.mxf", dir / "subs.mxf"); - auto asset = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.mxf"); + auto asset = make_shared<dcp::SMPTETextAsset>(dir / "subs.mxf"); asset->_language = "wrong-andbad"; asset->write (dir / "subs.mxf"); auto reel_asset = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::CAPTION, asset, dcp::Fraction(24, 1), 6046, 0); @@ -2070,7 +2070,7 @@ BOOST_AUTO_TEST_CASE (verify_picture_size) static void -add_test_subtitle (shared_ptr<dcp::SubtitleAsset> asset, int start_frame, int end_frame, float v_position = 0, dcp::VAlign v_align = dcp::VAlign::CENTER, string text = "Hello") +add_test_subtitle (shared_ptr<dcp::TextAsset> asset, int start_frame, int end_frame, float v_position = 0, dcp::VAlign v_align = dcp::VAlign::CENTER, string text = "Hello") { asset->add ( std::make_shared<dcp::SubtitleString>( @@ -2106,7 +2106,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_xml_size_in_bytes) path const dir("build/test/verify_invalid_closed_caption_xml_size_in_bytes"); prepare_directory (dir); - auto asset = make_shared<dcp::SMPTESubtitleAsset>(); + auto asset = make_shared<dcp::SMPTETextAsset>(); for (int i = 0; i < 2048; ++i) { add_test_subtitle (asset, i * 24, i * 24 + 20); } @@ -2146,10 +2146,10 @@ BOOST_AUTO_TEST_CASE (verify_invalid_closed_caption_xml_size_in_bytes) static -shared_ptr<dcp::SMPTESubtitleAsset> +shared_ptr<dcp::SMPTETextAsset> make_large_subtitle_asset (path font_file) { - auto asset = make_shared<dcp::SMPTESubtitleAsset>(); + auto asset = make_shared<dcp::SMPTETextAsset>(); dcp::ArrayData big_fake_font(1024 * 1024); big_fake_font.write (font_file); for (int i = 0; i < 116; ++i) { @@ -2243,7 +2243,7 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_language) BOOST_REQUIRE (xml_file); xml_file.write(xml.c_str(), xml.size(), 1); xml_file.close(); - auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml"); + auto subs = make_shared<dcp::SMPTETextAsset>(dir / "subs.xml"); subs->write (dir / "subs.mxf"); auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 106, 0); @@ -2287,7 +2287,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages) auto cpl = dcp->cpls()[0]; { - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->set_language (dcp::LanguageTag("de-DE")); subs->add (simple_subtitle()); add_font(subs); @@ -2297,7 +2297,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_languages) } { - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->set_language (dcp::LanguageTag("en-US")); subs->add (simple_subtitle()); add_font(subs); @@ -2349,7 +2349,7 @@ BOOST_AUTO_TEST_CASE (verify_multiple_closed_caption_languages_allowed) auto cpl = dcp->cpls()[0]; { - auto ccaps = make_shared<dcp::SMPTESubtitleAsset>(); + auto ccaps = make_shared<dcp::SMPTETextAsset>(); ccaps->set_language (dcp::LanguageTag("de-DE")); ccaps->add (simple_subtitle()); add_font(ccaps); @@ -2359,7 +2359,7 @@ BOOST_AUTO_TEST_CASE (verify_multiple_closed_caption_languages_allowed) } { - auto ccaps = make_shared<dcp::SMPTESubtitleAsset>(); + auto ccaps = make_shared<dcp::SMPTETextAsset>(); ccaps->set_language (dcp::LanguageTag("en-US")); ccaps->add (simple_subtitle()); add_font(ccaps); @@ -2431,7 +2431,7 @@ BOOST_AUTO_TEST_CASE (verify_missing_subtitle_start_time) BOOST_REQUIRE (xml_file); xml_file.write(xml.c_str(), xml.size(), 1); xml_file.close(); - auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml"); + auto subs = make_shared<dcp::SMPTETextAsset>(dir / "subs.xml"); subs->write (dir / "subs.mxf"); auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 106, 0); @@ -2499,7 +2499,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_subtitle_start_time) BOOST_REQUIRE (xml_file); xml_file.write(xml.c_str(), xml.size(), 1); xml_file.close(); - auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml"); + auto subs = make_shared<dcp::SMPTETextAsset>(dir / "subs.xml"); subs->write (dir / "subs.mxf"); auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 106, 0); @@ -2559,7 +2559,7 @@ shared_ptr<dcp::CPL> 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>(); + auto asset = make_shared<dcp::SMPTETextAsset>(); asset->set_start_time (dcp::Time()); for (auto i: subs) { add_test_subtitle (asset, i.in, i.out, i.v_position, i.v_align, i.text); @@ -2582,7 +2582,7 @@ shared_ptr<dcp::CPL> 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); + auto asset = make_shared<dcp::SMPTETextAsset>(subs_xml); asset->set_start_time (dcp::Time()); asset->set_language (dcp::LanguageTag("de-DE")); @@ -2667,7 +2667,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel) auto const dir = path("build/test/verify_valid_subtitle_first_text_time_on_second_reel"); prepare_directory (dir); - auto asset1 = make_shared<dcp::SMPTESubtitleAsset>(); + auto asset1 = make_shared<dcp::SMPTETextAsset>(); asset1->set_start_time (dcp::Time()); /* Just late enough */ add_test_subtitle (asset1, 4 * 24, 5 * 24); @@ -2681,7 +2681,7 @@ BOOST_AUTO_TEST_CASE (verify_valid_subtitle_first_text_time_on_second_reel) markers1->set (dcp::Marker::FFOC, dcp::Time(1, 24, 24)); reel1->add (markers1); - auto asset2 = make_shared<dcp::SMPTESubtitleAsset>(); + auto asset2 = make_shared<dcp::SMPTETextAsset>(); asset2->set_start_time (dcp::Time()); add_font(asset2); /* This would be too early on first reel but should be OK on the second */ @@ -2828,7 +2828,7 @@ BOOST_AUTO_TEST_CASE (verify_subtitle_overlapping_reel_boundary) { auto const dir = path("build/test/verify_subtitle_overlapping_reel_boundary"); prepare_directory (dir); - auto asset = make_shared<dcp::SMPTESubtitleAsset>(); + auto asset = make_shared<dcp::SMPTETextAsset>(); asset->set_start_time (dcp::Time()); add_test_subtitle (asset, 0, 4 * 24); add_font(asset); @@ -3572,7 +3572,7 @@ verify_subtitles_must_be_in_all_reels_check (path dir, bool add_to_reel1, bool a auto constexpr reel_length = 192; - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->set_language (dcp::LanguageTag("de-DE")); subs->set_start_time (dcp::Time()); subs->add (simple_subtitle()); @@ -3705,7 +3705,7 @@ verify_closed_captions_must_be_in_all_reels_check (path dir, int caps_in_reel1, auto constexpr reel_length = 192; - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->set_language (dcp::LanguageTag("de-DE")); subs->set_start_time (dcp::Time()); subs->add (simple_subtitle()); @@ -3836,7 +3836,7 @@ verify_text_entry_point_check(dcp::TextType type, path dir, dcp::VerificationNot auto constexpr reel_length = 192; - auto subs = make_shared<dcp::SMPTESubtitleAsset>(); + auto subs = make_shared<dcp::SMPTETextAsset>(); subs->set_language (dcp::LanguageTag("de-DE")); subs->set_start_time (dcp::Time()); subs->add (simple_subtitle()); @@ -4842,7 +4842,7 @@ BOOST_AUTO_TEST_CASE (verify_mismatched_subtitle_resource_id) writer.Finalize(); - auto subs_asset = make_shared<dcp::SMPTESubtitleAsset>(subs_mxf); + auto subs_asset = make_shared<dcp::SMPTETextAsset>(subs_mxf); 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); @@ -4922,7 +4922,7 @@ BOOST_AUTO_TEST_CASE (verify_incorrect_timed_text_id) writer.Finalize(); - auto subs_asset = make_shared<dcp::SMPTESubtitleAsset>(subs_mxf); + auto subs_asset = make_shared<dcp::SMPTETextAsset>(subs_mxf); 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); @@ -5602,7 +5602,7 @@ BOOST_AUTO_TEST_CASE(verify_missing_load_font_for_font) Editor editor(dir / "subs.xml"); editor.delete_first_line_containing("LoadFont"); } - auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "subs.xml"); + auto asset = make_shared<dcp::InteropTextAsset>(dir / "subs.xml"); 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); @@ -5653,7 +5653,7 @@ BOOST_AUTO_TEST_CASE(verify_missing_load_font) BOOST_REQUIRE(xml_file); xml_file.write(xml.c_str(), xml.size(), 1); xml_file.close(); - auto subs = make_shared<dcp::SMPTESubtitleAsset>(dir / "subs.xml"); + auto subs = make_shared<dcp::SMPTETextAsset>(dir / "subs.xml"); subs->write(dir / "subs.mxf"); auto reel_subs = make_shared<dcp::ReelSMPTETextAsset>(dcp::TextType::SUBTITLE, subs, dcp::Fraction(24, 1), 202, 0); @@ -5842,7 +5842,7 @@ BOOST_AUTO_TEST_CASE(verify_invalid_sound_bit_depth) BOOST_AUTO_TEST_CASE(overlapping_subtitles) { - auto asset = make_shared<dcp::InteropSubtitleAsset>(); + auto asset = make_shared<dcp::InteropTextAsset>(); asset->add(std::make_shared<dcp::SubtitleString>( optional<string>{}, false, false, false, diff --git a/tools/dcpdumpsub.cc b/tools/dcpdumpsub.cc index fa7a170c..da40b386 100644 --- a/tools/dcpdumpsub.cc +++ b/tools/dcpdumpsub.cc @@ -36,7 +36,7 @@ #include "decrypted_kdm_key.h" #include "encrypted_kdm.h" #include "file.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "util.h" #include <getopt.h> #include <cstdlib> @@ -107,7 +107,7 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - dcp::SMPTESubtitleAsset sub (argv[optind]); + dcp::SMPTETextAsset sub(argv[optind]); if (sub.key_id() && (!kdm_file || !private_key_file)) { cerr << "Subtitle MXF is encrypted so you must provide a KDM and private key.\n"; diff --git a/tools/dcpinfo.cc b/tools/dcpinfo.cc index 7cbdf140..4a790561 100644 --- a/tools/dcpinfo.cc +++ b/tools/dcpinfo.cc @@ -40,16 +40,16 @@ #include "encrypted_kdm.h" #include "exceptions.h" #include "filesystem.h" -#include "interop_subtitle_asset.h" +#include "interop_text_asset.h" #include "mono_j2k_picture_asset.h" #include "j2k_picture_asset.h" #include "reel.h" #include "reel_picture_asset.h" #include "reel_sound_asset.h" #include "reel_text_asset.h" -#include "smpte_subtitle_asset.h" +#include "smpte_text_asset.h" #include "sound_asset.h" -#include "subtitle_asset.h" +#include "text_asset.h" #include "subtitle_image.h" #include "subtitle_string.h" #include <getopt.h> @@ -253,11 +253,11 @@ main_subtitle (vector<string> const& only, shared_ptr<Reel> reel, bool list_subt if (ms->asset_ref().resolved()) { auto subs = ms->asset()->subtitles (); OUTPUT_SUBTITLE("\n Subtitle: %1 subtitles", subs.size()); - shared_ptr<InteropSubtitleAsset> iop = dynamic_pointer_cast<InteropSubtitleAsset> (ms->asset()); + auto iop = dynamic_pointer_cast<InteropTextAsset>(ms->asset()); if (iop) { OUTPUT_SUBTITLE(" in %1\n", iop->language()); } - shared_ptr<SMPTESubtitleAsset> smpte = dynamic_pointer_cast<SMPTESubtitleAsset> (ms->asset()); + auto smpte = dynamic_pointer_cast<SMPTETextAsset>(ms->asset()); if (smpte && smpte->language ()) { OUTPUT_SUBTITLE(" in %1\n", smpte->language().get()); } |
