From 8c0ceafb0f25da077ff23e394667119f031574fd Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 19 Feb 2016 18:02:45 +0100 Subject: 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. --- libavformat/rtspdec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libavformat/rtspdec.c') 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; } -- cgit v1.2.3