You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/ttmlenc: split header writing into its own function
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
This commit is contained in:
@@ -173,16 +173,8 @@ static av_cold int ttml_encode_close(AVCodecContext *avctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int ttml_encode_init(AVCodecContext *avctx)
|
static int ttml_write_header_content(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
TTMLContext *s = avctx->priv_data;
|
|
||||||
|
|
||||||
s->avctx = avctx;
|
|
||||||
|
|
||||||
if (!(s->ass_ctx = ff_ass_split(avctx->subtitle_header))) {
|
|
||||||
return AVERROR_INVALIDDATA;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(avctx->extradata = av_mallocz(TTMLENC_EXTRADATA_SIGNATURE_SIZE +
|
if (!(avctx->extradata = av_mallocz(TTMLENC_EXTRADATA_SIGNATURE_SIZE +
|
||||||
1 + AV_INPUT_BUFFER_PADDING_SIZE))) {
|
1 + AV_INPUT_BUFFER_PADDING_SIZE))) {
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
@@ -192,8 +184,25 @@ static av_cold int ttml_encode_init(AVCodecContext *avctx)
|
|||||||
memcpy(avctx->extradata, TTMLENC_EXTRADATA_SIGNATURE,
|
memcpy(avctx->extradata, TTMLENC_EXTRADATA_SIGNATURE,
|
||||||
TTMLENC_EXTRADATA_SIGNATURE_SIZE);
|
TTMLENC_EXTRADATA_SIGNATURE_SIZE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static av_cold int ttml_encode_init(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
TTMLContext *s = avctx->priv_data;
|
||||||
|
int ret = AVERROR_BUG;
|
||||||
|
s->avctx = avctx;
|
||||||
|
|
||||||
av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED);
|
av_bprint_init(&s->buffer, 0, AV_BPRINT_SIZE_UNLIMITED);
|
||||||
|
|
||||||
|
if (!(s->ass_ctx = ff_ass_split(avctx->subtitle_header))) {
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ret = ttml_write_header_content(avctx)) < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user