+static int avformat_lockmgr(void **mutex, enum AVLockOp op)
+{
+ pthread_mutex_t** pmutex = (pthread_mutex_t**) mutex;
+
+ switch (op)
+ {
+ case AV_LOCK_CREATE:
+ *pmutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
+ pthread_mutex_init(*pmutex, NULL);
+ break;
+ case AV_LOCK_OBTAIN:
+ pthread_mutex_lock(*pmutex);
+ break;
+ case AV_LOCK_RELEASE:
+ pthread_mutex_unlock(*pmutex);
+ break;
+ case AV_LOCK_DESTROY:
+ pthread_mutex_destroy(*pmutex);
+ free(*pmutex);
+ break;
+ }
+
+ return 0;
+}
+