projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c2cc3e0
)
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:34:30 +0000
(10:34 +0100)
src/lib/player.cc
patch
|
blob
|
history
diff --git
a/src/lib/player.cc
b/src/lib/player.cc
index 62527e3ebbf3b60408bd2cc967ffb568f529ddf8..bc0aa3b28c248e71f086d14761429d1407e3205f 100644
(file)
--- a/
src/lib/player.cc
+++ b/
src/lib/player.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2013-20
19
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.
@@
-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;
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()));