Changeset 5a1addd7 in ffmpeg


Ignore:
Timestamp:
Jan 7, 2015, 12:51:30 PM (10 years ago)
Author:
Luca Barbato <lu_zero@gentoo.org>
Branches:
master
Children:
3ed80bd9, 71ec3d36
Parents:
01168bf1
git-author:
Alexandre Colucci <alexandre@elgato.com> (01/07/15 11:18:08)
git-committer:
Luca Barbato <lu_zero@gentoo.org> (01/07/15 12:51:30)
Message:

xsub: Support DXSA subtitles

These have a DXSA tag and contain alpha in addition to
color values for palette.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libavcodec/xsubdec.c

    r01168bf1 r5a1addd7  
    5757    int64_t packet_time = 0;
    5858    GetBitContext gb;
     59    int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A');
    5960
    6061    memset(sub, 0, sizeof(*sub));
    6162
    6263    // check that at least header fits
    63     if (buf_size < 27 + 7 * 2 + 4 * 3) {
     64    if (buf_size < 27 + 7 * 2 + 4 * (3 + has_alpha)) {
    6465        av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
    6566        return -1;
     
    108109    for (i = 0; i < sub->rects[0]->nb_colors; i++)
    109110        ((uint32_t*)sub->rects[0]->pict.data[1])[i] = bytestream_get_be24(&buf);
    110     // make all except background (first entry) non-transparent
    111     for (i = 1; i < sub->rects[0]->nb_colors; i++)
    112         ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= 0xff000000;
     111
     112    if (!has_alpha) {
     113        // make all except background (first entry) non-transparent
     114        for (i = 1; i < sub->rects[0]->nb_colors; i++)
     115            ((uint32_t *)sub->rects[0]->pict.data[1])[i] |= 0xff000000;
     116    } else {
     117        for (i = 0; i < sub->rects[0]->nb_colors; i++)
     118            ((uint32_t *)sub->rects[0]->pict.data[1])[i] |= *buf++ << 24;
     119    }
    113120
    114121    // process RLE-compressed data
Note: See TracChangeset for help on using the changeset viewer.