summaryrefslogtreecommitdiff
path: root/libavformat/avio.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2003-07-17 10:25:36 +0000
committerFabrice Bellard <fabrice@bellard.org>2003-07-17 10:25:36 +0000
commit019ac05ace07ce3e911b90acaee64758028e7375 (patch)
tree51cab1d95c3946105ceaa6715963faa7c9583729 /libavformat/avio.c
parentd5809b0aa2852957bc34aaaa69f159c136d97359 (diff)
added primitive aborting system
Originally committed as revision 2058 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r--libavformat/avio.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 3cd9e4d991..2c25c8a059 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -19,7 +19,10 @@
#include "avformat.h"
#include <ctype.h>
+static int default_interrupt_cb(void);
+
URLProtocol *first_protocol = NULL;
+URLInterruptCB *url_interrupt_cb = default_interrupt_cb;
int register_protocol(URLProtocol *protocol)
{
@@ -165,3 +168,22 @@ void url_get_filename(URLContext *h, char *buf, int buf_size)
{
pstrcpy(buf, buf_size, h->filename);
}
+
+
+static int default_interrupt_cb(void)
+{
+ return 0;
+}
+
+/**
+ * The callback is called in blocking functions to test regulary if
+ * asynchronous interruption is needed. -EINTR is returned in this
+ * case by the interrupted function. 'NULL' means no interrupt
+ * callback is given.
+ */
+void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
+{
+ if (!interrupt_cb)
+ interrupt_cb = default_interrupt_cb;
+ url_interrupt_cb = interrupt_cb;
+}