diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-02-06 10:34:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-02-06 10:35:54 +0100 |
| commit | 9482a41238c370e093c896145b844dac0b221345 (patch) | |
| tree | 9df08c5ff0345bd514961485179659709869e92c | |
| parent | d4b8105a3b84de6b663da8dfd908e6eef322c33a (diff) | |
Fix crash with bitmapped subs that have zero width or height.
Back-ported from dec5ae11238495c64fffdab37f189d96aed7d636 in v2.15.x.
| -rw-r--r-- | src/lib/player.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index fe08241ab..30b49d186 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -937,8 +937,15 @@ Player::bitmap_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, C PlayerText ps; shared_ptr<Image> image = subtitle.sub.image; + /* We will scale the subtitle up to fit _video_container_size */ - dcp::Size scaled_size (subtitle.sub.rectangle.width * _video_container_size.width, subtitle.sub.rectangle.height * _video_container_size.height); + int const width = subtitle.sub.rectangle.width * _video_container_size.width; + int const height = subtitle.sub.rectangle.height * _video_container_size.height; + if (width == 0 || height == 0) { + return; + } + + dcp::Size scaled_size (width, height); ps.bitmap.push_back (BitmapText(image->scale(scaled_size, dcp::YUV_TO_RGB_REC601, image->pixel_format(), true, _fast), subtitle.sub.rectangle)); DCPTime from (content_time_to_dcp (piece, subtitle.from())); |
