From: Carl Hetherington Date: Mon, 13 Feb 2017 15:32:16 +0000 (+0000) Subject: Fix bug in gap-filling; rename _last_video_time -> _last_time. X-Git-Tag: v2.11.1~117 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=b800a9051f068b4b11a08248601bc7099e79807f Fix bug in gap-filling; rename _last_video_time -> _last_time. --- diff --git a/src/lib/player.cc b/src/lib/player.cc index d9fb8dfae..611e9c900 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -521,7 +521,6 @@ Player::pass () return true; } - cout << "Pass " << earliest->content->path(0) << "\n"; earliest->decoder->pass (); /* Emit any audio that is ready */ @@ -587,8 +586,10 @@ Player::video (weak_ptr wp, ContentVideo video) /* Fill gaps */ - if (_last_video_time) { - for (DCPTime i = _last_video_time.get(); i < time; i += DCPTime::from_frames (1, _film->video_frame_rate())) { + if (_last_time) { + /* XXX: this may not work for 3D */ + DCPTime const frame = DCPTime::from_frames (1, _film->video_frame_rate()); + for (DCPTime i = _last_time.get() + frame; i < time; i += frame) { if (_playlist->video_content_at(i) && _last_video) { Video (shared_ptr (new PlayerVideo (*_last_video)), i); } else { @@ -616,10 +617,9 @@ Player::video (weak_ptr wp, ContentVideo video) _last_video->set_subtitle (subtitles.get ()); } - _last_video_time = time; + _last_time = time; - cout << "Video @ " << to_string(_last_video_time.get()) << "\n"; - Video (_last_video, *_last_video_time); + Video (_last_video, *_last_time); /* Discard any subtitles we no longer need */ @@ -772,8 +772,8 @@ Player::seek (DCPTime time, bool accurate) } if (accurate) { - _last_video_time = time - DCPTime::from_frames (1, _film->video_frame_rate ()); + _last_time = time - DCPTime::from_frames (1, _film->video_frame_rate ()); } else { - _last_video_time = optional (); + _last_time = optional (); } } diff --git a/src/lib/player.h b/src/lib/player.h index 05e994d0b..ba7845b54 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -130,8 +130,10 @@ private: /** true if we should `play' (i.e output) referenced DCP data (e.g. for preview) */ bool _play_referenced; + /** Last PlayerVideo that was emitted */ boost::shared_ptr _last_video; - boost::optional _last_video_time; + /** Time of the last thing we emitted, or the last seek time */ + boost::optional _last_time; AudioMerger _audio_merger; DCPTime _last_audio_time;