]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/indeo2.c
Add av_log_{ask_for_sample|missing_feature} replacements to libavutil
[ffmpeg] / libavcodec / indeo2.c
index 1b4d51b6b1fed27fd15957c1735eae6bdbeefe06..a33bbb1fc920b1870481592f93303c74835c36e2 100644 (file)
@@ -29,6 +29,7 @@
 #include "avcodec.h"
 #include "get_bits.h"
 #include "indeo2data.h"
+#include "internal.h"
 #include "mathops.h"
 
 typedef struct Ir2Context{
@@ -148,12 +149,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
     AVFrame * const p    = &s->picture;
     int start, ret;
 
-    if (p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 1;
-    p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if ((ret = avctx->reget_buffer(avctx, p)) < 0) {
+    if ((ret = ff_reget_buffer(avctx, p)) < 0) {
         av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
         return ret;
     }
@@ -206,7 +202,9 @@ static int ir2_decode_frame(AVCodecContext *avctx,
             return ret;
     }
 
-    *picture   = s->picture;
+    if ((ret = av_frame_ref(picture, &s->picture)) < 0)
+        return ret;
+
     *got_frame = 1;
 
     return buf_size;
@@ -221,6 +219,8 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx)
 
     avctx->pix_fmt= AV_PIX_FMT_YUV410P;
 
+    avcodec_get_frame_defaults(&ic->picture);
+
     ir2_vlc.table = vlc_tables;
     ir2_vlc.table_allocated = 1 << CODE_VLC_BITS;
 #ifdef BITSTREAM_READER_LE
@@ -241,8 +241,7 @@ static av_cold int ir2_decode_end(AVCodecContext *avctx)
     Ir2Context * const ic = avctx->priv_data;
     AVFrame *pic = &ic->picture;
 
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
+    av_frame_unref(pic);
 
     return 0;
 }