@ -823,6 +823,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
if ( ( ret = ff_ffv1_common_init ( avctx ) ) < 0 )
if ( ( ret = ff_ffv1_common_init ( avctx ) ) < 0 )
return ret ;
return ret ;
f - > picture . f = av_frame_alloc ( ) ;
f - > last_picture . f = av_frame_alloc ( ) ;
if ( ! f - > picture . f | | ! f - > last_picture . f )
return AVERROR ( ENOMEM ) ;
if ( avctx - > extradata_size > 0 & & ( ret = read_extra_header ( f ) ) < 0 )
if ( avctx - > extradata_size > 0 & & ( ret = read_extra_header ( f ) ) < 0 )
return ret ;
return ret ;
@ -1068,6 +1073,22 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
}
}
# endif
# endif
static av_cold int ffv1_decode_close ( AVCodecContext * avctx )
{
FFV1Context * const s = avctx - > priv_data ;
if ( s - > picture . f ) {
ff_thread_release_ext_buffer ( avctx , & s - > picture ) ;
av_frame_free ( & s - > picture . f ) ;
}
if ( s - > last_picture . f ) {
ff_thread_release_ext_buffer ( avctx , & s - > last_picture ) ;
av_frame_free ( & s - > last_picture . f ) ;
}
return ff_ffv1_close ( avctx ) ;
}
const FFCodec ff_ffv1_decoder = {
const FFCodec ff_ffv1_decoder = {
. p . name = " ffv1 " ,
. p . name = " ffv1 " ,
CODEC_LONG_NAME ( " FFmpeg video codec #1 " ) ,
CODEC_LONG_NAME ( " FFmpeg video codec #1 " ) ,
@ -1075,7 +1096,7 @@ const FFCodec ff_ffv1_decoder = {
. p . id = AV_CODEC_ID_FFV1 ,
. p . id = AV_CODEC_ID_FFV1 ,
. priv_data_size = sizeof ( FFV1Context ) ,
. priv_data_size = sizeof ( FFV1Context ) ,
. init = decode_init ,
. init = decode_init ,
. close = ff_ff v1_close ,
. close = ffv1_decode _close ,
FF_CODEC_DECODE_CB ( decode_frame ) ,
FF_CODEC_DECODE_CB ( decode_frame ) ,
UPDATE_THREAD_CONTEXT ( update_thread_context ) ,
UPDATE_THREAD_CONTEXT ( update_thread_context ) ,
. p . capabilities = AV_CODEC_CAP_DR1 /*| AV_CODEC_CAP_DRAW_HORIZ_BAND*/ |
. p . capabilities = AV_CODEC_CAP_DR1 /*| AV_CODEC_CAP_DRAW_HORIZ_BAND*/ |