summaryrefslogtreecommitdiff
path: root/libavformat/rtspdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-02-19 18:02:45 +0100
committerAnton Khirnov <anton@khirnov.net>2016-02-22 11:45:31 +0100
commit8c0ceafb0f25da077ff23e394667119f031574fd (patch)
treec495ca2679de2d9c0bc436652cfb5764cee47905 /libavformat/rtspdec.c
parentcae448cfbf31d492cba782bc64fc4eed556ed83d (diff)
urlprotocol: receive a list of protocols from the caller
This way, the decisions about which protocols are available for use in any given situations can be delegated to the caller.
Diffstat (limited to 'libavformat/rtspdec.c')
-rw-r--r--libavformat/rtspdec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 8ccf147699..c6f4d521e4 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -295,7 +295,7 @@ static int rtsp_read_setup(AVFormatContext *s, char* host, char *controlurl)
ff_url_join(url, sizeof(url), "rtp", NULL, host, localport, NULL);
av_log(s, AV_LOG_TRACE, "Opening: %s", url);
ret = ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, &opts);
+ &s->interrupt_callback, &opts, rt->protocols);
av_dict_free(&opts);
if (ret)
localport += 2;
@@ -639,6 +639,12 @@ static int rtsp_listen(AVFormatContext *s)
int ret;
enum RTSPMethod methodcode;
+ if (!rt->protocols) {
+ rt->protocols = ffurl_get_protocols(NULL, NULL);
+ if (!rt->protocols)
+ return AVERROR(ENOMEM);
+ }
+
/* extract hostname and port */
av_url_split(proto, sizeof(proto), auth, sizeof(auth), host, sizeof(host),
&port, path, sizeof(path), s->filename);
@@ -660,7 +666,7 @@ static int rtsp_listen(AVFormatContext *s)
"?listen&listen_timeout=%d", rt->initial_timeout * 1000);
if (ret = ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, NULL)) {
+ &s->interrupt_callback, NULL, rt->protocols)) {
av_log(s, AV_LOG_ERROR, "Unable to open RTSP for listening\n");
return ret;
}