/* We will scale the subtitle up to fit _video_container_size */
dcp::Size scaled_size (i->rectangle.width * _video_container_size.width, i->rectangle.height * _video_container_size.height);
- /* Then we need a corrective translation, consisting of two parts:
- *
- * 1. that which is the result of the scaling of the subtitle by _video_container_size; this will be
- * rect.x * _video_container_size.width and rect.y * _video_container_size.height.
- *
- * 2. that to shift the origin of the scale by subtitle_scale to the centre of the subtitle; this will be
- * (width_before_subtitle_scale * (1 - subtitle_x_scale) / 2) and
- * (height_before_subtitle_scale * (1 - subtitle_y_scale) / 2).
- *
- * Combining these two translations gives these expressions.
- */
-
all.push_back (
PositionImage (
i->image->scale (
subtitle.sub.rectangle.x += piece->content->subtitle->x_offset ();
subtitle.sub.rectangle.y += piece->content->subtitle->y_offset ();
+ /* Apply a corrective translation to keep the subtitle centred after the scale that is coming up */
+ subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * ((piece->content->subtitle->x_scale() - 1) / 2);
+ subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * ((piece->content->subtitle->y_scale() - 1) / 2);
+
/* Apply content's subtitle scale */
subtitle.sub.rectangle.width *= piece->content->subtitle->x_scale ();
subtitle.sub.rectangle.height *= piece->content->subtitle->y_scale ();
- /* Apply a corrective translation to keep the subtitle centred after that scale */
- subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * (piece->content->subtitle->x_scale() - 1);
- subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * (piece->content->subtitle->y_scale() - 1);
-
PlayerSubtitles ps;
ps.image.push_back (subtitle.sub);
DCPTime from (content_time_to_dcp (piece, subtitle.from()));
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
if (time < i->content->position()) {
- /* Before; seek to 0 */
- i->decoder->seek (ContentTime(), accurate);
+ /* Before; seek to the start of the content */
+ i->decoder->seek (dcp_to_content_time (i, i->content->position()), accurate);
i->done = false;
} else if (i->content->position() <= time && time < i->content->end()) {
/* During; seek to position */