thread lock around avcodec_open/close()