[FFmpeg-cvslog] avio: Add an internal utility function for checking the new interrupt callback

Martin Storsjö git at videolan.org
Mon Nov 14 00:43:06 CET 2011


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sun Nov  6 22:10:21 2011 +0200| [c4a090ddb564b87fd9d6d4f83e0f134a77c96007] | committer: Anton Khirnov

avio: Add an internal utility function for checking the new interrupt callback

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c4a090ddb564b87fd9d6d4f83e0f134a77c96007
---

 libavformat/avio.c |    8 ++++++++
 libavformat/url.h  |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 8e18549..1964012 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -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)
 {
diff --git a/libavformat/url.h b/libavformat/url.h
index c0f5322..de10033 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -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);



More information about the ffmpeg-cvslog mailing list