v4l2-ctl: improve interval reporting.
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Mar 2013 11:20:49 +0000 (12:20 +0100)
committerHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Mar 2013 11:20:49 +0000 (12:20 +0100)
Shorten the text and drop the fps step value which was wrong and not useful.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp

index 1ba5131..6cd17a3 100644 (file)
@@ -86,7 +86,7 @@ static std::string fract2sec(const struct v4l2_fract &f)
 {
        char buf[100];
 
-       sprintf(buf, "%.3f s", (1.0 * f.numerator) / f.denominator);
+       sprintf(buf, "%.3f", (1.0 * f.numerator) / f.denominator);
        return buf;
 }
 
@@ -94,7 +94,7 @@ static std::string fract2fps(const struct v4l2_fract &f)
 {
        char buf[100];
 
-       sprintf(buf, "%.3f fps", (1.0 * f.denominator) / f.numerator);
+       sprintf(buf, "%.3f", (1.0 * f.denominator) / f.numerator);
        return buf;
 }
 
@@ -119,18 +119,15 @@ static void print_frmival(const struct v4l2_frmivalenum &frmival, const char *pr
 {
        printf("%s\tInterval: %s ", prefix, frmtype2s(frmival.type).c_str());
        if (frmival.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
-               printf("%s (%s)\n", fract2sec(frmival.discrete).c_str(),
+               printf("%ss (%s fps)\n", fract2sec(frmival.discrete).c_str(),
                                fract2fps(frmival.discrete).c_str());
        } else if (frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE) {
-               printf("%s - %s with step %s\n",
+               printf("%ss - %ss with step %ss (%s-%s fps)\n",
                                fract2sec(frmival.stepwise.min).c_str(),
                                fract2sec(frmival.stepwise.max).c_str(),
-                               fract2sec(frmival.stepwise.step).c_str());
-               printf("%s\t            : ", prefix);
-               printf("(%s - %s with step %s)\n",
-                               fract2fps(frmival.stepwise.min).c_str(),
+                               fract2sec(frmival.stepwise.step).c_str(),
                                fract2fps(frmival.stepwise.max).c_str(),
-                               fract2fps(frmival.stepwise.step).c_str());
+                               fract2fps(frmival.stepwise.min).c_str());
        }
 }