OSDN Git Service

avio: Add an internal utility function for checking the new interrupt callback
authorMartin Storsjö <martin@martin.st>
Sun, 6 Nov 2011 20:10:21 +0000 (22:10 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 13 Nov 2011 12:07:48 +0000 (13:07 +0100)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavformat/avio.c
libavformat/url.h

index 8e18549..1964012 100644 (file)
@@ -408,6 +408,14 @@ void avio_set_interrupt_cb(int (*interrupt_cb)(void))
     url_interrupt_cb = interrupt_cb;
 }
 
+int ff_check_interrupt(AVIOInterruptCB *cb)
+{
+    int ret;
+    if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
+        return ret;
+    return url_interrupt_cb();
+}
+
 #if FF_API_OLD_AVIO
 int av_url_read_pause(URLContext *h, int pause)
 {
index c0f5322..de10033 100644 (file)
@@ -170,6 +170,12 @@ int ffurl_get_file_handle(URLContext *h);
  */
 int ffurl_register_protocol(URLProtocol *protocol, int size);
 
+/**
+ * Check if the user has requested to interrup a blocking function
+ * associated with cb.
+ */
+int ff_check_interrupt(AVIOInterruptCB *cb);
+
 /* udp.c */
 int ff_udp_set_remote_url(URLContext *h, const char *uri);
 int ff_udp_get_local_port(URLContext *h);