projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d4b8105
)
Fix crash with bitmapped subs that have zero width or height.
author
Carl Hetherington
<cth@carlh.net>
Thu, 6 Feb 2020 09:34:30 +0000
(10:34 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Thu, 6 Feb 2020 09:35:54 +0000
(10:35 +0100)
Back-ported from
dec5ae11238495c64fffdab37f189d96aed7d636
in v2.15.x.
src/lib/player.cc
patch
|
blob
|
history
diff --git
a/src/lib/player.cc
b/src/lib/player.cc
index fe08241ab8258bca5ec05cf8865472ef584cc941..30b49d186db67b2492c333644f75dc03c07624d6 100644
(file)
--- a/
src/lib/player.cc
+++ b/
src/lib/player.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2013-20
18
Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-20
20
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
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;
PlayerText ps;
shared_ptr<Image> image = subtitle.sub.image;
+
/* We will scale the subtitle up to fit _video_container_size */
/* 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()));
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()));