diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-09-24 11:17:08 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-09-24 12:23:32 +0200 |
commit | 3c16f9eb0d2eea9c64d011bca6c52f520d66ec09 (patch) | |
tree | 683508e354ab8bedd7b3a3f53e1467daf3fe1cf7 /libavcodec | |
parent | f21899db7dae114e4519c0d14dd047efe022e16b (diff) | |
download | ffmpeg-3c16f9eb0d2eea9c64d011bca6c52f520d66ec09.tar.gz |
avcodec/qoidec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/qoidec.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/qoidec.c b/libavcodec/qoidec.c index d218d649de..9414d2fbe9 100644 --- a/libavcodec/qoidec.c +++ b/libavcodec/qoidec.c @@ -28,19 +28,18 @@ static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt) { - const uint8_t *buf = avpkt->data; - int ret, buf_size = avpkt->size; int width, height, channels, space, run = 0; uint8_t index[64][4] = { 0 }; uint8_t px[4] = { 0, 0, 0, 255 }; GetByteContext gb; uint8_t *dst; uint64_t len; + int ret; - if (buf_size < 20) + if (avpkt->size < 20) return AVERROR_INVALIDDATA; - bytestream2_init(&gb, buf, buf_size); + bytestream2_init(&gb, avpkt->data, avpkt->size); bytestream2_skip(&gb, 4); width = 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; } + if (avctx->skip_frame >= AVDISCARD_ALL) + return avpkt->size; + if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) return ret; @@ -109,7 +111,7 @@ static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p, *got_frame = 1; - return buf_size; + return avpkt->size; } const FFCodec ff_qoi_decoder = { @@ -118,5 +120,6 @@ const FFCodec ff_qoi_decoder = { .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_QOI, .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), }; |