aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/avcodec.h
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2010-02-09 20:28:42 +0000
committerReinhard Tartler <siretart@tauware.de>2010-02-09 20:28:42 +0000
commite5bea45df76a4888e37bc33f8cc803ec15d3ab7b (patch)
treed1827a645579e4bd7530569dab54971fa9116c04 /libavcodec/avcodec.h
parent9e3935dfd8c68608534206859b16239a652db37f (diff)
downloadffmpeg-e5bea45df76a4888e37bc33f8cc803ec15d3ab7b.tar.gz
Add a lock manager API to libavcodec.
Allows an application to register a callback that manages mutexes on behalf of FFmpeg. With this callback registered FFmpeg is fully thread safe. backport r19025 by andoma NB: This is a feature backport with little regression potential. It was requested at FOSDEM 2010 by ben@geexbox.org for use by geexbox and the enna mediacenter in the upcoming debian/squeeze and ubuntu/lucid release. Approved by DonDiego on #ffmpeg-devel Originally committed as revision 21731 to svn://svn.ffmpeg.org/ffmpeg/branches/0.5
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r--libavcodec/avcodec.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b078bc98c2..0794fbef68 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 20
+#define LIBAVCODEC_VERSION_MINOR 21
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -3344,4 +3344,30 @@ void av_register_hwaccel(AVHWAccel *hwaccel);
*/
AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
+
+/**
+ * Lock operation used by lockmgr
+ */
+enum AVLockOp {
+ AV_LOCK_CREATE, ///< Create a mutex
+ AV_LOCK_OBTAIN, ///< Lock the mutex
+ AV_LOCK_RELEASE, ///< Unlock the mutex
+ AV_LOCK_DESTROY, ///< Free mutex resources
+};
+
+/**
+ * Register a user provided lock manager supporting the operations
+ * specified by AVLockOp. \p mutex points to a (void *) where the
+ * lockmgr should store/get a pointer to a user allocated mutex. It's
+ * NULL upon AV_LOCK_CREATE and != NULL for all other ops.
+ *
+ * @param cb User defined callback. Note: FFmpeg may invoke calls to this
+ * callback during the call to av_lockmgr_register().
+ * Thus, the application must be prepared to handle that.
+ * If cb is set to NULL the lockmgr will be unregistered.
+ * Also note that during unregistration the previously registered
+ * lockmgr callback may also be invoked.
+ */
+int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
+
#endif /* AVCODEC_AVCODEC_H */