[FFmpeg-cvslog] avio: Mark the old interrupt callback mechanism as deprecated

Martin Storsjö git at videolan.org
Sat Nov 19 02:09:44 CET 2011


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Mon Nov  7 12:17:50 2011 +0200| [45f511ece7aaf730d51dff5b086e32bc43fc78ce] | committer: Anton Khirnov

avio: Mark the old interrupt callback mechanism as deprecated

Prepare for removing it at an upcoming major bump.

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

 libavformat/avio.c    |   10 +++++++++-
 libavformat/avio.h    |    6 +++++-
 libavformat/version.h |    3 +++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 9de435e..4750a9d 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -83,9 +83,11 @@ const AVClass ffurl_context_class = {
 };
 /*@}*/
 
-static int default_interrupt_cb(void);
 
+#if FF_API_OLD_INTERRUPT_CB
+static int default_interrupt_cb(void);
 int (*url_interrupt_cb)(void) = default_interrupt_cb;
+#endif
 
 #if FF_API_OLD_AVIO
 URLProtocol *av_protocol_next(URLProtocol *p)
@@ -441,6 +443,7 @@ int ffurl_get_file_handle(URLContext *h)
     return h->prot->url_get_file_handle(h);
 }
 
+#if FF_API_OLD_INTERRUPT_CB
 static int default_interrupt_cb(void)
 {
     return 0;
@@ -452,13 +455,18 @@ void avio_set_interrupt_cb(int (*interrupt_cb)(void))
         interrupt_cb = default_interrupt_cb;
     url_interrupt_cb = interrupt_cb;
 }
+#endif
 
 int ff_check_interrupt(AVIOInterruptCB *cb)
 {
     int ret;
     if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
         return ret;
+#if FF_API_OLD_INTERRUPT_CB
     return url_interrupt_cb();
+#else
+    return 0;
+#endif
 }
 
 #if FF_API_OLD_AVIO
diff --git a/libavformat/avio.h b/libavformat/avio.h
index b665bb3..d797702 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -389,13 +389,17 @@ attribute_deprecated int url_exist(const char *url);
  */
 int avio_check(const char *url, int flags);
 
+#if FF_API_OLD_INTERRUPT_CB
 /**
  * The callback is called in blocking functions to test regulary if
  * asynchronous interruption is needed. AVERROR_EXIT is returned
  * in this case by the interrupted function. 'NULL' means no interrupt
  * callback is given.
+ * @deprecated Use interrupt_callback in AVFormatContext/avio_open2
+ *             instead.
  */
-void avio_set_interrupt_cb(int (*interrupt_cb)(void));
+attribute_deprecated void avio_set_interrupt_cb(int (*interrupt_cb)(void));
+#endif
 
 /**
  * Allocate and initialize an AVIOContext for buffered I/O. It must be later
diff --git a/libavformat/version.h b/libavformat/version.h
index 6c1db42..d56bdb7 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -110,5 +110,8 @@
 #ifndef FF_API_REORDER_PRIVATE
 #define FF_API_REORDER_PRIVATE         (LIBAVFORMAT_VERSION_MAJOR < 54)
 #endif
+#ifndef FF_API_OLD_INTERRUPT_CB
+#define FF_API_OLD_INTERRUPT_CB        (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
 
 #endif /* AVFORMAT_VERSION_H */



More information about the ffmpeg-cvslog mailing list