Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / libavcodec / photocd.c
index 0f3001f..07e8d46 100644 (file)
@@ -36,8 +36,8 @@
 #include "avcodec.h"
 #include "bytestream.h"
 #include "codec_internal.h"
+#include "decode.h"
 #include "get_bits.h"
-#include "internal.h"
 #include "thread.h"
 
 typedef struct PhotoCDContext {
@@ -210,8 +210,8 @@ static av_noinline int read_hufftable(AVCodecContext *avctx, VLC *vlc)
         s->syms[j]  = sym;
     }
 
-    ff_free_vlc(vlc);
-    ret = ff_init_vlc_sparse(vlc, 12, count,
+    ff_vlc_free(vlc);
+    ret = ff_vlc_init_sparse(vlc, 12, count,
                              s->bits,  sizeof(*s->bits),  sizeof(*s->bits),
                              s->codes, sizeof(*s->codes), sizeof(*s->codes),
                              s->syms,  sizeof(*s->syms),  sizeof(*s->syms), 0);
@@ -325,11 +325,14 @@ static int photocd_decode_frame(AVCodecContext *avctx, AVFrame *p,
     if (ret < 0)
         return ret;
 
+    if (avctx->skip_frame >= AVDISCARD_ALL)
+        return avpkt->size;
+
     if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0)
         return ret;
 
     p->pict_type = AV_PICTURE_TYPE_I;
-    p->key_frame = 1;
+    p->flags |= AV_FRAME_FLAG_KEY;
 
     bytestream2_init(gb, avpkt->data, avpkt->size);
 
@@ -435,7 +438,7 @@ static av_cold int photocd_decode_close(AVCodecContext *avctx)
     PhotoCDContext *s = avctx->priv_data;
 
     for (int i = 0; i < 3; i++)
-        ff_free_vlc(&s->vlc[i]);
+        ff_vlc_free(&s->vlc[i]);
 
     return 0;
 }
@@ -466,6 +469,6 @@ const FFCodec ff_photocd_decoder = {
     .close          = photocd_decode_close,
     FF_CODEC_DECODE_CB(photocd_decode_frame),
     .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
-    .p.long_name    = NULL_IF_CONFIG_SMALL("Kodak Photo CD"),
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
+    CODEC_LONG_NAME("Kodak Photo CD"),
 };