diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-07-23 15:10:11 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-07-23 15:10:11 +0100 |
| commit | a5c629cb9b638b67a0e4c2d26fe9ab2e124bf0eb (patch) | |
| tree | 6cd463704f413259516e2888704272a371a108a6 /src/lib | |
| parent | df17bbd25da69fc38eb2dcd8b4a2531cf0bab0bc (diff) | |
Tidy up after mass rename.
Diffstat (limited to 'src/lib')
35 files changed, 315 insertions, 312 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> 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<const Content> c) audio->take_settings_from (c->audio); } - list<shared_ptr<TextContent> >::iterator i = caption.begin (); - list<shared_ptr<TextContent> >::const_iterator j = c->caption.begin (); - while (i != caption.end() && j != c->caption.end()) { + list<shared_ptr<TextContent> >::iterator i = text.begin (); + list<shared_ptr<TextContent> >::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<const Content> c) } shared_ptr<TextContent> -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<TextContent> (); } - return caption.front (); + return text.front (); } shared_ptr<TextContent> -Content::caption_of_original_type (TextType type) const +Content::text_of_original_type (TextType type) const { - BOOST_FOREACH (shared_ptr<TextContent> i, caption) { + BOOST_FOREACH (shared_ptr<TextContent> 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 <cth@carlh.net> + Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -182,10 +182,10 @@ public: boost::shared_ptr<VideoContent> video; boost::shared_ptr<AudioContent> audio; - std::list<boost::shared_ptr<TextContent> > caption; + std::list<boost::shared_ptr<TextContent> > text; - boost::shared_ptr<TextContent> only_caption () const; - boost::shared_ptr<TextContent> caption_of_original_type (TextType type) const; + boost::shared_ptr<TextContent> only_text () const; + boost::shared_ptr<TextContent> 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<const Film> film, boost::filesystem::path p) : Content (film) @@ -74,8 +74,8 @@ DCPContent::DCPContent (shared_ptr<const Film> 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<const Film> 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<const Film> 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> 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> 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<TextType>(i))) { - caption.push_back (shared_ptr<TextContent>(new TextContent(this, static_cast<TextType>(i)))); + for (int i = 0; i < TEXT_COUNT; ++i) { + if (examiner->has_text(static_cast<TextType>(i))) { + text.push_back (shared_ptr<TextContent>(new TextContent(this, static_cast<TextType>(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> 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<TextContent> i, caption) { + BOOST_FOREACH (shared_ptr<TextContent> 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<TextContent> i, caption) { + BOOST_FOREACH (shared_ptr<TextContent> 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<DCPTimePeriod> @@ -591,12 +591,12 @@ DCPContent::can_reference_audio (string& why_not) const } static -bool check_caption (shared_ptr<const Content> c) +bool check_text (shared_ptr<const Content> 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<DCPDecoder> decoder; try { @@ -610,12 +610,12 @@ DCPContent::can_reference_caption (TextType type, string& why_not) const } BOOST_FOREACH (shared_ptr<dcp::Reel> 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<const Content> 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<dcp::Standard> _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<const DCPContent> c, shared_ptr<Log> log, boo if (c->audio) { audio.reset (new AudioDecoder (this, c->audio, log, fast)); } - BOOST_FOREACH (shared_ptr<TextContent> i, c->caption) { + BOOST_FOREACH (shared_ptr<TextContent> i, c->text) { /* XXX: this time here should be the time of the first subtitle, not 0 */ - caption.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, i, log, ContentTime()))); + text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, i, log, ContentTime()))); } list<shared_ptr<dcp::CPL> > 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<dcp::PictureAsset> asset = (*_reel)->main_picture()->asset (); @@ -191,25 +191,25 @@ DCPDecoder::pass () } void -DCPDecoder::pass_captions (ContentTime next) +DCPDecoder::pass_texts (ContentTime next) { - list<shared_ptr<TextDecoder> >::const_iterator decoder = caption.begin (); + list<shared_ptr<TextDecoder> >::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<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder) +DCPDecoder::pass_texts (ContentTime next, shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> 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<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, boost::shared_ptr<TextDecoder> decoder); + void pass_texts (ContentTime next); + void pass_texts (ContentTime next, boost::shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, boost::shared_ptr<TextDecoder> 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<const Film> film, weak_ptr<Job> 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<const Content> c, film->content ()) { - BOOST_FOREACH (shared_ptr<TextContent> i, c->caption) { + BOOST_FOREACH (shared_ptr<TextContent> 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<AudioBuffers> 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<PlayerVideo>, DCPTime); void audio (boost::shared_ptr<AudioBuffers>, DCPTime); - void caption (PlayerText, TextType, DCPTimePeriod); + void text (PlayerText, TextType, DCPTimePeriod); boost::shared_ptr<Writer> _writer; boost::shared_ptr<J2KEncoder> _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<const DCPContent> content) { shared_ptr<dcp::CPL> 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<const DCPContent> 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<const DCPContent> 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<const Film> film, boost::filesystem::path path) : Content (film, path) { - caption.push_back (shared_ptr<TextContent> (new TextContent (this, CAPTION_OPEN))); + text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE))); } DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) , _length (node->number_child<ContentTime::Type> ("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> 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<dcp::LoadFontNode> i, sc->load_font_nodes ()) { - only_caption()->add_font (shared_ptr<Font> (new Font (i->id))); + only_text()->add_font (shared_ptr<Font> (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<string> (_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<const DCPSubtitleContent> con if (_next != _subtitles.end()) { first = content_time_period(*_next).from; } - caption.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_caption(), log, first))); + text.push_back (shared_ptr<TextDecoder> (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<TextDecoder> i, caption) { + BOOST_FOREACH (shared_ptr<TextDecoder> 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<TextDecoder> i, caption) { + BOOST_FOREACH (shared_ptr<TextDecoder> i, text) { i->seek (); } } shared_ptr<TextDecoder> -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<TextDecoder> (); } - 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<VideoDecoder> video; boost::shared_ptr<AudioDecoder> audio; - std::list<boost::shared_ptr<TextDecoder> > caption; + std::list<boost::shared_ptr<TextDecoder> > text; - boost::shared_ptr<TextDecoder> only_caption () const; + boost::shared_ptr<TextDecoder> 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<const Film> 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<cxml::NodePtr> c = node->node_children ("SubtitleStream"); for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) { @@ -135,12 +135,12 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con bool need_video = false; bool need_audio = false; - bool need_caption = false; + bool need_text = false; if (i != c.end ()) { need_video = static_cast<bool> ((*i)->video); need_audio = static_cast<bool> ((*i)->audio); - need_caption = !(*i)->caption.empty(); + need_text = !(*i)->text.empty(); } while (i != c.end ()) { @@ -150,8 +150,8 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con if (need_audio != static_cast<bool> ((*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<const Film> film, vector<shared_ptr<Con if (need_audio) { audio.reset (new AudioContent (this, c)); } - if (need_caption) { - caption.push_back (shared_ptr<TextContent> (new TextContent (this, c))); + if (need_text) { + text.push_back (shared_ptr<TextContent> (new TextContent (this, c))); } shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]); @@ -171,7 +171,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con for (size_t i = 0; i < c.size(); ++i) { shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (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> job) _subtitle_streams = examiner->subtitle_streams (); if (!_subtitle_streams.empty ()) { - caption.clear (); - caption.push_back (shared_ptr<TextContent> (new TextContent (this, CAPTION_OPEN))); + text.clear (); + text.push_back (shared_ptr<TextContent> (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<const FFmpegContent> c, shared_ptr<Log> 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<TextDecoder> (new TextDecoder (this, c->only_caption(), log, ContentTime()))); + text.push_back (shared_ptr<TextDecoder> (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<double> (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<list<sub::Subtitle> > (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<const Film> film, weak_ptr<Job> 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<Content> i, content()) { - BOOST_FOREACH (shared_ptr<TextContent> j, i->caption) { - if (j->type() == CAPTION_OPEN && j->use() && !j->burn()) { + BOOST_FOREACH (shared_ptr<TextContent> 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<TextType>(i))) { - any_caption = true; + bool any_text = false; + for (int i = 0; i < TEXT_COUNT; ++i) { + if (dc->reference_text(static_cast<TextType>(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<Content> 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<string> languages; BOOST_FOREACH (shared_ptr<Content> i, content()) { - BOOST_FOREACH (shared_ptr<TextContent> j, i->caption) { + BOOST_FOREACH (shared_ptr<TextContent> 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<const Film> film) bool big_font_files = false; if (film->interop ()) { BOOST_FOREACH (shared_ptr<Content> i, content) { - BOOST_FOREACH (shared_ptr<TextContent> j, i->caption) { + BOOST_FOREACH (shared_ptr<TextContent> j, i->text) { BOOST_FOREACH (shared_ptr<Font> k, j->fonts()) { for (int l = 0; l < FontFiles::VARIANTS; ++l) { optional<boost::filesystem::path> const p = k->file (static_cast<FontFiles::Variant>(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<const Film> film, shared_ptr<const Playlist> 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<TextDecoder> i, decoder->caption) { + if (_ignore_text) { + BOOST_FOREACH (shared_ptr<TextDecoder> 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> (piece), _1, _2)); } - list<shared_ptr<TextDecoder> >::const_iterator j = decoder->caption.begin(); + list<shared_ptr<TextDecoder> >::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>(piece), weak_ptr<const TextContent>((*j)->content()), _1) ); @@ -302,7 +302,7 @@ Player::film_changed (Film::Property p) } list<PositionImage> -Player::transform_bitmap_captions (list<BitmapText> subs) const +Player::transform_bitmap_texts (list<BitmapText> subs) const { list<PositionImage> all; @@ -419,7 +419,7 @@ Player::get_subtitle_fonts () list<shared_ptr<Font> > fonts; BOOST_FOREACH (shared_ptr<Piece> i, _pieces) { - BOOST_FOREACH (shared_ptr<TextContent> j, i->content->caption) { + BOOST_FOREACH (shared_ptr<TextContent> 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<dcp::ReelAsset> 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<dcp::ReelAsset> 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<PlayerText> 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<PositionImage> -Player::open_captions_for_frame (DCPTime time) const +Player::open_subtitles_for_frame (DCPTime time) const { list<PositionImage> 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<PositionImage> c = transform_bitmap_captions (j.image); + list<PositionImage> 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<Piece> wp, weak_ptr<const TextContent> wc, ContentBitmapText subtitle) { shared_ptr<Piece> piece = wp.lock (); - shared_ptr<const TextContent> caption = wc.lock (); - if (!piece || !caption) { + shared_ptr<const TextContent> 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<Piece> wp, weak_ptr<const TextContent> wc, ContentStringText subtitle) { shared_ptr<Piece> piece = wp.lock (); - shared_ptr<const TextContent> caption = wc.lock (); - if (!piece || !caption) { + shared_ptr<const TextContent> text = wc.lock (); + if (!piece || !text) { return; } @@ -914,10 +914,10 @@ Player::plain_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> 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<Piece> wp, weak_ptr<const TextContent> 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<Piece> wp, weak_ptr<const TextContent> wc, ContentTime to, TextType type) { - if (!_active_captions[type].have (wc)) { + if (!_active_texts[type].have (wc)) { return; } shared_ptr<Piece> piece = wp.lock (); - shared_ptr<const TextContent> caption = wc.lock (); - if (!piece || !caption) { + shared_ptr<const TextContent> text = wc.lock (); + if (!piece || !text) { return; } @@ -960,11 +960,11 @@ Player::subtitle_stop (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, Conte return; } - pair<PlayerText, DCPTime> from = _active_captions[type].add_to (wc, dcp_to); + pair<PlayerText, DCPTime> 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<Piece> i, _pieces) { @@ -1047,14 +1047,14 @@ void Player::do_emit_video (shared_ptr<PlayerVideo> 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<PositionImage> captions = open_captions_for_frame (time); - if (captions) { - pv->set_caption (captions.get ()); + optional<PositionImage> 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<int> reduction); @@ -100,10 +100,10 @@ public: /** Emitted when a video frame is ready. These emissions happen in the correct order. */ boost::signals2::signal<void (boost::shared_ptr<PlayerVideo>, DCPTime)> Video; boost::signals2::signal<void (boost::shared_ptr<AudioBuffers>, 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<void (PlayerText, TextType, DCPTimePeriod)> Caption; + boost::signals2::signal<void (PlayerText, TextType, DCPTimePeriod)> 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<Content>, int, bool); - std::list<PositionImage> transform_bitmap_captions (std::list<BitmapText>) const; + std::list<PositionImage> transform_bitmap_texts (std::list<BitmapText>) const; Frame dcp_to_content_video (boost::shared_ptr<const Piece> piece, DCPTime t) const; DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, Frame f) const; Frame dcp_to_resampled_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const; @@ -136,7 +136,7 @@ private: std::pair<boost::shared_ptr<AudioBuffers>, DCPTime> discard_audio ( boost::shared_ptr<const AudioBuffers> audio, DCPTime time, DCPTime discard_to ) const; - boost::optional<PositionImage> open_captions_for_frame (DCPTime time) const; + boost::optional<PositionImage> open_subtitles_for_frame (DCPTime time) const; void emit_video (boost::shared_ptr<PlayerVideo> pv, DCPTime time); void do_emit_video (boost::shared_ptr<PlayerVideo> pv, DCPTime time); void emit_audio (boost::shared_ptr<AudioBuffers> 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<AudioProcessor> _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<cxml::Node> node, shared_ptr<Socket> socket image->read_from_socket (socket); - _caption = PositionImage (image, Position<int> (node->number_child<int> ("SubtitleX"), node->number_child<int> ("SubtitleY"))); + _text = PositionImage (image, Position<int> (node->number_child<int> ("SubtitleX"), node->number_child<int> ("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, function<AVPixelFormat (AVPixelFormat total_crop, _inter_size, _out_size, yuv_to_rgb, pixel_format (_in->pixel_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<string> (_caption->image->size().width)); - node->add_child ("SubtitleHeight")->add_child_text (raw_convert<string> (_caption->image->size().height)); - node->add_child ("SubtitleX")->add_child_text (raw_convert<string> (_caption->position.x)); - node->add_child ("SubtitleY")->add_child_text (raw_convert<string> (_caption->position.y)); + if (_text) { + node->add_child ("SubtitleWidth")->add_child_text (raw_convert<string> (_text->image->size().width)); + node->add_child ("SubtitleHeight")->add_child_text (raw_convert<string> (_text->image->size().height)); + node->add_child ("SubtitleX")->add_child_text (raw_convert<string> (_text->position.x)); + node->add_child ("SubtitleY")->add_child_text (raw_convert<string> (_text->position.y)); } } @@ -193,8 +193,8 @@ void PlayerVideo::send_binary (shared_ptr<Socket> 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<const PlayerVideo> 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> 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<PlayerVideo> shallow_copy () const; - void set_caption (PositionImage); + void set_text (PositionImage); void prepare (); boost::shared_ptr<Image> image (dcp::NoteHandler note, boost::function<AVPixelFormat (AVPixelFormat)> pixel_format, bool aligned, bool fast) const; @@ -109,7 +109,7 @@ private: Eyes _eyes; Part _part; boost::optional<ColourConversion> _colour_conversion; - boost::optional<PositionImage> _caption; + boost::optional<PositionImage> _text; /** Content that we came from. This is so that reset_metadata() can work */ boost::weak_ptr<Content> _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<Content> 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<const Content> i, _content) { bool burn = false; - BOOST_FOREACH (shared_ptr<TextContent> j, i->caption) { + BOOST_FOREACH (shared_ptr<TextContent> 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<Content> 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<double, double> 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<ReferencedReelAsset> const & refs, list<shared_ptr } reel->add (reel_sound_asset); - maybe_add_captions<dcp::ReelSubtitleAsset> (_caption_asset[CAPTION_OPEN], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); - maybe_add_captions<dcp::ReelClosedCaptionAsset> (_caption_asset[CAPTION_CLOSED], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); + maybe_add_captions<dcp::ReelSubtitleAsset> (_caption_asset[TEXT_OPEN_SUBTITLE], reel_picture_asset->duration(), reel, refs, fonts, _film, _period); + maybe_add_captions<dcp::ReelClosedCaptionAsset> (_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<dcp::PictureAssetWriter> _picture_asset_writer; boost::shared_ptr<dcp::SoundAsset> _sound_asset; boost::shared_ptr<dcp::SoundAssetWriter> _sound_asset_writer; - boost::shared_ptr<dcp::SubtitleAsset> _caption_asset[CAPTION_COUNT]; + boost::shared_ptr<dcp::SubtitleAsset> _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<const Film> film, boost::filesystem::path path) : Content (film, path) { - caption.push_back (shared_ptr<TextContent> (new TextContent (this, CAPTION_OPEN))); + text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE))); } StringTextFileContent::StringTextFileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : Content (film, node) , _length (node->number_child<ContentTime::Type> ("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> 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<Font> (new Font (TEXT_FONT_ID))); + only_text()->add_font (shared_ptr<Font> (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<string> (_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<const StringTextFileCon if (!_subtitles.empty()) { first = content_time_period(_subtitles[0]).from; } - caption.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_caption(), log, first))); + text.push_back (shared_ptr<TextDecoder> (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<double>("LineSpacing").get_value_or (1)) , _outline_width (node->optional_number_child<int>("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<shared_ptr<Content> > 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<TextContent> ref = c[0]->only_caption(); + shared_ptr<TextContent> ref = c[0]->only_text(); DCPOMATIC_ASSERT (ref); list<shared_ptr<Font> > 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<shared_ptr<Font> > fonts = c[i]->only_caption()->fonts (); + list<shared_ptr<Font> > 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<string> (_x_offset)); - caption->add_child("YOffset")->add_child_text (raw_convert<string> (_y_offset)); - caption->add_child("XScale")->add_child_text (raw_convert<string> (_x_scale)); - caption->add_child("YScale")->add_child_text (raw_convert<string> (_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<string> (_x_offset)); + text->add_child("YOffset")->add_child_text (raw_convert<string> (_y_offset)); + text->add_child("XScale")->add_child_text (raw_convert<string> (_x_scale)); + text->add_child("YScale")->add_child_text (raw_convert<string> (_y_scale)); + text->add_child("Language")->add_child_text (_language); if (_colour) { - caption->add_child("Red")->add_child_text (raw_convert<string> (_colour->r)); - caption->add_child("Green")->add_child_text (raw_convert<string> (_colour->g)); - caption->add_child("Blue")->add_child_text (raw_convert<string> (_colour->b)); + text->add_child("Red")->add_child_text (raw_convert<string> (_colour->r)); + text->add_child("Green")->add_child_text (raw_convert<string> (_colour->g)); + text->add_child("Blue")->add_child_text (raw_convert<string> (_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<string> (_effect_colour->r)); - caption->add_child("EffectGreen")->add_child_text (raw_convert<string> (_effect_colour->g)); - caption->add_child("EffectBlue")->add_child_text (raw_convert<string> (_effect_colour->b)); + text->add_child("EffectRed")->add_child_text (raw_convert<string> (_effect_colour->r)); + text->add_child("EffectGreen")->add_child_text (raw_convert<string> (_effect_colour->g)); + text->add_child("EffectBlue")->add_child_text (raw_convert<string> (_effect_colour->b)); } - caption->add_child("LineSpacing")->add_child_text (raw_convert<string> (_line_spacing)); + text->add_child("LineSpacing")->add_child_text (raw_convert<string> (_line_spacing)); if (_fade_in) { - caption->add_child("FadeIn")->add_child_text (raw_convert<string> (_fade_in->get())); + text->add_child("FadeIn")->add_child_text (raw_convert<string> (_fade_in->get())); } if (_fade_out) { - caption->add_child("FadeOut")->add_child_text (raw_convert<string> (_fade_out->get())); + text->add_child("FadeOut")->add_child_text (raw_convert<string> (_fade_out->get())); } - caption->add_child("OutlineWidth")->add_child_text (raw_convert<string> (_outline_width)); + text->add_child("OutlineWidth")->add_child_text (raw_convert<string> (_outline_width)); for (list<shared_ptr<Font> >::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<const Film> film, weak_ptr<Job> 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> _job; std::vector<ReelWriter> _reels; std::vector<ReelWriter>::iterator _audio_reel; - std::vector<ReelWriter>::iterator _caption_reel[CAPTION_COUNT]; + std::vector<ReelWriter>::iterator _caption_reel[TEXT_COUNT]; /** our thread, or 0 */ boost::thread* _thread; |
