From 6aadfd3e775d7c23047dad1f383b8b68ba964782 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 29 Feb 2016 01:27:49 +0000 Subject: Fix error on loading pre-configurable-FFmpeg-subtitle-colour projects on later versions of DoM. --- src/lib/ffmpeg_decoder.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/lib/ffmpeg_decoder.cc') diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index a7cfb44ac..3d5244807 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -497,8 +497,16 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP vector mapped_palette (rect->nb_colors); for (int i = 0; i < rect->nb_colors; ++i) { RGBA c ((palette[i] & 0xff0000) >> 16, (palette[i] & 0xff00) >> 8, palette[i] & 0xff, (palette[i] & 0xff000000) >> 24); - DCPOMATIC_ASSERT (colour_map.find(c) != colour_map.end()); - mapped_palette[i] = colour_map[c]; + map::const_iterator j = colour_map.find (c); + if (j != colour_map.end ()) { + mapped_palette[i] = j->second; + } else { + /* This colour was not found in the FFmpegSubtitleStream's colour map; probably because + it is from a project that was created before this stuff was added. Just use the + colour straight from the original palette. + */ + mapped_palette[i] = c; + } } /* Start of the output data */ -- cgit v1.2.3