X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fwriter.h;h=71e04df96053c7cf9e7b756421b9e658e925a797;hb=2f796cd531de522a3b7ed03a9942f3c55f3a0b5b;hp=484ca1285043073f9f2a64af74fd2c91d10244c3;hpb=8855efa208776139bf9ce5a188db080e1e136e9b;p=dcpomatic.git diff --git a/src/lib/writer.h b/src/lib/writer.h index 484ca1285..71e04df96 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2018 Carl Hetherington + Copyright (C) 2012-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -22,9 +22,12 @@ * @brief Writer class. */ +#include "atmos_metadata.h" #include "types.h" #include "player_text.h" #include "exception_store.h" +#include "dcp_text_track.h" +#include #include #include #include @@ -35,10 +38,13 @@ namespace dcp { class Data; } +namespace dcpomatic { + class Font; +} + class Film; class AudioBuffers; class Job; -class Font; class ReferencedReelAsset; class ReelWriter; @@ -103,10 +109,11 @@ public: void fake_write (Frame, Eyes); bool can_repeat (Frame) const; void repeat (Frame, Eyes); - void write (boost::shared_ptr, DCPTime time); - void write (PlayerText text, TextType type, 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 write (boost::shared_ptr atmos, dcpomatic::DCPTime time, AtmosMetadata metadata); void finish (); void set_encoder_threads (int threads); @@ -124,10 +131,12 @@ private: boost::weak_ptr _job; std::vector _reels; std::vector::iterator _audio_reel; - std::vector::iterator _text_reel[TEXT_COUNT]; + std::vector::iterator _subtitle_reel; + std::map::iterator> _caption_reels; + std::vector::iterator _atmos_reel; - /** 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 */ @@ -146,6 +155,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 _last_written; + /** number of FULL written frames */ int _full_written; /** number of FAKE written frames */ @@ -161,5 +194,5 @@ private: std::list _reel_assets; - std::list > _fonts; + std::list > _fonts; };