mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avcodec: add FF_CODEC_CAP_INIT_CLEANUP for all codecs which use ff_mpv_common_init()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
parent
42a3850360
commit
4b2863ff01
@ -686,5 +686,6 @@ AVCodec ff_h261_decoder = {
|
||||
.close = h261_decode_end,
|
||||
.decode = h261_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.max_lowres = 3,
|
||||
};
|
||||
|
@ -770,7 +770,7 @@ AVCodec ff_h263_decoder = {
|
||||
.decode = ff_h263_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
|
||||
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.flush = ff_mpeg_flush,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = ff_h263_hwaccel_pixfmt_list_420,
|
||||
@ -788,7 +788,7 @@ AVCodec ff_h263p_decoder = {
|
||||
.decode = ff_h263_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
|
||||
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.flush = ff_mpeg_flush,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = ff_h263_hwaccel_pixfmt_list_420,
|
||||
|
@ -2873,8 +2873,7 @@ static av_cold int mpeg_decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
Mpeg1Context *s = avctx->priv_data;
|
||||
|
||||
if (s->mpeg_enc_ctx_allocated)
|
||||
ff_mpv_common_end(&s->mpeg_enc_ctx);
|
||||
ff_mpv_common_end(&s->mpeg_enc_ctx);
|
||||
av_freep(&s->a53_caption);
|
||||
return 0;
|
||||
}
|
||||
@ -2891,7 +2890,7 @@ AVCodec ff_mpeg1video_decoder = {
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
|
||||
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
|
||||
AV_CODEC_CAP_SLICE_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.flush = flush,
|
||||
.max_lowres = 3,
|
||||
.update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context),
|
||||
@ -2924,7 +2923,7 @@ AVCodec ff_mpeg2video_decoder = {
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
|
||||
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
|
||||
AV_CODEC_CAP_SLICE_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.flush = flush,
|
||||
.max_lowres = 3,
|
||||
.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
|
||||
@ -2968,7 +2967,7 @@ AVCodec ff_mpegvideo_decoder = {
|
||||
.close = mpeg_decode_end,
|
||||
.decode = mpeg_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.flush = flush,
|
||||
.max_lowres = 3,
|
||||
};
|
||||
|
@ -3594,7 +3594,8 @@ AVCodec ff_mpeg4_decoder = {
|
||||
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
|
||||
AV_CODEC_CAP_FRAME_THREADS,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM |
|
||||
FF_CODEC_CAP_ALLOCATE_PROGRESS,
|
||||
FF_CODEC_CAP_ALLOCATE_PROGRESS |
|
||||
FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.flush = ff_mpeg_flush,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = ff_h263_hwaccel_pixfmt_list_420,
|
||||
|
@ -90,7 +90,6 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
av_freep(&sc->edge_emu_buffer);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@ -991,7 +991,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
|
||||
fail_nomem:
|
||||
ret = AVERROR(ENOMEM);
|
||||
fail:
|
||||
ff_mpv_common_end(s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1123,7 +1122,6 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s)
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
ff_mpv_common_end(s);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1151,6 +1149,9 @@ void ff_mpv_common_end(MpegEncContext *s)
|
||||
av_freep(&s->bitstream_buffer);
|
||||
s->allocated_bitstream_buffer_size = 0;
|
||||
|
||||
if (!s->avctx)
|
||||
return;
|
||||
|
||||
if (s->picture) {
|
||||
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
|
||||
ff_free_picture_tables(&s->picture[i]);
|
||||
|
@ -888,7 +888,7 @@ AVCodec ff_msmpeg4v1_decoder = {
|
||||
.close = ff_h263_decode_end,
|
||||
.decode = ff_h263_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
@ -906,7 +906,7 @@ AVCodec ff_msmpeg4v2_decoder = {
|
||||
.close = ff_h263_decode_end,
|
||||
.decode = ff_h263_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
@ -924,7 +924,7 @@ AVCodec ff_msmpeg4v3_decoder = {
|
||||
.close = ff_h263_decode_end,
|
||||
.decode = ff_h263_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
@ -942,7 +942,7 @@ AVCodec ff_wmv1_decoder = {
|
||||
.close = ff_h263_decode_end,
|
||||
.decode = ff_h263_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
|
||||
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
|
@ -801,6 +801,7 @@ AVCodec ff_rv10_decoder = {
|
||||
.close = rv10_decode_end,
|
||||
.decode = rv10_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {
|
||||
AV_PIX_FMT_YUV420P,
|
||||
@ -818,6 +819,7 @@ AVCodec ff_rv20_decoder = {
|
||||
.close = rv10_decode_end,
|
||||
.decode = rv10_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.flush = ff_mpeg_flush,
|
||||
.max_lowres = 3,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) {
|
||||
|
@ -529,7 +529,6 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
|
||||
s->current_picture = av_frame_alloc();
|
||||
s->last_picture = av_frame_alloc();
|
||||
if (!s->current_picture || !s->last_picture) {
|
||||
svq1_encode_end(avctx);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
@ -546,7 +545,6 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
|
||||
s->m.avctx = avctx;
|
||||
|
||||
if ((ret = ff_mpv_common_init(&s->m)) < 0) {
|
||||
svq1_encode_end(avctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -564,7 +562,6 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
|
||||
|
||||
if (!s->m.me.temp || !s->m.me.scratchpad || !s->m.me.map ||
|
||||
!s->m.me.score_map || !s->mb_type || !s->dummy) {
|
||||
svq1_encode_end(avctx);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
@ -692,6 +689,7 @@ AVCodec ff_svq1_encoder = {
|
||||
.init = svq1_encode_init,
|
||||
.encode2 = svq1_encode_frame,
|
||||
.close = svq1_encode_end,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV410P,
|
||||
AV_PIX_FMT_NONE },
|
||||
};
|
||||
|
@ -537,6 +537,7 @@ AVCodec ff_wmv2_decoder = {
|
||||
.close = wmv2_decode_end,
|
||||
.decode = ff_h263_decode_frame,
|
||||
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_NONE },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user