X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplayer.cc;h=212bcfe45612f8d2264c03ebc923a7429f319507;hb=f46a52979f3ab49403408127141d3fed52bedbc7;hp=6ec593f6c8569e8d5a3d97e4efc113876b0587dd;hpb=800c0b9f95f422af66b6166fb4d13c1b89d04844;p=dcpomatic.git diff --git a/src/lib/player.cc b/src/lib/player.cc index 6ec593f6c..212bcfe45 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -301,18 +301,6 @@ Player::transform_image_subtitles (list subs) const /* 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 ( @@ -862,14 +850,14 @@ Player::image_subtitle_start (weak_ptr wp, ContentImageSubtitle subtitle) 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())); @@ -959,8 +947,8 @@ Player::seek (DCPTime time, bool accurate) BOOST_FOREACH (shared_ptr 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 */