/* Get pixel format and the size of the pixel */
if (avctx->codec_tag == MKTAG('I', 'S', 'C', 'C')) {
- avctx->pix_fmt = AV_PIX_FMT_BGRA;
- ctx->component_size = 4;
+ if (avctx->extradata && avctx->extradata_size == 4) {
+ if ((avctx->extradata[0] >> 1) & 1) {
+ avctx->pix_fmt = AV_PIX_FMT_BGRA;
+ ctx->component_size = 4;
+ } else {
+ avctx->pix_fmt = AV_PIX_FMT_BGR24;
+ ctx->component_size = 3;
+ }
+ } else {
+ avctx->pix_fmt = AV_PIX_FMT_BGRA;
+ ctx->component_size = 4;
+ }
} else if (avctx->codec_tag == MKTAG('R', 'S', 'C', 'C')) {
ctx->component_size = avctx->bits_per_coded_sample / 8;
switch (avctx->bits_per_coded_sample) {
/* Read number of tiles, and allocate the array */
tiles_nb = bytestream2_get_le16(gbc);
+
+ if (tiles_nb == 0) {
+ av_log(avctx, AV_LOG_DEBUG, "no tiles\n");
+ return avpkt->size;
+ }
+
av_fast_malloc(&ctx->tiles, &ctx->tiles_size,
tiles_nb * sizeof(*ctx->tiles));
if (!ctx->tiles) {