Mercurial > libavformat.hg
diff avio.c @ 177:16c4e43f34e5 libavformat
added primitive aborting system
author | bellard |
---|---|
date | Thu, 17 Jul 2003 10:25:36 +0000 |
parents | 22e4d9d88e25 |
children | b0771ae979e3 |
line wrap: on
line diff
--- a/avio.c Thu Jul 17 10:24:28 2003 +0000 +++ b/avio.c Thu Jul 17 10:25:36 2003 +0000 @@ -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 @@ { 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; +}