Remove in-place translations support.
[dcpomatic.git] / src / lib / writer.h
index aab7d5fc78da6e1d5c4211093c34c04b2781d2ea..efb6a17d8d54448b740e2b3fc238010c6abff01f 100644 (file)
 */
 
 
+#ifndef DCPOMATIC_WRITER_H
+#define DCPOMATIC_WRITER_H
+
+
 /** @file  src/lib/writer.h
  *  @brief Writer class.
  */
 
 
 #include "atmos_metadata.h"
-#include "types.h"
-#include "player_text.h"
-#include "exception_store.h"
 #include "dcp_text_track.h"
+#include "dcpomatic_time.h"
+#include "exception_store.h"
+#include "font_id_map.h"
+#include "player_text.h"
 #include "weak_film.h"
 #include <dcp/atmos_frame.h>
 #include <boost/thread.hpp>
@@ -40,15 +45,14 @@ namespace dcp {
        class Data;
 }
 
-namespace dcpomatic {
-       class FontData;
-}
-
-class Film;
 class AudioBuffers;
+class Film;
 class Job;
-class ReferencedReelAsset;
 class ReelWriter;
+class ReferencedReelAsset;
+struct writer_disambiguate_font_ids1;
+struct writer_disambiguate_font_ids2;
+struct writer_disambiguate_font_ids3;
 
 
 struct QueueItem
@@ -114,7 +118,7 @@ public:
        void repeat (Frame, Eyes);
        void write (std::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime time);
        void write (PlayerText text, TextType type, boost::optional<DCPTextTrack>, dcpomatic::DCPTimePeriod period);
-       void write (std::vector<dcpomatic::FontData> fonts);
+       void write (std::vector<std::shared_ptr<dcpomatic::Font>> fonts);
        void write (ReferencedReelAsset asset);
        void write (std::shared_ptr<const dcp::AtmosFrame> atmos, dcpomatic::DCPTime time, AtmosMetadata metadata);
        void finish (boost::filesystem::path output_dcp);
@@ -122,14 +126,19 @@ public:
        void set_encoder_threads (int threads);
 
 private:
+       friend struct ::writer_disambiguate_font_ids1;
+       friend struct ::writer_disambiguate_font_ids2;
+       friend struct ::writer_disambiguate_font_ids3;
+
        void thread ();
        void terminate_thread (bool);
        bool have_sequenced_image_at_queue_head ();
        size_t video_reel (int frame) const;
-       void set_digest_progress (Job* job, float progress);
+       void set_digest_progress(Job* job, int id, int64_t done, int64_t size);
        void write_cover_sheet (boost::filesystem::path output_dcp);
-       void calculate_referenced_digests (boost::function<void (float)> set_progress);
+       void calculate_referenced_digests(std::function<void (int64_t, int64_t)> set_progress);
        void write_hanging_text (ReelWriter& reel);
+       void calculate_digests ();
 
        std::weak_ptr<Job> _job;
        std::vector<ReelWriter> _reels;
@@ -195,11 +204,15 @@ private:
        bool _text_only;
 
        boost::mutex _digest_progresses_mutex;
-       std::map<boost::thread::id, float> _digest_progresses;
+       std::map<int, std::pair<int64_t, int64_t>> _digest_progresses;
 
        std::list<ReferencedReelAsset> _reel_assets;
 
-       std::vector<dcpomatic::FontData> _fonts;
+       FontIdMap _fonts;
+       /** If we are given many fonts, but we're making an Interop DCP, we'll choose a single
+        *  one that we'll use everywher.  This is that chosen font.
+        */
+       std::shared_ptr<dcpomatic::Font> _chosen_interop_font;
 
        /** true if any reel has any subtitles */
        bool _have_subtitles = false;
@@ -215,3 +228,7 @@ private:
 
        std::vector<HangingText> _hanging_texts;
 };
+
+
+#endif
+