Allow no-stretch scaling of video content.
[dcpomatic.git] / src / wx / film_viewer.cc
index f569f4c54ae097a43c893cccff62f09689cfaeca..69cd276e17a9fa6ac64aef63f0bde2b3003ca9d5 100644 (file)
@@ -131,7 +131,7 @@ FilmViewer::set_film (shared_ptr<Film> f)
 
        _player = f->make_player ();
        _player->disable_audio ();
-       _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _2, _4));
+       _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _2, _5));
        _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
 
        calculate_sizes ();
@@ -239,7 +239,7 @@ FilmViewer::calculate_sizes ()
 
        Ratio const * container = _film->container ();
        
-       float const panel_ratio = static_cast<float> (_panel_size.width) / _panel_size.height;
+       float const panel_ratio = _panel_size.ratio ();
        float const film_ratio = container ? container->ratio () : 1.78;
                        
        if (panel_ratio < film_ratio) {
@@ -382,8 +382,13 @@ FilmViewer::back_clicked ()
        /* Player::video_position is the time after the last frame that we received.
           We want to see the one before it, so we need to go back 2.
        */
+
+       Time p = _player->video_position() - _film->video_frames_to_time (2);
+       if (p < 0) {
+               p = 0;
+       }
        
-       _player->seek (_player->video_position() - _film->video_frames_to_time(2), true);
+       _player->seek (p, true);
        fetch_next_frame ();
 }