Mercurial > libavcodec.hg
comparison avcodec.h @ 9742:0d6f887d91fb libavcodec
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.
| author | andoma |
|---|---|
| date | Sun, 31 May 2009 06:51:18 +0000 |
| parents | 0bfb23c7633d |
| children | 48572d70c95f |
comparison
equal
deleted
inserted
replaced
| 9741:e52891e48ceb | 9742:0d6f887d91fb |
|---|---|
| 28 | 28 |
| 29 #include <errno.h> | 29 #include <errno.h> |
| 30 #include "libavutil/avutil.h" | 30 #include "libavutil/avutil.h" |
| 31 | 31 |
| 32 #define LIBAVCODEC_VERSION_MAJOR 52 | 32 #define LIBAVCODEC_VERSION_MAJOR 52 |
| 33 #define LIBAVCODEC_VERSION_MINOR 29 | 33 #define LIBAVCODEC_VERSION_MINOR 30 |
| 34 #define LIBAVCODEC_VERSION_MICRO 1 | 34 #define LIBAVCODEC_VERSION_MICRO 1 |
| 35 | 35 |
| 36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 37 LIBAVCODEC_VERSION_MINOR, \ | 37 LIBAVCODEC_VERSION_MINOR, \ |
| 38 LIBAVCODEC_VERSION_MICRO) | 38 LIBAVCODEC_VERSION_MICRO) |
| 3709 * if hwaccel is non-NULL, returns the next registered hardware accelerator | 3709 * if hwaccel is non-NULL, returns the next registered hardware accelerator |
| 3710 * after hwaccel, or NULL if hwaccel is the last one. | 3710 * after hwaccel, or NULL if hwaccel is the last one. |
| 3711 */ | 3711 */ |
| 3712 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); | 3712 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); |
| 3713 | 3713 |
| 3714 | |
| 3715 /** | |
| 3716 * Lock operation used by lockmgr | |
| 3717 */ | |
| 3718 enum AVLockOp { | |
| 3719 AV_LOCK_CREATE, ///< Create a mutex | |
| 3720 AV_LOCK_OBTAIN, ///< Lock the mutex | |
| 3721 AV_LOCK_RELEASE, ///< Unlock the mutex | |
| 3722 AV_LOCK_DESTROY, ///< Free mutex resources | |
| 3723 }; | |
| 3724 | |
| 3725 /** | |
| 3726 * Register a user provided lock manager supporting the operations | |
| 3727 * specified by AVLockOp. \p mutex points to a (void *) where the | |
| 3728 * lockmgr should store/get a pointer to a user allocated mutex. It's | |
| 3729 * NULL upon AV_LOCK_CREATE and != NULL for all other ops. | |
| 3730 * | |
| 3731 * @param cb User defined callback. Note: FFmpeg may invoke calls to this | |
| 3732 * callback during the call to av_lockmgr_register(). | |
| 3733 * Thus, the application must be prepared to handle that. | |
| 3734 * If cb is set to NULL the lockmgr will be unregistered. | |
| 3735 * Also note that during unregistration the previously registered | |
| 3736 * lockmgr callback may also be invoked. | |
| 3737 */ | |
| 3738 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); | |
| 3739 | |
| 3714 #endif /* AVCODEC_AVCODEC_H */ | 3740 #endif /* AVCODEC_AVCODEC_H */ |
