mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
avcodec/qoidec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
This commit is contained in:
parent
f21899db7d
commit
3c16f9eb0d
@ -28,19 +28,18 @@
|
|||||||
static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||||
int *got_frame, AVPacket *avpkt)
|
int *got_frame, AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
const uint8_t *buf = avpkt->data;
|
|
||||||
int ret, buf_size = avpkt->size;
|
|
||||||
int width, height, channels, space, run = 0;
|
int width, height, channels, space, run = 0;
|
||||||
uint8_t index[64][4] = { 0 };
|
uint8_t index[64][4] = { 0 };
|
||||||
uint8_t px[4] = { 0, 0, 0, 255 };
|
uint8_t px[4] = { 0, 0, 0, 255 };
|
||||||
GetByteContext gb;
|
GetByteContext gb;
|
||||||
uint8_t *dst;
|
uint8_t *dst;
|
||||||
uint64_t len;
|
uint64_t len;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (buf_size < 20)
|
if (avpkt->size < 20)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
bytestream2_init(&gb, buf, buf_size);
|
bytestream2_init(&gb, avpkt->data, avpkt->size);
|
||||||
bytestream2_skip(&gb, 4);
|
bytestream2_skip(&gb, 4);
|
||||||
width = bytestream2_get_be32(&gb);
|
width = bytestream2_get_be32(&gb);
|
||||||
height = bytestream2_get_be32(&gb);
|
height = bytestream2_get_be32(&gb);
|
||||||
@ -61,6 +60,9 @@ static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
|||||||
default: return AVERROR_INVALIDDATA;
|
default: return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (avctx->skip_frame >= AVDISCARD_ALL)
|
||||||
|
return avpkt->size;
|
||||||
|
|
||||||
if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
|
if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -109,7 +111,7 @@ static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
|||||||
|
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
|
|
||||||
return buf_size;
|
return avpkt->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FFCodec ff_qoi_decoder = {
|
const FFCodec ff_qoi_decoder = {
|
||||||
@ -118,5 +120,6 @@ const FFCodec ff_qoi_decoder = {
|
|||||||
.p.type = AVMEDIA_TYPE_VIDEO,
|
.p.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.p.id = AV_CODEC_ID_QOI,
|
.p.id = AV_CODEC_ID_QOI,
|
||||||
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
|
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
|
||||||
|
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||||
FF_CODEC_DECODE_CB(qoi_decode_frame),
|
FF_CODEC_DECODE_CB(qoi_decode_frame),
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user