diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2012-05-25 11:47:06 -0700 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2012-05-25 14:20:34 -0700 |
commit | beb33fca697e4a7ecfe1661d0699a0d55f23f03a (patch) | |
tree | 8b5a39c986a0659d200774e611597423e9288e1e | |
parent | c6eeb9b7b6bbf5d0f507cad522ed5a4f929de14f (diff) | |
download | ffmpeg-streaming-beb33fca697e4a7ecfe1661d0699a0d55f23f03a.zip ffmpeg-streaming-beb33fca697e4a7ecfe1661d0699a0d55f23f03a.tar.gz |
avprobe: improve formatting
Do not use decimals if not needed.
-rw-r--r-- | avprobe.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; |