summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-10-20 23:24:15 +0200
committerCarl Hetherington <cth@carlh.net>2020-01-08 21:56:47 +0100
commit0a3f387f5d39da2ca38ec90a9593c1b598040dd7 (patch)
treeba8cb7a5cee8ed78b3c5f0822224af2477fefed5 /src
parent3b173e309f9f2736aa7e7d09900c5baee4ef31b3 (diff)
Add FilmViewer::time_until_next_frame.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc8
-rw-r--r--src/wx/film_viewer.h3
-rw-r--r--src/wx/simple_video_view.cc2
3 files changed, 11 insertions, 2 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 8b90cd9c9..373e6d717 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -633,3 +633,11 @@ FilmViewer::set_pad_black (bool p)
{
_pad_black = p;
}
+
+/* XXX_b: comment */
+int
+FilmViewer::time_until_next_frame () const
+{
+ DCPTime const next = position() + one_video_frame();
+ return max ((next.seconds() - time().seconds()) * 1000, 1.0);
+}
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 51419a54d..55356f188 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -119,7 +119,7 @@ public:
return _gets;
}
- /* Some accessors that VideoView classes need */
+ /* Some accessors and utility methods that VideoView classes need */
dcp::Size out_size () const {
return _out_size;
}
@@ -138,6 +138,7 @@ public:
boost::shared_ptr<Butler> butler () const {
return _butler;
}
+ int time_until_next_frame () const;
boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
boost::signals2::signal<void ()> PositionChanged;
diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc
index f0c63d15a..c195bbc35 100644
--- a/src/wx/simple_video_view.cc
+++ b/src/wx/simple_video_view.cc
@@ -159,7 +159,7 @@ SimpleVideoView::timer ()
}
LOG_DEBUG_PLAYER("%1 -> %2; delay %3", next.seconds(), _viewer->time().seconds(), max((next.seconds() - _viewer->time().seconds()) * 1000, 1.0));
- _timer.Start (max ((next.seconds() - _viewer->time().seconds()) * 1000, 1.0), wxTIMER_ONE_SHOT);
+ _timer.Start (_viewer->time_until_next_frame()), wxTIMER_ONE_SHOT);
if (_viewer->butler()) {
_viewer->butler()->rethrow ();