Fix complete failure of preview/playback introduced in
[dcpomatic.git] / src / lib / player.h
index 7558f6da0bd2fd62376ae2e666623239cefd1729..82344604c24e2ff05f25a60ede8fa76e6eea74c3 100644 (file)
@@ -35,6 +35,7 @@
 #include "empty.h"
 #include <boost/shared_ptr.hpp>
 #include <boost/enable_shared_from_this.hpp>
+#include <boost/atomic.hpp>
 #include <list>
 
 namespace dcp {
@@ -59,6 +60,7 @@ public:
        static int const FILM_CONTAINER;
        static int const FILM_VIDEO_FRAME_RATE;
        static int const DCP_DECODE_REDUCTION;
+       static int const PLAYBACK_LENGTH;
 };
 
 /** @class Player
@@ -67,7 +69,7 @@ public:
 class Player : public boost::enable_shared_from_this<Player>, public boost::noncopyable
 {
 public:
-       Player (boost::shared_ptr<const Film>, boost::shared_ptr<const Playlist> playlist);
+       Player (boost::shared_ptr<const Film>, boost::shared_ptr<const Playlist> playlist, dcpomatic::DCPTime playback_length);
        ~Player ();
 
        bool pass ();
@@ -80,6 +82,7 @@ public:
                return _video_container_size;
        }
 
+       void set_playback_length (dcpomatic::DCPTime len);
        void set_video_container_size (dcp::Size);
        void set_ignore_video ();
        void set_ignore_audio ();
@@ -110,6 +113,7 @@ private:
        friend struct player_subframe_test;
        friend struct empty_test1;
        friend struct empty_test2;
+       friend struct check_reuse_old_data_test;
 
        void setup_pieces ();
        void setup_pieces_unlocked ();
@@ -148,8 +152,8 @@ private:
        boost::shared_ptr<const Film> _film;
        boost::shared_ptr<const Playlist> _playlist;
 
-       /** true if we are suspended (i.e. pass() and seek() do nothing) */
-       bool _suspended;
+       /** > 0 if we are suspended (i.e. pass() and seek() do nothing) */
+       boost::atomic<int> _suspended;
        std::list<boost::shared_ptr<Piece> > _pieces;
 
        /** Size of the image in the DCP (e.g. 1990x1080 for flat) */
@@ -205,6 +209,8 @@ private:
        ActiveText _active_texts[TEXT_COUNT];
        boost::shared_ptr<AudioProcessor> _audio_processor;
 
+       dcpomatic::DCPTime _playback_length;
+
        boost::signals2::scoped_connection _film_changed_connection;
        boost::signals2::scoped_connection _playlist_change_connection;
        boost::signals2::scoped_connection _playlist_content_change_connection;