]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/(movtext|srt|ttml|webvtt)enc: Reindent after previous commit
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 25 Feb 2021 19:33:44 +0000 (20:33 +0100)
committerJames Almer <jamrial@gmail.com>
Tue, 27 Apr 2021 13:43:04 +0000 (10:43 -0300)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/movtextenc.c
libavcodec/srtenc.c
libavcodec/ttmlenc.c
libavcodec/webvttenc.c

index 1b37d135e15dc26fd8b16847d2c0d0b33837e115..3c166639ba702faa59d085a19f9ca55b7bed0f4b 100644 (file)
@@ -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);
index 160f3bbf3a2d4d41e64a9fca780c752904777dce..08c52c2d56cef8db6289ad1aa0f4862c07234e31 100644 (file)
@@ -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))
index a0c605b91872ec02c4a15d072454400343bedada..83485197c991f85ccd76e685ae42852daa0baacf 100644 (file)
@@ -88,48 +88,45 @@ 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);
+        dialog = ff_ass_split_dialog2(s->ass_ctx, ass);
+        if (!dialog)
+            return AVERROR(ENOMEM);
 
-            if (dialog->style) {
-                av_bprintf(&s->buffer, "<span region=\"");
-                av_bprint_escape(&s->buffer, dialog->style, NULL,
-                                 AV_ESCAPE_MODE_XML,
-                                 AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
-                av_bprintf(&s->buffer, "\">");
-            }
-
-            {
-                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;
-                    }
-                }
-
-                if (dialog->style)
-                    av_bprintf(&s->buffer, "</span>");
+        if (dialog->style) {
+            av_bprintf(&s->buffer, "<span region=\"");
+            av_bprint_escape(&s->buffer, dialog->style, NULL,
+                             AV_ESCAPE_MODE_XML,
+                             AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES);
+            av_bprintf(&s->buffer, "\">");
+        }
 
+        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;
             }
+        }
+
+        if (dialog->style)
+            av_bprintf(&s->buffer, "</span>");
+
+        ff_ass_free_dialog(&dialog);
     }
 
     if (!av_bprint_is_complete(&s->buffer))
index 2419dd3d07dc60b8844f53bc03bb14da5810203d..fcbd9698f49ccb1cec59dfececebd11ddd63d4d2 100644 (file)
@@ -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))