_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;
void
FilmViewer::resume ()
{
+ DCPOMATIC_ASSERT (_suspended > 0);
--_suspended;
if (_playing && !_suspended) {
if (_audio.isStreamOpen()) {
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 ();
_playing = false;
_video_view->stop ();
Stopped (position());
+
+ _video_view->rethrow ();
return true;
}
recreate_butler ();
} else if (p == Film::VIDEO_FRAME_RATE) {
_video_view->set_video_frame_rate (_film->video_frame_rate());
+ } else if (p == Film::THREE_D) {
+ _video_view->set_three_d (_film->three_d());
}
}
bool
FilmViewer::quick_refresh ()
{
- if (!_video_view->_player_video.first) {
- return false;
- }
-
- if (!_video_view->_player_video.first->reset_metadata (_film, _player->video_container_size(), _film->frame_size())) {
- return false;
+ if (!_video_view || !_film) {
+ return true;
}
-
- _video_view->display_player_video ();
- return true;
+ return _video_view->refresh_metadata (_film, _player->video_container_size(), _film->frame_size());
}
void
_pad_black = p;
}
-/* May be called from a non-UI thread */
+/** Called when a player has finished the current film.
+ * May be called from a non-UI thread.
+ */
+void
+FilmViewer::finished ()
+{
+ emit (boost::bind(&FilmViewer::ui_finished, this));
+}
+
+/** Called by finished() in the UI thread */
void
-FilmViewer::emit_finished ()
+FilmViewer::ui_finished ()
{
- emit (boost::bind(boost::ref(Finished)));
+ stop ();
+ Finished ();
}
int