]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/iff.c
Add av_log_{ask_for_sample|missing_feature} replacements to libavutil
[ffmpeg] / libavcodec / iff.c
index 584e7f983fcff0d7d6180cf11d04837bcedba725..184dcab73e7566b91eeb017da124c7635f6cf143 100644 (file)
@@ -168,7 +168,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
     if (!s->planebuf)
         return AVERROR(ENOMEM);
 
-    s->frame.reference = 1;
+    avcodec_get_frame_defaults(&s->frame);
 
     return 0;
 }
@@ -256,15 +256,11 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
     const uint8_t *buf_end = buf+buf_size;
     int y, plane, res;
 
-    if (s->init) {
-        if ((res = avctx->reget_buffer(avctx, &s->frame)) < 0) {
-            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-            return res;
-        }
-    } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+    if ((res = ff_reget_buffer(avctx, &s->frame)) < 0)
         return res;
-    } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != AV_PIX_FMT_GRAY8) {
+
+    if (!s->init && avctx->bits_per_coded_sample <= 8 &&
+        avctx->pix_fmt != AV_PIX_FMT_GRAY8) {
         if ((res = cmap_read_palette(avctx, (uint32_t*)s->frame.data[1])) < 0)
             return res;
     }
@@ -298,8 +294,11 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
         }
     }
 
+    if ((res = av_frame_ref(data, &s->frame)) < 0)
+        return res;
+
     *got_frame = 1;
-    *(AVFrame*)data = s->frame;
+
     return buf_size;
 }
 
@@ -313,15 +312,11 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
     const uint8_t *buf_end = buf+buf_size;
     int y, plane, res;
 
-    if (s->init) {
-        if ((res = avctx->reget_buffer(avctx, &s->frame)) < 0) {
-            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-            return res;
-        }
-    } else if ((res = ff_get_buffer(avctx, &s->frame)) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+    if ((res = ff_reget_buffer(avctx, &s->frame)) < 0)
         return res;
-    } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != AV_PIX_FMT_GRAY8) {
+
+    if (!s->init && avctx->bits_per_coded_sample <= 8 &&
+        avctx->pix_fmt != AV_PIX_FMT_GRAY8) {
         if ((res = cmap_read_palette(avctx, (uint32_t*)s->frame.data[1])) < 0)
             return res;
     }
@@ -354,16 +349,18 @@ static int decode_frame_byterun1(AVCodecContext *avctx,
         }
     }
 
+    if ((res = av_frame_ref(data, &s->frame)) < 0)
+        return res;
+
     *got_frame = 1;
-    *(AVFrame*)data = s->frame;
+
     return buf_size;
 }
 
 static av_cold int decode_end(AVCodecContext *avctx)
 {
     IffContext *s = avctx->priv_data;
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
+    av_frame_unref(&s->frame);
     av_freep(&s->planebuf);
     return 0;
 }