summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-11-18 21:33:25 +0000
committerCarl Hetherington <cth@carlh.net>2016-11-19 00:51:05 +0000
commit5d6e2ffca8e4b0d587eff8723716003a6d81be47 (patch)
tree85c7476f7585f4e963131b7aa5206387171a61a5 /src/lib/ffmpeg_decoder.cc
parent3bc7c343d4e13a2d0498ae92dbc99b292f5ea322 (diff)
Fix incorrect scaling of DVB subtitles when the picture is not 720x576.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc11
1 files 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<double> const scaled_rect (
- static_cast<double> (rect->x) / vs.width,
- static_cast<double> (rect->y) / vs.height,
- static_cast<double> (rect->w) / vs.width,
- static_cast<double> (rect->h) / vs.height
+ static_cast<double> (rect->x) / target_width,
+ static_cast<double> (rect->y) / target_height,
+ static_cast<double> (rect->w) / target_width,
+ static_cast<double> (rect->h) / target_height
);
subtitle->give_image (period, image, scaled_rect);