Fix video timing and stop the viewer at the end of the film.
authorCarl Hetherington <cth@carlh.net>
Tue, 18 Apr 2017 09:57:19 +0000 (10:57 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 19 Apr 2017 22:04:32 +0000 (23:04 +0100)
src/wx/film_viewer.cc

index 2aef50c6ddf85b3f12f2316f1b3eb23ea2b1bb9b..56f9c15e863d4f7cd56ee634d441e6287e2b672e 100644 (file)
@@ -306,11 +306,15 @@ FilmViewer::timer ()
        }
 
        if (_audio.isStreamRunning ()) {
-               DCPTime const now = time().ceil (_film->video_frame_rate ());
                get ();
                update_position_label ();
                update_position_slider ();
-               DCPTime const next = now + DCPTime::from_frames (1, _film->video_frame_rate ());
+               DCPTime const next = _video_position + DCPTime::from_frames (1, _film->video_frame_rate ());
+
+               if (next >= _film->length()) {
+                       stop ();
+               }
+
                _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 0.0), wxTIMER_ONE_SHOT);
        }