Add a mode that automatically selects a format based on UA.

Signed-off-by: HIRANO Takahito <hiranotaka@zng.info>
Ship 5.2.

Signed-off-by: HIRANO Takahito <hiranotaka@zng.info>