Some simple-video-view tidy-ups.
[dcpomatic.git] / src / wx / film_viewer.cc
index 17573b4388053fe1ea09539510d8632a7770cffa..3a593fc556b80cd1babfba5a6dcd5c69b272a07f 100644 (file)
@@ -182,6 +182,10 @@ FilmViewer::set_film (shared_ptr<Film> film)
        _film->LengthChange.connect (boost::bind(&FilmViewer::film_length_change, this));
        _player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
 
+       film_change (CHANGE_TYPE_DONE, Film::VIDEO_FRAME_RATE);
+       film_change (CHANGE_TYPE_DONE, Film::THREE_D);
+       film_length_change ();
+
        /* Keep about 1 second's worth of history samples */
        _latency_history_count = _film->audio_frame_rate() / _audio_block_size;
 
@@ -310,6 +314,14 @@ FilmViewer::start ()
                return;
        }
 
+       /* We are about to set up the audio stream from the position of the video view.
+          If there is `lazy' seek in progress we need to wait for it to go through so that
+          _video_view->position() gives us a sensible answer.
+        */
+       while (_idle_get) {
+               idle_handler ();
+       }
+
        if (_audio.isStreamOpen()) {
                _audio.setStreamTime (_video_view->position().seconds());
                _audio.startStream ();