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

Cherry-picked from 09860271bb6d03b3937c08bffb4c672697f6d711 in v2.15.x.

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

index ef877a17fbd438d2159400190ebc91a185774597..2e93e9ee8f64931ea426f4d7b4535bf9cbfeb094 100644 (file)
@@ -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 ();
index c70d8b2dbc9172966e400ce8451c9a0ed6168493..31c80f724d7016b86d304bb058acce1672cffb55 100644 (file)
@@ -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()) {
index 199ac39851e4229e57949b33e7cd62043e22f771..9774ec519f86f0f51fcb536e0932307387db77c0 100644 (file)
@@ -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;
index 026e9d66f4920de0abf57468d8c24348b07b903d..f68b213091e7d26ab8f527552ba2081892bd09ef 100644 (file)
@@ -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 ();