diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index eadb230045dd641c3480a39d794cc736ed98acac..06884a07c6153c7a59fa205229d506c1a92baf82 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -99,6 +99,7 @@ typedef struct AppleHTTPContext {
     int cur_seq_no;
     int end_of_segment;
     int first_packet;
+    AVIOInterruptCB *interrupt_callback;
 } AppleHTTPContext;
 
 static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
@@ -388,7 +389,7 @@ reload:
                 return AVERROR_EOF;
             while (av_gettime() - v->last_load_time <
                    v->target_duration*1000000) {
-                if (url_interrupt_cb())
+                if (ff_check_interrupt(c->interrupt_callback))
                     return AVERROR_EXIT;
                 usleep(100*1000);
             }
@@ -433,6 +434,8 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
     AppleHTTPContext *c = s->priv_data;
     int ret = 0, i, j, stream_offset = 0;
 
+    c->interrupt_callback = &s->interrupt_callback;
+
     if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0)
         goto fail;
 
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 85f3cfcef43761b2cd932068d296a876e5adbd22..1476ea28f2ca0fa6f6c85ca5ef38d285e29bb218 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -266,7 +266,7 @@ retry:
         if (s->finished)
             return AVERROR_EOF;
         while (av_gettime() - s->last_load_time < s->target_duration*1000000) {
-            if (url_interrupt_cb())
+            if (ff_check_interrupt(&h->interrupt_callback))
                 return AVERROR_EXIT;
             usleep(100*1000);
         }
@@ -276,7 +276,7 @@ retry:
     av_log(h, AV_LOG_DEBUG, "opening %s\n", url);
     ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ);
     if (ret < 0) {
-        if (url_interrupt_cb())
+        if (ff_check_interrupt(&h->interrupt_callback))
             return AVERROR_EXIT;
         av_log(h, AV_LOG_WARNING, "Unable to open %s\n", url);
         s->cur_seq_no++;
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 1964012b1d16bd641d7160ebb9ecf302db25ecfa..c66e2caac3a05ec2a373e2c1a29a702013d93d47 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -284,7 +284,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
         if (ret)
            fast_retries = FFMAX(fast_retries, 2);
         len += ret;
-        if (url_interrupt_cb())
+        if (ff_check_interrupt(&h->interrupt_callback))
             return AVERROR_EXIT;
     }
     return len;
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 9a18157df56f404729e65ea692cb529cff33eb64..1bb0a4b8a6a09a23a7cac64bded2cd28b4c4d7ee 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -226,7 +226,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
     struct pollfd p[2] = {{s->rtp_fd, POLLIN, 0}, {s->rtcp_fd, POLLIN, 0}};
 
     for(;;) {
-        if (url_interrupt_cb())
+        if (ff_check_interrupt(&h->interrupt_callback))
             return AVERROR_EXIT;
         /* build fdset to listen to RTP and RTCP packets */
         n = poll(p, 2, 100);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 8f7bd3718f769f9e9fb81db5fd4f9071af39dd29..5bdb7fa6a45e1a8cdeb57c3a1e23ea8081770d1a 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1619,7 +1619,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
     struct pollfd *p = rt->p;
 
     for (;;) {
-        if (url_interrupt_cb())
+        if (ff_check_interrupt(&s->interrupt_callback))
             return AVERROR_EXIT;
         if (wait_end && wait_end - av_gettime() < 0)
             return AVERROR(EAGAIN);
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index e602a556d25c2c58663a507d60313138298d10ab..fda34a368d28ca34c3558b36f560c71e3a21ad38 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -100,7 +100,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
         struct pollfd p = {fd, POLLOUT, 0};
         ret = ff_neterrno();
         if (ret == AVERROR(EINTR)) {
-            if (url_interrupt_cb()) {
+            if (ff_check_interrupt(&h->interrupt_callback)) {
                 ret = AVERROR_EXIT;
                 goto fail1;
             }
@@ -112,7 +112,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
 
         /* wait until we are connected or until abort */
         while(timeout--) {
-            if (url_interrupt_cb()) {
+            if (ff_check_interrupt(&h->interrupt_callback)) {
                 ret = AVERROR_EXIT;
                 goto fail1;
             }
diff --git a/libavformat/tls.c b/libavformat/tls.c
index 8211e888467408c2c7eeeeed5fad2cb9d2ced6ef..15d51f3784c9a3790b41f0879d06af080e64271e 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -97,7 +97,7 @@ static int do_tls_poll(URLContext *h, int ret)
         int n = poll(&p, 1, 100);
         if (n > 0)
             break;
-        if (url_interrupt_cb())
+        if (ff_check_interrupt(&h->interrupt_callback))
             return AVERROR(EINTR);
     }
     return 0;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c2beeaee7a1fffc2a8ffe095c0557173e6858361..91760c89ab3ae82211e002dc869d327e28b61ffe 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2310,7 +2310,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
     count = 0;
     read_size = 0;
     for(;;) {
-        if(url_interrupt_cb()){
+        if (ff_check_interrupt(&ic->interrupt_callback)){
             ret= AVERROR_EXIT;
             av_log(ic, AV_LOG_DEBUG, "interrupted\n");
             break;