[FFmpeg-devel] [PATCH] Fix incorrect decoding of DXSA subtitles (DivX subtitle with alpha)

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Apr 23 17:34:09 CEST 2011


On Thu, Apr 21, 2011 at 11:49:09AM +0200, Alexandre Colucci wrote:
> This patch fixes the DXSA subtitles decoding. See screenshots for before and after the patch.
> If the fourcc is DXSA, there are extra 4 bytes before the compressed data. The specifications are not public but the format is supported by DivX Player.

I do not like depending on the tag.
I assume there is nothing in the data itself to distinguish
between the formats?
If not I think it might be better to add a new CODEC_ID.
But either way, the code should just be
|= *buf++ << 24;
which will work if you do not run the loop above that case.
Or use the same loop for both case, e.g. (pseudo-code):
for (i = 0; i < sub->rects[0]->nb_colors; i++) {
    uint32_t alpha = i ? 0xff000000 : 0;
    if (tag == DXSA)
        alpha = *buf++ << 24;
    ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= alpha;
}


More information about the ffmpeg-devel mailing list