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
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to