From: Alexandre Colucci <[email protected]> These have a DXSA tag and contain alpha in addition to color values for palette.
Signed-off-by: Jean-Baptiste Kempf <[email protected]> --- libavcodec/xsubdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index 3d85973..f876d92 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -56,6 +56,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, int w, h, x, y, i; int64_t packet_time = 0; GetBitContext gb; + int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A'); memset(sub, 0, sizeof(*sub)); @@ -108,8 +109,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 init_get_bits(&gb, buf, (buf_end - buf) * 8); -- 2.2.1 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
