From: Carl Hetherington Date: Tue, 5 Dec 2023 00:59:44 +0000 (+0100) Subject: Account for split branch in libdcp. X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fsplit;p=dcpomatic.git Account for split branch in libdcp. --- diff --git a/src/lib/analyse_subtitles_job.cc b/src/lib/analyse_subtitles_job.cc index b41990db5..ffc6b3fe2 100644 --- a/src/lib/analyse_subtitles_job.cc +++ b/src/lib/analyse_subtitles_job.cc @@ -115,20 +115,20 @@ AnalyseSubtitlesJob::analyse(PlayerText const& text, TextType type) /* We can provide dummy values for time and frame rate here as they are only used to calculate fades */ dcp::Size const frame = _film->frame_size(); - std::vector override_standard; + std::vector override_standard; if (_film->interop()) { /* Since the film is Interop there is only one way the vpositions in the subs can be interpreted * (we assume). */ - override_standard.push_back(dcp::SubtitleStandard::INTEROP); + override_standard.push_back(dcp::TextStandard::INTEROP); } else { /* We're using the great new SMPTE standard, which means there are two different ways that vposition * could be interpreted; we will write SMPTE-2014 standard assets, but if the projection system uses * SMPTE 20{07,10} instead they won't be placed how we intended. To show the user this, make the * bounding rectangle enclose both possibilities. */ - override_standard.push_back(dcp::SubtitleStandard::SMPTE_2007); - override_standard.push_back(dcp::SubtitleStandard::SMPTE_2014); + override_standard.push_back(dcp::TextStandard::SMPTE_2007); + override_standard.push_back(dcp::TextStandard::SMPTE_2014); } for (auto standard: override_standard) { diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index dfa1ba55e..bac41f940 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -41,7 +41,7 @@ #include "compose.hpp" #include #include -#include +#include #include #include "i18n.h" @@ -178,7 +178,7 @@ content_factory (boost::filesystem::path path) throw KDMAsContentError (); } single = make_shared(path); - } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf(path)) { + } else if (ext == ".mxf" && dcp::SMPTETextAsset::valid_mxf(path)) { single = make_shared(path); } else if (ext == ".mxf" && VideoMXFContent::valid_mxf(path)) { single = make_shared(path); diff --git a/src/lib/content_text.h b/src/lib/content_text.h index 51d4e8009..4b59ac65f 100644 --- a/src/lib/content_text.h +++ b/src/lib/content_text.h @@ -27,7 +27,7 @@ #include "dcpomatic_time.h" #include "rect.h" #include "string_text.h" -#include +#include #include diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 3a1871863..9e8959d71 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -281,7 +281,7 @@ DCPDecoder::pass_texts (ContentTime next, dcp::Size size) void DCPDecoder::pass_texts ( - ContentTime next, shared_ptr asset, bool reference, int64_t entry_point, shared_ptr decoder, dcp::Size size + ContentTime next, shared_ptr asset, bool reference, int64_t entry_point, shared_ptr decoder, dcp::Size size ) { auto const vfr = _dcp_content->active_video_frame_rate (film()); @@ -289,16 +289,16 @@ DCPDecoder::pass_texts ( auto const frame = next.frames_round (vfr); if (_decode_referenced || !reference) { - auto subs = asset->subtitles_during ( + auto subs = asset->texts_during( dcp::Time (entry_point + frame, vfr, vfr), dcp::Time (entry_point + frame + 1, vfr, vfr), true ); - vector strings; + vector strings; for (auto i: subs) { - auto is = dynamic_pointer_cast(i); + auto is = dynamic_pointer_cast(i); if (is) { if (!strings.empty() && (strings.back().in() != is->in() || strings.back().out() != is->out())) { auto b = strings.back(); @@ -308,12 +308,12 @@ DCPDecoder::pass_texts ( ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds()) ), strings, - asset->subtitle_standard() + asset->text_standard() ); strings.clear (); } - dcp::SubtitleString is_copy = *is; + dcp::TextString is_copy = *is; is_copy.set_font(_font_id_allocator.font_id(_reel - _reels.begin(), asset->id(), is_copy.font().get_value_or(""))); strings.push_back(is_copy); } @@ -344,7 +344,7 @@ DCPDecoder::pass_texts ( ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds()) ), strings, - asset->subtitle_standard() + asset->text_standard() ); strings.clear (); } diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h index 2c0cd8f41..b68eae80e 100644 --- a/src/lib/dcp_decoder.h +++ b/src/lib/dcp_decoder.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include namespace dcp { @@ -77,7 +77,7 @@ private: void pass_texts (dcpomatic::ContentTime next, dcp::Size size); void pass_texts ( dcpomatic::ContentTime next, - std::shared_ptr asset, + std::shared_ptr asset, bool reference, int64_t entry_point, std::shared_ptr decoder, diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index ca77f2db3..f7ef559ef 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include "i18n.h" @@ -326,7 +326,7 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) LOG_GENERAL_NC ("Subtitle has no key"); break; } - sub->subtitles (); + sub->texts(); } if (i->atmos()) { diff --git a/src/lib/dcp_subtitle.cc b/src/lib/dcp_subtitle.cc index c2c3f7f70..c2d390b55 100644 --- a/src/lib/dcp_subtitle.cc +++ b/src/lib/dcp_subtitle.cc @@ -22,8 +22,8 @@ #include "dcp_subtitle.h" #include "exceptions.h" #include "compose.hpp" -#include -#include +#include +#include #include #include "i18n.h" @@ -35,22 +35,22 @@ using std::string; using std::make_shared; -shared_ptr +shared_ptr DCPSubtitle::load (boost::filesystem::path file) const { - shared_ptr sc; + shared_ptr sc; string interop_error; string smpte_error; try { - sc = make_shared(file); + sc = make_shared(file); } catch (exception& e) { interop_error = e.what (); } if (!sc) { try { - sc = make_shared(file); + sc = make_shared(file); } catch (exception& e) { smpte_error = e.what(); } diff --git a/src/lib/dcp_subtitle.h b/src/lib/dcp_subtitle.h index 285dd55bc..0f7928103 100644 --- a/src/lib/dcp_subtitle.h +++ b/src/lib/dcp_subtitle.h @@ -28,14 +28,14 @@ namespace dcp { - class SubtitleAsset; + class TextAsset; } class DCPSubtitle { protected: - std::shared_ptr load (boost::filesystem::path) const; + std::shared_ptr load(boost::filesystem::path) const; }; diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index b3e24d5e2..5458f1391 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -23,8 +23,8 @@ #include "film.h" #include "text_content.h" #include -#include -#include +#include +#include #include #include @@ -59,8 +59,8 @@ DCPSubtitleContent::examine (shared_ptr film, shared_ptr job) auto subtitle_asset = load(path(0)); - auto iop = dynamic_pointer_cast(subtitle_asset); - auto smpte = dynamic_pointer_cast(subtitle_asset); + auto iop = dynamic_pointer_cast(subtitle_asset); + auto smpte = dynamic_pointer_cast(subtitle_asset); if (smpte) { set_video_frame_rate(film, smpte->edit_rate().numerator); } @@ -70,7 +70,7 @@ DCPSubtitleContent::examine (shared_ptr film, shared_ptr job) /* Default to turning these subtitles on */ only_text()->set_use (true); - _length = ContentTime::from_seconds(subtitle_asset->latest_subtitle_out().as_seconds()); + _length = ContentTime::from_seconds(subtitle_asset->latest_text_out().as_seconds()); subtitle_asset->fix_empty_font_ids(); diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index b3e6d7553..04dfddd12 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -25,7 +25,7 @@ #include "font.h" #include "text_content.h" #include "util.h" -#include +#include #include @@ -45,10 +45,10 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr film, shared_ptr< /* Load the XML or MXF file */ auto const asset = load (content->path(0)); asset->fix_empty_font_ids (); - _subtitles = asset->subtitles (); + _subtitles = asset->texts(); _next = _subtitles.begin (); - _subtitle_standard = asset->subtitle_standard(); + _subtitle_standard = asset->text_standard(); text.push_back (make_shared(this, content->only_text())); update_position(); @@ -84,12 +84,12 @@ DCPSubtitleDecoder::pass () time of emitting the first. */ - vector s; + vector s; vector i; auto const p = content_time_period (*_next); while (_next != _subtitles.end () && content_time_period (*_next) == p) { - auto ns = dynamic_pointer_cast(*_next); + auto ns = dynamic_pointer_cast(*_next); if (ns) { s.push_back (*ns); ++_next; @@ -115,7 +115,7 @@ DCPSubtitleDecoder::pass () ContentTimePeriod -DCPSubtitleDecoder::content_time_period (shared_ptr s) const +DCPSubtitleDecoder::content_time_period(shared_ptr s) const { return { ContentTime::from_seconds(s->in().as_seconds()), diff --git a/src/lib/dcp_subtitle_decoder.h b/src/lib/dcp_subtitle_decoder.h index 45a4999dd..cb5952d5d 100644 --- a/src/lib/dcp_subtitle_decoder.h +++ b/src/lib/dcp_subtitle_decoder.h @@ -37,11 +37,11 @@ public: boost::optional first () const; private: - dcpomatic::ContentTimePeriod content_time_period (std::shared_ptr s) const; + dcpomatic::ContentTimePeriod content_time_period(std::shared_ptr s) const; void update_position(); - std::vector> _subtitles; - std::vector>::const_iterator _next; + std::vector> _subtitles; + std::vector>::const_iterator _next; - dcp::SubtitleStandard _subtitle_standard; + dcp::TextStandard _subtitle_standard; }; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 6e9d671a2..1da2998ef 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -45,7 +45,7 @@ #include "util.h" #include "video_decoder.h" #include "video_filter_graph.h" -#include +#include #include #include #include diff --git a/src/lib/font_id_allocator.cc b/src/lib/font_id_allocator.cc index 70eda2b06..529361e41 100644 --- a/src/lib/font_id_allocator.cc +++ b/src/lib/font_id_allocator.cc @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -57,7 +57,7 @@ FontIDAllocator::add_fonts_from_reels(vector> const& reels void -FontIDAllocator::add_fonts_from_asset(int reel_index, shared_ptr asset) +FontIDAllocator::add_fonts_from_asset(int reel_index, shared_ptr asset) { for (auto const& font: asset->font_data()) { _map[Font(reel_index, asset->id(), font.first)] = 0; diff --git a/src/lib/font_id_allocator.h b/src/lib/font_id_allocator.h index bd99cad63..edec394ae 100644 --- a/src/lib/font_id_allocator.h +++ b/src/lib/font_id_allocator.h @@ -31,7 +31,7 @@ namespace dcp { class Reel; - class SubtitleAsset; + class TextAsset; } @@ -68,7 +68,7 @@ public: std::string font_id(int reel_index, std::string asset_id, std::string font_id) const; private: - void add_fonts_from_asset(int reel_index, std::shared_ptr asset); + void add_fonts_from_asset(int reel_index, std::shared_ptr asset); struct Font { diff --git a/src/lib/hints.cc b/src/lib/hints.cc index b4d94dbcc..0d4546c13 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -351,7 +351,7 @@ Hints::check_loudness () static bool -subtitle_mxf_too_big (shared_ptr asset) +subtitle_mxf_too_big(shared_ptr asset) { return asset && asset->file() && dcp::filesystem::file_size(*asset->file()) >= (MAX_TEXT_MXF_SIZE - SIZE_SLACK); } diff --git a/src/lib/map_cli.cc b/src/lib/map_cli.cc index e38af69cf..7a8827881 100644 --- a/src/lib/map_cli.cc +++ b/src/lib/map_cli.cc @@ -24,7 +24,7 @@ #include "util.h" #include #include -#include +#include #include #include #include @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -277,15 +277,15 @@ map_cli(int argc, char* argv[], std::function out) } }; - auto maybe_copy_font_and_images = [&maybe_copy, output_dir, copy](shared_ptr asset, bool rename, bool hard_link, bool soft_link) { - auto interop = dynamic_pointer_cast(asset); + auto maybe_copy_font_and_images = [&maybe_copy, output_dir, copy](shared_ptr asset, bool rename, bool hard_link, bool soft_link) { + auto interop = dynamic_pointer_cast(asset); boost::optional extra; if (interop) { extra = interop->id(); for (auto font_asset: interop->font_assets()) { maybe_copy(font_asset->id(), rename, hard_link, soft_link, extra); } - for (auto subtitle: interop->subtitles()) { + for (auto subtitle: interop->texts()) { if (auto image = dynamic_pointer_cast(subtitle)) { auto const output_path = *output_dir / asset->id() / image->file()->filename(); copy(*image->file(), output_path, hard_link, soft_link); diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 1b33cae85..8d30c1668 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include #include @@ -465,7 +465,7 @@ ReelWriter::finish (boost::filesystem::path output_dcp) template shared_ptr maybe_add_text ( - shared_ptr asset, + shared_ptr asset, int64_t picture_duration, shared_ptr reel, int reel_index, @@ -483,7 +483,7 @@ maybe_add_text ( shared_ptr reel_asset; if (asset) { - if (auto interop = dynamic_pointer_cast(asset)) { + if (auto interop = dynamic_pointer_cast(asset)) { auto directory = output_dcp / interop->id (); dcp::filesystem::create_directories(directory); interop->write (directory / subtitle_asset_filename(asset, reel_index, reel_count, content_summary, ".xml")); @@ -493,7 +493,7 @@ maybe_add_text ( picture_duration, 0 ); - } else if (auto smpte = dynamic_pointer_cast(asset)) { + } else if (auto smpte = dynamic_pointer_cast(asset)) { /* All our assets should be the same length; use the picture asset length here as a reference to set the subtitle one. We'll use the duration rather than the intrinsic duration; we don't care if the picture asset has been trimmed, we're @@ -832,15 +832,15 @@ ReelWriter::write (shared_ptr audio) } -shared_ptr +shared_ptr ReelWriter::empty_text_asset (TextType type, optional track, bool with_dummy) const { - shared_ptr asset; + shared_ptr asset; optional font; auto lang = film()->subtitle_languages(); if (film()->interop()) { - auto s = make_shared(); + auto s = make_shared(); s->set_movie_title (film()->name()); if (type == TextType::OPEN_SUBTITLE) { s->set_language (lang.first ? lang.first->to_string() : "Unknown"); @@ -850,7 +850,7 @@ ReelWriter::empty_text_asset (TextType type, optional track, bool s->set_reel_number (raw_convert (_reel_index + 1)); asset = s; } else { - auto s = make_shared(); + auto s = make_shared(); s->set_content_title_text (film()->name()); s->set_metadata (mxf_metadata()); if (type == TextType::OPEN_SUBTITLE && lang.first) { @@ -870,7 +870,7 @@ ReelWriter::empty_text_asset (TextType type, optional track, bool if (with_dummy) { asset->add( - std::make_shared( + std::make_shared( font, false, false, @@ -908,7 +908,7 @@ ReelWriter::empty_text_asset (TextType type, optional track, bool float -ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::SubtitleStandard to) const +ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::TextStandard to) const { if (dcp::uses_baseline(subtitle.valign_standard) == dcp::uses_baseline(to)) { /* The from and to standards use the same alignment reference */ @@ -938,7 +938,7 @@ ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::SubtitleS void ReelWriter::write(PlayerText subs, TextType type, optional track, DCPTimePeriod period, FontIdMap const& fonts, shared_ptr chosen_interop_font) { - shared_ptr asset; + shared_ptr asset; switch (type) { case TextType::OPEN_SUBTITLE: @@ -974,8 +974,8 @@ ReelWriter::write(PlayerText subs, TextType type, optional track, for (auto i: subs.string) { i.set_in (dcp::Time(period.from.seconds() - _period.from.seconds(), tcr)); i.set_out (dcp::Time(period.to.seconds() - _period.from.seconds(), tcr)); - i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::SubtitleStandard::INTEROP : dcp::SubtitleStandard::SMPTE_2014)); - auto sub = make_shared(i); + i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::TextStandard::INTEROP : dcp::TextStandard::SMPTE_2014)); + auto sub = make_shared(i); /* i.font is a shared_ptr which uniquely identifies the font we want, * though if we are Interop we can only have one font, so we'll use the chosen * one instead. diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h index c9052c832..783981b5d 100644 --- a/src/lib/reel_writer.h +++ b/src/lib/reel_writer.h @@ -52,7 +52,7 @@ namespace dcp { class SoundAssetWriter; class StereoPictureAsset; class StereoPictureAssetWriter; - class SubtitleAsset; + class TextAsset; } @@ -104,7 +104,7 @@ private: long frame_info_position (Frame frame, Eyes eyes) const; Frame check_existing_picture_asset (boost::filesystem::path asset); bool existing_picture_frame_ok (dcp::File& asset_file, std::shared_ptr info_file, Frame frame) const; - std::shared_ptr empty_text_asset (TextType type, boost::optional track, bool with_dummy) const; + std::shared_ptr empty_text_asset(TextType type, boost::optional track, bool with_dummy) const; std::shared_ptr create_reel_picture (std::shared_ptr reel, std::list const & refs) const; void create_reel_sound (std::shared_ptr reel, std::list const & refs) const; @@ -117,7 +117,7 @@ private: std::set ensure_closed_captions ) const; void create_reel_markers (std::shared_ptr reel) const; - float convert_vertical_position(StringText const& subtitle, dcp::SubtitleStandard to) const; + float convert_vertical_position(StringText const& subtitle, dcp::TextStandard to) const; dcpomatic::DCPTimePeriod _period; /** the first picture frame index that does not already exist in our MXF */ @@ -139,8 +139,8 @@ private: std::shared_ptr _picture_asset_writer; std::shared_ptr _sound_asset; std::shared_ptr _sound_asset_writer; - std::shared_ptr _subtitle_asset; - std::map> _closed_caption_assets; + std::shared_ptr _subtitle_asset; + std::map> _closed_caption_assets; std::shared_ptr _atmos_asset; std::shared_ptr _atmos_asset_writer; diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index 870f3045d..6aed15181 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -242,12 +242,12 @@ x_position(dcp::HAlign align, float position, int target_width, int layout_width * @return y position of the top of the subtitle bounding box (in pixels) from the top of the screen. */ static int -y_position(dcp::SubtitleStandard standard, dcp::VAlign align, float position, int target_height, int baseline_to_bottom, int layout_height) +y_position(dcp::TextStandard standard, dcp::VAlign align, float position, int target_height, int baseline_to_bottom, int layout_height) { int y = 0; switch (standard) { - case dcp::SubtitleStandard::INTEROP: - case dcp::SubtitleStandard::SMPTE_2014: + case dcp::TextStandard::INTEROP: + case dcp::TextStandard::SMPTE_2014: switch (align) { case dcp::VAlign::TOP: /* position is distance from top of frame to subtitle baseline */ @@ -263,8 +263,8 @@ y_position(dcp::SubtitleStandard standard, dcp::VAlign align, float position, in break; } break; - case dcp::SubtitleStandard::SMPTE_2007: - case dcp::SubtitleStandard::SMPTE_2010: + case dcp::TextStandard::SMPTE_2007: + case dcp::TextStandard::SMPTE_2010: switch (align) { case dcp::VAlign::TOP: /* v_position is distance from top of frame to top of subtitle */ @@ -452,7 +452,7 @@ render_text(vector subtitles, dcp::Size target, DCPTime time, int fr vector> -bounding_box(vector subtitles, dcp::Size target, optional override_standard) +bounding_box(vector subtitles, dcp::Size target, optional override_standard) { vector pending; vector> rects; diff --git a/src/lib/render_text.h b/src/lib/render_text.h index ff34dc10d..18264e0d0 100644 --- a/src/lib/render_text.h +++ b/src/lib/render_text.h @@ -34,7 +34,7 @@ namespace dcpomatic { std::string marked_up(std::vector subtitles, int target_height, float fade_factor, std::string font_name); std::vector render_text(std::vector, dcp::Size, dcpomatic::DCPTime, int); -std::vector> bounding_box(std::vector subtitles, dcp::Size target, boost::optional override_standard = boost::none); +std::vector> bounding_box(std::vector subtitles, dcp::Size target, boost::optional override_standard = boost::none); class FontMetrics diff --git a/src/lib/string_text.h b/src/lib/string_text.h index 787231b8c..827b426cc 100644 --- a/src/lib/string_text.h +++ b/src/lib/string_text.h @@ -24,8 +24,8 @@ #include "font.h" -#include -#include +#include +#include /** A wrapper for SubtitleString which allows us to: @@ -36,13 +36,13 @@ * - include details of how v_align should be interpreted * * - specify the font by referring to a Font object from the content we came from, rather than - * having to use a DCP ID like in dcp::SubtitleString. + * having to use a DCP ID like in dcp::TextString. */ -class StringText : public dcp::SubtitleString +class StringText : public dcp::TextString { public: - StringText(dcp::SubtitleString dcp_, int outline_width_, std::shared_ptr font_, dcp::SubtitleStandard valign_standard_) - : dcp::SubtitleString (dcp_) + StringText(dcp::TextString dcp_, int outline_width_, std::shared_ptr font_, dcp::TextStandard valign_standard_) + : dcp::TextString(dcp_) , outline_width (outline_width_) , font (font_) , valign_standard (valign_standard_) @@ -67,7 +67,7 @@ public: * center - centre of screen to baseline of subtitle * bottom - bottom of screen to baseline of subtitle */ - dcp::SubtitleStandard valign_standard; + dcp::TextStandard valign_standard; }; diff --git a/src/lib/string_text_file_decoder.cc b/src/lib/string_text_file_decoder.cc index 2ec0ec1cb..5b6e343b8 100644 --- a/src/lib/string_text_file_decoder.cc +++ b/src/lib/string_text_file_decoder.cc @@ -23,7 +23,7 @@ #include "string_text_file_content.h" #include "text_content.h" #include "text_decoder.h" -#include +#include #include diff --git a/src/lib/subtitle_encoder.cc b/src/lib/subtitle_encoder.cc index 8b1d9a15b..89e521588 100644 --- a/src/lib/subtitle_encoder.cc +++ b/src/lib/subtitle_encoder.cc @@ -25,9 +25,9 @@ #include "player.h" #include "subtitle_encoder.h" #include -#include +#include #include -#include +#include #include #include @@ -79,7 +79,7 @@ SubtitleEncoder::SubtitleEncoder (shared_ptr film, shared_ptr j } } - _assets.push_back(make_pair(shared_ptr(), dcp::filesystem::change_extension(filename, extension))); + _assets.push_back(make_pair(shared_ptr(), dcp::filesystem::change_extension(filename, extension))); } for (auto i: film->reels()) { @@ -108,12 +108,12 @@ SubtitleEncoder::go () if (!i.first) { /* No subtitles arrived for this asset; make an empty one so we write something to the output */ if (_film->interop()) { - auto s = make_shared(); + auto s = make_shared(); s->set_movie_title (_film->name()); s->set_reel_number (raw_convert(reel + 1)); i.first = s; } else { - auto s = make_shared(); + auto s = make_shared(); s->set_content_title_text (_film->name()); s->set_reel_number (reel + 1); i.first = s; @@ -140,10 +140,10 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional tr } if (!_assets[_reel_index].first) { - shared_ptr asset; + shared_ptr asset; auto lang = _film->subtitle_languages (); if (_film->interop ()) { - auto s = make_shared(); + auto s = make_shared(); s->set_movie_title (_film->name()); if (lang.first) { s->set_language (lang.first->to_string()); @@ -151,7 +151,7 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional tr s->set_reel_number (raw_convert(_reel_index + 1)); _assets[_reel_index].first = s; } else { - auto s = make_shared(); + auto s = make_shared(); s->set_content_title_text (_film->name()); if (lang.first) { s->set_language (*lang.first); @@ -176,7 +176,7 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional tr if (_film->interop() && !_include_font) { i.unset_font (); } - _assets[_reel_index].first->add (make_shared(i)); + _assets[_reel_index].first->add(make_shared(i)); } if (_split_reels && (_reel_index < int(_reels.size()) - 1) && period.from > _reels[_reel_index].from) { diff --git a/src/lib/subtitle_encoder.h b/src/lib/subtitle_encoder.h index 0815b1fff..3fc7445b9 100644 --- a/src/lib/subtitle_encoder.h +++ b/src/lib/subtitle_encoder.h @@ -26,7 +26,7 @@ namespace dcp { - class SubtitleAsset; + class TextAsset; } @@ -53,7 +53,7 @@ public: private: void text (PlayerText subs, TextType type, boost::optional track, dcpomatic::DCPTimePeriod period); - std::vector, boost::filesystem::path>> _assets; + std::vector, boost::filesystem::path>> _assets; std::vector _reels; bool _split_reels; bool _include_font; diff --git a/src/lib/text_decoder.cc b/src/lib/text_decoder.cc index 75fa33605..847f297ba 100644 --- a/src/lib/text_decoder.cc +++ b/src/lib/text_decoder.cc @@ -127,7 +127,7 @@ TextDecoder::remove_invalid_characters_for_xml(string text) void -TextDecoder::emit_plain_start(ContentTime from, vector subtitles, dcp::SubtitleStandard valign_standard) +TextDecoder::emit_plain_start(ContentTime from, vector subtitles, dcp::TextStandard valign_standard) { vector string_texts; @@ -273,7 +273,7 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & sub_subti return dcp::Colour(lrintf(c.r * 255), lrintf(c.g * 255), lrintf(c.b * 255)); }; - auto dcp_subtitle = dcp::SubtitleString( + auto dcp_subtitle = dcp::TextString( optional(), block.italic, block.bold, @@ -312,7 +312,7 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & sub_subti dcp_subtitle, content()->outline_width(), font, - dcp::SubtitleStandard::SMPTE_2014 + dcp::TextStandard::SMPTE_2014 ); set_forced_appearance(content(), string_text); string_texts.push_back(string_text); @@ -332,7 +332,7 @@ TextDecoder::emit_stop (ContentTime to) void -TextDecoder::emit_plain(ContentTimePeriod period, vector subtitles, dcp::SubtitleStandard valign_standard) +TextDecoder::emit_plain(ContentTimePeriod period, vector subtitles, dcp::TextStandard valign_standard) { emit_plain_start (period.from, subtitles, valign_standard); emit_stop (period.to); diff --git a/src/lib/text_decoder.h b/src/lib/text_decoder.h index 1a7632fd8..91f452b60 100644 --- a/src/lib/text_decoder.h +++ b/src/lib/text_decoder.h @@ -29,8 +29,8 @@ #include "rect.h" #include "content_text.h" #include "types.h" -#include -#include +#include +#include #include @@ -52,9 +52,9 @@ public: void emit_bitmap_start (ContentBitmapText const& bitmap); void emit_bitmap (dcpomatic::ContentTimePeriod period, std::shared_ptr image, dcpomatic::Rect rect); - void emit_plain_start(dcpomatic::ContentTime from, std::vector s, dcp::SubtitleStandard valign_standard); + void emit_plain_start(dcpomatic::ContentTime from, std::vector s, dcp::TextStandard valign_standard); void emit_plain_start (dcpomatic::ContentTime from, sub::Subtitle const & subtitle); - void emit_plain(dcpomatic::ContentTimePeriod period, std::vector s, dcp::SubtitleStandard valign_standard); + void emit_plain(dcpomatic::ContentTimePeriod period, std::vector s, dcp::TextStandard valign_standard); void emit_plain (dcpomatic::ContentTimePeriod period, sub::Subtitle const & subtitle); void emit_stop (dcpomatic::ContentTime to); diff --git a/src/lib/util.cc b/src/lib/util.cc index d23989afa..9884df730 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include LIBDCP_DISABLE_WARNINGS @@ -468,7 +468,7 @@ LIBDCP_ENABLE_WARNINGS #if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX) /* Render something to fontconfig to create its cache */ vector subs; - dcp::SubtitleString ss( + dcp::TextString ss( optional(), false, false, false, dcp::Colour(), 42, 1, dcp::Time(), dcp::Time(), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, 0, dcp::Direction::LTR, "Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0, std::vector() ); @@ -754,7 +754,7 @@ audio_asset_filename (shared_ptr asset, int reel_index, int ree string -subtitle_asset_filename (shared_ptr asset, int reel_index, int reel_count, optional summary, string extension) +subtitle_asset_filename(shared_ptr asset, int reel_index, int reel_count, optional summary, string extension) { return asset_filename(asset, "sub", reel_index, reel_count, summary, extension); } diff --git a/src/lib/util.h b/src/lib/util.h index b92869b25..f4bf51e8e 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -49,7 +49,7 @@ namespace dcp { class PictureAsset; class SoundAsset; - class SubtitleAsset; + class TextAsset; } extern std::string program_name; @@ -81,7 +81,7 @@ extern dcp::Size fit_ratio_within (float ratio, dcp::Size); extern void set_backtrace_file (boost::filesystem::path); extern std::string video_asset_filename (std::shared_ptr asset, int reel_index, int reel_count, boost::optional content_summary); extern std::string audio_asset_filename (std::shared_ptr asset, int reel_index, int reel_count, boost::optional content_summary); -extern std::string subtitle_asset_filename (std::shared_ptr asset, int reel_index, int reel_count, boost::optional content_summary, std::string extension); +extern std::string subtitle_asset_filename(std::shared_ptr asset, int reel_index, int reel_count, boost::optional content_summary, std::string extension); extern std::string atmos_asset_filename (std::shared_ptr asset, int reel_index, int reel_count, boost::optional content_summary); extern std::string careful_string_filter (std::string); extern std::pair audio_channel_types (std::list mapped, int channels); diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index 9b7b77279..fc7aee984 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -39,7 +39,7 @@ #include "test.h" #include #include -#include +#include #include #include @@ -292,12 +292,12 @@ BOOST_AUTO_TEST_CASE(entity_from_dcp_source) dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING, }); - dcp::SMPTESubtitleAsset check(dcp_file(film, "sub_")); - auto subs = check.subtitles(); + dcp::SMPTETextAsset check(dcp_file(film, "sub_")); + auto subs = check.texts(); BOOST_REQUIRE_EQUAL(subs.size(), 1U); - auto sub = std::dynamic_pointer_cast(subs[0]); + auto sub = std::dynamic_pointer_cast(subs[0]); BOOST_REQUIRE(sub); - /* libdcp::SubtitleAsset gets the text from the XML with get_content(), which + /* dcp::TextAsset gets the text from the XML with get_content(), which * resolves the 5 predefined entities & " < > ' so we shouldn't see any * entity here. */ diff --git a/test/render_subtitles_test.cc b/test/render_subtitles_test.cc index e3034def0..dec686a21 100644 --- a/test/render_subtitles_test.cc +++ b/test/render_subtitles_test.cc @@ -30,7 +30,7 @@ #include "lib/render_text.h" #include "lib/string_text.h" #include "test.h" -#include +#include #include @@ -43,7 +43,7 @@ add(std::vector& s, std::string text, bool italic, bool bold, bool u { s.push_back ( StringText ( - dcp::SubtitleString ( + dcp::TextString( boost::optional (), italic, bold, @@ -69,7 +69,7 @@ add(std::vector& s, std::string text, bool italic, bool bold, bool u ), 2, std::shared_ptr(), - dcp::SubtitleStandard::SMPTE_2014 + dcp::TextStandard::SMPTE_2014 ) ); } @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE (marked_up_test6) BOOST_AUTO_TEST_CASE(render_text_with_newline_test) { - std::list ss = { + std::list ss = { { {}, true, false, false, dcp::Colour(255, 255, 255), 42, 1.0, dcp::Time(0, 0, 0, 0, 24), dcp::Time(0, 0, 1, 0, 24), @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(render_text_with_newline_test) std::vector st; for (auto i: ss) { - st.push_back({i, 0, make_shared("foo"), dcp::SubtitleStandard::SMPTE_2014}); + st.push_back({i, 0, make_shared("foo"), dcp::TextStandard::SMPTE_2014}); } auto images = render_text(st, dcp::Size(1998, 1080), {}, 24); @@ -177,7 +177,7 @@ BOOST_AUTO_TEST_CASE(render_text_with_newline_test) BOOST_AUTO_TEST_CASE (render_text_test) { - auto dcp_string = dcp::SubtitleString( + auto dcp_string = dcp::TextString( {}, false, false, false, dcp::Colour(255, 255, 255), 42, 1.0, dcp::Time(0, 0, 0, 0, 24), dcp::Time(0, 0, 1, 0, 24), 0.5, dcp::HAlign::CENTER, diff --git a/test/srt_subtitle_test.cc b/test/srt_subtitle_test.cc index 0ee9cb197..702d0bbb6 100644 --- a/test/srt_subtitle_test.cc +++ b/test/srt_subtitle_test.cc @@ -32,8 +32,8 @@ #include "lib/string_text_file_content.h" #include "lib/text_content.h" #include "test.h" -#include -#include +#include +#include #include #include #include @@ -237,12 +237,12 @@ BOOST_AUTO_TEST_CASE(srt_subtitle_entity) dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING, }); - dcp::SMPTESubtitleAsset check(dcp_file(film, "sub_")); - auto subs = check.subtitles(); + dcp::SMPTETextAsset check(dcp_file(film, "sub_")); + auto subs = check.texts(); BOOST_REQUIRE_EQUAL(subs.size(), 1U); - auto sub = std::dynamic_pointer_cast(subs[0]); + auto sub = std::dynamic_pointer_cast(subs[0]); BOOST_REQUIRE(sub); - /* libdcp::SubtitleAsset gets the text from the XML with get_content(), which + /* dcp::TextAsset gets the text from the XML with get_content(), which * resolves the 5 predefined entities & " < > ' so we shouldn't see any * entity here. */ diff --git a/test/ssa_subtitle_test.cc b/test/ssa_subtitle_test.cc index 2d8102a07..2466de791 100644 --- a/test/ssa_subtitle_test.cc +++ b/test/ssa_subtitle_test.cc @@ -33,7 +33,7 @@ #include "lib/text_content.h" #include "test.h" #include -#include +#include #include #include @@ -62,8 +62,8 @@ BOOST_AUTO_TEST_CASE (ssa_subtitle_test1) make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD }); - auto ref = make_shared(TestPaths::private_data() / "DKH_UT_EN20160601def.xml"); - auto check = make_shared(subtitle_file(film)); + auto ref = make_shared(TestPaths::private_data() / "DKH_UT_EN20160601def.xml"); + auto check = make_shared(subtitle_file(film)); dcp::EqualityOptions options; options.max_subtitle_vertical_position_error = 0.1; diff --git a/test/subtitle_font_id_test.cc b/test/subtitle_font_id_test.cc index f6bd48c51..e42033825 100644 --- a/test/subtitle_font_id_test.cc +++ b/test/subtitle_font_id_test.cc @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "test.h" #include @@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_without_font_tag) }); auto check_file = subtitle_file(film); - dcp::SMPTESubtitleAsset check_asset(check_file); + dcp::SMPTETextAsset check_asset(check_file); BOOST_CHECK_EQUAL(check_asset.load_font_nodes().size(), 1U); auto check_font_data = check_asset.font_data(); BOOST_CHECK_EQUAL(check_font_data.size(), 1U); @@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE(make_dcp_with_subs_in_dcp_without_font_tag) }); auto check_file = subtitle_file(film); - dcp::SMPTESubtitleAsset check_asset(check_file); + dcp::SMPTETextAsset check_asset(check_file); BOOST_CHECK_EQUAL(check_asset.load_font_nodes().size(), 1U); auto check_font_data = check_asset.font_data(); BOOST_CHECK_EQUAL(check_font_data.size(), 1U); @@ -254,8 +254,8 @@ BOOST_AUTO_TEST_CASE(subtitle_with_no_font_test) BOOST_REQUIRE(check_subs); BOOST_CHECK_EQUAL(check_subs->font_data().size(), 1U); - BOOST_REQUIRE_EQUAL(check_subs->subtitles().size(), 1U); - BOOST_CHECK(!std::dynamic_pointer_cast(check_subs->subtitles()[0])->font().has_value()); + BOOST_REQUIRE_EQUAL(check_subs->texts().size(), 1U); + BOOST_CHECK(!std::dynamic_pointer_cast(check_subs->texts()[0])->font().has_value()); auto check_film = new_test_film2(name_base + "_check", { make_shared(bad_film->dir(bad_film->dcp_name())) }); make_and_verify_dcp(check_film); diff --git a/test/subtitle_position_test.cc b/test/subtitle_position_test.cc index 94a06b7f8..785164965 100644 --- a/test/subtitle_position_test.cc +++ b/test/subtitle_position_test.cc @@ -25,9 +25,9 @@ #include "lib/make_dcp.h" #include "lib/text_content.h" #include "test.h" -#include +#include #include -#include +#include #include #include @@ -55,8 +55,8 @@ BOOST_AUTO_TEST_CASE(srt_correctly_placed_in_interop) auto output = subtitle_file(film); - dcp::InteropSubtitleAsset asset(output); - auto output_subs = asset.subtitles(); + dcp::InteropTextAsset asset(output); + auto output_subs = asset.texts(); BOOST_REQUIRE_EQUAL(output_subs.size(), 1U); BOOST_CHECK(output_subs[0]->v_align() == dcp::VAlign::BOTTOM); @@ -83,8 +83,8 @@ BOOST_AUTO_TEST_CASE(srt_correctly_placed_in_smpte) auto output = subtitle_file(film); - dcp::SMPTESubtitleAsset asset(output); - auto output_subs = asset.subtitles(); + dcp::SMPTETextAsset asset(output); + auto output_subs = asset.texts(); BOOST_REQUIRE_EQUAL(output_subs.size(), 1U); BOOST_CHECK(output_subs[0]->v_align() == dcp::VAlign::BOTTOM); @@ -95,18 +95,18 @@ BOOST_AUTO_TEST_CASE(srt_correctly_placed_in_smpte) /** Make a DCP from some DCP subtitles and check the vertical alignment */ static void -vpos_test(dcp::VAlign reference, float position, dcp::SubtitleStandard from, dcp::Standard to) +vpos_test(dcp::VAlign reference, float position, dcp::TextStandard from, dcp::Standard to) { string standard; switch (from) { - case dcp::SubtitleStandard::SMPTE_2007: - case dcp::SubtitleStandard::SMPTE_2010: + case dcp::TextStandard::SMPTE_2007: + case dcp::TextStandard::SMPTE_2010: standard = "smpte_2010"; break; - case dcp::SubtitleStandard::INTEROP: + case dcp::TextStandard::INTEROP: standard = "interop"; break; - case dcp::SubtitleStandard::SMPTE_2014: + case dcp::TextStandard::SMPTE_2014: standard = "smpte_2014"; break; } @@ -122,13 +122,13 @@ vpos_test(dcp::VAlign reference, float position, dcp::SubtitleStandard from, dcp BOOST_REQUIRE(!wait_for_jobs()); auto out = subtitle_file(film); - vector> subtitles; + vector> subtitles; if (to == dcp::Standard::INTEROP) { - dcp::InteropSubtitleAsset asset(out); - subtitles = asset.subtitles(); + dcp::InteropTextAsset asset(out); + subtitles = asset.texts(); } else { - dcp::SMPTESubtitleAsset asset(out); - subtitles = asset.subtitles(); + dcp::SMPTETextAsset asset(out); + subtitles = asset.texts(); } BOOST_REQUIRE_EQUAL(subtitles.size(), 1U); @@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(subtitles_correctly_placed_with_all_references) constexpr auto height = 0.0462963; /* Interop source */ - auto from = dcp::SubtitleStandard::INTEROP; + auto from = dcp::TextStandard::INTEROP; // -> Interop vpos_test(dcp::VAlign::TOP, 0.2, from, dcp::Standard::INTEROP); @@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE(subtitles_correctly_placed_with_all_references) vpos_test(dcp::VAlign::BOTTOM, 0.08, from, dcp::Standard::SMPTE); /* SMPTE 2010 source */ - from = dcp::SubtitleStandard::SMPTE_2010; + from = dcp::TextStandard::SMPTE_2010; // -> Interop vpos_test(dcp::VAlign::TOP, 0.1 + height - baseline_to_bottom, from, dcp::Standard::INTEROP); @@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(subtitles_correctly_placed_with_all_references) vpos_test(dcp::VAlign::BOTTOM, 0.10 + baseline_to_bottom, from, dcp::Standard::SMPTE); /* SMPTE 2014 source */ - from = dcp::SubtitleStandard::SMPTE_2014; + from = dcp::TextStandard::SMPTE_2014; // -> Interop vpos_test(dcp::VAlign::TOP, 0.2, from, dcp::Standard::INTEROP); diff --git a/test/subtitle_reel_number_test.cc b/test/subtitle_reel_number_test.cc index 743d809dd..e7ac0c907 100644 --- a/test/subtitle_reel_number_test.cc +++ b/test/subtitle_reel_number_test.cc @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test) int n = 1; for (auto i: cpl->reels()) { if (i->main_subtitle()) { - auto ass = dynamic_pointer_cast(i->main_subtitle()->asset()); + auto ass = dynamic_pointer_cast(i->main_subtitle()->asset()); BOOST_REQUIRE (ass); BOOST_CHECK_EQUAL (ass->reel_number(), dcp::raw_convert(n)); ++n; diff --git a/test/subtitle_reel_test.cc b/test/subtitle_reel_test.cc index d7eb90d25..0f9abe782 100644 --- a/test/subtitle_reel_test.cc +++ b/test/subtitle_reel_test.cc @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -78,25 +78,25 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_test) auto i = reels.begin (); BOOST_REQUIRE ((*i)->main_subtitle()); BOOST_REQUIRE ((*i)->main_subtitle()->asset()); - auto A = std::dynamic_pointer_cast((*i)->main_subtitle()->asset()); + auto A = std::dynamic_pointer_cast((*i)->main_subtitle()->asset()); BOOST_REQUIRE (A); ++i; BOOST_REQUIRE ((*i)->main_subtitle()); BOOST_REQUIRE ((*i)->main_subtitle()->asset()); - auto B = std::dynamic_pointer_cast((*i)->main_subtitle()->asset()); + auto B = std::dynamic_pointer_cast((*i)->main_subtitle()->asset()); BOOST_REQUIRE (B); - BOOST_REQUIRE_EQUAL (A->subtitles().size(), 1U); - BOOST_REQUIRE_EQUAL (B->subtitles().size(), 1U); + BOOST_REQUIRE_EQUAL(A->texts().size(), 1U); + BOOST_REQUIRE_EQUAL(B->texts().size(), 1U); /* These times should be the same as they are should be offset from the start of the reel */ - BOOST_CHECK (A->subtitles().front()->in() == B->subtitles().front()->in()); + BOOST_CHECK(A->texts().front()->in() == B->texts().front()->in()); } /** Check that with a SMPTE DCP if we have subtitles in one reel, all reels have a - * SubtitleAsset (even if it's empty); SMPTE Bv2.1 section 8.3.1. + * TextAsset (even if it's empty); SMPTE Bv2.1 section 8.3.1. */ BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test) { @@ -224,7 +224,7 @@ BOOST_AUTO_TEST_CASE (subtitles_split_at_reel_boundaries) BOOST_REQUIRE (reel_sub); auto sub = reel_sub->asset(); BOOST_REQUIRE (sub); - BOOST_CHECK_EQUAL (sub->subtitles().size(), 1U); + BOOST_CHECK_EQUAL(sub->texts().size(), 1U); } } diff --git a/test/subtitle_timing_test.cc b/test/subtitle_timing_test.cc index e5a4133ad..48c3d00e5 100644 --- a/test/subtitle_timing_test.cc +++ b/test/subtitle_timing_test.cc @@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE (test_subtitle_timing_with_frame_rate_change) BOOST_REQUIRE(reel->main_subtitle()); BOOST_REQUIRE(reel->main_subtitle()->asset()); - auto subs = reel->main_subtitle()->asset()->subtitles(); + auto subs = reel->main_subtitle()->asset()->texts(); int index = 0; for (auto i: subs) { auto error = std::abs(i->in().as_seconds() - (index * content_frame_rate / dcp_frame_rate));