Browse code

avio: Mark the old interrupt callback mechanism as deprecated

Prepare for removing it at an upcoming major bump.

Martin Storsjö authored on 2011/11/07 19:17:50
Showing 3 changed files
... ...
@@ -83,9 +83,11 @@ const AVClass ffurl_context_class = {
83 83
 };
84 84
 /*@}*/
85 85
 
86
-static int default_interrupt_cb(void);
87 86
 
87
+#if FF_API_OLD_INTERRUPT_CB
88
+static int default_interrupt_cb(void);
88 89
 int (*url_interrupt_cb)(void) = default_interrupt_cb;
90
+#endif
89 91
 
90 92
 #if FF_API_OLD_AVIO
91 93
 URLProtocol *av_protocol_next(URLProtocol *p)
... ...
@@ -441,6 +443,7 @@ int ffurl_get_file_handle(URLContext *h)
441 441
     return h->prot->url_get_file_handle(h);
442 442
 }
443 443
 
444
+#if FF_API_OLD_INTERRUPT_CB
444 445
 static int default_interrupt_cb(void)
445 446
 {
446 447
     return 0;
... ...
@@ -452,13 +455,18 @@ void avio_set_interrupt_cb(int (*interrupt_cb)(void))
452 452
         interrupt_cb = default_interrupt_cb;
453 453
     url_interrupt_cb = interrupt_cb;
454 454
 }
455
+#endif
455 456
 
456 457
 int ff_check_interrupt(AVIOInterruptCB *cb)
457 458
 {
458 459
     int ret;
459 460
     if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
460 461
         return ret;
462
+#if FF_API_OLD_INTERRUPT_CB
461 463
     return url_interrupt_cb();
464
+#else
465
+    return 0;
466
+#endif
462 467
 }
463 468
 
464 469
 #if FF_API_OLD_AVIO
... ...
@@ -389,13 +389,17 @@ attribute_deprecated int url_exist(const char *url);
389 389
  */
390 390
 int avio_check(const char *url, int flags);
391 391
 
392
+#if FF_API_OLD_INTERRUPT_CB
392 393
 /**
393 394
  * The callback is called in blocking functions to test regulary if
394 395
  * asynchronous interruption is needed. AVERROR_EXIT is returned
395 396
  * in this case by the interrupted function. 'NULL' means no interrupt
396 397
  * callback is given.
398
+ * @deprecated Use interrupt_callback in AVFormatContext/avio_open2
399
+ *             instead.
397 400
  */
398
-void avio_set_interrupt_cb(int (*interrupt_cb)(void));
401
+attribute_deprecated void avio_set_interrupt_cb(int (*interrupt_cb)(void));
402
+#endif
399 403
 
400 404
 /**
401 405
  * Allocate and initialize an AVIOContext for buffered I/O. It must be later
... ...
@@ -110,5 +110,8 @@
110 110
 #ifndef FF_API_REORDER_PRIVATE
111 111
 #define FF_API_REORDER_PRIVATE         (LIBAVFORMAT_VERSION_MAJOR < 54)
112 112
 #endif
113
+#ifndef FF_API_OLD_INTERRUPT_CB
114
+#define FF_API_OLD_INTERRUPT_CB        (LIBAVFORMAT_VERSION_MAJOR < 54)
115
+#endif
113 116
 
114 117
 #endif /* AVFORMAT_VERSION_H */