avutil/opt: check flags validity in write_number()