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/sapdec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libavformat/sapdec.c') diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index f09222df3c..9fafd6bffe 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -39,6 +39,8 @@ struct SAPState { uint16_t hash; char *sdp; int eof; + + const URLProtocol **protocols; }; static int sap_probe(AVProbeData *p) @@ -55,6 +57,7 @@ static int sap_read_close(AVFormatContext *s) avformat_close_input(&sap->sdp_ctx); if (sap->ann_fd) ffurl_close(sap->ann_fd); + av_freep(&sap->protocols); av_freep(&sap->sdp); ff_network_close(); return 0; @@ -82,10 +85,16 @@ static int sap_read_header(AVFormatContext *s) av_strlcpy(host, "224.2.127.254", sizeof(host)); } + sap->protocols = ffurl_get_protocols(NULL, NULL); + if (!sap->protocols) { + ret = AVERROR(ENOMEM); + goto fail; + } + ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d", port); ret = ffurl_open(&sap->ann_fd, url, AVIO_FLAG_READ, - &s->interrupt_callback, NULL); + &s->interrupt_callback, NULL, sap->protocols); if (ret) goto fail; -- cgit v1.2.3