mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/movtextenc: Cleanup generically on init failure
Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
eab812d6d6
commit
2134667227
@ -30,6 +30,7 @@
|
|||||||
#include "ass_split.h"
|
#include "ass_split.h"
|
||||||
#include "ass.h"
|
#include "ass.h"
|
||||||
#include "bytestream.h"
|
#include "bytestream.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
#define STYLE_FLAG_BOLD (1<<0)
|
#define STYLE_FLAG_BOLD (1<<0)
|
||||||
#define STYLE_FLAG_ITALIC (1<<1)
|
#define STYLE_FLAG_ITALIC (1<<1)
|
||||||
@ -331,19 +332,13 @@ static av_cold int mov_text_encode_init(AVCodecContext *avctx)
|
|||||||
av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED);
|
av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||||
|
|
||||||
s->ass_ctx = ff_ass_split(avctx->subtitle_header);
|
s->ass_ctx = ff_ass_split(avctx->subtitle_header);
|
||||||
if (!s->ass_ctx) {
|
if (!s->ass_ctx)
|
||||||
ret = AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
ret = encode_sample_description(avctx);
|
ret = encode_sample_description(avctx);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
return ret;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
|
||||||
mov_text_encode_close(avctx);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a new style box if needed
|
// Start a new style box if needed
|
||||||
@ -736,4 +731,5 @@ AVCodec ff_movtext_encoder = {
|
|||||||
.init = mov_text_encode_init,
|
.init = mov_text_encode_init,
|
||||||
.encode_sub = mov_text_encode_frame,
|
.encode_sub = mov_text_encode_frame,
|
||||||
.close = mov_text_encode_close,
|
.close = mov_text_encode_close,
|
||||||
|
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user