From 9f294327cb59fce307c3a439f044d79b081376b0 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 25 Aug 2020 22:00:06 +0200 Subject: Add option to export Interop subs with or without the font file / reference. --- src/lib/subtitle_encoder.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lib/subtitle_encoder.cc') 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 film, shared_ptr 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 film, shared_ptr 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 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 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(new dcp::SubtitleString(i))); } -- cgit v1.2.3