summaryrefslogtreecommitdiff
path: root/libavformat/sapdec.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/sapdec.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/sapdec.c')
-rw-r--r--libavformat/sapdec.c11
1 files changed, 10 insertions, 1 deletions
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;