From 79ee0e5e79d8fb4a405d8b29827347d0243a17fe Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 1 Feb 2024 13:29:53 +0100 Subject: Don't emit subtitle images that have a zero dimension (#2743). They cause problems later when trying to blend them into the image. --- src/lib/player.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib/player.cc') 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; + }); + } } -- cgit v1.2.3