summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-07-28 22:20:19 +0200
committerCarl Hetherington <cth@carlh.net>2020-08-02 21:48:08 +0000
commit5fa8671eb5515a534d3971c249337303cab67740 (patch)
treead2fbf33f442a0a032300428eb5c3a904d79358e
parentb58ea0495d72d654161958e515dc6c5ba9992b80 (diff)
Fix various problems with the closed caption viewer not being updated properly.
Cherry-picked from d902160e3c89a9f65f58a2463fac0b1de1d940b1 in v2.15.x.
-rw-r--r--src/wx/closed_captions_dialog.cc17
-rw-r--r--src/wx/closed_captions_dialog.h3
-rw-r--r--src/wx/film_viewer.cc18
-rw-r--r--src/wx/film_viewer.h1
4 files changed, 35 insertions, 4 deletions
diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc
index 44e6b8da1..5403e7f2e 100644
--- a/src/wx/closed_captions_dialog.cc
+++ b/src/wx/closed_captions_dialog.cc
@@ -191,6 +191,12 @@ ClosedCaptionsDialog::update (DCPTime time)
Refresh ();
_current_in_lines = true;
}
+
+ if (!_current && _tracks.empty()) {
+ for (int i = 0; i < CLOSED_CAPTION_LINES; ++i) {
+ _lines[i] = wxString();
+ }
+ }
}
void
@@ -201,8 +207,15 @@ ClosedCaptionsDialog::clear ()
Refresh ();
}
+
+void
+ClosedCaptionsDialog::set_butler (weak_ptr<Butler> butler)
+{
+ _butler = butler;
+}
+
void
-ClosedCaptionsDialog::set_film_and_butler (shared_ptr<Film> film, weak_ptr<Butler> butler)
+ClosedCaptionsDialog::update_tracks (shared_ptr<const Film> film)
{
_tracks.clear ();
@@ -225,5 +238,5 @@ ClosedCaptionsDialog::set_film_and_butler (shared_ptr<Film> film, weak_ptr<Butle
_track->SetSelection (0);
}
- _butler = butler;
+ track_selected ();
}
diff --git a/src/wx/closed_captions_dialog.h b/src/wx/closed_captions_dialog.h
index 4b407fa5a..26d042639 100644
--- a/src/wx/closed_captions_dialog.h
+++ b/src/wx/closed_captions_dialog.h
@@ -33,7 +33,8 @@ public:
void update (DCPTime);
void clear ();
- void set_film_and_butler (boost::shared_ptr<Film>, boost::weak_ptr<Butler>);
+ void update_tracks (boost::shared_ptr<const Film> film);
+ void set_butler (boost::weak_ptr<Butler>);
private:
void paint ();
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 098fc2598..026e9d66f 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -45,6 +45,7 @@
#include "lib/config.h"
#include "lib/compose.hpp"
#include "lib/dcpomatic_log.h"
+#include "lib/text_content.h"
extern "C" {
#include <libavutil/pixfmt.h>
}
@@ -154,6 +155,7 @@ FilmViewer::set_film (shared_ptr<Film> film)
_player->set_play_referenced ();
_film->Change.connect (boost::bind (&FilmViewer::film_change, this, _1, _2));
+ _film->ContentChange.connect (boost::bind(&FilmViewer::content_change, this, _1, _3));
_player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
/* Keep about 1 second's worth of history samples */
@@ -213,7 +215,7 @@ FilmViewer::recreate_butler ()
_butler->disable_audio ();
}
- _closed_captions_dialog->set_film_and_butler (_film, _butler);
+ _closed_captions_dialog->set_butler (_butler);
if (was_running) {
start ();
@@ -554,6 +556,8 @@ FilmViewer::film_change (ChangeType type, Film::Property p)
{
if (type == CHANGE_TYPE_DONE && p == Film::AUDIO_CHANNELS) {
recreate_butler ();
+ } else if (p == Film::CONTENT) {
+ _closed_captions_dialog->update_tracks (_film);
}
}
@@ -792,3 +796,15 @@ FilmViewer::set_pad_black (bool p)
{
_pad_black = p;
}
+
+void
+FilmViewer::content_change (ChangeType type, int property)
+{
+ if (type != CHANGE_TYPE_DONE) {
+ return;
+ }
+
+ if (property == TextContentProperty::USE || property == TextContentProperty::TYPE || property == TextContentProperty::DCP_TRACK) {
+ _closed_captions_dialog->update_tracks (_film);
+ }
+}
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 972a88a5a..cfb8374ee 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -113,6 +113,7 @@ private:
void get ();
void display_player_video ();
void film_change (ChangeType, Film::Property);
+ void content_change (ChangeType, int property);
void recreate_butler ();
void config_changed (Config::Property);
bool maybe_draw_background_image (wxPaintDC& dc);