X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Futils.c;h=ced6b64c2936aca234bdfdac1348554f62f5e7b6;hb=e1d7c8831cf6dddddb8e151a673e89016d7b10db;hp=902951137cc86dcb5f4a70b3b7974895044bf4e0;hpb=25cbc8b46e1d4d17c4725b52bcb5cec4d832f894;p=ffmpeg diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 902951137cc..ced6b64c293 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -506,6 +506,13 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) } avctx->frame_number = 0; if(avctx->codec->init){ + if(avctx->codec_type == AVMEDIA_TYPE_VIDEO && + avctx->codec->max_lowres < avctx->lowres){ + av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", + avctx->codec->max_lowres); + goto free_and_end; + } + ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; @@ -682,6 +689,26 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, return ret; } +void avsubtitle_free(AVSubtitle *sub) +{ + int i; + + for (i = 0; i < sub->num_rects; i++) + { + av_freep(sub->rects[i]->pict.data[0]); + av_freep(sub->rects[i]->pict.data[1]); + av_freep(sub->rects[i]->pict.data[2]); + av_freep(sub->rects[i]->pict.data[3]); + av_freep(sub->rects[i]->text); + av_freep(sub->rects[i]->ass); + av_freep(sub->rects[i]); + } + + av_freep(sub->rects); + + memset(sub, 0, sizeof(AVSubtitle)); +} + av_cold int avcodec_close(AVCodecContext *avctx) { /* If there is a user-supplied mutex locking routine, call it. */