ffv1: Switch to ThreadFrame
[ffmpeg.git] / libavcodec / ffv1.c
index cbb1fe8..1b038b1 100644 (file)
@@ -49,8 +49,8 @@ av_cold int ffv1_common_init(AVCodecContext *avctx)
     s->avctx = avctx;
     s->flags = avctx->flags;
 
-    avcodec_get_frame_defaults(&s->picture);
-
+    s->picture.f = avcodec_alloc_frame();
+    s->last_picture.f = av_frame_alloc();
     ff_dsputil_init(&s->dsp, avctx);
 
     s->width  = avctx->width;
@@ -192,7 +192,13 @@ av_cold int ffv1_close(AVCodecContext *avctx)
     FFV1Context *s = avctx->priv_data;
     int i, j;
 
-    av_frame_unref(&s->last_picture);
+    if (s->picture.f)
+        ff_thread_release_buffer(avctx, &s->picture);
+    av_frame_free(&s->picture.f);
+
+    if (s->last_picture.f)
+        ff_thread_release_buffer(avctx, &s->last_picture);
+    av_frame_free(&s->last_picture.f);
 
     for (j = 0; j < s->slice_count; j++) {
         FFV1Context *fs = s->slice_context[j];