[FFmpeg-devel] [PATCH 21/87] avcodec/(movtext|srt|ttml|webvtt)enc: Reindent after previous commit
James Almer
jamrial at gmail.com
Mon Apr 19 17:09:18 EEST 2021
From: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavcodec/movtextenc.c | 12 +++++------
libavcodec/srtenc.c | 16 +++++++--------
libavcodec/ttmlenc.c | 44 ++++++++++++++++++++---------------------
libavcodec/webvttenc.c | 12 +++++------
4 files changed, 41 insertions(+), 43 deletions(-)
diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 1b37d135e1..3c166639ba 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -655,12 +655,12 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf,
return AVERROR(EINVAL);
}
- dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
- if (!dialog)
- return AVERROR(ENOMEM);
- mov_text_dialog(s, dialog);
- ff_ass_split_override_codes(&mov_text_callbacks, s, dialog->text);
- ff_ass_free_dialog(&dialog);
+ dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
+ if (!dialog)
+ return AVERROR(ENOMEM);
+ mov_text_dialog(s, dialog);
+ ff_ass_split_override_codes(&mov_text_callbacks, s, dialog->text);
+ ff_ass_free_dialog(&dialog);
for (j = 0; j < box_count; j++) {
box_types[j].encode(s);
diff --git a/libavcodec/srtenc.c b/libavcodec/srtenc.c
index 160f3bbf3a..08c52c2d56 100644
--- a/libavcodec/srtenc.c
+++ b/libavcodec/srtenc.c
@@ -244,14 +244,14 @@ static int encode_frame(AVCodecContext *avctx,
return AVERROR(EINVAL);
}
- dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
- if (!dialog)
- return AVERROR(ENOMEM);
- s->alignment_applied = 0;
- if (avctx->codec_id == AV_CODEC_ID_SUBRIP)
- srt_style_apply(s, dialog->style);
- ff_ass_split_override_codes(cb, s, dialog->text);
- ff_ass_free_dialog(&dialog);
+ dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
+ if (!dialog)
+ return AVERROR(ENOMEM);
+ s->alignment_applied = 0;
+ if (avctx->codec_id == AV_CODEC_ID_SUBRIP)
+ srt_style_apply(s, dialog->style);
+ ff_ass_split_override_codes(cb, s, dialog->text);
+ ff_ass_free_dialog(&dialog);
}
if (!av_bprint_is_complete(&s->buffer))
diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c
index c4964572f9..26ab76e9e7 100644
--- a/libavcodec/ttmlenc.c
+++ b/libavcodec/ttmlenc.c
@@ -88,37 +88,35 @@ static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf,
for (i=0; i<sub->num_rects; i++) {
const char *ass = sub->rects[i]->ass;
+ int ret;
if (sub->rects[i]->type != SUBTITLE_ASS) {
av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n");
return AVERROR(EINVAL);
}
- dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
- if (!dialog)
- return AVERROR(ENOMEM);
-
- {
- int ret = ff_ass_split_override_codes(&ttml_callbacks, s,
- dialog->text);
- int log_level = (ret != AVERROR_INVALIDDATA ||
- avctx->err_recognition & AV_EF_EXPLODE) ?
- AV_LOG_ERROR : AV_LOG_WARNING;
-
- if (ret < 0) {
- av_log(avctx, log_level,
- "Splitting received ASS dialog text %s failed: %s\n",
- dialog->text,
- av_err2str(ret));
-
- if (log_level == AV_LOG_ERROR) {
- ff_ass_free_dialog(&dialog);
- return ret;
- }
- }
-
+ dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
+ if (!dialog)
+ return AVERROR(ENOMEM);
+
+ ret = ff_ass_split_override_codes(&ttml_callbacks, s,
+ dialog->text);
+ if (ret < 0) {
+ int log_level = (ret != AVERROR_INVALIDDATA ||
+ avctx->err_recognition & AV_EF_EXPLODE) ?
+ AV_LOG_ERROR : AV_LOG_WARNING;
+ av_log(avctx, log_level,
+ "Splitting received ASS dialog text %s failed: %s\n",
+ dialog->text,
+ av_err2str(ret));
+
+ if (log_level == AV_LOG_ERROR) {
ff_ass_free_dialog(&dialog);
+ return ret;
}
+ }
+
+ ff_ass_free_dialog(&dialog);
}
if (!av_bprint_is_complete(&s->buffer))
diff --git a/libavcodec/webvttenc.c b/libavcodec/webvttenc.c
index 2419dd3d07..fcbd9698f4 100644
--- a/libavcodec/webvttenc.c
+++ b/libavcodec/webvttenc.c
@@ -171,12 +171,12 @@ static int webvtt_encode_frame(AVCodecContext *avctx,
return AVERROR(EINVAL);
}
- dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
- if (!dialog)
- return AVERROR(ENOMEM);
- webvtt_style_apply(s, dialog->style);
- ff_ass_split_override_codes(&webvtt_callbacks, s, dialog->text);
- ff_ass_free_dialog(&dialog);
+ dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
+ if (!dialog)
+ return AVERROR(ENOMEM);
+ webvtt_style_apply(s, dialog->style);
+ ff_ass_split_override_codes(&webvtt_callbacks, s, dialog->text);
+ ff_ass_free_dialog(&dialog);
}
if (!av_bprint_is_complete(&s->buffer))
--
2.31.1
More information about the ffmpeg-devel
mailing list