TextDecoder::TextDecoder (
Decoder* parent,
shared_ptr<const TextContent> c,
- shared_ptr<Log> log,
ContentTime first
)
- : DecoderPart (parent, log)
+ : DecoderPart (parent)
, _content (c)
, _position (first)
{
void
TextDecoder::emit_bitmap_start (ContentTime from, shared_ptr<Image> image, dcpomatic::Rect<double> rect)
{
- BitmapStart (ContentBitmapText (from, _content->type(), image, rect));
+ BitmapStart (ContentBitmapText (from, image, rect));
_position = from;
}
}
}
- PlainStart (ContentStringText (from, _content->type(), s));
+ PlainStart (ContentStringText (from, s));
_position = from;
}
v_align = dcp::VALIGN_TOP;
} else {
- DCPOMATIC_ASSERT (i.vertical_position.proportional);
DCPOMATIC_ASSERT (i.vertical_position.reference);
- v_position = i.vertical_position.proportional.get();
+ if (i.vertical_position.proportional) {
+ v_position = i.vertical_position.proportional.get();
+ } else {
+ DCPOMATIC_ASSERT (i.vertical_position.line);
+ DCPOMATIC_ASSERT (i.vertical_position.lines);
+ v_position = float(*i.vertical_position.line) / *i.vertical_position.lines;
+ }
if (lowest_proportional) {
/* Adjust line spacing */
void
TextDecoder::emit_stop (ContentTime to)
{
- Stop (to, _content->type());
+ Stop (to);
}
void
emit_stop (period.to);
}
+/* @param rect Area expressed as a fraction of the video frame that this subtitle
+ * is for (e.g. a width of 0.5 means the width of the subtitle is half the width
+ * of the video frame)
+ */
+void
+TextDecoder::emit_bitmap (ContentTimePeriod period, shared_ptr<Image> image, dcpomatic::Rect<double> rect)
+{
+ emit_bitmap_start (period.from, image, rect);
+ emit_stop (period.to);
+}
+
void
TextDecoder::seek ()
{