Commit c4a090dd authored by Martin Storsjö's avatar Martin Storsjö Committed by Anton Khirnov

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

Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 6aa0b98f
...@@ -408,6 +408,14 @@ void avio_set_interrupt_cb(int (*interrupt_cb)(void)) ...@@ -408,6 +408,14 @@ void avio_set_interrupt_cb(int (*interrupt_cb)(void))
url_interrupt_cb = interrupt_cb; 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 #if FF_API_OLD_AVIO
int av_url_read_pause(URLContext *h, int pause) int av_url_read_pause(URLContext *h, int pause)
{ {
......
...@@ -170,6 +170,12 @@ int ffurl_get_file_handle(URLContext *h); ...@@ -170,6 +170,12 @@ int ffurl_get_file_handle(URLContext *h);
*/ */
int ffurl_register_protocol(URLProtocol *protocol, int size); 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 */ /* udp.c */
int ff_udp_set_remote_url(URLContext *h, const char *uri); int ff_udp_set_remote_url(URLContext *h, const char *uri);
int ff_udp_get_local_port(URLContext *h); int ff_udp_get_local_port(URLContext *h);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment