Revision d6f910ea libavcodec/xsubdec.c

View differences:

libavcodec/xsubdec.c
54 54
    int w, h, x, y, rlelen, i;
55 55
    int64_t packet_time = 0;
56 56
    GetBitContext gb;
57
    int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A');
57 58

  
58 59
    // check that at least header fits
59 60
    if (buf_size < 27 + 7 * 2 + 4 * 3) {
......
100 101
    for (i = 0; i < sub->rects[0]->nb_colors; i++)
101 102
        ((uint32_t*)sub->rects[0]->pict.data[1])[i] = bytestream_get_be24(&buf);
102 103
    // make all except background (first entry) non-transparent
103
    for (i = 1; i < sub->rects[0]->nb_colors; i++)
104
        ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= 0xff000000;
104
    for (i = 0; i < sub->rects[0]->nb_colors; i++)
105
        ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= (has_alpha ? *buf++ : (i ? 0xff : 0)) << 24;
105 106

  
106 107
    // process RLE-compressed data
107 108
    rlelen = FFMIN(rlelen, buf_end - buf);

Also available in: Unified diff