implement the ffmpeg lock manager for thread safety