lavc/pthread: use THREAD_SAFE_CALLBACKS() to simplifx more code