Support different input formats.

Format is detected by file extension.