diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-08-25 22:00:06 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-08-25 22:00:06 +0200 |
| commit | 9f294327cb59fce307c3a439f044d79b081376b0 (patch) | |
| tree | bce7bffabf5d9f7903e46245448fface6cbe8d58 /src/lib | |
| parent | 8475d7b7d70d5b98e7737f326653d80a9fd8e9cf (diff) | |
Add option to export Interop subs with or without the font file / reference.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/subtitle_encoder.cc | 14 | ||||
| -rw-r--r-- | src/lib/subtitle_encoder.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/subtitle_encoder.cc b/src/lib/subtitle_encoder.cc index 2daa5086d..a94b9106a 100644 --- a/src/lib/subtitle_encoder.cc +++ b/src/lib/subtitle_encoder.cc @@ -18,6 +18,7 @@ */ +#include "font.h" #include "subtitle_encoder.h" #include "player.h" #include "compose.hpp" @@ -39,9 +40,11 @@ using boost::shared_ptr; using boost::optional; using dcp::raw_convert; -SubtitleEncoder::SubtitleEncoder (shared_ptr<const Film> film, shared_ptr<Job> job, boost::filesystem::path output, bool split_reels) +/** @param include_font true to refer to and export any font file (for Interop; ignored for SMPTE) */ +SubtitleEncoder::SubtitleEncoder (shared_ptr<const Film> film, shared_ptr<Job> job, boost::filesystem::path output, bool split_reels, bool include_font) : Encoder (film, job) , _split_reels (split_reels) + , _include_font (include_font) , _reel_index (0) , _length (film->length()) { @@ -101,6 +104,12 @@ SubtitleEncoder::go () } } + if (!_film->interop() || _include_font) { + BOOST_FOREACH (shared_ptr<dcpomatic::Font> j, _player->get_subtitle_fonts()) { + i->first->add_font (j->id(), default_font_file()); + } + } + i->first->write (i->second); ++reel; } @@ -145,6 +154,9 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> tr /* XXX: couldn't / shouldn't we use period here rather than getting time from the subtitle? */ i.set_in (i.in()); i.set_out (i.out()); + if (_film->interop() && !_include_font) { + i.unset_font (); + } _assets[_reel_index].first->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i))); } diff --git a/src/lib/subtitle_encoder.h b/src/lib/subtitle_encoder.h index 50485750d..b267c9bae 100644 --- a/src/lib/subtitle_encoder.h +++ b/src/lib/subtitle_encoder.h @@ -37,7 +37,7 @@ class Film; class SubtitleEncoder : public Encoder { public: - SubtitleEncoder (boost::shared_ptr<const Film> film, boost::shared_ptr<Job> job, boost::filesystem::path output, bool split_reels); + SubtitleEncoder (boost::shared_ptr<const Film> film, boost::shared_ptr<Job> job, boost::filesystem::path output, bool split_reels, bool include_font); void go (); @@ -54,6 +54,7 @@ private: std::vector<std::pair<boost::shared_ptr<dcp::SubtitleAsset>, boost::filesystem::path> > _assets; std::vector<dcpomatic::DCPTimePeriod> _reels; bool _split_reels; + bool _include_font; int _reel_index; boost::optional<dcpomatic::DCPTime> _last; dcpomatic::DCPTime _length; |
