From a5c629cb9b638b67a0e4c2d26fe9ab2e124bf0eb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 23 Jul 2018 15:10:11 +0100 Subject: [PATCH] Tidy up after mass rename. --- src/lib/analyse_audio_job.cc | 2 +- src/lib/content.cc | 18 ++-- src/lib/content.h | 8 +- src/lib/dcp_content.cc | 74 ++++++++--------- src/lib/dcp_content.h | 22 ++--- src/lib/dcp_decoder.cc | 28 +++---- src/lib/dcp_decoder.h | 4 +- src/lib/dcp_encoder.cc | 10 +-- src/lib/dcp_encoder.h | 4 +- src/lib/dcp_examiner.cc | 8 +- src/lib/dcp_examiner.h | 6 +- src/lib/dcp_subtitle_content.cc | 16 ++-- src/lib/dcp_subtitle_decoder.cc | 4 +- src/lib/decoder.cc | 12 +-- src/lib/decoder.h | 4 +- src/lib/ffmpeg_content.cc | 28 +++---- src/lib/ffmpeg_decoder.cc | 16 ++-- src/lib/ffmpeg_encoder.cc | 2 +- src/lib/film.cc | 22 ++--- src/lib/hints.cc | 2 +- src/lib/player.cc | 106 ++++++++++++------------ src/lib/player.h | 20 ++--- src/lib/player_video.cc | 36 ++++---- src/lib/player_video.h | 4 +- src/lib/playlist.cc | 8 +- src/lib/playlist.h | 2 +- src/lib/reel_writer.cc | 4 +- src/lib/reel_writer.h | 2 +- src/lib/string_text_file_content.cc | 12 +-- src/lib/string_text_file_decoder.cc | 4 +- src/lib/text_content.cc | 80 +++++++++--------- src/lib/types.cc | 28 +++---- src/lib/types.h | 27 +++--- src/lib/writer.cc | 2 +- src/lib/writer.h | 2 +- src/tools/dcpomatic.cc | 10 +-- src/tools/dcpomatic_player.cc | 2 +- src/wx/content_panel.cc | 40 ++++----- src/wx/content_panel.h | 4 +- src/wx/dcp_panel.cc | 2 +- src/wx/film_viewer.cc | 2 +- src/wx/paste_dialog.cc | 12 +-- src/wx/paste_dialog.h | 6 +- src/wx/player_information.cc | 2 +- src/wx/text_panel.cc | 122 ++++++++++++++-------------- src/wx/text_panel.h | 6 +- src/wx/text_view.cc | 6 +- src/wx/timeline.cc | 14 ++-- src/wx/timeline_labels_view.cc | 14 ++-- src/wx/timeline_labels_view.h | 4 +- src/wx/timing_panel.cc | 2 +- test/client_server_test.cc | 4 +- test/closed_caption_test.cc | 2 +- test/dcp_subtitle_test.cc | 14 ++-- test/ffmpeg_encoder_test.cc | 24 +++--- test/player_test.cc | 8 +- test/remake_with_subtitle_test.cc | 6 +- test/srt_subtitle_test.cc | 26 +++--- test/ssa_subtitle_test.cc | 4 +- test/subtitle_reel_number_test.cc | 4 +- test/vf_test.cc | 20 ++--- 61 files changed, 495 insertions(+), 492 deletions(-) diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 03497b91e..461b84b4f 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -106,7 +106,7 @@ AnalyseAudioJob::run () { shared_ptr player (new Player (_film, _playlist)); player->set_ignore_video (); - player->set_ignore_caption (); + player->set_ignore_text (); player->set_fast (); player->set_play_referenced (); player->Audio.connect (bind (&AnalyseAudioJob::analyse, this, _1, _2)); diff --git a/src/lib/content.cc b/src/lib/content.cc index 7a8088289..c1812b9fd 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -437,9 +437,9 @@ Content::take_settings_from (shared_ptr c) audio->take_settings_from (c->audio); } - list >::iterator i = caption.begin (); - list >::const_iterator j = c->caption.begin (); - while (i != caption.end() && j != c->caption.end()) { + list >::iterator i = text.begin (); + list >::const_iterator j = c->text.begin (); + while (i != text.end() && j != c->text.end()) { (*i)->take_settings_from (*j); ++i; ++j; @@ -447,19 +447,19 @@ Content::take_settings_from (shared_ptr c) } shared_ptr -Content::only_caption () const +Content::only_text () const { - DCPOMATIC_ASSERT (caption.size() < 2); - if (caption.empty ()) { + DCPOMATIC_ASSERT (text.size() < 2); + if (text.empty ()) { return shared_ptr (); } - return caption.front (); + return text.front (); } shared_ptr -Content::caption_of_original_type (TextType type) const +Content::text_of_original_type (TextType type) const { - BOOST_FOREACH (shared_ptr i, caption) { + BOOST_FOREACH (shared_ptr i, text) { if (i->original_type() == type) { return i; } diff --git a/src/lib/content.h b/src/lib/content.h index 850cb0891..23afa2243 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2016 Carl Hetherington + Copyright (C) 2013-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -182,10 +182,10 @@ public: boost::shared_ptr video; boost::shared_ptr audio; - std::list > caption; + std::list > text; - boost::shared_ptr only_caption () const; - boost::shared_ptr caption_of_original_type (TextType type) const; + boost::shared_ptr only_text () const; + boost::shared_ptr text_of_original_type (TextType type) const; void signal_changed (int); diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index aaf8064f3..5371fbc11 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -58,9 +58,9 @@ int const DCPContentProperty::NEEDS_ASSETS = 600; int const DCPContentProperty::NEEDS_KDM = 601; int const DCPContentProperty::REFERENCE_VIDEO = 602; int const DCPContentProperty::REFERENCE_AUDIO = 603; -int const DCPContentProperty::REFERENCE_CAPTION = 604; +int const DCPContentProperty::REFERENCE_TEXT = 604; int const DCPContentProperty::NAME = 605; -int const DCPContentProperty::CAPTIONS = 606; +int const DCPContentProperty::TEXTS = 606; DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) : Content (film) @@ -74,8 +74,8 @@ DCPContent::DCPContent (shared_ptr film, boost::filesystem::path p) read_directory (p); set_default_colour_conversion (); - for (int i = 0; i < CAPTION_COUNT; ++i) { - _reference_caption[i] = false; + for (int i = 0; i < TEXT_COUNT; ++i) { + _reference_text[i] = false; } } @@ -84,10 +84,10 @@ DCPContent::DCPContent (shared_ptr film, cxml::ConstNodePtr node, in { video = VideoContent::from_xml (this, node, version); audio = AudioContent::from_xml (this, node, version); - caption = TextContent::from_xml (this, node, version); + text = TextContent::from_xml (this, node, version); - for (int i = 0; i < CAPTION_COUNT; ++i) { - _reference_caption[i] = false; + for (int i = 0; i < TEXT_COUNT; ++i) { + _reference_text[i] = false; } if (video && audio) { @@ -115,11 +115,11 @@ DCPContent::DCPContent (shared_ptr film, cxml::ConstNodePtr node, in _reference_video = node->optional_bool_child ("ReferenceVideo").get_value_or (false); _reference_audio = node->optional_bool_child ("ReferenceAudio").get_value_or (false); if (version >= 37) { - _reference_caption[CAPTION_OPEN] = node->optional_bool_child("ReferenceOpenCaption").get_value_or(false); - _reference_caption[CAPTION_CLOSED] = node->optional_bool_child("ReferenceClosedCaption").get_value_or(false); + _reference_text[TEXT_OPEN_SUBTITLE] = node->optional_bool_child("ReferenceOpenSubtitle").get_value_or(false); + _reference_text[TEXT_CLOSED_CAPTION] = node->optional_bool_child("ReferenceClosedCaption").get_value_or(false); } else { - _reference_caption[CAPTION_OPEN] = node->optional_bool_child("ReferenceSubtitle").get_value_or(false); - _reference_caption[CAPTION_CLOSED] = false; + _reference_text[TEXT_OPEN_SUBTITLE] = node->optional_bool_child("ReferenceSubtitle").get_value_or(false); + _reference_text[TEXT_CLOSED_CAPTION] = false; } if (node->optional_string_child("Standard")) { string const s = node->optional_string_child("Standard").get(); @@ -156,7 +156,7 @@ DCPContent::examine (shared_ptr job) bool const needed_assets = needs_assets (); bool const needed_kdm = needs_kdm (); string const old_name = name (); - int const old_captions = caption.size (); + int const old_texts = text.size (); if (job) { job->set_progress_unknown (); @@ -187,16 +187,16 @@ DCPContent::examine (shared_ptr job) signal_changed (AudioContentProperty::STREAMS); } - int captions = 0; + int texts = 0; { boost::mutex::scoped_lock lm (_mutex); _name = examiner->name (); - for (int i = 0; i < CAPTION_COUNT; ++i) { - if (examiner->has_caption(static_cast(i))) { - caption.push_back (shared_ptr(new TextContent(this, static_cast(i)))); + for (int i = 0; i < TEXT_COUNT; ++i) { + if (examiner->has_text(static_cast(i))) { + text.push_back (shared_ptr(new TextContent(this, static_cast(i)))); } } - captions = caption.size (); + texts = text.size (); _encrypted = examiner->encrypted (); _needs_assets = examiner->needs_assets (); _kdm_valid = examiner->kdm_valid (); @@ -206,8 +206,8 @@ DCPContent::examine (shared_ptr job) _reel_lengths = examiner->reel_lengths (); } - if (old_captions != captions) { - signal_changed (DCPContentProperty::CAPTIONS); + if (old_texts != texts) { + signal_changed (DCPContentProperty::TEXTS); } if (needed_assets != needs_assets ()) { @@ -267,7 +267,7 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const audio->stream()->mapping().as_xml (node->add_child("AudioMapping")); } - BOOST_FOREACH (shared_ptr i, caption) { + BOOST_FOREACH (shared_ptr i, text) { i->as_xml (node); } @@ -281,8 +281,8 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const node->add_child("KDMValid")->add_child_text (_kdm_valid ? "1" : "0"); node->add_child("ReferenceVideo")->add_child_text (_reference_video ? "1" : "0"); node->add_child("ReferenceAudio")->add_child_text (_reference_audio ? "1" : "0"); - node->add_child("ReferenceOpenCaption")->add_child_text(_reference_caption[CAPTION_OPEN] ? "1" : "0"); - node->add_child("ReferenceClosedCaption")->add_child_text(_reference_caption[CAPTION_CLOSED] ? "1" : "0"); + node->add_child("ReferenceOpenSubtitle")->add_child_text(_reference_text[TEXT_OPEN_SUBTITLE] ? "1" : "0"); + node->add_child("ReferenceClosedCaption")->add_child_text(_reference_text[TEXT_CLOSED_CAPTION] ? "1" : "0"); if (_standard) { switch (_standard.get ()) { case dcp::INTEROP: @@ -323,13 +323,13 @@ DCPContent::identifier () const s += video->identifier() + "_"; } - BOOST_FOREACH (shared_ptr i, caption) { + BOOST_FOREACH (shared_ptr i, text) { s += i->identifier () + " "; } s += string (_reference_video ? "1" : "0"); - for (int i = 0; i < CAPTION_COUNT; ++i) { - s += string (_reference_caption[i] ? "1" : "0"); + for (int i = 0; i < TEXT_COUNT; ++i) { + s += string (_reference_text[i] ? "1" : "0"); } return s; } @@ -416,14 +416,14 @@ DCPContent::set_reference_audio (bool r) } void -DCPContent::set_reference_caption (TextType type, bool r) +DCPContent::set_reference_text (TextType type, bool r) { { boost::mutex::scoped_lock lm (_mutex); - _reference_caption[type] = r; + _reference_text[type] = r; } - signal_changed (DCPContentProperty::REFERENCE_CAPTION); + signal_changed (DCPContentProperty::REFERENCE_TEXT); } list @@ -591,12 +591,12 @@ DCPContent::can_reference_audio (string& why_not) const } static -bool check_caption (shared_ptr c) +bool check_text (shared_ptr c) { - return !c->caption.empty(); + return !c->text.empty(); } bool -DCPContent::can_reference_caption (TextType type, string& why_not) const +DCPContent::can_reference_text (TextType type, string& why_not) const { shared_ptr decoder; try { @@ -610,12 +610,12 @@ DCPContent::can_reference_caption (TextType type, string& why_not) const } BOOST_FOREACH (shared_ptr i, decoder->reels()) { - if (type == CAPTION_OPEN && !i->main_subtitle()) { + if (type == TEXT_OPEN_SUBTITLE && !i->main_subtitle()) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - why_not = _("it does not have subtitles in all its reels."); + why_not = _("it does not have open subtitles in all its reels."); return false; } - if (type == CAPTION_CLOSED && !i->closed_caption()) { + if (type == TEXT_CLOSED_CAPTION && !i->closed_caption()) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " why_not = _("it does not have closed captions in all its reels."); return false; @@ -623,7 +623,7 @@ DCPContent::can_reference_caption (TextType type, string& why_not) const } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (bind (&check_caption, _1), _("it overlaps other caption content; remove the other content."), why_not); + return can_reference (bind (&check_text, _1), _("it overlaps other text content; remove the other content."), why_not); } void @@ -636,8 +636,8 @@ DCPContent::take_settings_from (shared_ptr c) _reference_video = dc->_reference_video; _reference_audio = dc->_reference_audio; - for (int i = 0; i < CAPTION_COUNT; ++i) { - _reference_caption[i] = dc->_reference_caption[i]; + for (int i = 0; i < TEXT_COUNT; ++i) { + _reference_text[i] = dc->_reference_text[i]; } } diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index fedc43d64..cccf127c3 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -36,9 +36,9 @@ public: static int const NEEDS_ASSETS; static int const REFERENCE_VIDEO; static int const REFERENCE_AUDIO; - static int const REFERENCE_CAPTION; + static int const REFERENCE_TEXT; static int const NAME; - static int const CAPTIONS; + static int const TEXTS; }; class ContentPart; @@ -108,17 +108,17 @@ public: bool can_reference_audio (std::string &) const; - void set_reference_caption (TextType type, bool r); + void set_reference_text (TextType type, bool r); - /** @param type Original type of captions in the DCP. - * @return true if these captions are to be referenced. + /** @param type Original type of texts in the DCP. + * @return true if these texts are to be referenced. */ - bool reference_caption (TextType type) const { + bool reference_text (TextType type) const { boost::mutex::scoped_lock lm (_mutex); - return _reference_caption[type]; + return _reference_text[type]; } - bool can_reference_caption (TextType type, std::string &) const; + bool can_reference_text (TextType type, std::string &) const; void set_cpl (std::string id); @@ -166,11 +166,11 @@ private: * rather than by rewrapping. */ bool _reference_audio; - /** true if the captions in this DCP should be included in the output by reference - * rather than by rewrapping. The types here are the original caption types, + /** true if the texts in this DCP should be included in the output by reference + * rather than by rewrapping. The types here are the original text types, * not what they are being used for. */ - bool _reference_caption[CAPTION_COUNT]; + bool _reference_text[TEXT_COUNT]; boost::optional _standard; bool _three_d; diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 86152c817..85fa41ddd 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -63,9 +63,9 @@ DCPDecoder::DCPDecoder (shared_ptr c, shared_ptr log, boo if (c->audio) { audio.reset (new AudioDecoder (this, c->audio, log, fast)); } - BOOST_FOREACH (shared_ptr i, c->caption) { + BOOST_FOREACH (shared_ptr i, c->text) { /* XXX: this time here should be the time of the first subtitle, not 0 */ - caption.push_back (shared_ptr (new TextDecoder (this, i, log, ContentTime()))); + text.push_back (shared_ptr (new TextDecoder (this, i, log, ContentTime()))); } list > cpl_list = cpls (); @@ -110,10 +110,10 @@ DCPDecoder::pass () /* Frame within the (played part of the) reel that is coming up next */ int64_t const frame = _next.frames_round (vfr); - /* We must emit captions first as when we emit the video for this frame - it will expect already to have the captions. + /* We must emit texts first as when we emit the video for this frame + it will expect already to have the texts. */ - pass_captions (_next); + pass_texts (_next); if ((_mono_reader || _stereo_reader) && (_decode_referenced || !_dcp_content->reference_video())) { shared_ptr asset = (*_reel)->main_picture()->asset (); @@ -191,25 +191,25 @@ DCPDecoder::pass () } void -DCPDecoder::pass_captions (ContentTime next) +DCPDecoder::pass_texts (ContentTime next) { - list >::const_iterator decoder = caption.begin (); + list >::const_iterator decoder = text.begin (); if ((*_reel)->main_subtitle()) { - pass_captions ( - next, (*_reel)->main_subtitle()->asset(), _dcp_content->reference_caption(CAPTION_OPEN), (*_reel)->main_subtitle()->entry_point(), *decoder + pass_texts ( + next, (*_reel)->main_subtitle()->asset(), _dcp_content->reference_text(TEXT_OPEN_SUBTITLE), (*_reel)->main_subtitle()->entry_point(), *decoder ); ++decoder; } if ((*_reel)->closed_caption()) { - pass_captions ( - next, (*_reel)->closed_caption()->asset(), _dcp_content->reference_caption(CAPTION_CLOSED), (*_reel)->closed_caption()->entry_point(), *decoder + pass_texts ( + next, (*_reel)->closed_caption()->asset(), _dcp_content->reference_text(TEXT_CLOSED_CAPTION), (*_reel)->closed_caption()->entry_point(), *decoder ); ++decoder; } } void -DCPDecoder::pass_captions (ContentTime next, shared_ptr asset, bool reference, int64_t entry_point, shared_ptr decoder) +DCPDecoder::pass_texts (ContentTime next, shared_ptr asset, bool reference, int64_t entry_point, shared_ptr decoder) { double const vfr = _dcp_content->active_video_frame_rate (); /* Frame within the (played part of the) reel that is coming up next */ @@ -314,11 +314,11 @@ DCPDecoder::seek (ContentTime t, bool accurate) next_reel (); } - /* Pass captions in the pre-roll */ + /* Pass texts in the pre-roll */ double const vfr = _dcp_content->active_video_frame_rate (); for (int i = 0; i < pre_roll_seconds * vfr; ++i) { - pass_captions (pre); + pass_texts (pre); pre += ContentTime::from_frames (1, vfr); } diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h index 2fbdb884a..36b5bbafb 100644 --- a/src/lib/dcp_decoder.h +++ b/src/lib/dcp_decoder.h @@ -57,8 +57,8 @@ private: void next_reel (); void get_readers (); - void pass_captions (ContentTime next); - void pass_captions (ContentTime next, boost::shared_ptr asset, bool reference, int64_t entry_point, boost::shared_ptr decoder); + void pass_texts (ContentTime next); + void pass_texts (ContentTime next, boost::shared_ptr asset, bool reference, int64_t entry_point, boost::shared_ptr decoder); /** Time of next thing to return from pass relative to the start of _reel */ ContentTime _next; diff --git a/src/lib/dcp_encoder.cc b/src/lib/dcp_encoder.cc index 42984887d..7fbbb2c63 100644 --- a/src/lib/dcp_encoder.cc +++ b/src/lib/dcp_encoder.cc @@ -61,10 +61,10 @@ DCPEncoder::DCPEncoder (shared_ptr film, weak_ptr job) { _player_video_connection = _player->Video.connect (bind (&DCPEncoder::video, this, _1, _2)); _player_audio_connection = _player->Audio.connect (bind (&DCPEncoder::audio, this, _1, _2)); - _player_caption_connection = _player->Caption.connect (bind (&DCPEncoder::caption, this, _1, _2, _3)); + _player_text_connection = _player->Text.connect (bind (&DCPEncoder::text, this, _1, _2, _3)); BOOST_FOREACH (shared_ptr c, film->content ()) { - BOOST_FOREACH (shared_ptr i, c->caption) { + BOOST_FOREACH (shared_ptr i, c->text) { if (i->use() && !i->burn()) { _non_burnt_subtitles = true; } @@ -77,7 +77,7 @@ DCPEncoder::~DCPEncoder () /* We must stop receiving more video data before we die */ _player_video_connection.release (); _player_audio_connection.release (); - _player_caption_connection.release (); + _player_text_connection.release (); } void @@ -143,9 +143,9 @@ DCPEncoder::audio (shared_ptr data, DCPTime time) } void -DCPEncoder::caption (PlayerText data, TextType type, DCPTimePeriod period) +DCPEncoder::text (PlayerText data, TextType type, DCPTimePeriod period) { - if (type == CAPTION_CLOSED || _non_burnt_subtitles) { + if (type == TEXT_CLOSED_CAPTION || _non_burnt_subtitles) { _writer->write (data, type, period); } } diff --git a/src/lib/dcp_encoder.h b/src/lib/dcp_encoder.h index 23b05d0dc..8a2ad947d 100644 --- a/src/lib/dcp_encoder.h +++ b/src/lib/dcp_encoder.h @@ -52,7 +52,7 @@ private: void video (boost::shared_ptr, DCPTime); void audio (boost::shared_ptr, DCPTime); - void caption (PlayerText, TextType, DCPTimePeriod); + void text (PlayerText, TextType, DCPTimePeriod); boost::shared_ptr _writer; boost::shared_ptr _j2k_encoder; @@ -61,5 +61,5 @@ private: boost::signals2::scoped_connection _player_video_connection; boost::signals2::scoped_connection _player_audio_connection; - boost::signals2::scoped_connection _player_caption_connection; + boost::signals2::scoped_connection _player_text_connection; }; diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 6b4f854f8..4b9238e5b 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -65,8 +65,8 @@ DCPExaminer::DCPExaminer (shared_ptr content) { shared_ptr cpl; - for (int i = 0; i < CAPTION_COUNT; ++i) { - _has_caption[i] = false; + for (int i = 0; i < TEXT_COUNT; ++i) { + _has_text[i] = false; } if (content->cpl ()) { @@ -169,7 +169,7 @@ DCPExaminer::DCPExaminer (shared_ptr content) return; } - _has_caption[CAPTION_OPEN] = true; + _has_text[TEXT_OPEN_SUBTITLE] = true; } if (i->closed_caption ()) { @@ -179,7 +179,7 @@ DCPExaminer::DCPExaminer (shared_ptr content) return; } - _has_caption[CAPTION_CLOSED] = true; + _has_text[TEXT_CLOSED_CAPTION] = true; } if (i->main_picture()) { diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index 29fcc48d2..4b93bfa42 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -83,8 +83,8 @@ public: return _audio_frame_rate.get_value_or (48000); } - bool has_caption (TextType type) const { - return _has_caption[type]; + bool has_text (TextType type) const { + return _has_text[type]; } bool kdm_valid () const { @@ -119,7 +119,7 @@ private: bool _has_video; /** true if this DCP has audio content (but false if it has unresolved references to audio content) */ bool _has_audio; - bool _has_caption[CAPTION_COUNT]; + bool _has_text[TEXT_COUNT]; bool _encrypted; bool _needs_assets; bool _kdm_valid; diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 6a7e38153..5acc51ac4 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -40,14 +40,14 @@ using dcp::raw_convert; DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, boost::filesystem::path path) : Content (film, path) { - caption.push_back (shared_ptr (new TextContent (this, CAPTION_OPEN))); + text.push_back (shared_ptr (new TextContent (this, TEXT_OPEN_SUBTITLE))); } DCPSubtitleContent::DCPSubtitleContent (shared_ptr film, cxml::ConstNodePtr node, int version) : Content (film, node) , _length (node->number_child ("Length")) { - caption = TextContent::from_xml (this, node, version); + text = TextContent::from_xml (this, node, version); } void @@ -66,18 +66,18 @@ DCPSubtitleContent::examine (shared_ptr job) boost::mutex::scoped_lock lm (_mutex); /* Default to turning these subtitles on */ - only_caption()->set_use (true); + only_text()->set_use (true); if (iop) { - only_caption()->set_language (iop->language ()); + only_text()->set_language (iop->language ()); } else if (smpte) { - only_caption()->set_language (smpte->language().get_value_or ("")); + only_text()->set_language (smpte->language().get_value_or ("")); } _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ()); BOOST_FOREACH (shared_ptr i, sc->load_font_nodes ()) { - only_caption()->add_font (shared_ptr (new Font (i->id))); + only_text()->add_font (shared_ptr (new Font (i->id))); } } @@ -106,8 +106,8 @@ DCPSubtitleContent::as_xml (xmlpp::Node* node, bool with_paths) const node->add_child("Type")->add_child_text ("DCPSubtitle"); Content::as_xml (node, with_paths); - if (only_caption()) { - only_caption()->as_xml (node); + if (only_text()) { + only_text()->as_xml (node); } node->add_child("Length")->add_child_text (raw_convert (_length.get ())); diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 05d815265..9c803a3b6 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -39,7 +39,7 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr con if (_next != _subtitles.end()) { first = content_time_period(*_next).from; } - caption.push_back (shared_ptr (new TextDecoder (this, content->only_caption(), log, first))); + text.push_back (shared_ptr (new TextDecoder (this, content->only_text(), log, first))); } void @@ -81,7 +81,7 @@ DCPSubtitleDecoder::pass () /* XXX: image subtitles */ } - only_caption()->emit_plain (p, s); + only_text()->emit_plain (p, s); return false; } diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 52949a098..6078141dc 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -43,7 +43,7 @@ Decoder::position () const pos = audio->position(); } - BOOST_FOREACH (shared_ptr i, caption) { + BOOST_FOREACH (shared_ptr i, text) { if (!i->ignore() && (!pos || i->position() < *pos)) { pos = i->position(); } @@ -61,17 +61,17 @@ Decoder::seek (ContentTime, bool) if (audio) { audio->seek (); } - BOOST_FOREACH (shared_ptr i, caption) { + BOOST_FOREACH (shared_ptr i, text) { i->seek (); } } shared_ptr -Decoder::only_caption () const +Decoder::only_text () const { - DCPOMATIC_ASSERT (caption.size() < 2); - if (caption.empty ()) { + DCPOMATIC_ASSERT (text.size() < 2); + if (text.empty ()) { return shared_ptr (); } - return caption.front (); + return text.front (); } diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 1b330316e..55d9cfc64 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -45,9 +45,9 @@ public: boost::shared_ptr video; boost::shared_ptr audio; - std::list > caption; + std::list > text; - boost::shared_ptr only_caption () const; + boost::shared_ptr only_text () const; /** Do some decoding and perhaps emit video, audio or subtitle data. * @return true if this decoder will emit no more data unless a seek() happens. diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 86965ff49..fc2a3ff40 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -85,7 +85,7 @@ FFmpegContent::FFmpegContent (shared_ptr film, cxml::ConstNodePtr no { video = VideoContent::from_xml (this, node, version); audio = AudioContent::from_xml (this, node, version); - caption = TextContent::from_xml (this, node, version); + text = TextContent::from_xml (this, node, version); list c = node->node_children ("SubtitleStream"); for (list::const_iterator i = c.begin(); i != c.end(); ++i) { @@ -135,12 +135,12 @@ FFmpegContent::FFmpegContent (shared_ptr film, vector ((*i)->video); need_audio = static_cast ((*i)->audio); - need_caption = !(*i)->caption.empty(); + need_text = !(*i)->text.empty(); } while (i != c.end ()) { @@ -150,8 +150,8 @@ FFmpegContent::FFmpegContent (shared_ptr film, vector ((*i)->audio)) { throw JoinError (_("Content to be joined must all have or not have audio")); } - if (need_caption != !(*i)->caption.empty()) { - throw JoinError (_("Content to be joined must all have or not have captions")); + if (need_text != !(*i)->text.empty()) { + throw JoinError (_("Content to be joined must all have or not have subtitles or captions")); } ++i; } @@ -162,8 +162,8 @@ FFmpegContent::FFmpegContent (shared_ptr film, vector (new TextContent (this, c))); + if (need_text) { + text.push_back (shared_ptr (new TextContent (this, c))); } shared_ptr ref = dynamic_pointer_cast (c[0]); @@ -171,7 +171,7 @@ FFmpegContent::FFmpegContent (shared_ptr film, vector fc = dynamic_pointer_cast (c[i]); - if (fc->only_caption() && fc->only_caption()->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { + if (fc->only_text() && fc->only_text()->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { throw JoinError (_("Content to be joined must use the same subtitle stream.")); } } @@ -209,8 +209,8 @@ FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const } } - if (only_caption()) { - only_caption()->as_xml (node); + if (only_text()) { + only_text()->as_xml (node); } boost::mutex::scoped_lock lm (_mutex); @@ -303,8 +303,8 @@ FFmpegContent::examine (shared_ptr job) _subtitle_streams = examiner->subtitle_streams (); if (!_subtitle_streams.empty ()) { - caption.clear (); - caption.push_back (shared_ptr (new TextContent (this, CAPTION_OPEN))); + text.clear (); + text.push_back (shared_ptr (new TextContent (this, TEXT_OPEN_SUBTITLE))); _subtitle_stream = _subtitle_streams.front (); } @@ -427,8 +427,8 @@ FFmpegContent::identifier () const s += "_" + video->identifier(); } - if (only_caption() && only_caption()->use() && only_caption()->burn()) { - s += "_" + only_caption()->identifier(); + if (only_text() && only_text()->use() && only_text()->burn()) { + s += "_" + only_text()->identifier(); } boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 665ee3e13..32e9c2314 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -97,9 +97,9 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr c, shared_ptr audio.reset (new AudioDecoder (this, c->audio, log, fast)); } - if (c->only_caption()) { + if (c->only_text()) { /* XXX: this time here should be the time of the first subtitle, not 0 */ - caption.push_back (shared_ptr (new TextDecoder (this, c->only_caption(), log, ContentTime()))); + text.push_back (shared_ptr (new TextDecoder (this, c->only_text(), log, ContentTime()))); } _next_time.resize (_format_context->nb_streams); @@ -184,7 +184,7 @@ FFmpegDecoder::pass () if (_video_stream && si == _video_stream.get() && !video->ignore()) { decode_video_packet (); - } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_caption()->ignore()) { + } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) { decode_subtitle_packet (); } else { decode_audio_packet (); @@ -549,9 +549,9 @@ FFmpegDecoder::decode_subtitle_packet () /* Stop any current subtitle, either at the time it was supposed to stop, or now if now is sooner */ if (_have_current_subtitle) { if (_current_subtitle_to) { - only_caption()->emit_stop (min(*_current_subtitle_to, subtitle_period(sub).from + _pts_offset)); + only_text()->emit_stop (min(*_current_subtitle_to, subtitle_period(sub).from + _pts_offset)); } else { - only_caption()->emit_stop (subtitle_period(sub).from + _pts_offset); + only_text()->emit_stop (subtitle_period(sub).from + _pts_offset); } _have_current_subtitle = false; } @@ -593,7 +593,7 @@ FFmpegDecoder::decode_subtitle_packet () } if (_current_subtitle_to) { - only_caption()->emit_stop (*_current_subtitle_to); + only_text()->emit_stop (*_current_subtitle_to); } avsubtitle_free (&sub); @@ -669,7 +669,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime static_cast (rect->h) / target_height ); - only_caption()->emit_bitmap_start (from, image, scaled_rect); + only_text()->emit_bitmap_start (from, image, scaled_rect); } void @@ -702,6 +702,6 @@ FFmpegDecoder::decode_ass_subtitle (string ass, ContentTime from) ); BOOST_FOREACH (sub::Subtitle const & i, sub::collect > (raw)) { - only_caption()->emit_plain_start (from, i); + only_text()->emit_plain_start (from, i); } } diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index f82290c6c..71063c123 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -72,7 +72,7 @@ FFmpegEncoder::FFmpegEncoder (shared_ptr film, weak_ptr job, bo break; } - _player->set_always_burn_open_captions (); + _player->set_always_burn_open_subtitles (); _player->set_play_referenced (); int const ch = film->audio_channels (); diff --git a/src/lib/film.cc b/src/lib/film.cc index 475d28b4f..ba97f833e 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -704,10 +704,10 @@ Film::isdcf_name (bool if_created_now) const bool burnt_in = true; bool ccap = false; BOOST_FOREACH (shared_ptr i, content()) { - BOOST_FOREACH (shared_ptr j, i->caption) { - if (j->type() == CAPTION_OPEN && j->use() && !j->burn()) { + BOOST_FOREACH (shared_ptr j, i->text) { + if (j->type() == TEXT_OPEN_SUBTITLE && j->use() && !j->burn()) { burnt_in = false; - } else if (j->type() == CAPTION_CLOSED) { + } else if (j->type() == TEXT_CLOSED_CAPTION) { ccap = true; } } @@ -782,13 +782,13 @@ Film::isdcf_name (bool if_created_now) const continue; } - bool any_caption = false; - for (int i = 0; i < CAPTION_COUNT; ++i) { - if (dc->reference_caption(static_cast(i))) { - any_caption = true; + bool any_text = false; + for (int i = 0; i < TEXT_COUNT; ++i) { + if (dc->reference_text(static_cast(i))) { + any_text = true; } } - if (dc->reference_video() || dc->reference_audio() || any_caption) { + if (dc->reference_video() || dc->reference_audio() || any_text) { vf = true; } } @@ -1102,8 +1102,8 @@ Film::add_content (shared_ptr c) /* Add {video,subtitle} content after any existing {video,subtitle} content */ if (c->video) { c->set_position (_playlist->video_end()); - } else if (!c->caption.empty()) { - c->set_position (_playlist->caption_end()); + } else if (!c->text.empty()) { + c->set_position (_playlist->text_end()); } if (_template_film) { @@ -1391,7 +1391,7 @@ Film::subtitle_language () const set languages; BOOST_FOREACH (shared_ptr i, content()) { - BOOST_FOREACH (shared_ptr j, i->caption) { + BOOST_FOREACH (shared_ptr j, i->text) { languages.insert (j->language ()); } } diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 8cc0cfbfb..31b2ad849 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -56,7 +56,7 @@ get_hints (shared_ptr film) bool big_font_files = false; if (film->interop ()) { BOOST_FOREACH (shared_ptr i, content) { - BOOST_FOREACH (shared_ptr j, i->caption) { + BOOST_FOREACH (shared_ptr j, i->text) { BOOST_FOREACH (shared_ptr k, j->fonts()) { for (int l = 0; l < FontFiles::VARIANTS; ++l) { optional const p = k->file (static_cast(l)); diff --git a/src/lib/player.cc b/src/lib/player.cc index 22526edef..831d503f9 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -89,7 +89,7 @@ Player::Player (shared_ptr film, shared_ptr playlist , _playlist (playlist) , _have_valid_pieces (false) , _ignore_video (false) - , _ignore_caption (false) + , _ignore_text (false) , _fast (false) , _play_referenced (false) , _audio_merger (_film->audio_frame_rate()) @@ -137,8 +137,8 @@ Player::setup_pieces () decoder->video->set_ignore (true); } - if (_ignore_caption) { - BOOST_FOREACH (shared_ptr i, decoder->caption) { + if (_ignore_text) { + BOOST_FOREACH (shared_ptr i, decoder->text) { i->set_ignore (true); } } @@ -167,9 +167,9 @@ Player::setup_pieces () decoder->audio->Data.connect (bind (&Player::audio, this, weak_ptr (piece), _1, _2)); } - list >::const_iterator j = decoder->caption.begin(); + list >::const_iterator j = decoder->text.begin(); - while (j != decoder->caption.end()) { + while (j != decoder->text.end()) { (*j)->BitmapStart.connect ( bind(&Player::bitmap_text_start, this, weak_ptr(piece), weak_ptr((*j)->content()), _1) ); @@ -302,7 +302,7 @@ Player::film_changed (Film::Property p) } list -Player::transform_bitmap_captions (list subs) const +Player::transform_bitmap_texts (list subs) const { list all; @@ -419,7 +419,7 @@ Player::get_subtitle_fonts () list > fonts; BOOST_FOREACH (shared_ptr i, _pieces) { - BOOST_FOREACH (shared_ptr j, i->content->caption) { + BOOST_FOREACH (shared_ptr j, i->content->text) { /* XXX: things may go wrong if there are duplicate font IDs with different font files. */ @@ -439,16 +439,16 @@ Player::set_ignore_video () } void -Player::set_ignore_caption () +Player::set_ignore_text () { - _ignore_caption = true; + _ignore_text = true; } -/** Set the player to always burn open captions into the image regardless of the content settings */ +/** Set the player to always burn open texts into the image regardless of the content settings */ void -Player::set_always_burn_open_captions () +Player::set_always_burn_open_subtitles () { - _always_burn_open_captions = true; + _always_burn_open_subtitles = true; } /** Sets up the player to be faster, possibly at the expense of quality */ @@ -514,7 +514,7 @@ Player::get_reel_assets () ); } - if (j->reference_caption (CAPTION_OPEN)) { + if (j->reference_text (TEXT_OPEN_SUBTITLE)) { shared_ptr ra = k->main_subtitle (); DCPOMATIC_ASSERT (ra); ra->set_entry_point (ra->entry_point() + trim_start); @@ -524,7 +524,7 @@ Player::get_reel_assets () ); } - if (j->reference_caption (CAPTION_CLOSED)) { + if (j->reference_text (TEXT_CLOSED_CAPTION)) { shared_ptr ra = k->closed_caption (); DCPOMATIC_ASSERT (ra); ra->set_entry_point (ra->entry_point() + trim_start); @@ -570,10 +570,10 @@ Player::pass () i->done = true; } else { - /* Given two choices at the same time, pick the one with captions so we see it before + /* Given two choices at the same time, pick the one with texts so we see it before the video. */ - if (!earliest_time || t < *earliest_time || (t == *earliest_time && !i->decoder->caption.empty())) { + if (!earliest_time || t < *earliest_time || (t == *earliest_time && !i->decoder->text.empty())) { earliest_time = t; earliest_content = i; } @@ -679,25 +679,25 @@ Player::pass () list Player::closed_captions_for_frame (DCPTime time) const { - return _active_captions[CAPTION_CLOSED].get ( + return _active_texts[TEXT_CLOSED_CAPTION].get ( DCPTimePeriod(time, time + DCPTime::from_frames(1, _film->video_frame_rate())) ); } -/** @return Open captions for the frame at the given time, converted to images */ +/** @return Open subtitles for the frame at the given time, converted to images */ optional -Player::open_captions_for_frame (DCPTime time) const +Player::open_subtitles_for_frame (DCPTime time) const { list captions; int const vfr = _film->video_frame_rate(); BOOST_FOREACH ( PlayerText j, - _active_captions[CAPTION_OPEN].get_burnt(DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_open_captions) + _active_texts[TEXT_OPEN_SUBTITLE].get_burnt(DCPTimePeriod(time, time + DCPTime::from_frames(1, vfr)), _always_burn_open_subtitles) ) { /* Image subtitles */ - list c = transform_bitmap_captions (j.image); + list c = transform_bitmap_texts (j.image); copy (c.begin(), c.end(), back_inserter (captions)); /* Text subtitles (rendered to an image) */ @@ -873,36 +873,36 @@ void Player::bitmap_text_start (weak_ptr wp, weak_ptr wc, ContentBitmapText subtitle) { shared_ptr piece = wp.lock (); - shared_ptr caption = wc.lock (); - if (!piece || !caption) { + shared_ptr text = wc.lock (); + if (!piece || !text) { return; } /* Apply content's subtitle offsets */ - subtitle.sub.rectangle.x += caption->x_offset (); - subtitle.sub.rectangle.y += caption->y_offset (); + subtitle.sub.rectangle.x += text->x_offset (); + subtitle.sub.rectangle.y += text->y_offset (); /* Apply a corrective translation to keep the subtitle centred after the scale that is coming up */ - subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * ((caption->x_scale() - 1) / 2); - subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * ((caption->y_scale() - 1) / 2); + subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * ((text->x_scale() - 1) / 2); + subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * ((text->y_scale() - 1) / 2); /* Apply content's subtitle scale */ - subtitle.sub.rectangle.width *= caption->x_scale (); - subtitle.sub.rectangle.height *= caption->y_scale (); + subtitle.sub.rectangle.width *= text->x_scale (); + subtitle.sub.rectangle.height *= text->y_scale (); PlayerText ps; ps.image.push_back (subtitle.sub); DCPTime from (content_time_to_dcp (piece, subtitle.from())); - _active_captions[subtitle.type()].add_from (wc, ps, from); + _active_texts[subtitle.type()].add_from (wc, ps, from); } void Player::plain_text_start (weak_ptr wp, weak_ptr wc, ContentStringText subtitle) { shared_ptr piece = wp.lock (); - shared_ptr caption = wc.lock (); - if (!piece || !caption) { + shared_ptr text = wc.lock (); + if (!piece || !text) { return; } @@ -914,10 +914,10 @@ Player::plain_text_start (weak_ptr wp, weak_ptr wc, Co } BOOST_FOREACH (dcp::SubtitleString s, subtitle.subs) { - s.set_h_position (s.h_position() + caption->x_offset ()); - s.set_v_position (s.v_position() + caption->y_offset ()); - float const xs = caption->x_scale(); - float const ys = caption->y_scale(); + s.set_h_position (s.h_position() + text->x_offset ()); + s.set_v_position (s.v_position() + text->y_offset ()); + float const xs = text->x_scale(); + float const ys = text->y_scale(); float size = s.size(); /* Adjust size to express the common part of the scaling; @@ -934,23 +934,23 @@ Player::plain_text_start (weak_ptr wp, weak_ptr wc, Co } s.set_in (dcp::Time(from.seconds(), 1000)); - ps.text.push_back (StringText (s, caption->outline_width())); - ps.add_fonts (caption->fonts ()); + ps.text.push_back (StringText (s, text->outline_width())); + ps.add_fonts (text->fonts ()); } - _active_captions[subtitle.type()].add_from (wc, ps, from); + _active_texts[subtitle.type()].add_from (wc, ps, from); } void Player::subtitle_stop (weak_ptr wp, weak_ptr wc, ContentTime to, TextType type) { - if (!_active_captions[type].have (wc)) { + if (!_active_texts[type].have (wc)) { return; } shared_ptr piece = wp.lock (); - shared_ptr caption = wc.lock (); - if (!piece || !caption) { + shared_ptr text = wc.lock (); + if (!piece || !text) { return; } @@ -960,11 +960,11 @@ Player::subtitle_stop (weak_ptr wp, weak_ptr wc, Conte return; } - pair from = _active_captions[type].add_to (wc, dcp_to); + pair from = _active_texts[type].add_to (wc, dcp_to); - bool const always = type == CAPTION_OPEN && _always_burn_open_captions; - if (caption->use() && !always && !caption->burn()) { - Caption (from.first, type, DCPTimePeriod (from.second, dcp_to)); + bool const always = type == TEXT_OPEN_SUBTITLE && _always_burn_open_subtitles; + if (text->use() && !always && !text->burn()) { + Text (from.first, type, DCPTimePeriod (from.second, dcp_to)); } } @@ -986,8 +986,8 @@ Player::seek (DCPTime time, bool accurate) } _audio_merger.clear (); - for (int i = 0; i < CAPTION_COUNT; ++i) { - _active_captions[i].clear (); + for (int i = 0; i < TEXT_COUNT; ++i) { + _active_texts[i].clear (); } BOOST_FOREACH (shared_ptr i, _pieces) { @@ -1047,14 +1047,14 @@ void Player::do_emit_video (shared_ptr pv, DCPTime time) { if (pv->eyes() == EYES_BOTH || pv->eyes() == EYES_RIGHT) { - for (int i = 0; i < CAPTION_COUNT; ++i) { - _active_captions[i].clear_before (time); + for (int i = 0; i < TEXT_COUNT; ++i) { + _active_texts[i].clear_before (time); } } - optional captions = open_captions_for_frame (time); - if (captions) { - pv->set_caption (captions.get ()); + optional subtitles = open_subtitles_for_frame (time); + if (subtitles) { + pv->set_text (subtitles.get ()); } Video (pv, time); diff --git a/src/lib/player.h b/src/lib/player.h index 280373738..223db86b3 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -78,8 +78,8 @@ public: void set_video_container_size (dcp::Size); void set_ignore_video (); - void set_ignore_caption (); - void set_always_burn_open_captions (); + void set_ignore_text (); + void set_always_burn_open_subtitles (); void set_fast (); void set_play_referenced (); void set_dcp_decode_reduction (boost::optional reduction); @@ -100,10 +100,10 @@ public: /** Emitted when a video frame is ready. These emissions happen in the correct order. */ boost::signals2::signal, DCPTime)> Video; boost::signals2::signal, DCPTime)> Audio; - /** Emitted when a caption is ready. This signal may be emitted considerably + /** Emitted when a text is ready. This signal may be emitted considerably * after the corresponding Video. */ - boost::signals2::signal Caption; + boost::signals2::signal Text; private: friend class PlayerWrapper; @@ -118,7 +118,7 @@ private: void film_changed (Film::Property); void playlist_changed (); void playlist_content_changed (boost::weak_ptr, int, bool); - std::list transform_bitmap_captions (std::list) const; + std::list transform_bitmap_texts (std::list) const; Frame dcp_to_content_video (boost::shared_ptr piece, DCPTime t) const; DCPTime content_video_to_dcp (boost::shared_ptr piece, Frame f) const; Frame dcp_to_resampled_audio (boost::shared_ptr piece, DCPTime t) const; @@ -136,7 +136,7 @@ private: std::pair, DCPTime> discard_audio ( boost::shared_ptr audio, DCPTime time, DCPTime discard_to ) const; - boost::optional open_captions_for_frame (DCPTime time) const; + boost::optional open_subtitles_for_frame (DCPTime time) const; void emit_video (boost::shared_ptr pv, DCPTime time); void do_emit_video (boost::shared_ptr pv, DCPTime time); void emit_audio (boost::shared_ptr data, DCPTime time); @@ -154,9 +154,9 @@ private: /** true if the player should ignore all video; i.e. never produce any */ bool _ignore_video; - /** true if the player should ignore all captions; i.e. never produce any */ - bool _ignore_caption; - bool _always_burn_open_captions; + /** true if the player should ignore all text; i.e. never produce any */ + bool _ignore_text; + bool _always_burn_open_subtitles; /** true if we should try to be fast rather than high quality */ bool _fast; /** true if we should `play' (i.e output) referenced DCP data (e.g. for preview) */ @@ -195,7 +195,7 @@ private: Empty _black; Empty _silent; - ActiveText _active_captions[CAPTION_COUNT]; + ActiveText _active_texts[TEXT_COUNT]; boost::shared_ptr _audio_processor; boost::signals2::scoped_connection _film_changed_connection; diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index c8fb044aa..02c85be12 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -92,14 +92,14 @@ PlayerVideo::PlayerVideo (shared_ptr node, shared_ptr socket image->read_from_socket (socket); - _caption = PositionImage (image, Position (node->number_child ("SubtitleX"), node->number_child ("SubtitleY"))); + _text = PositionImage (image, Position (node->number_child ("SubtitleX"), node->number_child ("SubtitleY"))); } } void -PlayerVideo::set_caption (PositionImage image) +PlayerVideo::set_text (PositionImage image) { - _caption = image; + _text = image; } /** Create an image for this frame. @@ -153,8 +153,8 @@ PlayerVideo::image (dcp::NoteHandler note, functionpixel_format()), aligned, fast ); - if (_caption) { - out->alpha_blend (Image::ensure_aligned (_caption->image), _caption->position); + if (_text) { + out->alpha_blend (Image::ensure_aligned (_text->image), _text->position); } if (_fade) { @@ -181,11 +181,11 @@ PlayerVideo::add_metadata (xmlpp::Node* node) const if (_colour_conversion) { _colour_conversion.get().as_xml (node); } - if (_caption) { - node->add_child ("SubtitleWidth")->add_child_text (raw_convert (_caption->image->size().width)); - node->add_child ("SubtitleHeight")->add_child_text (raw_convert (_caption->image->size().height)); - node->add_child ("SubtitleX")->add_child_text (raw_convert (_caption->position.x)); - node->add_child ("SubtitleY")->add_child_text (raw_convert (_caption->position.y)); + if (_text) { + node->add_child ("SubtitleWidth")->add_child_text (raw_convert (_text->image->size().width)); + node->add_child ("SubtitleHeight")->add_child_text (raw_convert (_text->image->size().height)); + node->add_child ("SubtitleX")->add_child_text (raw_convert (_text->position.x)); + node->add_child ("SubtitleY")->add_child_text (raw_convert (_text->position.y)); } } @@ -193,8 +193,8 @@ void PlayerVideo::send_binary (shared_ptr socket) const { _in->send_binary (socket); - if (_caption) { - _caption->image->write_to_socket (socket); + if (_text) { + _text->image->write_to_socket (socket); } } @@ -208,7 +208,7 @@ PlayerVideo::has_j2k () const return false; } - return _crop == Crop () && _out_size == j2k->size() && !_caption && !_fade && !_colour_conversion; + return _crop == Crop () && _out_size == j2k->size() && !_text && !_fade && !_colour_conversion; } Data @@ -239,13 +239,13 @@ PlayerVideo::same (shared_ptr other) const return false; } - if ((!_caption && other->_caption) || (_caption && !other->_caption)) { - /* One has a caption and the other doesn't */ + if ((!_text && other->_text) || (_text && !other->_text)) { + /* One has a text and the other doesn't */ return false; } - if (_caption && other->_caption && !_caption->same (other->_caption.get ())) { - /* They both have captions but they are different */ + if (_text && other->_text && !_text->same (other->_text.get ())) { + /* They both have texts but they are different */ return false; } @@ -278,7 +278,7 @@ PlayerVideo::memory_used () const return _in->memory_used(); } -/** @return Shallow copy of this; _in and _caption are shared between the original and the copy */ +/** @return Shallow copy of this; _in and _text are shared between the original and the copy */ shared_ptr PlayerVideo::shallow_copy () const { diff --git a/src/lib/player_video.h b/src/lib/player_video.h index 96878e0bd..cd904af06 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -60,7 +60,7 @@ public: boost::shared_ptr shallow_copy () const; - void set_caption (PositionImage); + void set_text (PositionImage); void prepare (); boost::shared_ptr image (dcp::NoteHandler note, boost::function pixel_format, bool aligned, bool fast) const; @@ -109,7 +109,7 @@ private: Eyes _eyes; Part _part; boost::optional _colour_conversion; - boost::optional _caption; + boost::optional _text; /** Content that we came from. This is so that reset_metadata() can work */ boost::weak_ptr _content; /** Video frame that we came from. Again, this is for reset_metadata() */ diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index a55893291..c830e5e1e 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -135,7 +135,7 @@ Playlist::maybe_sequence () DCPTime next; BOOST_FOREACH (shared_ptr i, _content) { - if (i->caption.empty() || find (placed.begin(), placed.end(), i) != placed.end()) { + if (i->text.empty() || find (placed.begin(), placed.end(), i) != placed.end()) { continue; } @@ -156,7 +156,7 @@ Playlist::video_identifier () const BOOST_FOREACH (shared_ptr i, _content) { bool burn = false; - BOOST_FOREACH (shared_ptr j, i->caption) { + BOOST_FOREACH (shared_ptr j, i->text) { if (j->burn()) { burn = true; } @@ -368,11 +368,11 @@ Playlist::video_end () const } DCPTime -Playlist::caption_end () const +Playlist::text_end () const { DCPTime end; BOOST_FOREACH (shared_ptr i, _content) { - if (!i->caption.empty ()) { + if (!i->text.empty ()) { end = max (end, i->end ()); } } diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 073e53de7..4ee120198 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -64,7 +64,7 @@ public: int best_video_frame_rate () const; DCPTime video_end () const; - DCPTime caption_end () const; + DCPTime text_end () const; FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const; std::string content_summary (DCPTimePeriod period) const; std::pair speed_up_range (int dcp_video_frame_rate) const; diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 7f5572c36..2561e556a 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -508,8 +508,8 @@ ReelWriter::create_reel (list const & refs, listadd (reel_sound_asset); - maybe_add_captions (_caption_asset[CAPTION_OPEN], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); - maybe_add_captions (_caption_asset[CAPTION_CLOSED], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); + maybe_add_captions (_caption_asset[TEXT_OPEN_SUBTITLE], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); + maybe_add_captions (_caption_asset[TEXT_CLOSED_CAPTION], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); return reel; } diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h index 8007b7f29..a46c3efa7 100644 --- a/src/lib/reel_writer.h +++ b/src/lib/reel_writer.h @@ -113,7 +113,7 @@ private: boost::shared_ptr _picture_asset_writer; boost::shared_ptr _sound_asset; boost::shared_ptr _sound_asset_writer; - boost::shared_ptr _caption_asset[CAPTION_COUNT]; + boost::shared_ptr _caption_asset[TEXT_COUNT]; static int const _info_size; }; diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc index 6c181bb91..2698dbb6d 100644 --- a/src/lib/string_text_file_content.cc +++ b/src/lib/string_text_file_content.cc @@ -38,14 +38,14 @@ using dcp::raw_convert; StringTextFileContent::StringTextFileContent (shared_ptr film, boost::filesystem::path path) : Content (film, path) { - caption.push_back (shared_ptr (new TextContent (this, CAPTION_OPEN))); + text.push_back (shared_ptr (new TextContent (this, TEXT_OPEN_SUBTITLE))); } StringTextFileContent::StringTextFileContent (shared_ptr film, cxml::ConstNodePtr node, int version) : Content (film, node) , _length (node->number_child ("Length")) { - caption = TextContent::from_xml (this, node, version); + text = TextContent::from_xml (this, node, version); } void @@ -55,11 +55,11 @@ StringTextFileContent::examine (boost::shared_ptr job) StringTextFile s (shared_from_this ()); /* Default to turning these subtitles on */ - only_caption()->set_use (true); + only_text()->set_use (true); boost::mutex::scoped_lock lm (_mutex); _length = s.length (); - only_caption()->add_font (shared_ptr (new Font (TEXT_FONT_ID))); + only_text()->add_font (shared_ptr (new Font (TEXT_FONT_ID))); } string @@ -80,8 +80,8 @@ StringTextFileContent::as_xml (xmlpp::Node* node, bool with_paths) const node->add_child("Type")->add_child_text ("TextSubtitle"); Content::as_xml (node, with_paths); - if (only_caption()) { - only_caption()->as_xml (node); + if (only_text()) { + only_text()->as_xml (node); } node->add_child("Length")->add_child_text (raw_convert (_length.get ())); diff --git a/src/lib/string_text_file_decoder.cc b/src/lib/string_text_file_decoder.cc index a81f2592d..8286c1e39 100644 --- a/src/lib/string_text_file_decoder.cc +++ b/src/lib/string_text_file_decoder.cc @@ -43,7 +43,7 @@ StringTextFileDecoder::StringTextFileDecoder (shared_ptr (new TextDecoder (this, content->only_caption(), log, first))); + text.push_back (shared_ptr (new TextDecoder (this, content->only_text(), log, first))); } void @@ -73,7 +73,7 @@ StringTextFileDecoder::pass () } ContentTimePeriod const p = content_time_period (_subtitles[_next]); - only_caption()->emit_plain (p, _subtitles[_next]); + only_text()->emit_plain (p, _subtitles[_next]); ++_next; return false; diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc index fbc7d82af..011c42f35 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -120,8 +120,8 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version) , _y_scale (1) , _line_spacing (node->optional_number_child("LineSpacing").get_value_or (1)) , _outline_width (node->optional_number_child("OutlineWidth").get_value_or (2)) - , _type (CAPTION_OPEN) - , _original_type (CAPTION_OPEN) + , _type (TEXT_OPEN_SUBTITLE) + , _original_type (TEXT_OPEN_SUBTITLE) { if (version >= 37) { _use = node->bool_child ("Use"); @@ -225,59 +225,59 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version) connect_to_fonts (); - _type = string_to_caption_type (node->optional_string_child("Type").get_value_or("open")); - _original_type = string_to_caption_type (node->optional_string_child("OriginalType").get_value_or("open")); + _type = string_to_text_type (node->optional_string_child("Type").get_value_or("open")); + _original_type = string_to_text_type (node->optional_string_child("OriginalType").get_value_or("open")); } TextContent::TextContent (Content* parent, vector > c) : ContentPart (parent) { /* This constructor is for join which is only supported for content types - that have a single caption, so we can use only_caption() here. + that have a single text, so we can use only_text() here. */ - shared_ptr ref = c[0]->only_caption(); + shared_ptr ref = c[0]->only_text(); DCPOMATIC_ASSERT (ref); list > ref_fonts = ref->fonts (); for (size_t i = 1; i < c.size(); ++i) { - if (c[i]->only_caption()->use() != ref->use()) { + if (c[i]->only_text()->use() != ref->use()) { throw JoinError (_("Content to be joined must have the same 'use subtitles' setting.")); } - if (c[i]->only_caption()->burn() != ref->burn()) { + if (c[i]->only_text()->burn() != ref->burn()) { throw JoinError (_("Content to be joined must have the same 'burn subtitles' setting.")); } - if (c[i]->only_caption()->x_offset() != ref->x_offset()) { + if (c[i]->only_text()->x_offset() != ref->x_offset()) { throw JoinError (_("Content to be joined must have the same subtitle X offset.")); } - if (c[i]->only_caption()->y_offset() != ref->y_offset()) { + if (c[i]->only_text()->y_offset() != ref->y_offset()) { throw JoinError (_("Content to be joined must have the same subtitle Y offset.")); } - if (c[i]->only_caption()->x_scale() != ref->x_scale()) { + if (c[i]->only_text()->x_scale() != ref->x_scale()) { throw JoinError (_("Content to be joined must have the same subtitle X scale.")); } - if (c[i]->only_caption()->y_scale() != ref->y_scale()) { + if (c[i]->only_text()->y_scale() != ref->y_scale()) { throw JoinError (_("Content to be joined must have the same subtitle Y scale.")); } - if (c[i]->only_caption()->line_spacing() != ref->line_spacing()) { + if (c[i]->only_text()->line_spacing() != ref->line_spacing()) { throw JoinError (_("Content to be joined must have the same subtitle line spacing.")); } - if ((c[i]->only_caption()->fade_in() != ref->fade_in()) || (c[i]->only_caption()->fade_out() != ref->fade_out())) { + if ((c[i]->only_text()->fade_in() != ref->fade_in()) || (c[i]->only_text()->fade_out() != ref->fade_out())) { throw JoinError (_("Content to be joined must have the same subtitle fades.")); } - if ((c[i]->only_caption()->outline_width() != ref->outline_width())) { + if ((c[i]->only_text()->outline_width() != ref->outline_width())) { throw JoinError (_("Content to be joined must have the same outline width.")); } - list > fonts = c[i]->only_caption()->fonts (); + list > fonts = c[i]->only_text()->fonts (); if (fonts.size() != ref_fonts.size()) { throw JoinError (_("Content to be joined must use the same fonts.")); } @@ -318,53 +318,53 @@ TextContent::as_xml (xmlpp::Node* root) const { boost::mutex::scoped_lock lm (_mutex); - xmlpp::Element* caption = root->add_child ("Caption"); + xmlpp::Element* text = root->add_child ("Text"); - caption->add_child("Use")->add_child_text (_use ? "1" : "0"); - caption->add_child("Burn")->add_child_text (_burn ? "1" : "0"); - caption->add_child("XOffset")->add_child_text (raw_convert (_x_offset)); - caption->add_child("YOffset")->add_child_text (raw_convert (_y_offset)); - caption->add_child("XScale")->add_child_text (raw_convert (_x_scale)); - caption->add_child("YScale")->add_child_text (raw_convert (_y_scale)); - caption->add_child("Language")->add_child_text (_language); + text->add_child("Use")->add_child_text (_use ? "1" : "0"); + text->add_child("Burn")->add_child_text (_burn ? "1" : "0"); + text->add_child("XOffset")->add_child_text (raw_convert (_x_offset)); + text->add_child("YOffset")->add_child_text (raw_convert (_y_offset)); + text->add_child("XScale")->add_child_text (raw_convert (_x_scale)); + text->add_child("YScale")->add_child_text (raw_convert (_y_scale)); + text->add_child("Language")->add_child_text (_language); if (_colour) { - caption->add_child("Red")->add_child_text (raw_convert (_colour->r)); - caption->add_child("Green")->add_child_text (raw_convert (_colour->g)); - caption->add_child("Blue")->add_child_text (raw_convert (_colour->b)); + text->add_child("Red")->add_child_text (raw_convert (_colour->r)); + text->add_child("Green")->add_child_text (raw_convert (_colour->g)); + text->add_child("Blue")->add_child_text (raw_convert (_colour->b)); } if (_effect) { switch (*_effect) { case dcp::NONE: - caption->add_child("Effect")->add_child_text("none"); + text->add_child("Effect")->add_child_text("none"); break; case dcp::BORDER: - caption->add_child("Effect")->add_child_text("outline"); + text->add_child("Effect")->add_child_text("outline"); break; case dcp::SHADOW: - caption->add_child("Effect")->add_child_text("shadow"); + text->add_child("Effect")->add_child_text("shadow"); break; } } if (_effect_colour) { - caption->add_child("EffectRed")->add_child_text (raw_convert (_effect_colour->r)); - caption->add_child("EffectGreen")->add_child_text (raw_convert (_effect_colour->g)); - caption->add_child("EffectBlue")->add_child_text (raw_convert (_effect_colour->b)); + text->add_child("EffectRed")->add_child_text (raw_convert (_effect_colour->r)); + text->add_child("EffectGreen")->add_child_text (raw_convert (_effect_colour->g)); + text->add_child("EffectBlue")->add_child_text (raw_convert (_effect_colour->b)); } - caption->add_child("LineSpacing")->add_child_text (raw_convert (_line_spacing)); + text->add_child("LineSpacing")->add_child_text (raw_convert (_line_spacing)); if (_fade_in) { - caption->add_child("FadeIn")->add_child_text (raw_convert (_fade_in->get())); + text->add_child("FadeIn")->add_child_text (raw_convert (_fade_in->get())); } if (_fade_out) { - caption->add_child("FadeOut")->add_child_text (raw_convert (_fade_out->get())); + text->add_child("FadeOut")->add_child_text (raw_convert (_fade_out->get())); } - caption->add_child("OutlineWidth")->add_child_text (raw_convert (_outline_width)); + text->add_child("OutlineWidth")->add_child_text (raw_convert (_outline_width)); for (list >::const_iterator i = _fonts.begin(); i != _fonts.end(); ++i) { - (*i)->as_xml (caption->add_child("Font")); + (*i)->as_xml (text->add_child("Font")); } - caption->add_child("Type")->add_child_text (caption_type_to_string(_type)); - caption->add_child("OriginalType")->add_child_text (caption_type_to_string(_original_type)); + text->add_child("Type")->add_child_text (text_type_to_string(_type)); + text->add_child("OriginalType")->add_child_text (text_type_to_string(_original_type)); } string diff --git a/src/lib/types.cc b/src/lib/types.cc index 7f0bf4305..d25c9aba4 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -94,37 +94,37 @@ Crop::as_xml (xmlpp::Node* node) const } TextType -string_to_caption_type (string s) +string_to_text_type (string s) { - if (s == "open") { - return CAPTION_OPEN; + if (s == "open-subtitle") { + return TEXT_OPEN_SUBTITLE; } else if (s == "closed") { - return CAPTION_CLOSED; + return TEXT_CLOSED_CAPTION; } else { - throw MetadataError (String::compose ("Unknown caption type %1", s)); + throw MetadataError (String::compose ("Unknown text type %1", s)); } } string -caption_type_to_string (TextType t) +text_type_to_string (TextType t) { switch (t) { - case CAPTION_OPEN: - return "open"; - case CAPTION_CLOSED: - return "closed"; + case TEXT_OPEN_SUBTITLE: + return "open-subtitle"; + case TEXT_CLOSED_CAPTION: + return "closed-caption"; default: DCPOMATIC_ASSERT (false); } } string -caption_type_to_name (TextType t) +text_type_to_name (TextType t) { switch (t) { - case CAPTION_OPEN: - return _("Subtitles"); - case CAPTION_CLOSED: + case TEXT_OPEN_SUBTITLE: + return _("Open subtitles"); + case TEXT_CLOSED_CAPTION: return _("Closed captions"); default: DCPOMATIC_ASSERT (false); diff --git a/src/lib/types.h b/src/lib/types.h index 6e3732d31..02d71e297 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -130,25 +130,28 @@ enum ReelType }; /** Type of captions. - * For better or worse DoM has uses two names for text that appears - * with the DCP: * - * open captions: text that is shown to everybody on-screen (aka subtitles). - * closed captions: text that is shown to some viewers using some other method. + * The generally accepted definitions seem to be: + * - subtitles: text for an audience who doesn't speak the film's language + * - captions: text for a hearing-impaired audience + * - open: on-screen + * - closed: only visible by some audience members * - * There is also still use of the word `subtitle' in the code; these are the - * same as open captions in DoM. + * At the moment DoM supports open subtitles and closed captions. + * + * There is some use of the word `subtitle' in the code which may mean + * caption in some contexts. */ enum TextType { - CAPTION_OPEN, - CAPTION_CLOSED, - CAPTION_COUNT + TEXT_OPEN_SUBTITLE, + TEXT_CLOSED_CAPTION, + TEXT_COUNT }; -extern std::string caption_type_to_string (TextType t); -extern std::string caption_type_to_name (TextType t); -extern TextType string_to_caption_type (std::string s); +extern std::string text_type_to_string (TextType t); +extern std::string text_type_to_name (TextType t); +extern TextType string_to_text_type (std::string s); /** @struct Crop * @brief A description of the crop of an image or video. diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 3ab1cc5b9..b4655baf9 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -95,7 +95,7 @@ Writer::Writer (shared_ptr film, weak_ptr j) and captions arrive to the Writer in sequence. This is not so for video. */ _audio_reel = _reels.begin (); - for (int i = 0; i < CAPTION_COUNT; ++i) { + for (int i = 0; i < TEXT_COUNT; ++i) { _caption_reel[i] = _reels.begin (); } diff --git a/src/lib/writer.h b/src/lib/writer.h index 71d11b773..8fc0ce29e 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -124,7 +124,7 @@ private: boost::weak_ptr _job; std::vector _reels; std::vector::iterator _audio_reel; - std::vector::iterator _caption_reel[CAPTION_COUNT]; + std::vector::iterator _caption_reel[TEXT_COUNT]; /** our thread, or 0 */ boost::thread* _thread; diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index a2b55691e..a97e12b69 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -567,7 +567,7 @@ private: { DCPOMATIC_ASSERT (_clipboard); - PasteDialog* d = new PasteDialog (this, static_cast(_clipboard->video), static_cast(_clipboard->audio), !_clipboard->caption.empty()); + PasteDialog* d = new PasteDialog (this, static_cast(_clipboard->video), static_cast(_clipboard->audio), !_clipboard->text.empty()); if (d->ShowModal() == wxID_OK) { BOOST_FOREACH (shared_ptr i, _film_editor->content_panel()->selected()) { if (d->video() && i->video) { @@ -579,10 +579,10 @@ private: i->audio->take_settings_from (_clipboard->audio); } - if (d->caption()) { - list >::iterator j = i->caption.begin (); - list >::const_iterator k = _clipboard->caption.begin (); - while (j != i->caption.end() && k != _clipboard->caption.end()) { + if (d->text()) { + list >::iterator j = i->text.begin (); + list >::const_iterator k = _clipboard->text.begin (); + while (j != i->text.end() && k != _clipboard->text.end()) { (*j)->take_settings_from (*k); ++j; ++k; diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 44c6b8606..fce069d7e 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -626,7 +626,7 @@ private: void setup_from_dcp (shared_ptr dcp) { - BOOST_FOREACH (shared_ptr i, dcp->caption) { + BOOST_FOREACH (shared_ptr i, dcp->text) { i->set_use (true); } diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index a6338ecfd..820372728 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -127,9 +127,9 @@ ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr film, FilmVie _panels.push_back (_video_panel); _audio_panel = new AudioPanel (this); _panels.push_back (_audio_panel); - for (int i = 0; i < CAPTION_COUNT; ++i) { - _caption_panel[i] = new TextPanel (this, static_cast(i)); - _panels.push_back (_caption_panel[i]); + for (int i = 0; i < TEXT_COUNT; ++i) { + _text_panel[i] = new TextPanel (this, static_cast(i)); + _panels.push_back (_text_panel[i]); } _timing_panel = new TimingPanel (this, _film_viewer); _panels.push_back (_timing_panel); @@ -195,12 +195,12 @@ ContentPanel::selected_audio () } ContentList -ContentPanel::selected_caption () +ContentPanel::selected_text () { ContentList sc; BOOST_FOREACH (shared_ptr i, selected ()) { - if (!i->caption.empty()) { + if (!i->text.empty()) { sc.push_back (i); } } @@ -298,7 +298,7 @@ ContentPanel::selection_changed () bool have_video = false; bool have_audio = false; - bool have_caption[CAPTION_COUNT] = { false, false }; + bool have_text[TEXT_COUNT] = { false, false }; BOOST_FOREACH (shared_ptr i, selected()) { if (i->video) { have_video = true; @@ -306,23 +306,23 @@ ContentPanel::selection_changed () if (i->audio) { have_audio = true; } - BOOST_FOREACH (shared_ptr j, i->caption) { - have_caption[j->original_type()] = true; + BOOST_FOREACH (shared_ptr j, i->text) { + have_text[j->original_type()] = true; } } bool video_panel = false; bool audio_panel = false; - bool caption_panel[CAPTION_COUNT] = { false, false }; + bool text_panel[TEXT_COUNT] = { false, false }; for (size_t i = 0; i < _notebook->GetPageCount(); ++i) { if (_notebook->GetPage(i) == _video_panel) { video_panel = true; } else if (_notebook->GetPage(i) == _audio_panel) { audio_panel = true; } - for (int j = 0; j < CAPTION_COUNT; ++j) { - if (_notebook->GetPage(i) == _caption_panel[j]) { - caption_panel[j] = true; + for (int j = 0; j < TEXT_COUNT; ++j) { + if (_notebook->GetPage(i) == _text_panel[j]) { + text_panel[j] = true; } } } @@ -355,16 +355,16 @@ ContentPanel::selection_changed () ++off; } - for (int i = 0; i < CAPTION_COUNT; ++i) { - if (have_caption[i] != caption_panel[i]) { - if (caption_panel[i]) { + for (int i = 0; i < TEXT_COUNT; ++i) { + if (have_text[i] != text_panel[i]) { + if (text_panel[i]) { _notebook->RemovePage (off); } - if (have_caption[i]) { - _notebook->InsertPage (off, _caption_panel[i], _caption_panel[i]->name()); + if (have_text[i]) { + _notebook->InsertPage (off, _text_panel[i], _text_panel[i]->name()); } } - if (have_caption[i]) { + if (have_text[i]) { ++off; } } @@ -550,8 +550,8 @@ ContentPanel::setup_sensitivity () _video_panel->Enable (_generally_sensitive && video_selection.size() > 0); _audio_panel->Enable (_generally_sensitive && audio_selection.size() > 0); - for (int i = 0; i < CAPTION_COUNT; ++i) { - _caption_panel[i]->Enable (_generally_sensitive && selection.size() == 1 && !selection.front()->caption.empty()); + for (int i = 0; i < TEXT_COUNT; ++i) { + _text_panel[i]->Enable (_generally_sensitive && selection.size() == 1 && !selection.front()->text.empty()); } _timing_panel->Enable (_generally_sensitive); } diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h index d31375c8e..82cb2ed88 100644 --- a/src/wx/content_panel.h +++ b/src/wx/content_panel.h @@ -65,7 +65,7 @@ public: ContentList selected (); ContentList selected_video (); ContentList selected_audio (); - ContentList selected_caption (); + ContentList selected_text (); FFmpegContentList selected_ffmpeg (); void add_file_clicked (); @@ -105,7 +105,7 @@ private: wxButton* _timeline; ContentSubPanel* _video_panel; AudioPanel* _audio_panel; - TextPanel* _caption_panel[CAPTION_COUNT]; + TextPanel* _text_panel[TEXT_COUNT]; ContentSubPanel* _timing_panel; std::list _panels; ContentMenu* _menu; diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index f1f82287d..5c4d3148d 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -438,7 +438,7 @@ DCPPanel::film_content_changed (int property) property == VideoContentProperty::SCALE || property == DCPContentProperty::REFERENCE_VIDEO || property == DCPContentProperty::REFERENCE_AUDIO || - property == DCPContentProperty::REFERENCE_CAPTION) { + property == DCPContentProperty::REFERENCE_TEXT) { setup_dcp_name (); setup_sensitivity (); } diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 651196d3c..ef28018e9 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -224,7 +224,7 @@ FilmViewer::set_film (shared_ptr film) _closed_captions_dialog->set_player (_player); - _player->set_always_burn_open_captions (); + _player->set_always_burn_open_subtitles (); _player->set_play_referenced (); _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1)); diff --git a/src/wx/paste_dialog.cc b/src/wx/paste_dialog.cc index 07a3b156c..c613cad3b 100644 --- a/src/wx/paste_dialog.cc +++ b/src/wx/paste_dialog.cc @@ -20,7 +20,7 @@ #include "paste_dialog.h" -PasteDialog::PasteDialog (wxWindow* parent, bool video, bool audio, bool caption) +PasteDialog::PasteDialog (wxWindow* parent, bool video, bool audio, bool text) : TableDialog (parent, _("Paste"), 1, 0, true) { _video = new wxCheckBox (this, wxID_ANY, _("Paste video settings")); @@ -29,9 +29,9 @@ PasteDialog::PasteDialog (wxWindow* parent, bool video, bool audio, bool caption _audio = new wxCheckBox (this, wxID_ANY, _("Paste audio settings")); _audio->Enable (audio); add (_audio); - _caption = new wxCheckBox (this, wxID_ANY, _("Paste caption settings")); - _caption->Enable (caption); - add (_caption); + _text = new wxCheckBox (this, wxID_ANY, _("Paste subtitle and caption settings")); + _text->Enable (text); + add (_text); layout (); } @@ -49,7 +49,7 @@ PasteDialog::audio () const } bool -PasteDialog::caption () const +PasteDialog::text () const { - return _caption->GetValue (); + return _text->GetValue (); } diff --git a/src/wx/paste_dialog.h b/src/wx/paste_dialog.h index 7de38fd2c..792195947 100644 --- a/src/wx/paste_dialog.h +++ b/src/wx/paste_dialog.h @@ -23,14 +23,14 @@ class PasteDialog : public TableDialog { public: - PasteDialog (wxWindow* parent, bool video, bool audio, bool caption); + PasteDialog (wxWindow* parent, bool video, bool audio, bool text); bool video () const; bool audio () const; - bool caption () const; + bool text () const; private: wxCheckBox* _video; wxCheckBox* _audio; - wxCheckBox* _caption; + wxCheckBox* _text; }; diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc index c2bf77259..dbb394c64 100644 --- a/src/wx/player_information.cc +++ b/src/wx/player_information.cc @@ -131,7 +131,7 @@ PlayerInformation::triggered_update () if (dcp->audio && !dcp->audio->streams().empty()) { checked_set (_dcp[r++], wxString::Format(_("Audio channels: %d"), dcp->audio->streams().front()->channels())); } - if (!dcp->caption.empty()) { + if (!dcp->text.empty()) { checked_set (_dcp[r++], _("Subtitles: yes")); } else { checked_set (_dcp[r++], _("Subtitles: no")); diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index bc1183443..81ea9c941 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -45,8 +45,8 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; TextPanel::TextPanel (ContentPanel* p, TextType t) - : ContentSubPanel (p, std_to_wx(caption_type_to_name(t))) - , _caption_view (0) + : ContentSubPanel (p, std_to_wx(text_type_to_name(t))) + , _text_view (0) , _fonts_dialog (0) , _original_type (t) { @@ -73,7 +73,7 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) _use = new wxCheckBox (this, wxID_ANY, _("Use as")); use->Add (_use, 0, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP); _type = new wxChoice (this, wxID_ANY); - _type->Append (_("subtitles (open captions)")); + _type->Append (_("open subtitles")); _type->Append (_("closed captions")); use->Add (_type, 1, wxEXPAND, 0); grid->Add (use, wxGBPosition (r, 0), wxGBSpan (1, 2)); @@ -146,8 +146,8 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) { wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _caption_view_button = new wxButton (this, wxID_ANY, _("View...")); - s->Add (_caption_view_button, 1, wxALL, DCPOMATIC_SIZER_GAP); + _text_view_button = new wxButton (this, wxID_ANY, _("View...")); + s->Add (_text_view_button, 1, wxALL, DCPOMATIC_SIZER_GAP); _fonts_dialog_button = new wxButton (this, wxID_ANY, _("Fonts...")); s->Add (_fonts_dialog_button, 1, wxALL, DCPOMATIC_SIZER_GAP); _appearance_dialog_button = new wxButton (this, wxID_ANY, _("Appearance...")); @@ -165,7 +165,7 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) _reference->Bind (wxEVT_CHECKBOX, boost::bind (&TextPanel::reference_clicked, this)); _use->Bind (wxEVT_CHECKBOX, boost::bind (&TextPanel::use_toggled, this)); - _type->Bind (wxEVT_CHOICE, boost::bind (&TextPanel::type_changed, this)); + _type->Bind (wxEVT_CHOICE, boost::bind (&TextPanel::type_changed, this)); _burn->Bind (wxEVT_CHECKBOX, boost::bind (&TextPanel::burn_toggled, this)); _x_offset->Bind (wxEVT_SPINCTRL, boost::bind (&TextPanel::x_offset_changed, this)); _y_offset->Bind (wxEVT_SPINCTRL, boost::bind (&TextPanel::y_offset_changed, this)); @@ -174,7 +174,7 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) _line_spacing->Bind (wxEVT_SPINCTRL, boost::bind (&TextPanel::line_spacing_changed, this)); _language->Bind (wxEVT_TEXT, boost::bind (&TextPanel::language_changed, this)); _stream->Bind (wxEVT_CHOICE, boost::bind (&TextPanel::stream_changed, this)); - _caption_view_button->Bind (wxEVT_BUTTON, boost::bind (&TextPanel::caption_view_clicked, this)); + _text_view_button->Bind (wxEVT_BUTTON, boost::bind (&TextPanel::text_view_clicked, this)); _fonts_dialog_button->Bind (wxEVT_BUTTON, boost::bind (&TextPanel::fonts_dialog_clicked, this)); _appearance_dialog_button->Bind (wxEVT_BUTTON, boost::bind (&TextPanel::appearance_dialog_clicked, this)); } @@ -191,7 +191,7 @@ void TextPanel::film_content_changed (int property) { FFmpegContentList fc = _parent->selected_ffmpeg (); - ContentList sc = _parent->selected_caption (); + ContentList sc = _parent->selected_text (); shared_ptr fcs; if (fc.size() == 1) { @@ -203,9 +203,9 @@ TextPanel::film_content_changed (int property) scs = sc.front (); } - shared_ptr caption; + shared_ptr text; if (scs) { - caption = scs->caption_of_original_type(_original_type); + text = scs->text_of_original_type(_original_type); } if (property == FFmpegContentProperty::SUBTITLE_STREAMS) { @@ -224,15 +224,15 @@ TextPanel::film_content_changed (int property) } setup_sensitivity (); } else if (property == TextContentProperty::USE) { - checked_set (_use, caption ? caption->use() : false); + checked_set (_use, text ? text->use() : false); setup_sensitivity (); } else if (property == TextContentProperty::TYPE) { - if (caption) { - switch (caption->type()) { - case CAPTION_OPEN: + if (text) { + switch (text->type()) { + case TEXT_OPEN_SUBTITLE: _type->SetSelection (0); break; - case CAPTION_CLOSED: + case TEXT_CLOSED_CAPTION: _type->SetSelection (1); break; default: @@ -243,29 +243,29 @@ TextPanel::film_content_changed (int property) } setup_sensitivity (); } else if (property == TextContentProperty::BURN) { - checked_set (_burn, caption ? caption->burn() : false); + checked_set (_burn, text ? text->burn() : false); } else if (property == TextContentProperty::X_OFFSET) { - checked_set (_x_offset, caption ? lrint (caption->x_offset() * 100) : 0); + checked_set (_x_offset, text ? lrint (text->x_offset() * 100) : 0); } else if (property == TextContentProperty::Y_OFFSET) { - checked_set (_y_offset, caption ? lrint (caption->y_offset() * 100) : 0); + checked_set (_y_offset, text ? lrint (text->y_offset() * 100) : 0); } else if (property == TextContentProperty::X_SCALE) { - checked_set (_x_scale, caption ? lrint (caption->x_scale() * 100) : 100); + checked_set (_x_scale, text ? lrint (text->x_scale() * 100) : 100); } else if (property == TextContentProperty::Y_SCALE) { - checked_set (_y_scale, caption ? lrint (caption->y_scale() * 100) : 100); + checked_set (_y_scale, text ? lrint (text->y_scale() * 100) : 100); } else if (property == TextContentProperty::LINE_SPACING) { - checked_set (_line_spacing, caption ? lrint (caption->line_spacing() * 100) : 100); + checked_set (_line_spacing, text ? lrint (text->line_spacing() * 100) : 100); } else if (property == TextContentProperty::LANGUAGE) { - checked_set (_language, caption ? caption->language() : ""); - } else if (property == DCPContentProperty::REFERENCE_CAPTION) { + checked_set (_language, text ? text->language() : ""); + } else if (property == DCPContentProperty::REFERENCE_TEXT) { if (scs) { shared_ptr dcp = dynamic_pointer_cast (scs); - checked_set (_reference, dcp ? dcp->reference_caption(_original_type) : false); + checked_set (_reference, dcp ? dcp->reference_text(_original_type) : false); } else { checked_set (_reference, false); } setup_sensitivity (); - } else if (property == DCPContentProperty::CAPTIONS) { + } else if (property == DCPContentProperty::TEXTS) { setup_sensitivity (); } } @@ -273,21 +273,21 @@ TextPanel::film_content_changed (int property) void TextPanel::use_toggled () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption()) { - i->caption_of_original_type(_original_type)->set_use (_use->GetValue()); + BOOST_FOREACH (shared_ptr i, _parent->selected_text()) { + i->text_of_original_type(_original_type)->set_use (_use->GetValue()); } } void TextPanel::type_changed () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption()) { + BOOST_FOREACH (shared_ptr i, _parent->selected_text()) { switch (_type->GetSelection()) { case 0: - i->caption_of_original_type(_original_type)->set_type (CAPTION_OPEN); + i->text_of_original_type(_original_type)->set_type (TEXT_OPEN_SUBTITLE); break; case 1: - i->caption_of_original_type(_original_type)->set_type (CAPTION_CLOSED); + i->text_of_original_type(_original_type)->set_type (TEXT_CLOSED_CAPTION); break; } } @@ -296,8 +296,8 @@ TextPanel::type_changed () void TextPanel::burn_toggled () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption ()) { - i->caption_of_original_type(_original_type)->set_burn (_burn->GetValue()); + BOOST_FOREACH (shared_ptr i, _parent->selected_text ()) { + i->text_of_original_type(_original_type)->set_burn (_burn->GetValue()); } } @@ -306,7 +306,7 @@ TextPanel::setup_sensitivity () { int any_subs = 0; int ffmpeg_subs = 0; - ContentList sel = _parent->selected_caption (); + ContentList sel = _parent->selected_text (); BOOST_FOREACH (shared_ptr i, sel) { /* These are the content types that could include subtitles */ shared_ptr fc = boost::dynamic_pointer_cast (i); @@ -314,7 +314,7 @@ TextPanel::setup_sensitivity () shared_ptr dc = boost::dynamic_pointer_cast (i); shared_ptr dsc = boost::dynamic_pointer_cast (i); if (fc) { - if (!fc->caption.empty()) { + if (!fc->text.empty()) { ++ffmpeg_subs; ++any_subs; } @@ -332,7 +332,7 @@ TextPanel::setup_sensitivity () } string why_not; - bool const can_reference = dcp && dcp->can_reference_caption (_original_type, why_not); + bool const can_reference = dcp && dcp->can_reference_text (_original_type, why_not); setup_refer_button (_reference, _reference_note, dcp, can_reference, why_not); bool const reference = _reference->GetValue (); @@ -349,7 +349,7 @@ TextPanel::setup_sensitivity () _line_spacing->Enable (!reference && use); _language->Enable (!reference && any_subs > 0 && use); _stream->Enable (!reference && ffmpeg_subs == 1); - _caption_view_button->Enable (!reference); + _text_view_button->Enable (!reference); _fonts_dialog_button->Enable (!reference); _appearance_dialog_button->Enable (!reference && any_subs > 0 && use); } @@ -379,49 +379,49 @@ TextPanel::stream_changed () void TextPanel::x_offset_changed () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption ()) { - i->caption_of_original_type(_original_type)->set_x_offset (_x_offset->GetValue() / 100.0); + BOOST_FOREACH (shared_ptr i, _parent->selected_text ()) { + i->text_of_original_type(_original_type)->set_x_offset (_x_offset->GetValue() / 100.0); } } void TextPanel::y_offset_changed () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption ()) { - i->caption_of_original_type(_original_type)->set_y_offset (_y_offset->GetValue() / 100.0); + BOOST_FOREACH (shared_ptr i, _parent->selected_text ()) { + i->text_of_original_type(_original_type)->set_y_offset (_y_offset->GetValue() / 100.0); } } void TextPanel::x_scale_changed () { - ContentList c = _parent->selected_caption (); + ContentList c = _parent->selected_text (); if (c.size() == 1) { - c.front()->caption_of_original_type(_original_type)->set_x_scale (_x_scale->GetValue() / 100.0); + c.front()->text_of_original_type(_original_type)->set_x_scale (_x_scale->GetValue() / 100.0); } } void TextPanel::y_scale_changed () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption ()) { - i->caption_of_original_type(_original_type)->set_y_scale (_y_scale->GetValue() / 100.0); + BOOST_FOREACH (shared_ptr i, _parent->selected_text ()) { + i->text_of_original_type(_original_type)->set_y_scale (_y_scale->GetValue() / 100.0); } } void TextPanel::line_spacing_changed () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption ()) { - i->caption_of_original_type(_original_type)->set_line_spacing (_line_spacing->GetValue() / 100.0); + BOOST_FOREACH (shared_ptr i, _parent->selected_text ()) { + i->text_of_original_type(_original_type)->set_line_spacing (_line_spacing->GetValue() / 100.0); } } void TextPanel::language_changed () { - BOOST_FOREACH (shared_ptr i, _parent->selected_caption ()) { - i->caption_of_original_type(_original_type)->set_language (wx_to_std (_language->GetValue())); + BOOST_FOREACH (shared_ptr i, _parent->selected_text ()) { + i->text_of_original_type(_original_type)->set_language (wx_to_std (_language->GetValue())); } } @@ -439,25 +439,25 @@ TextPanel::content_selection_changed () film_content_changed (TextContentProperty::LANGUAGE); film_content_changed (TextContentProperty::FONTS); film_content_changed (TextContentProperty::TYPE); - film_content_changed (DCPContentProperty::REFERENCE_CAPTION); + film_content_changed (DCPContentProperty::REFERENCE_TEXT); } void -TextPanel::caption_view_clicked () +TextPanel::text_view_clicked () { - if (_caption_view) { - _caption_view->Destroy (); - _caption_view = 0; + if (_text_view) { + _text_view->Destroy (); + _text_view = 0; } - ContentList c = _parent->selected_caption (); + ContentList c = _parent->selected_text (); DCPOMATIC_ASSERT (c.size() == 1); shared_ptr decoder = decoder_factory (c.front(), _parent->film()->log(), false); if (decoder) { - _caption_view = new TextView (this, _parent->film(), c.front(), c.front()->caption_of_original_type(_original_type), decoder, _parent->film_viewer()); - _caption_view->Show (); + _text_view = new TextView (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer()); + _text_view->Show (); } } @@ -469,10 +469,10 @@ TextPanel::fonts_dialog_clicked () _fonts_dialog = 0; } - ContentList c = _parent->selected_caption (); + ContentList c = _parent->selected_text (); DCPOMATIC_ASSERT (c.size() == 1); - _fonts_dialog = new FontsDialog (this, c.front(), c.front()->caption_of_original_type(_original_type)); + _fonts_dialog = new FontsDialog (this, c.front(), c.front()->text_of_original_type(_original_type)); _fonts_dialog->Show (); } @@ -489,16 +489,16 @@ TextPanel::reference_clicked () return; } - d->set_reference_caption (_original_type, _reference->GetValue ()); + d->set_reference_text (_original_type, _reference->GetValue ()); } void TextPanel::appearance_dialog_clicked () { - ContentList c = _parent->selected_caption (); + ContentList c = _parent->selected_text (); DCPOMATIC_ASSERT (c.size() == 1); - SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, c.front(), c.front()->caption_of_original_type(_original_type)); + SubtitleAppearanceDialog* d = new SubtitleAppearanceDialog (this, c.front(), c.front()->text_of_original_type(_original_type)); if (d->ShowModal () == wxID_OK) { d->apply (); } diff --git a/src/wx/text_panel.h b/src/wx/text_panel.h index 70d46dacd..86381e6ff 100644 --- a/src/wx/text_panel.h +++ b/src/wx/text_panel.h @@ -45,7 +45,7 @@ private: void line_spacing_changed (); void language_changed (); void stream_changed (); - void caption_view_clicked (); + void text_view_clicked (); void fonts_dialog_clicked (); void reference_clicked (); void appearance_dialog_clicked (); @@ -64,8 +64,8 @@ private: wxSpinCtrl* _line_spacing; wxTextCtrl* _language; wxChoice* _stream; - wxButton* _caption_view_button; - TextView* _caption_view; + wxButton* _text_view_button; + TextView* _text_view; wxButton* _fonts_dialog_button; FontsDialog* _fonts_dialog; wxButton* _appearance_dialog_button; diff --git a/src/wx/text_view.cc b/src/wx/text_view.cc index 583632dd0..2106a3dec 100644 --- a/src/wx/text_view.cc +++ b/src/wx/text_view.cc @@ -35,7 +35,7 @@ using boost::shared_ptr; using boost::bind; using boost::dynamic_pointer_cast; -TextView::TextView (wxWindow* parent, shared_ptr film, shared_ptr content, shared_ptr caption, shared_ptr decoder, FilmViewer* viewer) +TextView::TextView (wxWindow* parent, shared_ptr film, shared_ptr content, shared_ptr text, shared_ptr decoder, FilmViewer* viewer) : wxDialog (parent, wxID_ANY, _("Captions"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , _content (content) , _film_viewer (viewer) @@ -87,8 +87,8 @@ TextView::TextView (wxWindow* parent, shared_ptr film, shared_ptr _frc = film->active_frame_rate_change (content->position()); /* Find the decoder that is being used for our TextContent and attach to it */ - BOOST_FOREACH (shared_ptr i, decoder->caption) { - if (i->content() == caption) { + BOOST_FOREACH (shared_ptr i, decoder->text) { + if (i->content() == text) { i->PlainStart.connect (bind (&TextView::data_start, this, _1)); i->Stop.connect (bind (&TextView::data_stop, this, _1)); } diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index b0a3a7247..dc0234376 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -228,7 +228,7 @@ Timeline::recreate_views () _views.push_back (shared_ptr (new TimelineAudioContentView (*this, i))); } - BOOST_FOREACH (shared_ptr j, i->caption) { + BOOST_FOREACH (shared_ptr j, i->text) { _views.push_back (shared_ptr (new TimelineTextContentView (*this, i, j))); } @@ -334,9 +334,9 @@ Timeline::assign_tracks () /* Tracks are: Video (mono or left-eye) Video (right-eye) - Caption 1 - Caption 2 - Caption N + Text 1 + Text 2 + Text N Atmos Audio 1 Audio 2 @@ -373,9 +373,9 @@ Timeline::assign_tracks () _tracks = max (_tracks, 1); - /* Captions */ + /* Texts */ - int const caption_tracks = place (_views, _tracks); + int const text_tracks = place (_views, _tracks); /* Atmos */ @@ -405,7 +405,7 @@ Timeline::assign_tracks () _labels_view->set_3d (have_3d); _labels_view->set_audio_tracks (audio_tracks); - _labels_view->set_caption_tracks (caption_tracks); + _labels_view->set_text_tracks (text_tracks); _labels_view->set_atmos (have_atmos); _time_axis_view->set_y (tracks()); diff --git a/src/wx/timeline_labels_view.cc b/src/wx/timeline_labels_view.cc index af9cb771e..56228a7e7 100644 --- a/src/wx/timeline_labels_view.cc +++ b/src/wx/timeline_labels_view.cc @@ -32,13 +32,13 @@ TimelineLabelsView::TimelineLabelsView (Timeline& tl) : TimelineView (tl) , _threed (true) , _audio_tracks (0) - , _caption_tracks (0) + , _text_tracks (0) , _atmos (true) { wxString labels[] = { _("Video"), _("Audio"), - _("Captions"), + _("Subtitles/captions"), _("Atmos") }; @@ -70,9 +70,9 @@ TimelineLabelsView::do_paint (wxGraphicsContext* gc, list > gc->DrawText (_("Video"), 0, (ty + fy) / 2 - 8); fy = ty; - if (_caption_tracks) { - ty = fy + _caption_tracks * h; - gc->DrawText (_("Captions"), 0, (ty + fy) / 2 - 8); + if (_text_tracks) { + ty = fy + _text_tracks * h; + gc->DrawText (_("Subtitle/captions"), 0, (ty + fy) / 2 - 8); fy = ty; } @@ -101,9 +101,9 @@ TimelineLabelsView::set_audio_tracks (int n) } void -TimelineLabelsView::set_caption_tracks (int n) +TimelineLabelsView::set_text_tracks (int n) { - _caption_tracks = n; + _text_tracks = n; } void diff --git a/src/wx/timeline_labels_view.h b/src/wx/timeline_labels_view.h index 646d93a58..f26c9762b 100644 --- a/src/wx/timeline_labels_view.h +++ b/src/wx/timeline_labels_view.h @@ -31,7 +31,7 @@ public: void set_3d (bool s); void set_audio_tracks (int n); - void set_caption_tracks (int n); + void set_text_tracks (int n); void set_atmos (bool s); private: @@ -40,6 +40,6 @@ private: int _width; bool _threed; int _audio_tracks; - int _caption_tracks; + int _text_tracks; bool _atmos; }; diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index bf987e51e..e9fc51f58 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -282,7 +282,7 @@ TimingPanel::film_content_changed (int property) ++count_ac; content = i; } - if (!i->caption.empty() && i->video_frame_rate()) { + if (!i->text.empty() && i->video_frame_rate()) { ++count_sc; content = i; } diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 74f0cae59..592a7e294 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) ) ); - pvf->set_caption (PositionImage (sub_image, Position (50, 60))); + pvf->set_text (PositionImage (sub_image, Position (50, 60))); shared_ptr frame ( new DCPVideo ( @@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv) ) ); - pvf->set_caption (PositionImage (sub_image, Position (50, 60))); + pvf->set_text (PositionImage (sub_image, Position (50, 60))); shared_ptr frame ( new DCPVideo ( diff --git a/test/closed_caption_test.cc b/test/closed_caption_test.cc index 8cceec483..53538cd7c 100644 --- a/test/closed_caption_test.cc +++ b/test/closed_caption_test.cc @@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE (closed_caption_test1) film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - content->only_caption()->set_type (CAPTION_CLOSED); + content->only_text()->set_type (TEXT_CLOSED_CAPTION); film->make_dcp (); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc index 2dbf43b2a..47938d309 100644 --- a/test/dcp_subtitle_test.cc +++ b/test/dcp_subtitle_test.cc @@ -71,8 +71,8 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test) BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(2).get()); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->make_dcp (); BOOST_REQUIRE (!wait_for_jobs ()); @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test) BOOST_REQUIRE (!wait_for_jobs ()); shared_ptr decoder (new DCPDecoder (content, film->log(), false)); - decoder->only_caption()->PlainStart.connect (bind (store, _1)); + decoder->only_text()->PlainStart.connect (bind (store, _1)); stored = optional (); while (!decoder->pass() && !stored) {} @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test2) BOOST_REQUIRE (!wait_for_jobs ()); shared_ptr decoder (new DCPSubtitleDecoder (content, film->log())); - decoder->only_caption()->PlainStart.connect (bind (store, _1)); + decoder->only_text()->PlainStart.connect (bind (store, _1)); stored = optional (); while (!decoder->pass ()) { @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test3) shared_ptr decoder (new DCPSubtitleDecoder (content, film->log())); stored = optional (); while (!decoder->pass ()) { - decoder->only_caption()->PlainStart.connect (bind (store, _1)); + decoder->only_text()->PlainStart.connect (bind (store, _1)); if (stored && stored->from() == ContentTime::from_seconds(0.08)) { list s = stored->subs; list::const_iterator i = s.begin (); @@ -171,8 +171,8 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test4) film->examine_and_add_content (content2); BOOST_REQUIRE (!wait_for_jobs ()); - content->only_caption()->add_font (shared_ptr (new Font ("font1"))); - content2->only_caption()->add_font (shared_ptr (new Font ("font2"))); + content->only_text()->add_font (shared_ptr (new Font ("font1"))); + content2->only_text()->add_font (shared_ptr (new Font ("font2"))); film->make_dcp (); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index d1d07e28c..b286bbdb4 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -124,9 +124,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6) shared_ptr s (new StringTextFileContent (film, "test/data/subrip2.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); - s->only_caption()->set_colour (dcp::Colour (255, 255, 0)); - s->only_caption()->set_effect (dcp::SHADOW); - s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255)); + s->only_text()->set_colour (dcp::Colour (255, 255, 0)); + s->only_text()->set_effect (dcp::SHADOW); + s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); film->write_metadata(); shared_ptr job (new TranscodeJob (film)); @@ -149,9 +149,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7) shared_ptr s (new StringTextFileContent (film, "test/data/subrip.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); - s->only_caption()->set_colour (dcp::Colour (255, 255, 0)); - s->only_caption()->set_effect (dcp::SHADOW); - s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255)); + s->only_text()->set_colour (dcp::Colour (255, 255, 0)); + s->only_text()->set_effect (dcp::SHADOW); + s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); shared_ptr job (new TranscodeJob (film)); FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", FFmpegEncoder::FORMAT_PRORES, false); @@ -175,9 +175,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2) shared_ptr s (new StringTextFileContent (film, "test/data/subrip2.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); - s->only_caption()->set_colour (dcp::Colour (255, 255, 0)); - s->only_caption()->set_effect (dcp::SHADOW); - s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255)); + s->only_text()->set_colour (dcp::Colour (255, 255, 0)); + s->only_text()->set_effect (dcp::SHADOW); + s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); film->write_metadata(); shared_ptr job (new TranscodeJob (film)); @@ -200,9 +200,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3) shared_ptr s (new StringTextFileContent (film, "test/data/subrip.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); - s->only_caption()->set_colour (dcp::Colour (255, 255, 0)); - s->only_caption()->set_effect (dcp::SHADOW); - s->only_caption()->set_effect_colour (dcp::Colour (0, 255, 255)); + s->only_text()->set_colour (dcp::Colour (255, 255, 0)); + s->only_text()->set_effect (dcp::SHADOW); + s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255)); film->write_metadata(); shared_ptr job (new TranscodeJob (film)); diff --git a/test/player_test.cc b/test/player_test.cc index b86a94403..7cc846aff 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -211,11 +211,11 @@ BOOST_AUTO_TEST_CASE (player_seek_test) shared_ptr dcp (new DCPContent (film, private_data / "awkward_subs")); film->examine_and_add_content (dcp, true); BOOST_REQUIRE (!wait_for_jobs ()); - dcp->only_caption()->set_use (true); + dcp->only_text()->set_use (true); shared_ptr player (new Player (film, film->playlist())); player->set_fast (); - player->set_always_burn_open_captions (); + player->set_always_burn_open_subtitles (); player->set_play_referenced (); shared_ptr butler (new Butler (player, film->log(), AudioMapping(), 2)); @@ -242,11 +242,11 @@ BOOST_AUTO_TEST_CASE (player_seek_test2) shared_ptr dcp (new DCPContent (film, private_data / "awkward_subs2")); film->examine_and_add_content (dcp, true); BOOST_REQUIRE (!wait_for_jobs ()); - dcp->only_caption()->set_use (true); + dcp->only_text()->set_use (true); shared_ptr player (new Player (film, film->playlist())); player->set_fast (); - player->set_always_burn_open_captions (); + player->set_always_burn_open_subtitles (); player->set_play_referenced (); shared_ptr butler (new Butler (player, film->log(), AudioMapping(), 2)); diff --git a/test/remake_with_subtitle_test.cc b/test/remake_with_subtitle_test.cc index 61cf0187f..c54dee61f 100644 --- a/test/remake_with_subtitle_test.cc +++ b/test/remake_with_subtitle_test.cc @@ -37,14 +37,14 @@ BOOST_AUTO_TEST_CASE (remake_with_subtitle_test) shared_ptr content = dynamic_pointer_cast(content_factory(film, private_data / "prophet_short_clip.mkv").front()); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - content->only_caption()->set_burn (true); - content->only_caption()->set_use (true); + content->only_text()->set_burn (true); + content->only_text()->set_use (true); film->make_dcp (); BOOST_REQUIRE (!wait_for_jobs ()); boost::filesystem::remove_all (film->dir (film->dcp_name(), false)); - content->only_caption()->set_use (false); + content->only_text()->set_use (false); film->make_dcp (); BOOST_REQUIRE (!wait_for_jobs ()); diff --git a/test/srt_subtitle_test.cc b/test/srt_subtitle_test.cc index eb7918914..c4bdd76d1 100644 --- a/test/srt_subtitle_test.cc +++ b/test/srt_subtitle_test.cc @@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test) film->examine_and_add_content (content); wait_for_jobs (); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->make_dcp (); wait_for_jobs (); @@ -73,10 +73,10 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test2) film->examine_and_add_content (content); wait_for_jobs (); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); /* Use test/data/subrip2.srt as if it were a font file */ - content->only_caption()->fonts().front()->set_file (FontFiles::NORMAL, "test/data/subrip2.srt"); + content->only_text()->fonts().front()->set_file (FontFiles::NORMAL, "test/data/subrip2.srt"); film->make_dcp (); wait_for_jobs (); @@ -108,8 +108,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test3) film->examine_and_add_content (content); wait_for_jobs (); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->make_dcp (); wait_for_jobs (); @@ -126,8 +126,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test4) film->set_name ("frobozz"); film->set_interop (false); shared_ptr content (new StringTextFileContent (film, "test/data/subrip2.srt")); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->examine_and_add_content (content); wait_for_jobs (); film->make_dcp (); @@ -147,8 +147,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test5) film->set_interop (true); film->set_sequence (false); shared_ptr content (new StringTextFileContent (film, "test/data/subrip2.srt")); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->examine_and_add_content (content); film->examine_and_add_content (content); wait_for_jobs (); @@ -165,8 +165,8 @@ BOOST_AUTO_TEST_CASE (srt_subtitle_test6) shared_ptr film = new_test_film2 ("srt_subtitle_test6"); film->set_interop (false); shared_ptr content (new StringTextFileContent (film, "test/data/frames.srt")); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); film->make_dcp (); diff --git a/test/ssa_subtitle_test.cc b/test/ssa_subtitle_test.cc index 5a6eaaa68..cd22450a6 100644 --- a/test/ssa_subtitle_test.cc +++ b/test/ssa_subtitle_test.cc @@ -51,8 +51,8 @@ BOOST_AUTO_TEST_CASE (ssa_subtitle_test1) film->examine_and_add_content (content); wait_for_jobs (); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->make_dcp (); wait_for_jobs (); diff --git a/test/subtitle_reel_number_test.cc b/test/subtitle_reel_number_test.cc index d78cb63d7..f02920b7f 100644 --- a/test/subtitle_reel_number_test.cc +++ b/test/subtitle_reel_number_test.cc @@ -46,8 +46,8 @@ BOOST_AUTO_TEST_CASE (subtitle_reel_number_test) shared_ptr content (new StringTextFileContent (film, "test/data/subrip5.srt")); film->examine_and_add_content (content); BOOST_REQUIRE (!wait_for_jobs ()); - content->only_caption()->set_use (true); - content->only_caption()->set_burn (false); + content->only_text()->set_use (true); + content->only_text()->set_burn (false); film->set_reel_type (REELTYPE_BY_LENGTH); film->set_interop (true); film->set_reel_length (1024 * 1024 * 512); diff --git a/test/vf_test.cc b/test/vf_test.cc index 5cded6e25..fa1e7cdab 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -57,16 +57,16 @@ BOOST_AUTO_TEST_CASE (vf_test1) string why_not; BOOST_CHECK (!dcp->can_reference_video(why_not)); BOOST_CHECK (!dcp->can_reference_audio(why_not)); - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not)); - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not)); + BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); /* Multi-reel DCP can be referenced if we are using by-video-content */ film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT); BOOST_CHECK (dcp->can_reference_video(why_not)); BOOST_CHECK (dcp->can_reference_audio(why_not)); - /* (but reels_test2 has no captions to reference) */ - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not)); - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not)); + /* (but reels_test2 has no texts to reference) */ + BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); shared_ptr other (new FFmpegContent (film, "test/data/test.mp4")); film->examine_and_add_content (other); @@ -76,16 +76,16 @@ BOOST_AUTO_TEST_CASE (vf_test1) other->set_position (DCPTime (0)); BOOST_CHECK (!dcp->can_reference_video(why_not)); BOOST_CHECK (!dcp->can_reference_audio(why_not)); - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not)); - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not)); + BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); /* This should not be considered an overlap */ other->set_position (dcp->end ()); BOOST_CHECK (dcp->can_reference_video(why_not)); BOOST_CHECK (dcp->can_reference_audio(why_not)); - /* (reels_test2 has no captions to reference) */ - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_OPEN, why_not)); - BOOST_CHECK (!dcp->can_reference_caption(CAPTION_CLOSED, why_not)); + /* (reels_test2 has no texts to reference) */ + BOOST_CHECK (!dcp->can_reference_text(TEXT_OPEN_SUBTITLE, why_not)); + BOOST_CHECK (!dcp->can_reference_text(TEXT_CLOSED_CAPTION, why_not)); } /** Make a OV with video and audio and a VF referencing the OV and adding subs */ -- 2.30.2