Fix no subtitles/captions in the player after changing the CPL.
authorCarl Hetherington <cth@carlh.net>
Thu, 4 Feb 2021 16:21:42 +0000 (17:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 4 Feb 2021 16:21:42 +0000 (17:21 +0100)
src/tools/dcpomatic_player.cc

index 2c561d16b69f8d111871280e8d49799aeb7d40b7..6e1104b66eba5767910eb8f7069a799100096ee2 100644 (file)
@@ -472,6 +472,19 @@ public:
 
 private:
 
+       void examine_content ()
+       {
+               DCPOMATIC_ASSERT (_film);
+               auto dcp = dynamic_pointer_cast<DCPContent>(_film->content().front());
+               DCPOMATIC_ASSERT (dcp);
+               dcp->examine (_film, shared_ptr<Job>());
+
+               /* Examining content re-creates the TextContent objects, so we must re-enable them */
+               for (auto i: dcp->text) {
+                       i->set_use (true);
+               }
+       }
+
        bool report_errors_from_last_job (wxWindow* parent) const
        {
                auto jm = JobManager::instance ();
@@ -639,7 +652,7 @@ private:
                        try {
                                if (dcp) {
                                        dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE)));
-                                       dcp->examine (_film, shared_ptr<Job>());
+                                       examine_content();
                                }
                        } catch (exception& e) {
                                error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what()));
@@ -705,7 +718,7 @@ private:
                }
 
                dcp->set_cpl ((*i)->id());
-               dcp->examine (_film, shared_ptr<Job>());
+               examine_content ();
                _info->triggered_update ();
        }