summaryrefslogtreecommitdiff
path: root/src/lib/reel_writer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-08 23:26:21 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-08 23:26:21 +0100
commit54ef3f25f924a677de0d71e1f773898b56ab5852 (patch)
treeb2d57ad1a77a17076c8044f089a3d266778e042c /src/lib/reel_writer.cc
parent64a6a87dd4a3fd43665242b8a8b2b35a675a7839 (diff)
Write image subs to DCPs.
Diffstat (limited to 'src/lib/reel_writer.cc')
-rw-r--r--src/lib/reel_writer.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc
index 7fca9e245..24ab1c534 100644
--- a/src/lib/reel_writer.cc
+++ b/src/lib/reel_writer.cc
@@ -27,6 +27,7 @@
#include "font.h"
#include "compose.hpp"
#include "audio_buffers.h"
+#include "image.h"
#include <dcp/mono_picture_asset.h>
#include <dcp/stereo_picture_asset.h>
#include <dcp/sound_asset.h>
@@ -42,6 +43,7 @@
#include <dcp/interop_subtitle_asset.h>
#include <dcp/smpte_subtitle_asset.h>
#include <dcp/raw_convert.h>
+#include <dcp/subtitle_image.h>
#include <boost/foreach.hpp>
#include "i18n.h"
@@ -526,7 +528,7 @@ ReelWriter::write (shared_ptr<const AudioBuffers> audio)
}
void
-ReelWriter::write (PlayerSubtitles subs)
+ReelWriter::write (PlayerSubtitles subs, DCPTimePeriod period)
{
if (!_subtitle_asset) {
string lang = _film->subtitle_language ();
@@ -555,10 +557,25 @@ ReelWriter::write (PlayerSubtitles subs)
}
BOOST_FOREACH (SubtitleString i, subs.text) {
+ /* XXX: couldn't / shouldn't we use period here rather than getting time from the subtitle? */
i.set_in (i.in() - dcp::Time (_period.from.seconds(), i.in().tcr));
i.set_out (i.out() - dcp::Time (_period.from.seconds(), i.out().tcr));
_subtitle_asset->add (shared_ptr<dcp::Subtitle>(new dcp::SubtitleString(i)));
}
+
+ BOOST_FOREACH (ImageSubtitle i, subs.image) {
+ _subtitle_asset->add (
+ shared_ptr<dcp::Subtitle>(
+ new dcp::SubtitleImage(
+ i.image->as_png(),
+ dcp::Time(period.from.seconds(), _film->video_frame_rate()),
+ dcp::Time(period.to.seconds(), _film->video_frame_rate()),
+ i.rectangle.x, dcp::HALIGN_LEFT, i.rectangle.y, dcp::VALIGN_TOP,
+ dcp::Time(), dcp::Time()
+ )
+ )
+ );
+ }
}
bool