mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-25 00:33:26 +00:00
Merge commit '3d0752d82f8eaa326cff306ae50b0186a5b4d304' into release/2.4
* commit '3d0752d82f8eaa326cff306ae50b0186a5b4d304':
xsub: Support DXSA subtitles
Conflicts:
libavcodec/xsubdec.c
See: d6f910ea47
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
3cc8822c93
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user