projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup: white space.
[dcpomatic.git]
/
src
/
lib
/
writer.h
diff --git
a/src/lib/writer.h
b/src/lib/writer.h
index 52cb222e76c4c1bc2791340b9f1d4d2512204644..efb6a17d8d54448b740e2b3fc238010c6abff01f 100644
(file)
--- a/
src/lib/writer.h
+++ b/
src/lib/writer.h
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2012-202
0
Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-202
1
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,48
+18,49
@@
*/
*/
+
+#ifndef DCPOMATIC_WRITER_H
+#define DCPOMATIC_WRITER_H
+
+
/** @file src/lib/writer.h
* @brief Writer class.
*/
/** @file src/lib/writer.h
* @brief Writer class.
*/
+
#include "atmos_metadata.h"
#include "atmos_metadata.h"
-#include "types.h"
-#include "player_text.h"
-#include "exception_store.h"
#include "dcp_text_track.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 "weak_film.h"
#include <dcp/atmos_frame.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include <list>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include <list>
+
namespace dcp {
class Data;
}
namespace dcp {
class Data;
}
-namespace dcpomatic {
- class Font;
-}
-
-class Film;
class AudioBuffers;
class AudioBuffers;
+class Film;
class Job;
class Job;
-class ReferencedReelAsset;
class ReelWriter;
class ReelWriter;
+class ReferencedReelAsset;
+struct writer_disambiguate_font_ids1;
+struct writer_disambiguate_font_ids2;
+struct writer_disambiguate_font_ids3;
+
struct QueueItem
{
public:
struct QueueItem
{
public:
- QueueItem ()
- : size (0)
- , reel (0)
- , frame (0)
- , eyes (EYES_BOTH)
- {}
-
- enum Type {
+ QueueItem () {}
+
+ enum class Type {
/** a normal frame with some JPEG200 data */
FULL,
/** a frame whose data already exists in the MXF,
/** a normal frame with some JPEG200 data */
FULL,
/** a frame whose data already exists in the MXF,
@@
-71,20
+72,22
@@
public:
} type;
/** encoded data for FULL */
} type;
/** encoded data for FULL */
-
boost
::shared_ptr<const dcp::Data> encoded;
+
std
::shared_ptr<const dcp::Data> encoded;
/** size of data for FAKE */
/** size of data for FAKE */
- int size;
+ int size
= 0
;
/** reel index */
/** reel index */
- size_t reel;
+ size_t reel
= 0
;
/** frame index within the reel */
/** frame index within the reel */
- int frame;
+ int frame
= 0
;
/** eyes for FULL, FAKE and REPEAT */
/** eyes for FULL, FAKE and REPEAT */
- Eyes eyes;
+ Eyes eyes
= Eyes::BOTH
;
};
};
+
bool operator< (QueueItem const & a, QueueItem const & b);
bool operator== (QueueItem const & a, QueueItem const & b);
bool operator< (QueueItem const & a, QueueItem const & b);
bool operator== (QueueItem const & a, QueueItem const & b);
+
/** @class Writer
* @brief Class to manage writing JPEG2000 and audio data to assets on disk.
*
/** @class Writer
* @brief Class to manage writing JPEG2000 and audio data to assets on disk.
*
@@
-96,39
+99,48
@@
bool operator== (QueueItem const & a, QueueItem const & b);
* will sort it out. write() for AudioBuffers must be called in order.
*/
* will sort it out. write() for AudioBuffers must be called in order.
*/
-class Writer : public ExceptionStore, public
boost::noncopyable, public
WeakConstFilm
+class Writer : public ExceptionStore, public WeakConstFilm
{
public:
{
public:
- Writer (
boost::weak_ptr<const Film>, boost
::weak_ptr<Job>, bool text_only = false);
+ Writer (
std::weak_ptr<const Film>, std
::weak_ptr<Job>, bool text_only = false);
~Writer ();
~Writer ();
+ Writer (Writer const &) = delete;
+ Writer& operator= (Writer const &) = delete;
+
void start ();
bool can_fake_write (Frame) const;
void start ();
bool can_fake_write (Frame) const;
- void write (
boost
::shared_ptr<const dcp::Data>, Frame, Eyes);
+ void write (
std
::shared_ptr<const dcp::Data>, Frame, Eyes);
void fake_write (Frame, Eyes);
bool can_repeat (Frame) const;
void repeat (Frame, Eyes);
void fake_write (Frame, Eyes);
bool can_repeat (Frame) const;
void repeat (Frame, Eyes);
- void write (
boost
::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime time);
+ void write (
std
::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime time);
void write (PlayerText text, TextType type, boost::optional<DCPTextTrack>, dcpomatic::DCPTimePeriod period);
void write (PlayerText text, TextType type, boost::optional<DCPTextTrack>, dcpomatic::DCPTimePeriod period);
- void write (std::
list<boost::shared_ptr<dcpomatic::Font>
> fonts);
+ void write (std::
vector<std::shared_ptr<dcpomatic::Font>
> fonts);
void write (ReferencedReelAsset asset);
void write (ReferencedReelAsset asset);
- void write (
boost
::shared_ptr<const dcp::AtmosFrame> atmos, dcpomatic::DCPTime time, AtmosMetadata metadata);
+ void write (
std
::shared_ptr<const dcp::AtmosFrame> atmos, dcpomatic::DCPTime time, AtmosMetadata metadata);
void finish (boost::filesystem::path output_dcp);
void set_encoder_threads (int threads);
private:
void finish (boost::filesystem::path output_dcp);
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 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 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 ();
-
boost
::weak_ptr<Job> _job;
+
std
::weak_ptr<Job> _job;
std::vector<ReelWriter> _reels;
std::vector<ReelWriter>::iterator _audio_reel;
std::vector<ReelWriter>::iterator _subtitle_reel;
std::vector<ReelWriter> _reels;
std::vector<ReelWriter>::iterator _audio_reel;
std::vector<ReelWriter>::iterator _subtitle_reel;
@@
-138,11
+150,11
@@
private:
/** our thread */
boost::thread _thread;
/** true if our thread should finish */
/** our thread */
boost::thread _thread;
/** true if our thread should finish */
- bool _finish;
+ bool _finish
= false
;
/** queue of things to write to disk */
std::list<QueueItem> _queue;
/** number of FULL frames whose JPEG200 data is currently held in RAM */
/** queue of things to write to disk */
std::list<QueueItem> _queue;
/** number of FULL frames whose JPEG200 data is currently held in RAM */
- int _queued_full_in_memory;
+ int _queued_full_in_memory
= 0
;
/** mutex for thread state */
mutable boost::mutex _state_mutex;
/** condition to manage thread wakeups when we have nothing to do */
/** mutex for thread state */
mutable boost::mutex _state_mutex;
/** condition to manage thread wakeups when we have nothing to do */
@@
-160,7
+172,7
@@
private:
public:
LastWritten()
: _frame(-1)
public:
LastWritten()
: _frame(-1)
- , _eyes(E
YES_
RIGHT)
+ , _eyes(E
yes::
RIGHT)
{}
/** @return true if qi is the next item after this one */
{}
/** @return true if qi is the next item after this one */
@@
-180,26
+192,43
@@
private:
std::vector<LastWritten> _last_written;
/** number of FULL written frames */
std::vector<LastWritten> _last_written;
/** number of FULL written frames */
- int _full_written;
+ int _full_written
= 0
;
/** number of FAKE written frames */
/** number of FAKE written frames */
- int _fake_written;
- int _repeat_written;
+ int _fake_written
= 0
;
+ int _repeat_written
= 0
;
/** number of frames pushed to disk and then recovered
due to the limit of frames to be held in memory.
*/
/** number of frames pushed to disk and then recovered
due to the limit of frames to be held in memory.
*/
- int _pushed_to_disk;
+ int _pushed_to_disk
= 0
;
bool _text_only;
boost::mutex _digest_progresses_mutex;
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::list<ReferencedReelAsset> _reel_assets;
- std::list<boost::shared_ptr<dcpomatic::Font> > _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 */
/** true if any reel has any subtitles */
- bool _have_subtitles;
+ bool _have_subtitles
= false
;
/** all closed caption tracks that we have on any reel */
std::set<DCPTextTrack> _have_closed_captions;
/** all closed caption tracks that we have on any reel */
std::set<DCPTextTrack> _have_closed_captions;
+
+ struct HangingText {
+ PlayerText text;
+ TextType type;
+ boost::optional<DCPTextTrack> track;
+ dcpomatic::DCPTimePeriod period;
+ };
+
+ std::vector<HangingText> _hanging_texts;
};
};
+
+
+#endif
+