1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

avprobe: improve formatting

Do not use decimals if not needed.
This commit is contained in:
Luca Barbato 2012-05-25 11:47:06 -07:00
parent c6eeb9b7b6
commit beb33fca69

View File

@ -90,11 +90,12 @@ static char *value_string(char *buf, int buf_size, double val, const char *unit)
val /= pow(10, index * 3);
prefix_string = decimal_unit_prefixes[index];
}
snprintf(buf, buf_size, "%.3f %s%s", val, prefix_string,
snprintf(buf, buf_size, "%.*f%s%s",
index ? 3 : 0, val,
prefix_string,
show_value_unit ? unit : "");
} else {
snprintf(buf, buf_size, "%f %s", val, show_value_unit ? unit : "");
snprintf(buf, buf_size, "%f%s", val, show_value_unit ? unit : "");
}
return buf;