summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-11 00:58:33 +0000
committerCarl Hetherington <cth@carlh.net>2018-01-11 00:58:33 +0000
commita990b287abee2fcfb7fc12d813265afa9d945646 (patch)
tree394ac66223e90abacdc4973967cc2fbbb4ec68f7 /src/lib/ffmpeg_decoder.cc
parent081ab0a238d9dc4896023ae85b62bae927f60884 (diff)
Fix crash due to alpha_blend requiring BGRA (#1165).
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
-rw-r--r--src/lib/ffmpeg_decoder.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 26b1d4bf8..2f46f17c6 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -595,10 +595,10 @@ FFmpegDecoder::decode_subtitle_packet ()
void
FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime from)
{
- /* Note RGBA is expressed little-endian, so the first byte in the word is R, second
- G, third B, fourth A.
+ /* Note BGRA is expressed little-endian, so the first byte in the word is B, second
+ G, third R, fourth A.
*/
- shared_ptr<Image> image (new Image (AV_PIX_FMT_RGBA, dcp::Size (rect->w, rect->h), true));
+ shared_ptr<Image> image (new Image (AV_PIX_FMT_BGRA, dcp::Size (rect->w, rect->h), true));
#ifdef DCPOMATIC_HAVE_AVSUBTITLERECT_PICT
/* Start of the first line in the subtitle */
@@ -642,8 +642,8 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTime
uint32_t* out_line_p = out_p;
for (int x = 0; x < rect->w; ++x) {
RGBA const p = mapped_palette[*sub_line_p++];
- /* XXX: this seems to be wrong to me (isn't the output image RGBA?) but it looks right on screen */
- *out_line_p++ = (p.a << 24) | (p.r << 16) | (p.g << 8) | p.b;
+ /* XXX: this seems to be wrong to me (isn't the output image BGRA?) but it looks right on screen */
+ *out_line_p++ = (p.a << 24) | (p.b << 16) | (p.g << 8) | p.r;
}
#ifdef DCPOMATIC_HAVE_AVSUBTITLERECT_PICT
sub_p += rect->pict.linesize[0];