Add FilmViewer::time_until_next_frame.
authorCarl Hetherington <cth@carlh.net>
Sun, 20 Oct 2019 21:24:15 +0000 (23:24 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 8 Jan 2020 20:56:47 +0000 (21:56 +0100)
src/wx/film_viewer.cc
src/wx/film_viewer.h
src/wx/simple_video_view.cc

index 8b90cd9c99c81c429ce41543861e43b12881f0c4..373e6d717246d956f982242d83103ce1cbc405fb 100644 (file)
@@ -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);
+}
index 51419a54dc9c5cf29b139f8ea5af79754e1084cb..55356f18815885a0218e752e9b4a29ea4d55e4d2 100644 (file)
@@ -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;
index f0c63d15aa71f4ad633bc09328b3fea84bb7e299..c195bbc35489024d8fcf435e1dee57d0291755c1 100644 (file)
@@ -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 ();