From 5d6e2ffca8e4b0d587eff8723716003a6d81be47 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 18 Nov 2016 21:33:25 +0000 Subject: [PATCH] Fix incorrect scaling of DVB subtitles when the picture is not 720x576. --- src/lib/ffmpeg_decoder.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index e2c200d77..253272e96 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -612,12 +612,13 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP out_p += image->stride()[0] / sizeof (uint32_t); } - dcp::Size const vs = _ffmpeg_content->video->size (); + int const target_width = subtitle_codec_context()->width; + int const target_height = subtitle_codec_context()->height; dcpomatic::Rect const scaled_rect ( - static_cast (rect->x) / vs.width, - static_cast (rect->y) / vs.height, - static_cast (rect->w) / vs.width, - static_cast (rect->h) / vs.height + static_cast (rect->x) / target_width, + static_cast (rect->y) / target_height, + static_cast (rect->w) / target_width, + static_cast (rect->h) / target_height ); subtitle->give_image (period, image, scaled_rect); -- 2.30.2