Fix bug in gap-filling; rename _last_video_time -> _last_time.
authorCarl Hetherington <cth@carlh.net>
Mon, 13 Feb 2017 15:32:16 +0000 (15:32 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 19 Apr 2017 22:04:32 +0000 (23:04 +0100)
src/lib/player.cc
src/lib/player.h

index d9fb8dfaec67c949f196c00d26f3f0a14a8a1481..611e9c9002344b032485dff3febf094a922dac56 100644 (file)
@@ -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<Piece> 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<PlayerVideo> (new PlayerVideo (*_last_video)), i);
                        } else {
@@ -616,10 +617,9 @@ Player::video (weak_ptr<Piece> 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<DCPTime> ();
+               _last_time = optional<DCPTime> ();
        }
 }
index 05e994d0bb105aa8b797762e96a285e3de4e4624..ba7845b541d935e905663eca9a91abdad9dafe17 100644 (file)
@@ -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<PlayerVideo> _last_video;
-       boost::optional<DCPTime> _last_video_time;
+       /** Time of the last thing we emitted, or the last seek time */
+       boost::optional<DCPTime> _last_time;
 
        AudioMerger _audio_merger;
        DCPTime _last_audio_time;