mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 19:58:59 +00:00
lavf/hlsproto: use ff_get_chomp_line
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
This commit is contained in:
parent
f1ccb4dbcf
commit
52623bc26f
@ -69,14 +69,6 @@ typedef struct HLSContext {
|
|||||||
int64_t last_load_time;
|
int64_t last_load_time;
|
||||||
} HLSContext;
|
} 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)
|
static void free_segment_list(HLSContext *s)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -122,7 +114,7 @@ static int parse_playlist(URLContext *h, const char *url)
|
|||||||
h->protocol_whitelist, h->protocol_blacklist)) < 0)
|
h->protocol_whitelist, h->protocol_blacklist)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
read_chomp_line(in, line, sizeof(line));
|
ff_get_chomp_line(in, line, sizeof(line));
|
||||||
if (strcmp(line, "#EXTM3U")) {
|
if (strcmp(line, "#EXTM3U")) {
|
||||||
ret = AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -131,7 +123,7 @@ static int parse_playlist(URLContext *h, const char *url)
|
|||||||
free_segment_list(s);
|
free_segment_list(s);
|
||||||
s->finished = 0;
|
s->finished = 0;
|
||||||
while (!avio_feof(in)) {
|
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)) {
|
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
|
||||||
struct variant_info info = {{0}};
|
struct variant_info info = {{0}};
|
||||||
is_variant = 1;
|
is_variant = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user