aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtsp.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2017-12-29 23:30:14 +0100
committerMarton Balint <cus@passwd.hu>2018-01-28 23:06:43 +0100
commit18ac64235939c4c5c7656546a9545f68339affbe (patch)
tree53d6aab3edafd9bd621558415b63546ca0c5674e /libavformat/rtsp.c
parent45ec2e44be911da073b02ae3a14e3cb08ce0a1f5 (diff)
downloadffmpeg-18ac64235939c4c5c7656546a9545f68339affbe.tar.gz
avformat: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r--libavformat/rtsp.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index cf7cdb2f2b..89fc1e293c 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1686,7 +1686,7 @@ int ff_rtsp_connect(AVFormatContext *s)
redirect:
/* extract hostname and port */
av_url_split(proto, sizeof(proto), auth, sizeof(auth),
- host, sizeof(host), &port, path, sizeof(path), s->filename);
+ host, sizeof(host), &port, path, sizeof(path), s->url);
if (!strcmp(proto, "rtsps")) {
lower_rtsp_proto = "tls";
@@ -1717,7 +1717,7 @@ redirect:
}
}
- /* Construct the URI used in request; this is similar to s->filename,
+ /* Construct the URI used in request; this is similar to s->url,
* but with authentication credentials removed and RTSP specific options
* stripped out. */
ff_url_join(rt->control_uri, sizeof(rt->control_uri), proto, NULL,
@@ -1905,13 +1905,19 @@ redirect:
ff_rtsp_close_streams(s);
ff_rtsp_close_connections(s);
if (reply->status_code >=300 && reply->status_code < 400 && s->iformat) {
- av_strlcpy(s->filename, reply->location, sizeof(s->filename));
+ char *new_url = av_strdup(reply->location);
+ if (!new_url) {
+ err = AVERROR(ENOMEM);
+ goto fail2;
+ }
+ ff_format_set_url(s, new_url);
rt->session_id[0] = '\0';
av_log(s, AV_LOG_INFO, "Status %d: Redirecting to %s\n",
reply->status_code,
- s->filename);
+ s->url);
goto redirect;
}
+ fail2:
ff_network_close();
return err;
}
@@ -2425,7 +2431,7 @@ static int rtp_read_header(AVFormatContext *s)
if (!ff_network_init())
return AVERROR(EIO);
- ret = ffurl_open_whitelist(&in, s->filename, AVIO_FLAG_READ,
+ ret = ffurl_open_whitelist(&in, s->url, AVIO_FLAG_READ,
&s->interrupt_callback, NULL, s->protocol_whitelist, s->protocol_blacklist, NULL);
if (ret)
goto fail;
@@ -2476,7 +2482,7 @@ static int rtp_read_header(AVFormatContext *s)
}
av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port,
- NULL, 0, s->filename);
+ NULL, 0, s->url);
snprintf(sdp, sizeof(sdp),
"v=0\r\nc=IN IP%d %s\r\nm=%s %d RTP/AVP %d\r\n",