diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-01-08 00:04:17 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-08 00:09:13 +0100 |
commit | 3ed80bd95e1dd6864dbd08fa622d7eec97ac9a38 (patch) | |
tree | b4ee64ff2463e87c8d211b28014200bc8133f600 /libavcodec | |
parent | 0e1bb03cb034fcdc83f964fd8ca5e98c569078be (diff) | |
parent | 5a1addd7c1d8ff218ed4b84f4f02fdb83980094c (diff) | |
download | ffmpeg-streaming-3ed80bd95e1dd6864dbd08fa622d7eec97ac9a38.zip ffmpeg-streaming-3ed80bd95e1dd6864dbd08fa622d7eec97ac9a38.tar.gz |
Merge commit '5a1addd7c1d8ff218ed4b84f4f02fdb83980094c'
* commit '5a1addd7c1d8ff218ed4b84f4f02fdb83980094c':
xsub: Support DXSA subtitles
Conflicts:
libavcodec/xsubdec.c
See: d6f910ea47255b519e0b71c33d74c409a29ab3db
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/xsubdec.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index 174d74e..94a68e2 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -59,7 +59,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, 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) { + if (buf_size < 27 + 7 * 2 + 4 * (3 + has_alpha)) { av_log(avctx, AV_LOG_ERROR, "coded frame size %d too small\n", buf_size); return -1; } @@ -106,9 +106,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, // read palette 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 = 0; i < sub->rects[0]->nb_colors; i++) - ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= (has_alpha ? *buf++ : (i ? 0xff : 0)) << 24; + + if (!has_alpha) { + // 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; + } else { + for (i = 0; i < sub->rects[0]->nb_colors; i++) + ((uint32_t *)sub->rects[0]->pict.data[1])[i] |= *buf++ << 24; + } // process RLE-compressed data init_get_bits(&gb, buf, (buf_end - buf) * 8); |