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:34:30 +0100 |
| commit | dec5ae11238495c64fffdab37f189d96aed7d636 (patch) | |
| tree | 59bdff9477864c28a7a0daa6216e03c804378c2a /src | |
| parent | c2cc3e03b3b5973b64271cd8dcf4e7843e8b6d1e (diff) | |
Fix crash with bitmapped subs that have zero width or height.
Diffstat (limited to 'src')
| -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 62527e3eb..bc0aa3b28 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -955,8 +955,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())); |
