Register lock method to FFmpeg.

This fixes avcodec_open/close() assertion under multi-thread.