#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
+#include "internal.h"
static av_cold int decode_init(AVCodecContext *avctx) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
return ms - packet_time;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
AVPacket *avpkt) {
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
((uint32_t *)sub->rects[0]->data[1])[i] |= 0xff000000;
} else {
for (i = 0; i < sub->rects[0]->nb_colors; i++)
- ((uint32_t *)sub->rects[0]->data[1])[i] |= *buf++ << 24;
+ ((uint32_t *)sub->rects[0]->data[1])[i] |= (unsigned)*buf++ << 24;
}
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
-{
- AVSubtitleRect *rect;
- int j;
- rect = sub->rects[0];
- for (j = 0; j < 4; j++) {
- rect->pict.data[j] = rect->data[j];
- rect->pict.linesize[j] = rect->linesize[j];
- }
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
// process RLE-compressed data
if ((ret = init_get_bits8(&gb, buf, buf_end - buf)) < 0)
return ret;
bitmap += w;
align_get_bits(&gb);
}
- *data_size = 1;
+ *got_sub_ptr = 1;
return buf_size;
}
-AVCodec ff_xsub_decoder = {
+const AVCodec ff_xsub_decoder = {
.name = "xsub",
.long_name = NULL_IF_CONFIG_SMALL("XSUB"),
.type = AVMEDIA_TYPE_SUBTITLE,
.id = AV_CODEC_ID_XSUB,
.init = decode_init,
.decode = decode_frame,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
};