[FFmpeg-devel] [PATCH 3/4] lavf/hlsenc: use ff_get_chomp_line

Jun Zhao mypopydev at gmail.com
Tue Apr 10 03:33:56 EEST 2018


-------------- next part --------------
From a883ac7d3db7c42e87f645dbc00423ad906ede0d Mon Sep 17 00:00:00 2001
From: Jun Zhao <mypopydev at gmail.com>
Date: Mon, 9 Apr 2018 23:12:16 +0800
Subject: [PATCH 3/4] lavf/hlsenc: use ff_get_chomp_line

Signed-off-by: Jun Zhao <mypopydev at gmail.com>
---
 libavformat/hlsenc.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 2a54b4342e..20982ced75 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -680,14 +680,6 @@ static int hls_encryption_start(AVFormatContext *s)
     return 0;
 }
 
-static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
-{
-    int len = ff_get_line(s, buf, maxlen);
-    while (len > 0 && av_isspace(buf[len - 1]))
-        buf[--len] = '\0';
-    return len;
-}
-
 static int hls_mux_init(AVFormatContext *s, VariantStream *vs)
 {
     AVDictionary *options = NULL;
@@ -1055,7 +1047,7 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs
                                    s->protocol_whitelist, s->protocol_blacklist)) < 0)
         return ret;
 
-    read_chomp_line(in, line, sizeof(line));
+    ff_get_chomp_line(in, line, sizeof(line));
     if (strcmp(line, "#EXTM3U")) {
         ret = AVERROR_INVALIDDATA;
         goto fail;
@@ -1063,7 +1055,7 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs
 
     vs->discontinuity = 0;
     while (!avio_feof(in)) {
-        read_chomp_line(in, line, sizeof(line));
+        ff_get_chomp_line(in, line, sizeof(line));
         if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
             int64_t tmp_sequence = strtoll(ptr, NULL, 10);
             if (tmp_sequence < vs->sequence)
-- 
2.14.1



More information about the ffmpeg-devel mailing list