Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / libavcodec / cpia.c
index fcf2621..f62100c 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "codec_internal.h"
-#include "get_bits.h"
-#include "internal.h"
+#include "decode.h"
 
 
 #define FRAME_HEADER_SIZE 64
@@ -94,10 +94,10 @@ static int cpia_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
 
     if (header[28] == NOT_COMPRESSED) {
         frame->pict_type = AV_PICTURE_TYPE_I;
-        frame->key_frame = 1;
+        frame->flags |= AV_FRAME_FLAG_KEY;
     } else {
         frame->pict_type = AV_PICTURE_TYPE_P;
-        frame->key_frame = 0;
+        frame->flags &= ~AV_FRAME_FLAG_KEY;
     }
 
     // Get buffer filled with previous frame
@@ -198,14 +198,6 @@ static av_cold int cpia_decode_init(AVCodecContext *avctx)
     // output pixel format
     avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 
-    /* The default timebase set by the v4l2 demuxer leads to probing which is buggy.
-     * Set some reasonable time_base to skip this.
-     */
-    if (avctx->time_base.num == 1 && avctx->time_base.den == 1000000) {
-        avctx->time_base.num = 1;
-        avctx->time_base.den = 60;
-    }
-
     s->frame = av_frame_alloc();
     if (!s->frame)
         return AVERROR(ENOMEM);
@@ -224,7 +216,7 @@ static av_cold int cpia_decode_end(AVCodecContext *avctx)
 
 const FFCodec ff_cpia_decoder = {
     .p.name         = "cpia",
-    .p.long_name    = NULL_IF_CONFIG_SMALL("CPiA video format"),
+    CODEC_LONG_NAME("CPiA video format"),
     .p.type         = AVMEDIA_TYPE_VIDEO,
     .p.id           = AV_CODEC_ID_CPIA,
     .priv_data_size = sizeof(CpiaContext),
@@ -232,5 +224,4 @@ const FFCodec ff_cpia_decoder = {
     .close          = cpia_decode_end,
     FF_CODEC_DECODE_CB(cpia_decode_frame),
     .p.capabilities = AV_CODEC_CAP_DR1,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };