Re: [FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: reindent hlsenc code
2017-11-02 7:52 GMT+08:00 Steven Liu: > Signed-off-by: Steven Liu > --- > 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) > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel pushed, Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: reindent hlsenc code
Signed-off-by: Steven Liu--- 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) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: reindent hlsenc code
> 在 2017年10月27日,上午8:11,Steven Liu写道: > > Signed-off-by: Steven Liu > --- > libavformat/hlsenc.c | 20 ++-- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 530fc11305..0ea93480a5 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -1081,13 +1081,13 @@ static int hls_window(AVFormatContext *s, int last) > } > avio_printf(out, "\n"); > } > -if (hls->flags & HLS_ROUND_DURATIONS) > -avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration)); > -else > -avio_printf(out, "#EXTINF:%f,\n", en->duration); > -if (byterange_mode) > -avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", > -en->size, en->pos); > +if (hls->flags & HLS_ROUND_DURATIONS) > +avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration)); > +else > +avio_printf(out, "#EXTINF:%f,\n", en->duration); > +if (byterange_mode) > +avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", > +en->size, en->pos); > > if (hls->flags & HLS_PROGRAM_DATE_TIME) { > time_t tt, wrongsecs; > @@ -1113,9 +1113,9 @@ static int hls_window(AVFormatContext *s, int last) > avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, > milli, buf1); > prog_date_time += en->duration; > } > -if (hls->baseurl) > -avio_printf(out, "%s", hls->baseurl); > -avio_printf(out, "%s\n", en->filename); > +if (hls->baseurl) > +avio_printf(out, "%s", hls->baseurl); > +avio_printf(out, "%s\n", en->filename); > } > > if (last && (hls->flags & HLS_OMIT_ENDLIST)==0) > -- > 2.11.0 (Apple Git-81) > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Applied! Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avformat/hlsenc: reindent hlsenc code
Signed-off-by: Steven Liu--- libavformat/hlsenc.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 530fc11305..0ea93480a5 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1081,13 +1081,13 @@ static int hls_window(AVFormatContext *s, int last) } avio_printf(out, "\n"); } -if (hls->flags & HLS_ROUND_DURATIONS) -avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration)); -else -avio_printf(out, "#EXTINF:%f,\n", en->duration); -if (byterange_mode) -avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", -en->size, en->pos); +if (hls->flags & HLS_ROUND_DURATIONS) +avio_printf(out, "#EXTINF:%ld,\n", lrint(en->duration)); +else +avio_printf(out, "#EXTINF:%f,\n", en->duration); +if (byterange_mode) +avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", +en->size, en->pos); if (hls->flags & HLS_PROGRAM_DATE_TIME) { time_t tt, wrongsecs; @@ -1113,9 +1113,9 @@ static int hls_window(AVFormatContext *s, int last) avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, milli, buf1); prog_date_time += en->duration; } -if (hls->baseurl) -avio_printf(out, "%s", hls->baseurl); -avio_printf(out, "%s\n", en->filename); +if (hls->baseurl) +avio_printf(out, "%s", hls->baseurl); +avio_printf(out, "%s\n", en->filename); } if (last && (hls->flags & HLS_OMIT_ENDLIST)==0) -- 2.11.0 (Apple Git-81) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel