Another attempt to fix back / same-frame seeks.
[dcpomatic.git] / src / wx / film_viewer.cc
index e5d07a118e28cfb510a3b4528672712dac4766eb..d27386d3d685ca79fac6bed542b38efd4cf744b4 100644 (file)
@@ -67,9 +67,7 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
        _panel->SetDoubleBuffered (true);
 #endif
        
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
        _panel->SetBackgroundStyle (wxBG_STYLE_PAINT);
-#endif 
        
        _v_sizer = new wxBoxSizer (wxVERTICAL);
        SetSizer (_v_sizer);
@@ -141,8 +139,8 @@ FilmViewer::fetch_current_frame_again ()
        if (!_player) {
                return;
        }
-
-       _player->seek (_player->video_position() - _film->video_frames_to_time (1), false);
+          
+       _player->seek (_player->video_position(), true);
        fetch_next_frame ();
 }
 
@@ -174,7 +172,7 @@ FilmViewer::paint_panel (wxPaintEvent &)
                return;
        }
 
-       shared_ptr<SimpleImage> packed_frame (new SimpleImage (_frame, false));
+       shared_ptr<Image> packed_frame (new Image (_frame, false));
 
        wxImage frame (_out_size.width, _out_size.height, packed_frame->data()[0], true);
        wxBitmap frame_bitmap (frame);
@@ -275,7 +273,7 @@ FilmViewer::process_video (shared_ptr<const Image> image, bool, Time t)
        double const fps = _film->dcp_video_frame_rate ();
        /* Count frame number from 1 ... not sure if this is the best idea */
        _frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (t * fps / TIME_HZ)) + 1));
-
+       
        double w = static_cast<double>(t) / TIME_HZ;
        int const h = (w / 3600);
        w -= h * 3600;
@@ -300,7 +298,7 @@ FilmViewer::fetch_next_frame ()
 
        try {
                _got_frame = false;
-               while (!_got_frame && !_player->pass ());
+               while (!_got_frame && !_player->pass ()) {}
        } catch (DecodeError& e) {
                _play_button->SetValue (false);
                check_play_state ();
@@ -338,9 +336,7 @@ FilmViewer::back_clicked (wxCommandEvent &)
                return;
        }
 
-       Time const t = _film->video_frames_to_time (1);
-       
-       _player->seek (_player->video_position() - t * 2.5, true);
+       _player->seek (_player->video_position() - _film->video_frames_to_time(1), true);
        fetch_next_frame ();
 }