swscale: make handle_formats() safe to be called multiple times