summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-11-21 22:38:33 +0100
committerCarl Hetherington <cth@carlh.net>2020-01-08 21:56:47 +0100
commitb3b371294ed5e6cc18ef64ba1b06ca76726b903a (patch)
tree08ecb920e3aef37a3aa6adef501b35c85eac018b
parent7f5d317d3ba2bdb1838e942c436ad9f5de321bb4 (diff)
Remove some friends from FilmViewer.
-rw-r--r--src/wx/closed_captions_dialog.cc19
-rw-r--r--src/wx/closed_captions_dialog.h5
-rw-r--r--src/wx/film_viewer.cc11
-rw-r--r--src/wx/film_viewer.h18
-rw-r--r--src/wx/simple_video_view.cc2
-rw-r--r--src/wx/video_view.cc6
-rw-r--r--src/wx/video_view.h18
7 files changed, 53 insertions, 26 deletions
diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc
index 061262cdd..afcf5fa87 100644
--- a/src/wx/closed_captions_dialog.cc
+++ b/src/wx/closed_captions_dialog.cc
@@ -53,6 +53,7 @@ ClosedCaptionsDialog::ClosedCaptionsDialog (wxWindow* parent, FilmViewer* viewer
, _display (new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(640, (640 / 10) + 64)))
, _track (new wxChoice(this, wxID_ANY))
, _current_in_lines (false)
+ , _timer (this)
{
_lines.resize (CLOSED_CAPTION_LINES);
@@ -65,6 +66,8 @@ ClosedCaptionsDialog::ClosedCaptionsDialog (wxWindow* parent, FilmViewer* viewer
sizer->Add (track_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP);
sizer->Add (_display, 1, wxEXPAND);
+ Bind (wxEVT_SHOW, boost::bind(&ClosedCaptionsDialog::shown, this, _1));
+ Bind (wxEVT_TIMER, boost::bind(&ClosedCaptionsDialog::update, this));
_display->Bind (wxEVT_PAINT, boost::bind(&ClosedCaptionsDialog::paint, this));
_track->Bind (wxEVT_CHOICE, boost::bind(&ClosedCaptionsDialog::track_selected, this));
@@ -72,11 +75,21 @@ ClosedCaptionsDialog::ClosedCaptionsDialog (wxWindow* parent, FilmViewer* viewer
}
void
+ClosedCaptionsDialog::shown (wxShowEvent ev)
+{
+ if (ev.IsShown ()) {
+ _timer.Start (40);
+ } else {
+ _timer.Stop ();
+ }
+}
+
+void
ClosedCaptionsDialog::track_selected ()
{
_current = optional<TextRingBuffers::Data> ();
_viewer->slow_refresh ();
- update (_last_update);
+ update ();
}
void
@@ -131,9 +144,9 @@ private:
};
void
-ClosedCaptionsDialog::update (DCPTime time)
+ClosedCaptionsDialog::update ()
{
- _last_update = time;
+ DCPTime const time = _viewer->time ();
if (_current_in_lines && _current && _current->period.to > time) {
/* Current one is fine */
diff --git a/src/wx/closed_captions_dialog.h b/src/wx/closed_captions_dialog.h
index fb4e9d59b..5c366ca7b 100644
--- a/src/wx/closed_captions_dialog.h
+++ b/src/wx/closed_captions_dialog.h
@@ -31,11 +31,12 @@ class ClosedCaptionsDialog : public wxDialog
public:
explicit ClosedCaptionsDialog (wxWindow* parent, FilmViewer* viewer);
- void update (dcpomatic::DCPTime);
void clear ();
void set_film_and_butler (boost::shared_ptr<Film>, boost::weak_ptr<Butler>);
private:
+ void shown (wxShowEvent);
+ void update ();
void paint ();
void track_selected ();
@@ -47,5 +48,5 @@ private:
std::vector<wxString> _lines;
std::vector<DCPTextTrack> _tracks;
boost::weak_ptr<Butler> _butler;
- dcpomatic::DCPTime _last_update;
+ wxTimer _timer;
};
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 7437612af..dcbfedc81 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -88,12 +88,10 @@ FilmViewer::FilmViewer (wxWindow* p)
, _latency_history_count (0)
, _closed_captions_dialog (new ClosedCaptionsDialog(p, this))
, _outline_content (false)
- , _eyes (EYES_LEFT)
, _pad_black (false)
#ifdef DCPOMATIC_VARIANT_SWAROOP
, _background_image (false)
#endif
- , _gets (0)
, _idle_get (false)
{
switch (Config::instance()->video_view_type()) {
@@ -234,7 +232,7 @@ FilmViewer::set_outline_content (bool o)
void
FilmViewer::set_eyes (Eyes e)
{
- _eyes = e;
+ _video_view->set_eyes (e);
slow_refresh ();
}
@@ -651,3 +649,10 @@ FilmViewer::dropped () const
return _video_view->dropped ();
}
+int
+FilmViewer::gets () const
+{
+ return _video_view->gets ();
+}
+
+
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 21195e747..ec481f34e 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -92,7 +92,11 @@ public:
void slow_refresh ();
+ dcpomatic::DCPTime time () const;
+ boost::optional<dcpomatic::DCPTime> audio_time () const;
+
int dropped () const;
+ int gets () const;
int audio_callback (void* out, unsigned int frames);
@@ -107,10 +111,6 @@ public:
}
#endif
- int gets () const {
- return _gets;
- }
-
StateTimer const & state_timer () const {
return _video_view->state_timer ();
}
@@ -143,11 +143,6 @@ public:
private:
- /* XXX_b: to remove */
- friend class SimpleVideoView;
- friend class GLVideoView;
- friend class VideoView;
-
void video_view_sized ();
void calculate_sizes ();
void player_change (ChangeType type, int, bool);
@@ -158,8 +153,6 @@ private:
void config_changed (Config::Property);
void film_length_change ();
- dcpomatic::DCPTime time () const;
- boost::optional<dcpomatic::DCPTime> audio_time () const;
dcpomatic::DCPTime uncorrected_time () const;
Frame average_latency () const;
@@ -192,7 +185,6 @@ private:
ClosedCaptionsDialog* _closed_captions_dialog;
bool _outline_content;
- Eyes _eyes;
/** true to pad the viewer panel with black, false to use
the normal window background colour.
*/
@@ -202,8 +194,6 @@ private:
bool _background_image;
#endif
- int _gets;
-
/** true if an get() is required next time we are idle */
bool _idle_get;
diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc
index 63dc10200..22e4db887 100644
--- a/src/wx/simple_video_view.cc
+++ b/src/wx/simple_video_view.cc
@@ -253,6 +253,4 @@ SimpleVideoView::display_player_video ()
_inter_size = player_video().first->inter_size ();
update ();
-
- _viewer->closed_captions_dialog()->update (_viewer->time());
}
diff --git a/src/wx/video_view.cc b/src/wx/video_view.cc
index e65888656..5dd857fab 100644
--- a/src/wx/video_view.cc
+++ b/src/wx/video_view.cc
@@ -30,7 +30,9 @@ VideoView::VideoView (FilmViewer* viewer)
#endif
, _state_timer ("viewer")
, _video_frame_rate (0)
+ , _eyes (EYES_LEFT)
, _dropped (0)
+ , _gets (0)
{
}
@@ -54,7 +56,7 @@ VideoView::get_next_frame (bool non_blocking)
}
DCPOMATIC_ASSERT (_viewer->butler());
- _viewer->_gets++;
+ add_get ();
boost::mutex::scoped_lock lm (_mutex);
@@ -67,7 +69,7 @@ VideoView::get_next_frame (bool non_blocking)
} while (
_player_video.first &&
_viewer->film()->three_d() &&
- _viewer->_eyes != _player_video.first->eyes() &&
+ _eyes != _player_video.first->eyes() &&
_player_video.first->eyes() != EYES_BOTH
);
diff --git a/src/wx/video_view.h b/src/wx/video_view.h
index 4a94aa879..fd2684e41 100644
--- a/src/wx/video_view.h
+++ b/src/wx/video_view.h
@@ -23,6 +23,7 @@
#include "lib/dcpomatic_time.h"
#include "lib/timer.h"
+#include "lib/types.h"
#include <boost/shared_ptr.hpp>
#include <boost/signals2.hpp>
#include <boost/thread.hpp>
@@ -63,6 +64,11 @@ public:
return _dropped;
}
+ int gets () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _gets;
+ }
+
StateTimer const & state_timer () const {
return _state_timer;
}
@@ -82,6 +88,11 @@ public:
_length = len;
}
+ void set_eyes (Eyes eyes) {
+ boost::mutex::scoped_lock lm (_mutex);
+ _eyes = eyes;
+ }
+
protected:
/* XXX_b: to remove */
friend class FilmViewer;
@@ -110,6 +121,11 @@ protected:
++_dropped;
}
+ void add_get () {
+ boost::mutex::scoped_lock lm (_mutex);
+ ++_gets;
+ }
+
FilmViewer* _viewer;
#ifdef DCPOMATIC_VARIANT_SWAROOP
@@ -128,8 +144,10 @@ private:
int _video_frame_rate;
/** length of the film we are playing, or 0 if there is none */
dcpomatic::DCPTime _length;
+ Eyes _eyes;
int _dropped;
+ int _gets;
};
#endif