Extract common code out into kdm_for_screen()
[dcpomatic.git] / src / lib / writer.h
index 5fe96a3ac94eee955cd9ac1429e86986e4da2f15..d09b062649f94ea55f74ad563847f54118330772 100644 (file)
@@ -131,8 +131,8 @@ private:
        std::vector<ReelWriter>::iterator _subtitle_reel;
        std::map<DCPTextTrack, std::vector<ReelWriter>::iterator> _caption_reels;
 
-       /** our thread, or 0 */
-       boost::thread* _thread;
+       /** our thread */
+       boost::thread _thread;
        /** true if our thread should finish */
        bool _finish;
        /** queue of things to write to disk */
@@ -151,6 +151,30 @@ private:
        int _maximum_frames_in_memory;
        unsigned int _maximum_queue_size;
 
+       class LastWritten
+       {
+       public:
+               LastWritten()
+                       : _frame(-1)
+                       , _eyes(EYES_RIGHT)
+               {}
+
+               /** @return true if qi is the next item after this one */
+               bool next (QueueItem qi) const;
+               void update (QueueItem qi);
+
+               int frame () const {
+                       return _frame;
+               }
+
+       private:
+               int _frame;
+               Eyes _eyes;
+       };
+
+       /** The last frame written to each reel */
+       std::vector<LastWritten> _last_written;
+
        /** number of FULL written frames */
        int _full_written;
        /** number of FAKE written frames */