[FFmpeg-devel] [PATCH 2/4] lavf/hls: use ff_get_chomp_line

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


-------------- next part --------------
From 4cd7996babcb80a0bae6bb4c0f31600d70b5f575 Mon Sep 17 00:00:00 2001
From: Jun Zhao <mypopydev at gmail.com>
Date: Mon, 9 Apr 2018 23:11:02 +0800
Subject: [PATCH 2/4] lavf/hls: use ff_get_chomp_line

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

diff --git a/libavformat/hls.c b/libavformat/hls.c
index ae0545a086..1257cd101c 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -216,14 +216,6 @@ typedef struct HLSContext {
     AVIOContext *playlist_pb;
 } HLSContext;
 
-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 void free_segment_list(struct playlist *pls)
 {
     int i;
@@ -770,7 +762,7 @@ static int parse_playlist(HLSContext *c, const char *url,
     if (av_opt_get(in, "location", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)
         url = new_url;
 
-    read_chomp_line(in, line, sizeof(line));
+    ff_get_chomp_line(in, line, sizeof(line));
     if (strcmp(line, "#EXTM3U")) {
         ret = AVERROR_INVALIDDATA;
         goto fail;
@@ -782,7 +774,7 @@ static int parse_playlist(HLSContext *c, const char *url,
         pls->type = PLS_TYPE_UNSPECIFIED;
     }
     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-STREAM-INF:", &ptr)) {
             is_variant = 1;
             memset(&variant_info, 0, sizeof(variant_info));
-- 
2.14.1



More information about the ffmpeg-devel mailing list