From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/ffv1.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'ffmpeg/libavcodec/ffv1.c') diff --git a/ffmpeg/libavcodec/ffv1.c b/ffmpeg/libavcodec/ffv1.c index 404b0e3..f8556b0 100644 --- a/ffmpeg/libavcodec/ffv1.c +++ b/ffmpeg/libavcodec/ffv1.c @@ -1,7 +1,7 @@ /* * FFV1 codec for libavcodec * - * Copyright (c) 2003-2012 Michael Niedermayer + * Copyright (c) 2003-2013 Michael Niedermayer * * This file is part of FFmpeg. * @@ -25,6 +25,7 @@ * FF Video Codec 1 (a lossless codec) */ +#include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/crc.h" #include "libavutil/opt.h" @@ -48,7 +49,10 @@ av_cold int ffv1_common_init(AVCodecContext *avctx) s->avctx = avctx; s->flags = avctx->flags; - avcodec_get_frame_defaults(&s->picture); + s->picture.f = av_frame_alloc(); + s->last_picture.f = av_frame_alloc(); + if (!s->picture.f || !s->last_picture.f) + return AVERROR(ENOMEM); ff_dsputil_init(&s->dsp, avctx); @@ -62,7 +66,7 @@ av_cold int ffv1_common_init(AVCodecContext *avctx) return 0; } -int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) +av_cold int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) { int j; @@ -96,7 +100,7 @@ int ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs) return 0; } -int ffv1_init_slices_state(FFV1Context *f) +av_cold int ffv1_init_slices_state(FFV1Context *f) { int i, ret; for (i = 0; i < f->slice_count; i++) { @@ -191,7 +195,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]; -- cgit v1.2.3