Improve behaviour of the position slider at the end of films.
authorCarl Hetherington <cth@carlh.net>
Mon, 17 Mar 2014 10:56:41 +0000 (10:56 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 17 Mar 2014 10:56:41 +0000 (10:56 +0000)
Reported-by: GĂ©rald Maruccia
ChangeLog
src/wx/film_viewer.cc

index 15aa8a87b3a927a9a64a42ba5d60c3953009f996..5a99d30ff0a76a1525db6738a009684081a72bc8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-03-17  Carl Hetherington  <cth@carlh.net>
 
+       * Improve behaviour of the position slider at the end of films.
+
        * Version 1.66.2 released.
 
 2014-03-17  Carl Hetherington  <cth@carlh.net>
index 45372d8111f532495d82cd56409aaa22773af1a1..ce5eab00e1db8e8f0bd4bb7e707fe470e59bc7cb 100644 (file)
@@ -219,7 +219,12 @@ void
 FilmViewer::slider_moved ()
 {
        if (_film && _player) {
-               _player->seek (_slider->GetValue() * _film->length() / 4096, false);
+               Time t = _slider->GetValue() * _film->length() / 4096;
+               /* Ensure that we hit the end of the film at the end of the slider */
+               if (t >= _film->length ()) {
+                       t = _film->length() - _film->video_frames_to_time (1);
+               }
+               _player->seek (t, false);
                fetch_next_frame ();
        }
 }