@@ -353,6 +353,24 @@ fail:
return ret;
}
+int ffurl_open_with_parent(URLContext **puc, const char *filename, int flags,
+ AVDictionary **options, URLContext *parent)
+{
+ return ffurl_open_whitelist(puc, filename, flags,
+ &parent->interrupt_callback, options,
+ parent->protocol_whitelist,
+ parent->protocol_blacklist, parent);
+}
+
+int ffurl_open_with_avfmt(URLContext **puc, const char *filename, int flags,
+ AVDictionary **options, AVFormatContext *avfmt)
+{
+ return ffurl_open_whitelist(puc, filename, flags,
+ &avfmt->interrupt_callback, options,
+ avfmt->protocol_whitelist,
+ avfmt->protocol_blacklist, NULL);
+}
+
static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
int size, int size_min,
int (*transfer_func)(URLContext *h,
@@ -92,8 +92,7 @@ static int cache_open(URLContext *h, const char *arg, int flags, AVDictionary **
else
c->filename = buffername;
- return ffurl_open_whitelist(&c->inner, arg, flags, &h->interrupt_callback,
- options, h->protocol_whitelist, h->protocol_blacklist, h);
+ return ffurl_open_with_parent(&c->inner, arg, flags, options, h);
}
static int add_entry(URLContext *h, const unsigned char *buf, int size)
@@ -99,8 +99,7 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
uri += len + strspn(uri + len, AV_CAT_SEPARATOR);
/* creating URLContext */
- err = ffurl_open_whitelist(&uc, node_uri, flags,
- &h->interrupt_callback, NULL, h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&uc, node_uri, flags, NULL, h);
if (err < 0)
break;
@@ -267,8 +266,7 @@ static av_cold int concatf_open(URLContext *h, const char *uri, int flags)
}
/* creating URLContext */
- err = ffurl_open_whitelist(&uc, node_uri, flags,
- &h->interrupt_callback, NULL, h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&uc, node_uri, flags, NULL, h);
av_free(node_uri);
if (err < 0)
break;
@@ -140,9 +140,7 @@ static int crypto_open2(URLContext *h, const char *uri, int flags, AVDictionary
goto err;
}
- if ((ret = ffurl_open_whitelist(&c->hd, nested_url, flags,
- &h->interrupt_callback, options,
- h->protocol_whitelist, h->protocol_blacklist, h)) < 0) {
+ if ((ret = ffurl_open_with_parent(&c->hd, nested_url, flags, options, h)) < 0) {
av_log(h, AV_LOG_ERROR, "Unable to open resource: %s\n", nested_url);
goto err;
}
@@ -574,9 +574,8 @@ static int ftp_connect_control_connection(URLContext *h)
if (s->rw_timeout != -1) {
av_dict_set_int(&opts, "timeout", s->rw_timeout, 0);
} /* if option is not given, don't pass it and let tcp use its own default */
- err = ffurl_open_whitelist(&s->conn_control, buf, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, &opts,
- h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&s->conn_control, buf,
+ AVIO_FLAG_READ_WRITE, &opts, h);
av_dict_free(&opts);
if (err < 0) {
av_log(h, AV_LOG_ERROR, "Cannot open control connection\n");
@@ -628,9 +627,7 @@ static int ftp_connect_data_connection(URLContext *h)
if (s->rw_timeout != -1) {
av_dict_set_int(&opts, "timeout", s->rw_timeout, 0);
} /* if option is not given, don't pass it and let tcp use its own default */
- err = ffurl_open_whitelist(&s->conn_data, buf, h->flags,
- &h->interrupt_callback, &opts,
- h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&s->conn_data, buf, h->flags, &opts, h);
av_dict_free(&opts);
if (err < 0)
return err;
@@ -98,8 +98,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
s->hd = NULL;
- err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, NULL, h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&s->hd, buf, AVIO_FLAG_READ_WRITE, NULL, h);
if (err < 0)
goto fail;
@@ -295,9 +295,7 @@ retry:
}
url = s->segments[s->cur_seq_no - s->start_seq_no]->url;
av_log(h, AV_LOG_DEBUG, "opening %s\n", url);
- ret = ffurl_open_whitelist(&s->seg_hd, url, AVIO_FLAG_READ,
- &h->interrupt_callback, NULL,
- h->protocol_whitelist, h->protocol_blacklist, h);
+ ret = ffurl_open_with_parent(&s->seg_hd, url, AVIO_FLAG_READ, NULL, h);
if (ret < 0) {
if (ff_check_interrupt(&h->interrupt_callback))
return AVERROR_EXIT;
@@ -263,9 +263,8 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
if (!s->hd) {
- err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, options,
- h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&s->hd, buf, AVIO_FLAG_READ_WRITE,
+ options, h);
}
end:
@@ -662,10 +661,8 @@ static int http_listen(URLContext *h, const char *uri, int flags,
NULL);
if ((ret = av_dict_set_int(options, "listen", s->listen, 0)) < 0)
goto fail;
- if ((ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, options,
- h->protocol_whitelist, h->protocol_blacklist, h
- )) < 0)
+ if ((ret = ffurl_open_with_parent(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
+ options, h)) < 0)
goto fail;
s->handshake_step = LOWER_PROTO;
if (s->listen == HTTP_SINGLE) { /* single client */
@@ -2066,9 +2063,8 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags)
ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port,
NULL);
redo:
- ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, NULL,
- h->protocol_whitelist, h->protocol_blacklist, h);
+ ret = ffurl_open_with_parent(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
+ NULL, h);
if (ret < 0)
return ret;
@@ -168,8 +168,7 @@ static int icecast_open(URLContext *h, const char *uri, int flags)
s->tls ? "https" : "http",
auth, host, port, "%s", path);
// Finally open http proto handler
- ret = ffurl_open_whitelist(&s->hd, h_url, AVIO_FLAG_READ_WRITE, NULL,
- &opt_dict, h->protocol_whitelist, h->protocol_blacklist, h);
+ ret = ffurl_open_with_parent(&s->hd, h_url, AVIO_FLAG_READ_WRITE, &opt_dict, h);
cleanup:
av_freep(&user);
@@ -290,10 +290,7 @@ static int translate_ipfs_to_http(URLContext *h, const char *uri, int flags, AVD
}
// Pass the URL back to FFMpeg's protocol handler.
- ret = ffurl_open_whitelist(&c->inner, fulluri, flags,
- &h->interrupt_callback, options,
- h->protocol_whitelist,
- h->protocol_blacklist, h);
+ ret = ffurl_open_with_parent(&c->inner, fulluri, flags, options, h);
if (ret < 0) {
av_log(h, AV_LOG_WARNING, "Unable to open resource: %s\n", fulluri);
goto err;
@@ -69,9 +69,7 @@ static int md5_close(URLContext *h)
av_strstart(filename, "md5:", &filename);
if (*filename) {
- err = ffurl_open_whitelist(&out, filename, AVIO_FLAG_WRITE,
- &h->interrupt_callback, NULL,
- h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&out, filename, AVIO_FLAG_WRITE, NULL, h);
if (err)
return err;
err = ffurl_write(out, buf, sizeof(buf));
@@ -528,9 +528,8 @@ static int mms_open(URLContext *h, const char *uri, int flags)
// establish tcp connection.
ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, mmst->host, port, NULL);
- err = ffurl_open_whitelist(&mms->mms_hd, tcpname, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, NULL,
- h->protocol_whitelist, h->protocol_blacklist, h);
+ err = ffurl_open_with_parent(&mms->mms_hd, tcpname, AVIO_FLAG_READ_WRITE,
+ NULL, h);
if (err)
goto fail;
@@ -295,12 +295,10 @@ static int prompeg_open(URLContext *h, const char *uri, int flags) {
}
ff_url_join(buf, sizeof (buf), "udp", NULL, hostname, rtp_port + 2, NULL);
- if (ffurl_open_whitelist(&s->fec_col_hd, buf, flags, &h->interrupt_callback,
- &udp_opts, h->protocol_whitelist, h->protocol_blacklist, h) < 0)
+ if (ffurl_open_with_parent(&s->fec_col_hd, buf, flags, &udp_opts, h) < 0)
goto fail;
ff_url_join(buf, sizeof (buf), "udp", NULL, hostname, rtp_port + 4, NULL);
- if (ffurl_open_whitelist(&s->fec_row_hd, buf, flags, &h->interrupt_callback,
- &udp_opts, h->protocol_whitelist, h->protocol_blacklist, h) < 0)
+ if (ffurl_open_with_parent(&s->fec_row_hd, buf, flags, &udp_opts, h) < 0)
goto fail;
h->max_packet_size = s->fec_col_hd->max_packet_size;
@@ -264,9 +264,8 @@ static int rtmpe_open(URLContext *h, const char *uri, int flags)
}
/* open the tcp or ffrtmphttp connection */
- if ((ret = ffurl_open_whitelist(&rt->stream, url, AVIO_FLAG_READ_WRITE,
- &h->interrupt_callback, NULL,
- h->protocol_whitelist, h->protocol_blacklist, h)) < 0) {
+ if ((ret = ffurl_open_with_parent(&rt->stream, url, AVIO_FLAG_READ_WRITE,
+ NULL, h)) < 0) {
rtmpe_close(h);
return ret;
}
@@ -1121,9 +1121,8 @@ static int rtmp_calc_swfhash(URLContext *s)
int ret = 0;
/* Get the SWF player file. */
- if ((ret = ffurl_open_whitelist(&stream, rt->swfverify, AVIO_FLAG_READ,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist, s)) < 0) {
+ if ((ret = ffurl_open_with_parent(&stream, rt->swfverify, AVIO_FLAG_READ,
+ NULL, s)) < 0) {
av_log(s, AV_LOG_ERROR, "Cannot open connection %s.\n", rt->swfverify);
goto fail;
}
@@ -2663,9 +2662,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags, AVDictionary **o
}
reconnect:
- if ((ret = ffurl_open_whitelist(&rt->stream, buf, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, opts,
- s->protocol_whitelist, s->protocol_blacklist, s)) < 0) {
+ if ((ret = ffurl_open_with_parent(&rt->stream, buf, AVIO_FLAG_READ_WRITE, opts, s)) < 0) {
av_log(s , AV_LOG_ERROR, "Cannot open connection %s\n", buf);
goto fail;
}
@@ -327,8 +327,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
build_udp_url(s, buf, sizeof(buf),
hostname, s->localaddr, rtp_port, s->local_rtpport,
sources, block);
- if (ffurl_open_whitelist(&s->rtp_hd, buf, flags, &h->interrupt_callback,
- NULL, h->protocol_whitelist, h->protocol_blacklist, h) < 0)
+ if (ffurl_open_with_parent(&s->rtp_hd, buf, flags, NULL, h) < 0)
goto fail;
s->local_rtpport = ff_udp_get_local_port(s->rtp_hd);
if(s->local_rtpport == 65535) {
@@ -341,9 +340,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
build_udp_url(s, buf, sizeof(buf),
hostname, s->localaddr, s->rtcp_port, s->local_rtcpport,
sources, block);
- if (ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags,
- &h->interrupt_callback, NULL,
- h->protocol_whitelist, h->protocol_blacklist, h) < 0) {
+ if (ffurl_open_with_parent(&s->rtcp_hd, buf, rtcpflags, NULL, h) < 0) {
s->local_rtpport = s->local_rtcpport = -1;
continue;
}
@@ -352,8 +349,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
build_udp_url(s, buf, sizeof(buf),
hostname, s->localaddr, s->rtcp_port, s->local_rtcpport,
sources, block);
- if (ffurl_open_whitelist(&s->rtcp_hd, buf, rtcpflags, &h->interrupt_callback,
- NULL, h->protocol_whitelist, h->protocol_blacklist, h) < 0)
+ if (ffurl_open_with_parent(&s->rtcp_hd, buf, rtcpflags, NULL, h) < 0)
goto fail;
break;
}
@@ -361,8 +357,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
s->fec_hd = NULL;
if (fec_protocol) {
ff_url_join(buf, sizeof(buf), fec_protocol, NULL, hostname, rtp_port, NULL);
- if (ffurl_open_whitelist(&s->fec_hd, buf, flags, &h->interrupt_callback,
- &fec_opts, h->protocol_whitelist, h->protocol_blacklist, h) < 0)
+ if (ffurl_open_with_parent(&s->fec_hd, buf, flags, &fec_opts, h) < 0)
goto fail;
}
@@ -1523,8 +1523,8 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
"?localport=%d", j);
/* we will use two ports per rtp stream (rtp and rtcp) */
j += 2;
- err = ffurl_open_whitelist(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
+ err = ffurl_open_with_avfmt(&rtsp_st->rtp_handle, buf, AVIO_FLAG_READ_WRITE,
+ &opts, s);
av_dict_free(&opts);
@@ -1678,8 +1678,8 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL, namebuf,
port, "%s", optbuf);
- err = ffurl_open_whitelist(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
+ err = ffurl_open_with_avfmt(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
+ &opts, s);
av_dict_free(&opts);
if (err < 0) {
@@ -1893,8 +1893,8 @@ redirect:
ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
host, port,
"?timeout=%"PRId64, rt->stimeout);
- if ((ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, NULL, s->protocol_whitelist, s->protocol_blacklist, NULL)) < 0) {
+ if ((ret = ffurl_open_with_avfmt(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
+ NULL, s)) < 0) {
err = ret;
goto fail;
}
@@ -2450,8 +2450,8 @@ static int sdp_read_header(AVFormatContext *s)
append_source_addrs(url, sizeof(url), "block",
rtsp_st->nb_exclude_source_addrs,
rtsp_st->exclude_source_addrs);
- err = ffurl_open_whitelist(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ,
- &s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
+ err = ffurl_open_with_avfmt(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ,
+ &opts, s);
av_dict_free(&opts);
@@ -2524,8 +2524,7 @@ static int rtp_read_header(AVFormatContext *s)
return AVERROR(EIO);
opts = map_to_opts(rt);
- ret = ffurl_open_whitelist(&in, s->url, AVIO_FLAG_READ,
- &s->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist, NULL);
+ ret = ffurl_open_with_avfmt(&in, s->url, AVIO_FLAG_READ, &opts, s);
av_dict_free(&opts);
if (ret)
goto fail;
@@ -312,9 +312,8 @@ static int rtsp_read_setup(AVFormatContext *s, char* host, char *controlurl)
av_dict_set_int(&opts, "buffer_size", rt->buffer_size, 0);
ff_url_join(url, sizeof(url), "rtp", NULL, host, localport, NULL);
av_log(s, AV_LOG_TRACE, "Opening: %s\n", url);
- ret = ffurl_open_whitelist(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, &opts,
- s->protocol_whitelist, s->protocol_blacklist, NULL);
+ ret = ffurl_open_with_avfmt(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
+ &opts, s);
av_dict_free(&opts);
if (ret)
localport += 2;
@@ -684,9 +683,8 @@ static int rtsp_listen(AVFormatContext *s)
ff_url_join(tcpname, sizeof(tcpname), lower_proto, NULL, host, port,
"?listen&listen_timeout=%d", rt->initial_timeout * 1000);
- if (ret = ffurl_open_whitelist(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist, NULL)) {
+ if (ret = ffurl_open_with_avfmt(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
+ NULL, s)) {
av_log(s, AV_LOG_ERROR, "Unable to open RTSP for listening\n");
goto fail;
}
@@ -83,9 +83,7 @@ static int sap_read_header(AVFormatContext *s)
ff_url_join(url, sizeof(url), "udp", NULL, host, port, "?localport=%d",
port);
- ret = ffurl_open_whitelist(&sap->ann_fd, url, AVIO_FLAG_READ,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist, NULL);
+ ret = ffurl_open_with_avfmt(&sap->ann_fd, url, AVIO_FLAG_READ, NULL, s);
if (ret)
goto fail;
@@ -150,9 +150,7 @@ static int sap_write_header(AVFormatContext *s)
"?ttl=%d", ttl);
if (!same_port)
base_port += 2;
- ret = ffurl_open_whitelist(&fd, url, AVIO_FLAG_WRITE,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist, NULL);
+ ret = ffurl_open_with_avfmt(&fd, url, AVIO_FLAG_WRITE, NULL, s);
if (ret) {
ret = AVERROR(EIO);
goto fail;
@@ -175,9 +173,7 @@ static int sap_write_header(AVFormatContext *s)
ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
"?ttl=%d&connect=1", ttl);
- ret = ffurl_open_whitelist(&sap->ann_fd, url, AVIO_FLAG_WRITE,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist, NULL);
+ ret = ffurl_open_with_avfmt(&sap->ann_fd, url, AVIO_FLAG_WRITE, NULL, s);
if (ret) {
ret = AVERROR(EIO);
goto fail;
@@ -113,8 +113,7 @@ static int64_t ism_seek(void *opaque, int64_t offset, int whence)
AVDictionary *opts = NULL;
os->tail_out = os->out;
av_dict_set(&opts, "truncate", "0", 0);
- ret = ffurl_open_whitelist(&os->out, frag->file, AVIO_FLAG_WRITE,
- &os->ctx->interrupt_callback, &opts, os->ctx->protocol_whitelist, os->ctx->protocol_blacklist, NULL);
+ ret = ffurl_open_with_avfmt(&os->out, frag->file, AVIO_FLAG_WRITE, &opts, os->ctx);
av_dict_free(&opts);
if (ret < 0) {
os->out = os->tail_out;
@@ -122,8 +121,7 @@ static int64_t ism_seek(void *opaque, int64_t offset, int whence)
return ret;
}
av_dict_set(&opts, "truncate", "0", 0);
- ffurl_open_whitelist(&os->out2, frag->infofile, AVIO_FLAG_WRITE,
- &os->ctx->interrupt_callback, &opts, os->ctx->protocol_whitelist, os->ctx->protocol_blacklist, NULL);
+ ffurl_open_with_avfmt(&os->out2, frag->infofile, AVIO_FLAG_WRITE, &opts, os->ctx);
av_dict_free(&opts);
ffurl_seek(os->out, offset - frag->start_pos, SEEK_SET);
if (os->out2)
@@ -507,7 +505,7 @@ static int ism_flush(AVFormatContext *s, int final)
continue;
snprintf(filename, sizeof(filename), "%s/temp", os->dirname);
- ret = ffurl_open_whitelist(&os->out, filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL, s->protocol_whitelist, s->protocol_blacklist, NULL);
+ ret = ffurl_open_with_avfmt(&os->out, filename, AVIO_FLAG_WRITE, NULL, s);
if (ret < 0)
break;
os->cur_start_pos = os->tail_pos;
@@ -79,8 +79,7 @@ static int srtp_open(URLContext *h, const char *uri, int flags)
av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
path, sizeof(path), uri);
ff_url_join(buf, sizeof(buf), "rtp", NULL, hostname, rtp_port, "%s", path);
- if ((ret = ffurl_open_whitelist(&s->rtp_hd, buf, flags, &h->interrupt_callback,
- NULL, h->protocol_whitelist, h->protocol_blacklist, h)) < 0)
+ if ((ret = ffurl_open_with_parent(&s->rtp_hd, buf, flags, NULL, h)) < 0)
goto fail;
h->max_packet_size = FFMIN(s->rtp_hd->max_packet_size,
@@ -79,8 +79,7 @@ static int subfile_open(URLContext *h, const char *filename, int flags,
return AVERROR(EINVAL);
}
av_strstart(filename, "subfile:", &filename);
- ret = ffurl_open_whitelist(&c->h, filename, flags, &h->interrupt_callback,
- options, h->protocol_whitelist, h->protocol_blacklist, h);
+ ret = ffurl_open_with_parent(&c->h, filename, flags, options, h);
if (ret < 0)
return ret;
c->pos = c->start;
@@ -111,10 +111,8 @@ static int tee_open(URLContext *h, const char *filename, int flags)
if (ret < 0)
goto loop_fail;
- ret = ffurl_open_whitelist(&c->child[c->child_count].url_context, child_name, flags,
- &h->interrupt_callback, &options,
- h->protocol_whitelist, h->protocol_blacklist,
- h);
+ ret = ffurl_open_with_parent(&c->child[c->child_count].url_context, child_name, flags,
+ &options, h);
loop_fail:
av_freep(&child_string);
av_dict_free(&options);
@@ -125,7 +125,6 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV
}
freeenv_utf8(env_http_proxy);
- return ffurl_open_whitelist(&c->tcp, buf, AVIO_FLAG_READ_WRITE,
- &parent->interrupt_callback, options,
- parent->protocol_whitelist, parent->protocol_blacklist, parent);
+ return ffurl_open_with_parent(&c->tcp, buf, AVIO_FLAG_READ_WRITE,
+ options, parent);
}
@@ -24,6 +24,7 @@
#ifndef AVFORMAT_URL_H
#define AVFORMAT_URL_H
+#include "avformat.h"
#include "avio.h"
#include "libavutil/dict.h"
@@ -147,6 +148,18 @@ int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags,
const char *whitelist, const char* blacklist,
URLContext *parent);
+/**
+ * same as ffurl_open_whitelist but using the parent context to setup arguments.
+ */
+int ffurl_open_with_parent(URLContext **puc, const char *filename, int flags,
+ AVDictionary **options, URLContext *parent);
+
+/**
+ * same as ffurl_open_whitelist but using the AVFormatContext to setup arguments.
+ */
+int ffurl_open_with_avfmt(URLContext **puc, const char *filename, int flags,
+ AVDictionary **options, AVFormatContext *avfmt);
+
/**
* Accept an URLContext c on an URLContext s
*
This also simplifies passing more things from parent contexts in the future It also avoids bugs as the calls are simpler. In that sense this change adds a missing interrupt callback to icecast Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/avio.c | 18 ++++++++++++++++++ libavformat/cache.c | 3 +-- libavformat/concat.c | 6 ++---- libavformat/crypto.c | 4 +--- libavformat/ftp.c | 9 +++------ libavformat/gopher.c | 3 +-- libavformat/hlsproto.c | 4 +--- libavformat/http.c | 16 ++++++---------- libavformat/icecast.c | 3 +-- libavformat/ipfsgateway.c | 5 +---- libavformat/md5proto.c | 4 +--- libavformat/mmst.c | 5 ++--- libavformat/prompeg.c | 6 ++---- libavformat/rtmpcrypt.c | 5 ++--- libavformat/rtmpproto.c | 9 +++------ libavformat/rtpproto.c | 13 ++++--------- libavformat/rtsp.c | 19 +++++++++---------- libavformat/rtspdec.c | 10 ++++------ libavformat/sapdec.c | 4 +--- libavformat/sapenc.c | 8 ++------ libavformat/smoothstreamingenc.c | 8 +++----- libavformat/srtpproto.c | 3 +-- libavformat/subfile.c | 3 +-- libavformat/teeproto.c | 6 ++---- libavformat/tls.c | 5 ++--- libavformat/url.h | 13 +++++++++++++ 26 files changed, 87 insertions(+), 105 deletions(-)