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/subtitle_encoder.cc | |
| parent | 8475d7b7d70d5b98e7737f326653d80a9fd8e9cf (diff) | |
Add option to export Interop subs with or without the font file / reference.
Diffstat (limited to 'src/lib/subtitle_encoder.cc')
| -rw-r--r-- | src/lib/subtitle_encoder.cc | 14 |
1 files changed, 13 insertions, 1 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))); } |
