[FFmpeg-cvslog] avcodec/qoidec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM

Paul B Mahol git at videolan.org
Sat Sep 24 13:27:41 EEST 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Sep 24 11:17:08 2022 +0200| [3c16f9eb0d2eea9c64d011bca6c52f520d66ec09] | committer: Paul B Mahol

avcodec/qoidec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c16f9eb0d2eea9c64d011bca6c52f520d66ec09
---

 libavcodec/qoidec.c | 13 ++++++++-----
 1 file 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),
 };



More information about the ffmpeg-cvslog mailing list