ff_get_format: fix infinite loop

Signed-off-by: Anton Khirnov <anton@khirnov.net>