[FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: reindent hlsenc code

Steven Liu lq at chinaffmpeg.org
Thu Nov 2 01:52:56 EET 2017


Signed-off-by: Steven Liu <lq at onvideo.cn>
---
 libavformat/hlsenc.c | 52 ++++++++++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 6d573db094..5ea9d216a4 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1444,36 +1444,36 @@ static int hls_write_header(AVFormatContext *s)
     }
 
     if (hls->segment_type == SEGMENT_TYPE_FMP4) {
-    if (av_strcasecmp(hls->fmp4_init_filename, "init.mp4")) {
-        hls->base_output_dirname = av_malloc(fmp4_init_filename_len);
-        if (!hls->base_output_dirname) {
-            ret = AVERROR(ENOMEM);
-            goto fail;
-        }
-        av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, fmp4_init_filename_len);
-    } else {
-        if (basename_size > 0) {
-            hls->base_output_dirname = av_malloc(basename_size);
+        if (av_strcasecmp(hls->fmp4_init_filename, "init.mp4")) {
+            hls->base_output_dirname = av_malloc(fmp4_init_filename_len);
+            if (!hls->base_output_dirname) {
+                ret = AVERROR(ENOMEM);
+                goto fail;
+            }
+            av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, fmp4_init_filename_len);
         } else {
-            hls->base_output_dirname = av_malloc(strlen(hls->fmp4_init_filename));
-        }
-        if (!hls->base_output_dirname) {
-            ret = AVERROR(ENOMEM);
-            goto fail;
-        }
+            if (basename_size > 0) {
+                hls->base_output_dirname = av_malloc(basename_size);
+            } else {
+                hls->base_output_dirname = av_malloc(strlen(hls->fmp4_init_filename));
+            }
+            if (!hls->base_output_dirname) {
+                ret = AVERROR(ENOMEM);
+                goto fail;
+            }
 
-        if (basename_size > 0) {
-            av_strlcpy(hls->base_output_dirname, s->filename, basename_size);
-            p = strrchr(hls->base_output_dirname, '/');
-        }
-        if (p) {
-            *(p + 1) = '\0';
-            av_strlcat(hls->base_output_dirname, hls->fmp4_init_filename, basename_size);
-        } else {
-            av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, fmp4_init_filename_len);
+            if (basename_size > 0) {
+                av_strlcpy(hls->base_output_dirname, s->filename, basename_size);
+                p = strrchr(hls->base_output_dirname, '/');
+            }
+            if (p) {
+                *(p + 1) = '\0';
+                av_strlcat(hls->base_output_dirname, hls->fmp4_init_filename, basename_size);
+            } else {
+                av_strlcpy(hls->base_output_dirname, hls->fmp4_init_filename, fmp4_init_filename_len);
+            }
         }
     }
-    }
 
     if (!hls->use_localtime) {
         ret = sls_flag_check_duration_size_index(hls);
-- 
2.11.0 (Apple Git-81)





More information about the ffmpeg-devel mailing list