Commit 2f9ca645 authored by Aman Gupta's avatar Aman Gupta

avformat/hls: remove repeated http proto_name checks in open_url()

Signed-off-by: 's avatarAman Gupta <aman@tmm1.net>
parent 7e60c743
...@@ -623,12 +623,13 @@ static int open_url_keepalive(AVFormatContext *s, AVIOContext **pb, ...@@ -623,12 +623,13 @@ static int open_url_keepalive(AVFormatContext *s, AVIOContext **pb,
} }
static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
AVDictionary *opts, AVDictionary *opts2, int *is_http) AVDictionary *opts, AVDictionary *opts2, int *is_http_out)
{ {
HLSContext *c = s->priv_data; HLSContext *c = s->priv_data;
AVDictionary *tmp = NULL; AVDictionary *tmp = NULL;
const char *proto_name = NULL; const char *proto_name = NULL;
int ret; int ret;
int is_http = 0;
av_dict_copy(&tmp, opts, 0); av_dict_copy(&tmp, opts, 0);
av_dict_copy(&tmp, opts2, 0); av_dict_copy(&tmp, opts2, 0);
...@@ -654,7 +655,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ...@@ -654,7 +655,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} else if (av_strstart(proto_name, "http", NULL)) { } else if (av_strstart(proto_name, "http", NULL)) {
; is_http = 1;
} else } else
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
...@@ -665,7 +666,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ...@@ -665,7 +666,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5)) else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (c->http_persistent && *pb && av_strstart(proto_name, "http", NULL)) { if (is_http && c->http_persistent && *pb) {
ret = open_url_keepalive(c->ctx, pb, url); ret = open_url_keepalive(c->ctx, pb, url);
if (ret == AVERROR_EXIT) { if (ret == AVERROR_EXIT) {
return ret; return ret;
...@@ -696,8 +697,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ...@@ -696,8 +697,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
av_dict_free(&tmp); av_dict_free(&tmp);
if (is_http) if (is_http_out)
*is_http = av_strstart(proto_name, "http", NULL); *is_http_out = is_http;
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment