diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-29 01:27:49 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-29 01:27:49 +0000 |
| commit | 6aadfd3e775d7c23047dad1f383b8b68ba964782 (patch) | |
| tree | a305f89c4c1e1616c0531badaeb811137081596a /src/lib/ffmpeg_decoder.cc | |
| parent | 408112e38effb8ba362d796f6a49380d67fc3f9d (diff) | |
Fix error on loading pre-configurable-FFmpeg-subtitle-colour projects on later versions of DoM.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 12 |
1 files changed, 10 insertions, 2 deletions
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<RGBA> 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<RGBA, RGBA>::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 */ |
