From: Carl Hetherington Date: Wed, 29 Jul 2020 09:44:05 +0000 (+0200) Subject: Recover information about closed caption tracks when loading DCPs X-Git-Tag: v2.15.93 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=09860271bb6d03b3937c08bffb4c672697f6d711 Recover information about closed caption tracks when loading DCPs so that they can be displayed. --- diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index ec6894428..00ffb390c 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -253,7 +253,11 @@ DCPContent::examine (shared_ptr film, shared_ptr job) _name = examiner->name (); for (int i = 0; i < TEXT_COUNT; ++i) { for (int j = 0; j < examiner->text_count(static_cast(i)); ++j) { - text.push_back (shared_ptr(new TextContent(this, static_cast(i), static_cast(i)))); + shared_ptr c(new TextContent(this, static_cast(i), static_cast(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 b05ef593b..44513ff45 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -190,6 +190,7 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) } _text_count[TEXT_CLOSED_CAPTION]++; + _dcp_text_tracks.push_back (DCPTextTrack(j->annotation_text(), j->language().get_value_or(_("Unknown")))); } if (i->main_markers ()) { diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index 78d2befd3..cb68aa523 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -25,6 +25,8 @@ #include "video_examiner.h" #include "audio_examiner.h" #include "dcp.h" +#include "dcp_text_track.h" +#include "dcpomatic_assert.h" #include class DCPContent; @@ -95,6 +97,11 @@ public: return _text_count[type]; } + DCPTextTrack dcp_text_track (int i) const { + DCPOMATIC_ASSERT (i >= 0 && i < static_cast(_dcp_text_tracks.size())); + return _dcp_text_tracks[i]; + } + bool kdm_valid () const { return _kdm_valid; } @@ -157,6 +164,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 _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 154b3a5fd..d3a6c12e4 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -191,6 +191,8 @@ FilmViewer::set_film (shared_ptr 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 ();