Implement ffmpeg lockmgr using pthreads

Java locks seem to be crashy