Hopefully fix seek back/forward.
[dcpomatic.git] / src / lib / player.h
index 903d011d0aad99a64bc4650786f20c174e8b65a8..15fa4dbd6ce5c1d118683e26bc5278e96cf31eef 100644 (file)
@@ -26,6 +26,7 @@
 #include "playlist.h"
 #include "audio_buffers.h"
 #include "content.h"
+#include "film.h"
 
 class Job;
 class Film;
@@ -48,12 +49,10 @@ public:
        void disable_audio ();
 
        bool pass ();
-       void seek (Time);
-       void seek_back ();
+       void seek (Time, bool);
 
-       /** @return position that we are at; ie the time of the next thing we will emit on pass() */
-       Time position () const {
-               return _position;
+       Time video_position () const {
+               return _video_position;
        }
 
        void set_video_container_size (libdcp::Size);
@@ -68,6 +67,12 @@ public:
        /** Emitted when some audio data is ready */
        boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, Time)> Audio;
 
+       /** Emitted when something has changed such that if we went back and emitted
+        *  the last frame again it would look different.  This is not emitted after
+        *  a seek.
+        */
+       boost::signals2::signal<void ()> Changed;
+
 private:
 
        void process_video (boost::weak_ptr<Piece>, boost::shared_ptr<const Image>, bool, VideoContent::Frame);
@@ -76,10 +81,11 @@ private:
        void playlist_changed ();
        void content_changed (boost::weak_ptr<Content>, int);
        void do_seek (Time, bool);
-       void add_black_piece (Time, Time);
-       void add_silent_piece (Time, Time);
        void flush ();
+       void emit_black ();
+       void emit_silence (OutputAudioFrame);
        boost::shared_ptr<Resampler> resampler (boost::shared_ptr<AudioContent>);
+       void film_changed (Film::Property);
 
        boost::shared_ptr<const Film> _film;
        boost::shared_ptr<const Playlist> _playlist;
@@ -90,10 +96,16 @@ private:
        /** Our pieces are ready to go; if this is false the pieces must be (re-)created before they are used */
        bool _have_valid_pieces;
        std::list<boost::shared_ptr<Piece> > _pieces;
-       Time _position;
+
+       /** The time after the last video that we emitted */
+       Time _video_position;
+       /** The time after the last audio that we emitted */
+       Time _audio_position;
+
        AudioBuffers _audio_buffers;
-       Time _next_audio;
-       boost::optional<libdcp::Size> _video_container_size;
+
+       libdcp::Size _video_container_size;
+       boost::shared_ptr<Image> _black_frame;
        std::map<boost::shared_ptr<AudioContent>, boost::shared_ptr<Resampler> > _resamplers;
 };