diff mbox

[FFmpeg-devel,4/4] lavf/hlsproto: use ff_get_chomp_line

Message ID 3ff5df99-bca0-684f-4d4e-549fddba2754@gmail.com
State Accepted
Commit 52623bc26fc49a1335a7ba4aab6ddb2b6588c105
Headers show

Commit Message

Jun Zhao April 10, 2018, 12:34 a.m. UTC
From beace363b11e4a472d84d001458ffd4017788cfb Mon Sep 17 00:00:00 2001
From: Jun Zhao <mypopydev@gmail.com>
Date: Mon, 9 Apr 2018 23:13:03 +0800
Subject: [PATCH 4/4] lavf/hlsproto: use ff_get_chomp_line

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

Patch

diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 2b19ed0cf6..e7ef2d88ea 100644
--- a/libavformat/hlsproto.c
+++ b/libavformat/hlsproto.c
@@ -69,14 +69,6 @@  typedef struct HLSContext {
     int64_t last_load_time;
 } 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(HLSContext *s)
 {
     int i;
@@ -122,7 +114,7 @@  static int parse_playlist(URLContext *h, const char *url)
                                    h->protocol_whitelist, h->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;
@@ -131,7 +123,7 @@  static int parse_playlist(URLContext *h, const char *url)
     free_segment_list(s);
     s->finished = 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-STREAM-INF:", &ptr)) {
             struct variant_info info = {{0}};
             is_variant = 1;