summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-02-01 13:29:53 +0100
committerCarl Hetherington <cth@carlh.net>2024-02-03 09:57:25 +0100
commit79ee0e5e79d8fb4a405d8b29827347d0243a17fe (patch)
treedb63ac4498164af59823a6070e96b2640ea4f502 /src/lib
parent092c23dde5ad89e8dc8d31b83154b5ac58f5a7f2 (diff)
Don't emit subtitle images that have a zero dimension (#2743).
They cause problems later when trying to blend them into the image.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index ef7ecde5a..79b48ea71 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -921,7 +921,7 @@ Player::open_subtitles_for_frame (DCPTime time) const
/* Bitmap subtitles */
for (auto i: j.bitmap) {
- if (!i.image) {
+ if (!i.image || i.image->size().width == 0 || i.image->size().height == 0) {
continue;
}
@@ -942,7 +942,10 @@ Player::open_subtitles_for_frame (DCPTime time) const
/* String subtitles (rendered to an image) */
if (!j.string.empty()) {
auto s = render_text(j.string, _video_container_size, time, vfr);
- copy (s.begin(), s.end(), back_inserter (captions));
+ copy_if(s.begin(), s.end(), back_inserter(captions), [](PositionImage const& image) {
+ return image.image->size().width && image.image->size().height;
+ });
+
}
}