avfilter/avfilter: Make avfilter_register() thread safe