summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-02-20 17:38:11 +0100
committerCarl Hetherington <cth@carlh.net>2020-02-20 17:38:11 +0100
commit351942d335db261ac6fe54f2f8a3f439fef22d47 (patch)
treee7ca01c91bed841375bb2a584c6a14019c42e839 /src
parentf515b8daea9d28200be803bb64ff17e9f30343c4 (diff)
Apply FFmpeg palette fix to examination too; fix build with old FFmpeg.
Diffstat (limited to 'src')
-rw-r--r--src/lib/examine_ffmpeg_subtitles_job.cc7
-rw-r--r--src/lib/ffmpeg_decoder.cc6
2 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/examine_ffmpeg_subtitles_job.cc b/src/lib/examine_ffmpeg_subtitles_job.cc
index af548b794..b9d5f54e5 100644
--- a/src/lib/examine_ffmpeg_subtitles_job.cc
+++ b/src/lib/examine_ffmpeg_subtitles_job.cc
@@ -82,16 +82,17 @@ ExamineFFmpegSubtitlesJob::run ()
/* sub_p looks up into a BGRA palette which is here
(i.e. first byte B, second G, third R, fourth A)
*/
- uint32_t const * palette = (uint32_t *) rect->pict.data[1];
+ uint8_t const * palette = rect->pict.data[1];
#else
/* sub_p looks up into a BGRA palette which is here
(i.e. first byte B, second G, third R, fourth A)
*/
- uint32_t const * palette = (uint32_t *) rect->data[1];
+ uint8_t const * palette = rect->data[1];
#endif
for (int j = 0; j < rect->nb_colors; ++j) {
- RGBA c ((palette[j] & 0xff0000) >> 16, (palette[j] & 0xff00) >> 8, palette[j] & 0xff, (palette[j] & 0xff000000) >> 24);
+ RGBA c (palette[2], palette[1], palette[0], palette[3]);
_content->subtitle_stream()->set_colour (c, c);
+ palette += 4;
}
}
}
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 77b608fa8..350362478 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -626,23 +626,23 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime
#ifdef DCPOMATIC_HAVE_AVSUBTITLERECT_PICT
/* Start of the first line in the subtitle */
uint8_t* sub_p = rect->pict.data[0];
- /* sub_p looks up into a BGRA palette which is here
+ /* sub_p looks up into a BGRA palette which is at rect->pict.data[1];
(i.e. first byte B, second G, third R, fourth A)
*/
- uint32_t const * palette = (uint32_t *) rect->pict.data[1];
+ uint8_t const * palette = rect->pict.data[1];
#else
/* Start of the first line in the subtitle */
uint8_t* sub_p = rect->data[0];
/* sub_p looks up into a BGRA palette which is at rect->data[1].
(first byte B, second G, third R, fourth A)
*/
+ uint8_t const * palette = rect->data[1];
#endif
/* And the stream has a map of those palette colours to colours
chosen by the user; created a `mapped' palette from those settings.
*/
map<RGBA, RGBA> colour_map = ffmpeg_content()->subtitle_stream()->colours ();
vector<RGBA> mapped_palette (rect->nb_colors);
- uint8_t const * palette = rect->data[1];
for (int i = 0; i < rect->nb_colors; ++i) {
RGBA c (palette[2], palette[1], palette[0], palette[3]);
map<RGBA, RGBA>::const_iterator j = colour_map.find (c);