Recover information about closed caption tracks when loading DCPs v2.15.93
authorCarl Hetherington <cth@carlh.net>
Wed, 29 Jul 2020 09:44:05 +0000 (11:44 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 29 Jul 2020 09:44:05 +0000 (11:44 +0200)
so that they can be displayed.

src/lib/dcp_content.cc
src/lib/dcp_examiner.cc
src/lib/dcp_examiner.h
src/wx/film_viewer.cc

index ec6894428f96438d9cc76d60506a38c64540b3b0..00ffb390c2c501970e71f20eb6de4cf90493b4c0 100644 (file)
@@ -253,7 +253,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 ();
index b05ef593b7e538735f1067119db13ff23b26ed14..44513ff452c7a8901c0b3721914fc2ef7d02e931 100644 (file)
@@ -190,6 +190,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> 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 ()) {
index 78d2befd3b3115631d81290f714ed858c6a64809..cb68aa523c5235cd726361e40b47c793c763ff1f 100644 (file)
@@ -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 <dcp/dcp_time.h>
 
 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<int>(_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<DCPTextTrack> _dcp_text_tracks;
        bool _encrypted;
        bool _needs_assets;
        bool _kdm_valid;
index 154b3a5fd394a12d154662da1420e1c805818785..d3a6c12e44335a782d5a2e1b802acf15a85581c4 100644 (file)
@@ -191,6 +191,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 ();