swaroop: hopefully fix wallpaper apparition.
[dcpomatic.git] / src / wx / film_viewer.cc
index 35b0663b0fd10b596dd73d4f1ce18c26abdf519f..dd088db20fa2d59c0c201b0fdca3e260e64c7ba3 100644 (file)
@@ -121,6 +121,9 @@ FilmViewer::set_film (shared_ptr<Film> film)
        }
 
        _film = film;
+       _video_position = DCPTime ();
+       _player_video.first.reset ();
+       _player_video.second = DCPTime ();
 
        _frame.reset ();
        _closed_captions_dialog->clear ();
@@ -295,6 +298,8 @@ FilmViewer::timer ()
 
        if (next >= _film->length()) {
                stop ();
+               Finished ();
+               return;
        }
 
        _timer.Start (max ((next.seconds() - time().seconds()) * 1000, 1.0), wxTIMER_ONE_SHOT);
@@ -325,13 +330,14 @@ FilmViewer::paint_panel ()
 {
        wxPaintDC dc (_panel);
 
-       if (!_frame || !_film || !_out_size.width || !_out_size.height || _out_size != _frame->size()) {
+       if (!_out_size.width || !_out_size.height || !_frame || _out_size != _frame->size()) {
                dc.Clear ();
-               maybe_draw_background_image (dc);
                return;
        }
 
-       if (_video_position == DCPTime() && maybe_draw_background_image (dc)) {
+       if (!_film) {
+               dc.Clear ();
+               maybe_draw_background_image (dc);
                return;
        }
 
@@ -598,7 +604,6 @@ FilmViewer::seek (DCPTime t, bool accurate)
        }
 
        PositionChanged ();
-       Seeked (position());
 }
 
 void
@@ -636,7 +641,6 @@ FilmViewer::config_changed (Config::Property p)
                }
 
                _audio_channels = _audio.getDeviceInfo(st).outputChannels;
-               cout << "RtAudio reports " << _audio_channels << " channels.\n";
 
                RtAudio::StreamParameters sp;
                sp.deviceId = st;