X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fwriter.h;h=d09b062649f94ea55f74ad563847f54118330772;hp=ec7b9880417c9363d13f7d6459b95124afb594f5;hb=8f12e84009d7c2685bb2eeb32665876463d4e6e5;hpb=60d528017a3ac1afdc30a3a000b28dda96a2175e diff --git a/src/lib/writer.h b/src/lib/writer.h index ec7b98804..d09b06264 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington + Copyright (C) 2012-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -23,8 +23,9 @@ */ #include "types.h" -#include "player_subtitles.h" +#include "player_text.h" #include "exception_store.h" +#include "dcp_text_track.h" #include #include #include @@ -35,10 +36,13 @@ namespace dcp { class Data; } +namespace dcpomatic { + class Font; +} + class Film; class AudioBuffers; class Job; -class Font; class ReferencedReelAsset; class ReelWriter; @@ -103,9 +107,9 @@ public: void fake_write (Frame, Eyes); bool can_repeat (Frame) const; void repeat (Frame, Eyes); - void write (boost::shared_ptr, DCPTime time); - void write (PlayerSubtitles subs, DCPTimePeriod period); - void write (std::list > fonts); + void write (boost::shared_ptr, dcpomatic::DCPTime time); + void write (PlayerText text, TextType type, boost::optional, dcpomatic::DCPTimePeriod period); + void write (std::list > fonts); void write (ReferencedReelAsset asset); void finish (); @@ -125,9 +129,10 @@ private: std::vector _reels; std::vector::iterator _audio_reel; std::vector::iterator _subtitle_reel; + std::map::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 */ @@ -144,6 +149,31 @@ private: * ordering */ 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 _last_written; /** number of FULL written frames */ int _full_written; @@ -160,5 +190,5 @@ private: std::list _reel_assets; - std::list > _fonts; + std::list > _fonts; };