diff options
author | Martin Storsjö <martin@martin.st> | 2011-11-06 22:50:44 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-11-13 13:12:17 +0100 |
commit | 6f1b7b39449c4cd58e37d831d5d97bfd25eb26f0 (patch) | |
tree | b97fb7b744d0d6d1d3611465b055dd10c17d8ebc /libavformat/avio.c | |
parent | 9957cdbfd5ced5baae6ec97b97b08f1ad42aa4e4 (diff) | |
download | ffmpeg-6f1b7b39449c4cd58e37d831d5d97bfd25eb26f0.tar.gz |
avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
Change all uses of these function to pass the relevant
callback on.
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r-- | libavformat/avio.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index c66e2caac3..c17c1c4438 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -86,7 +86,8 @@ int ffurl_register_protocol(URLProtocol *protocol, int size) } static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up, - const char *filename, int flags) + const char *filename, int flags, + const AVIOInterruptCB *int_cb) { URLContext *uc; int err; @@ -114,6 +115,8 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up, av_opt_set_defaults(uc->priv_data); } } + if (int_cb) + uc->interrupt_callback = *int_cb; *puc = uc; return 0; @@ -145,7 +148,7 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up, { int ret; - ret = url_alloc_for_protocol(puc, up, filename, flags); + ret = url_alloc_for_protocol(puc, up, filename, flags, NULL); if (ret) goto fail; ret = ffurl_connect(*puc); @@ -158,7 +161,7 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up, } int url_alloc(URLContext **puc, const char *filename, int flags) { - return ffurl_alloc(puc, filename, flags); + return ffurl_alloc(puc, filename, flags, NULL); } int url_connect(URLContext* uc) { @@ -166,7 +169,7 @@ int url_connect(URLContext* uc) } int url_open(URLContext **puc, const char *filename, int flags) { - return ffurl_open(puc, filename, flags); + return ffurl_open(puc, filename, flags, NULL); } int url_read(URLContext *h, unsigned char *buf, int size) { @@ -219,7 +222,8 @@ int av_register_protocol2(URLProtocol *protocol, int size) "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "0123456789+-." -int ffurl_alloc(URLContext **puc, const char *filename, int flags) +int ffurl_alloc(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb) { URLProtocol *up; char proto_str[128], proto_nested[128], *ptr; @@ -237,19 +241,20 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags) up = first_protocol; while (up != NULL) { if (!strcmp(proto_str, up->name)) - return url_alloc_for_protocol (puc, up, filename, flags); + return url_alloc_for_protocol (puc, up, filename, flags, int_cb); if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && !strcmp(proto_nested, up->name)) - return url_alloc_for_protocol (puc, up, filename, flags); + return url_alloc_for_protocol (puc, up, filename, flags, int_cb); up = up->next; } *puc = NULL; return AVERROR(ENOENT); } -int ffurl_open(URLContext **puc, const char *filename, int flags) +int ffurl_open(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb) { - int ret = ffurl_alloc(puc, filename, flags); + int ret = ffurl_alloc(puc, filename, flags, int_cb); if (ret) return ret; ret = ffurl_connect(*puc); @@ -348,7 +353,7 @@ int ffurl_close(URLContext *h) int url_exist(const char *filename) { URLContext *h; - if (ffurl_open(&h, filename, AVIO_FLAG_READ) < 0) + if (ffurl_open(&h, filename, AVIO_FLAG_READ, NULL) < 0) return 0; ffurl_close(h); return 1; @@ -358,7 +363,7 @@ int url_exist(const char *filename) int avio_check(const char *url, int flags) { URLContext *h; - int ret = ffurl_alloc(&h, url, flags); + int ret = ffurl_alloc(&h, url, flags, NULL); if (ret) return ret; |