diff mbox series

[FFmpeg-devel,v1,2/4] avformat/hlsplaylist: simplify code for checking whether the string is empty

Message ID 20200326135700.11167-2-lance.lmwang@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,v1,1/4] avformat/hlsenc: remove the first slash of the relative path line in the master m3u8 file | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Lance Wang March 26, 2020, 1:56 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/hlsplaylist.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Liu Steven March 29, 2020, 8:25 a.m. UTC | #1
> 2020年3月26日 下午9:56,lance.lmwang@gmail.com 写道:
> 
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavformat/hlsplaylist.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
> index 9cbd02353f..56244496c0 100644
> --- a/libavformat/hlsplaylist.c
> +++ b/libavformat/hlsplaylist.c
> @@ -65,11 +65,11 @@ void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
>     if (st && st->codecpar->width > 0 && st->codecpar->height > 0)
>         avio_printf(out, ",RESOLUTION=%dx%d", st->codecpar->width,
>                 st->codecpar->height);
> -    if (codecs && strlen(codecs) > 0)
> +    if (codecs && codecs[0])
>         avio_printf(out, ",CODECS=\"%s\"", codecs);
> -    if (agroup && strlen(agroup) > 0)
> +    if (agroup && agroup[0])
>         avio_printf(out, ",AUDIO=\"group_%s\"", agroup);
> -    if (ccgroup && strlen(ccgroup) > 0)
> +    if (ccgroup && ccgroup[0])
>         avio_printf(out, ",CLOSED-CAPTIONS=\"%s\"", ccgroup);
>     avio_printf(out, "\n%s\n\n", filename);
> }
> -- 
> 2.21.0
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

LGTM

Thanks

Steven Liu
diff mbox series

Patch

diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
index 9cbd02353f..56244496c0 100644
--- a/libavformat/hlsplaylist.c
+++ b/libavformat/hlsplaylist.c
@@ -65,11 +65,11 @@  void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
     if (st && st->codecpar->width > 0 && st->codecpar->height > 0)
         avio_printf(out, ",RESOLUTION=%dx%d", st->codecpar->width,
                 st->codecpar->height);
-    if (codecs && strlen(codecs) > 0)
+    if (codecs && codecs[0])
         avio_printf(out, ",CODECS=\"%s\"", codecs);
-    if (agroup && strlen(agroup) > 0)
+    if (agroup && agroup[0])
         avio_printf(out, ",AUDIO=\"group_%s\"", agroup);
-    if (ccgroup && strlen(ccgroup) > 0)
+    if (ccgroup && ccgroup[0])
         avio_printf(out, ",CLOSED-CAPTIONS=\"%s\"", ccgroup);
     avio_printf(out, "\n%s\n\n", filename);
 }