[Libav-user] Info about lock manager

Massimo Battistel battistel at gmail.com
Tue Jul 23 17:08:26 CEST 2013


Hello,
I would like to have more info about lock manager provided by libav*.

1. Which funtions if libav* use it and when is it recommended to use?
2. Is the following implementation correct (it uses pthread)?

int myLockManager(void** mutex, AVLockOp op)
{
    pthread_mutex_t** pmutex = (pthread_mutex_t**)mutex;

    switch (op)
    {
       case AV_LOCK_CREATE:
           *pmutex = (pthread_mutex_t*)av_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);
           av_free(*pmutex);
           break;
    }

    return 0;
}

...somewhere in main...

av_lockmgr_register(myLockManager);


Thanks,
M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130723/e416d207/attachment.html>


More information about the Libav-user mailing list