diff mbox

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

Message ID a6094bce-3857-6efe-93a2-7b570842fe47@gmail.com
State Accepted
Commit 0e49118271ce0a3e8911200824032508b5a7de16
Headers show

Commit Message

Jun Zhao April 10, 2018, 12:33 a.m. UTC
From 4cd7996babcb80a0bae6bb4c0f31600d70b5f575 Mon Sep 17 00:00:00 2001
From: Jun Zhao <mypopydev@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@gmail.com>
---
 libavformat/hls.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
diff mbox

Patch

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));