diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-07-29 11:44:05 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-08-02 21:48:32 +0000 |
| commit | 768287d3b8fff495f5b86ae9cea750bff7652fe2 (patch) | |
| tree | fa3f271a249523cdd7c71e55b7a83a0e515edcfe | |
| parent | 5fa8671eb5515a534d3971c249337303cab67740 (diff) | |
Recover information about closed caption tracks when loading DCPs
so that they can be displayed.
Cherry-picked from 09860271bb6d03b3937c08bffb4c672697f6d711 in v2.15.x.
| -rw-r--r-- | src/lib/dcp_content.cc | 6 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.cc | 1 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.h | 10 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 2 |
4 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index ef877a17f..2e93e9ee8 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -226,7 +226,11 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) _name = examiner->name (); for (int i = 0; i < TEXT_COUNT; ++i) { for (int j = 0; j < examiner->text_count(static_cast<TextType>(i)); ++j) { - text.push_back (shared_ptr<TextContent>(new TextContent(this, static_cast<TextType>(i), static_cast<TextType>(i)))); + shared_ptr<TextContent> c(new TextContent(this, static_cast<TextType>(i), static_cast<TextType>(i))); + if (i == TEXT_CLOSED_CAPTION) { + c->set_dcp_track (examiner->dcp_text_track(j)); + } + text.push_back (c); } } texts = text.size (); diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index c70d8b2db..31c80f724 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -181,6 +181,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content) } _text_count[TEXT_CLOSED_CAPTION]++; + _dcp_text_tracks.push_back (DCPTextTrack(j->annotation_text(), j->language().get_value_or(_("Unknown")))); } if (i->main_picture()) { diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index 199ac3985..9774ec519 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -25,6 +25,9 @@ #include "video_examiner.h" #include "audio_examiner.h" #include "dcp.h" +#include "dcp_text_track.h" +#include "dcpomatic_assert.h" +#include <dcp/dcp_time.h> class DCPContent; @@ -90,6 +93,11 @@ public: return _text_count[type]; } + DCPTextTrack dcp_text_track (int i) const { + DCPOMATIC_ASSERT (i >= 0 && i < static_cast<int>(_dcp_text_tracks.size())); + return _dcp_text_tracks[i]; + } + bool kdm_valid () const { return _kdm_valid; } @@ -128,6 +136,8 @@ private: bool _has_audio; /** number of different assets of each type (OCAP/CCAP) */ int _text_count[TEXT_COUNT]; + /** the DCPTextTracks for each of our CCAPs */ + std::vector<DCPTextTrack> _dcp_text_tracks; bool _encrypted; bool _needs_assets; bool _kdm_valid; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 026e9d66f..f68b21309 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -161,6 +161,8 @@ FilmViewer::set_film (shared_ptr<Film> film) /* Keep about 1 second's worth of history samples */ _latency_history_count = _film->audio_frame_rate() / _audio_block_size; + _closed_captions_dialog->update_tracks (_film); + recreate_butler (); calculate_sizes (); |
