diff options
author | Alexandre Colucci <alexandre@elgato.com> | 2011-04-27 18:39:57 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-04-27 19:45:57 +0200 |
commit | d6f910ea47255b519e0b71c33d74c409a29ab3db (patch) | |
tree | 6d80e18ff9cb41302a921feab4ed7aad019995cf /libavcodec/xsubdec.c | |
parent | f08d171caa6a8eab00c1b0ac87bb3a79d98727e5 (diff) | |
download | ffmpeg-d6f910ea47255b519e0b71c33d74c409a29ab3db.tar.gz |
Fix decoding of DXSA subtitles.
These have a DXSA tag and contain alpha in addition to
color values for palette.
Diffstat (limited to 'libavcodec/xsubdec.c')
-rw-r--r-- | libavcodec/xsubdec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index a577ac8f28..d7babe4cd2 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -54,6 +54,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, int w, h, x, y, rlelen, i; int64_t packet_time = 0; GetBitContext gb; + int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A'); // check that at least header fits if (buf_size < 27 + 7 * 2 + 4 * 3) { @@ -100,8 +101,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, for (i = 0; i < sub->rects[0]->nb_colors; i++) ((uint32_t*)sub->rects[0]->pict.data[1])[i] = bytestream_get_be24(&buf); // make all except background (first entry) non-transparent - for (i = 1; i < sub->rects[0]->nb_colors; i++) - ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= 0xff000000; + for (i = 0; i < sub->rects[0]->nb_colors; i++) + ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= (has_alpha ? *buf++ : (i ? 0xff : 0)) << 24; // process RLE-compressed data rlelen = FFMIN(rlelen, buf_end - buf); |