summaryrefslogtreecommitdiff
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 12:54:03 +0000
commitc667459d676ded64c9db5f3d626e420477837070 (patch)
tree10254d07e98e73507db1565ac667c3b63c20bd3d
parentfa3eeca8774162bdf4e66f3b77e797e0dc7746f4 (diff)
Fix incorrect scaling of DVB subtitles when the picture is not 720x576.
-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 f0500a629..f635cfc03 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -608,12 +608,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);