The patch number 12572 was added via Mauro Carvalho Chehab <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <[email protected]>

------

From: Mauro Carvalho Chehab  <[email protected]>
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb


Signed-off-by: Mauro Carvalho Chehab <[email protected]>


---

 v4l/versions.txt                 |    2 
 v4l2-apps/util/v4l2-ctl.cpp      |  209 +++++++++++++++++++++++++++++--
 v4l2-apps/util/v4l2-sysfs-path.c |    3 
 3 files changed, 206 insertions(+), 8 deletions(-)

diff -r 87ae9fddaa27 -r 8ff376c1e896 v4l/versions.txt
--- a/v4l/versions.txt  Sat Aug 29 09:51:51 2009 -0300
+++ b/v4l/versions.txt  Sun Aug 30 18:48:23 2009 -0300
@@ -79,6 +79,8 @@
 # Uses supports_autosuspend
 USB_MR800
 USB_DSBR
+# Uses MODULE_FIRMWARE
+DVB_AV7110
 
 # Uses remap_vmalloc_range()
 [2.6.18]
diff -r 87ae9fddaa27 -r 8ff376c1e896 v4l2-apps/util/v4l2-ctl.cpp
--- a/v4l2-apps/util/v4l2-ctl.cpp       Sat Aug 29 09:51:51 2009 -0300
+++ b/v4l2-apps/util/v4l2-ctl.cpp       Sun Aug 30 18:48:23 2009 -0300
@@ -105,6 +105,9 @@
        OptStreamOn,
        OptListStandards,
        OptListFormats,
+       OptListFormatsExt,
+       OptListFrameSizes,
+       OptListFrameIntervals,
        OptLogStatus,
        OptVerbose,
        OptSilent,
@@ -221,6 +224,9 @@
        {"streamon", no_argument, 0, OptStreamOn},
        {"list-standards", no_argument, 0, OptListStandards},
        {"list-formats", no_argument, 0, OptListFormats},
+       {"list-formats-ext", no_argument, 0, OptListFormatsExt},
+       {"list-framesizes", required_argument, 0, OptListFrameSizes},
+       {"list-frameintervals", required_argument, 0, OptListFrameIntervals},
        {"get-standard", no_argument, 0, OptGetStandard},
        {"set-standard", required_argument, 0, OptSetStandard},
        {"get-parm", no_argument, 0, OptGetParm},
@@ -319,6 +325,18 @@
               "                     set the audio mode of the tuner 
[VIDIOC_S_TUNER]\n"
               "                     Possible values: mono, stereo, lang2, 
lang1, bilingual\n"
               "  --list-formats     display supported video formats 
[VIDIOC_ENUM_FMT]\n"
+              "  --list-formats-ext display supported video formats including 
frame sizes\n"
+              "                     and intervals\n"
+              "  --list-framesizes=<f>\n"
+              "                     list supported framesizes for pixelformat 
<f>\n"
+              "                     [VIDIOC_ENUM_FRAMESIZES]\n"
+              "                     pixelformat is either the format index as 
reported by\n"
+              "                     --list-formats, or the fourcc value as a 
string\n"
+              "  --list-frameintervals=width=<w>,height=<h>,pixelformat=<f>\n"
+              "                     list supported frame intervals for 
pixelformat <f> and\n"
+              "                     the given width and height 
[VIDIOC_ENUM_FRAMEINTERVALS]\n"
+              "                     pixelformat is either the format index as 
reported by\n"
+              "                     --list-formats, or the fourcc value as a 
string\n"
               "  -V, --get-fmt-video\n"
               "                     query the video capture format 
[VIDIOC_G_FMT]\n"
               "  -v, --set-fmt-video=width=<w>,height=<h>,pixelformat=<f>\n"
@@ -951,6 +969,72 @@
        }
 }
 
+static std::string frmtype2s(unsigned type)
+{
+       static const char *types[] = {
+               "Unknown",
+               "Discrete",
+               "Continuous",
+               "Stepwise"
+       };
+
+       if (type > 3)
+               type = 0;
+       return types[type];
+}
+
+static std::string fract2sec(const struct v4l2_fract &f)
+{
+       char buf[100];
+
+       sprintf(buf, "%.3f s", (1.0 * f.numerator) / f.denominator);
+       return buf;
+}
+
+static std::string fract2fps(const struct v4l2_fract &f)
+{
+       char buf[100];
+
+       sprintf(buf, "%.3f fps", (1.0 * f.denominator) / f.numerator);
+       return buf;
+}
+
+static void print_frmsize(const struct v4l2_frmsizeenum &frmsize, const char 
*prefix)
+{
+       printf("%s\tSize: %s ", prefix, frmtype2s(frmsize.type).c_str());
+       if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
+               printf("%dx%d", frmsize.discrete.width, 
frmsize.discrete.height);
+       } else if (frmsize.type == V4L2_FRMSIZE_TYPE_STEPWISE) {
+               printf("%dx%d - %dx%d with step %d/%d",
+                               frmsize.stepwise.min_width,
+                               frmsize.stepwise.min_height,
+                               frmsize.stepwise.max_width,
+                               frmsize.stepwise.max_height,
+                               frmsize.stepwise.step_width,
+                               frmsize.stepwise.step_height);
+       }
+       printf("\n");
+}
+
+static void print_frmival(const struct v4l2_frmivalenum &frmival, const char 
*prefix)
+{
+       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(),
+                               fract2fps(frmival.discrete).c_str());
+       } else if (frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE) {
+               printf("%s - %s with step %s\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(),
+                               fract2fps(frmival.stepwise.max).c_str(),
+                               fract2fps(frmival.stepwise.step).c_str());
+       }
+}
+
 static void print_video_formats(int fd, enum v4l2_buf_type type)
 {
        struct v4l2_fmtdesc fmt;
@@ -970,6 +1054,43 @@
        }
 }
 
+static void print_video_formats_ext(int fd, enum v4l2_buf_type type)
+{
+       struct v4l2_fmtdesc fmt;
+       struct v4l2_frmsizeenum frmsize;
+       struct v4l2_frmivalenum frmival;
+
+       fmt.index = 0;
+       fmt.type = type;
+       while (ioctl(fd, VIDIOC_ENUM_FMT, &fmt) >= 0) {
+               printf("\tIndex       : %d\n", fmt.index);
+               printf("\tType        : %s\n", buftype2s(type).c_str());
+               printf("\tPixel Format: '%s'", fcc2s(fmt.pixelformat).c_str());
+               if (fmt.flags)
+                       printf(" (compressed)");
+               printf("\n");
+               printf("\tName        : %s\n", fmt.description);
+               frmsize.pixel_format = fmt.pixelformat;
+               frmsize.index = 0;
+               while (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) >= 0) {
+                       print_frmsize(frmsize, "\t");
+                       if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
+                               frmival.index = 0;
+                               frmival.pixel_format = fmt.pixelformat;
+                               frmival.width = frmsize.discrete.width;
+                               frmival.height = frmsize.discrete.height;
+                               while (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, 
&frmival) >= 0) {
+                                       print_frmival(frmival, "\t\t");
+                                       frmival.index++;
+                               }
+                       }
+                       frmsize.index++;
+               }
+               printf("\n");
+               fmt.index++;
+       }
+}
+
 static char *pts_to_string(char *str, unsigned long pts)
 {
        static char buf[256];
@@ -1441,6 +1562,17 @@
        return V4L2_FIELD_ANY;
 }
 
+static __u32 find_pixel_format(int fd, unsigned index)
+{
+       struct v4l2_fmtdesc fmt;
+
+       fmt.index = index;
+       fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       if (doioctl(fd, VIDIOC_ENUM_FMT, &fmt, "VIDIOC_ENUM_FMT"))
+               return 0;
+       return fmt.pixelformat;
+}
+
 int main(int argc, char **argv)
 {
        char *value, *subs;
@@ -1479,6 +1611,8 @@
        struct v4l2_output vout;        /* list_outputs */
        struct v4l2_audio vaudio;       /* list audio inputs */
        struct v4l2_audioout vaudout;   /* audio outputs */
+       struct v4l2_frmsizeenum frmsize;/* list frame sizes */
+       struct v4l2_frmivalenum frmival;/* list frame intervals */
        struct v4l2_rect vcrop;         /* crop rect */
        struct v4l2_rect vcrop_out;     /* crop rect */
        struct v4l2_rect vcrop_overlay;         /* crop rect */
@@ -1517,6 +1651,8 @@
        memset(&vout, 0, sizeof(vout));
        memset(&vaudio, 0, sizeof(vaudio));
        memset(&vaudout, 0, sizeof(vaudout));
+       memset(&frmsize, 0, sizeof(frmsize));
+       memset(&frmival, 0, sizeof(frmival));
        memset(&vcrop, 0, sizeof(vcrop));
        memset(&vcrop_out, 0, sizeof(vcrop_out));
        memset(&vcrop_overlay, 0, sizeof(vcrop_overlay));
@@ -1710,6 +1846,41 @@
                case OptOverlay:
                        overlay = strtol(optarg, 0L, 0);
                        break;
+               case OptListFrameSizes:
+                       if (strlen(optarg) == 4)
+                           frmsize.pixel_format = v4l2_fourcc(optarg[0], 
optarg[1],
+                                       optarg[2], optarg[3]);
+                       else
+                           frmsize.pixel_format = strtol(optarg, 0L, 0);
+                       break;
+               case OptListFrameIntervals:
+                       subs = optarg;
+                       while (*subs != '\0') {
+                               static const char *const subopts[] = {
+                                       "width",
+                                       "height",
+                                       "pixelformat",
+                                       NULL
+                               };
+
+                               switch (parse_subopt(&subs, subopts, &value)) {
+                               case 0:
+                                       frmival.width = strtol(value, 0L, 0);
+                                       break;
+                               case 1:
+                                       frmival.height = strtol(value, 0L, 0);
+                                       break;
+                               case 2:
+                                       if (strlen(value) == 4)
+                                               frmival.pixel_format =
+                                                   v4l2_fourcc(value[0], 
value[1],
+                                                           value[2], value[3]);
+                                       else
+                                               frmival.pixel_format = 
strtol(value, 0L, 0);
+                                       break;
+                               }
+                       }
+                       break;
                case OptSetCrop:
                        parse_crop(optarg, set_crop, vcrop);
                        break;
@@ -2158,13 +2329,8 @@
                        if (set_fmts & FmtPixelFormat) {
                                in_vfmt.fmt.pix.pixelformat = 
vfmt.fmt.pix.pixelformat;
                                if (in_vfmt.fmt.pix.pixelformat < 256) {
-                                       struct v4l2_fmtdesc fmt;
-
-                                       fmt.index = in_vfmt.fmt.pix.pixelformat;
-                                       fmt.type = in_vfmt.type;
-                                       if (doioctl(fd, VIDIOC_ENUM_FMT, &fmt, 
"VIDIOC_ENUM_FMT"))
-                                               goto set_vid_fmt_error;
-                                       in_vfmt.fmt.pix.pixelformat = 
fmt.pixelformat;
+                                       in_vfmt.fmt.pix.pixelformat =
+                                               find_pixel_format(fd, 
in_vfmt.fmt.pix.pixelformat);
                                }
                        }
                        if (options[OptSetVideoFormat])
@@ -2842,6 +3008,35 @@
                print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_OVERLAY);
        }
 
+       if (options[OptListFormatsExt]) {
+               printf("ioctl: VIDIOC_ENUM_FMT\n");
+               print_video_formats_ext(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE);
+               print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+               print_video_formats(fd, V4L2_BUF_TYPE_VIDEO_OVERLAY);
+       }
+
+       if (options[OptListFrameSizes]) {
+               printf("ioctl: VIDIOC_ENUM_FRAMESIZES\n");
+               if (frmsize.pixel_format < 256)
+                       frmsize.pixel_format = find_pixel_format(fd, 
frmsize.pixel_format);
+               frmsize.index = 0;
+               while (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) >= 0) {
+                       print_frmsize(frmsize, "");
+                       frmsize.index++;
+               }
+       }
+
+       if (options[OptListFrameIntervals]) {
+               printf("ioctl: VIDIOC_ENUM_FRAMEINTERVALS\n");
+               if (frmival.pixel_format < 256)
+                       frmival.pixel_format = find_pixel_format(fd, 
frmival.pixel_format);
+               frmival.index = 0;
+               while (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frmival) >= 0) {
+                       print_frmival(frmival, "");
+                       frmival.index++;
+               }
+       }
+
        if (options[OptGetSlicedVbiCap]) {
                struct v4l2_sliced_vbi_cap cap;
 
diff -r 87ae9fddaa27 -r 8ff376c1e896 v4l2-apps/util/v4l2-sysfs-path.c
--- a/v4l2-apps/util/v4l2-sysfs-path.c  Sat Aug 29 09:51:51 2009 -0300
+++ b/v4l2-apps/util/v4l2-sysfs-path.c  Sun Aug 30 18:48:23 2009 -0300
@@ -245,13 +245,14 @@
                        char *s = strchr(entry->d_name, ':');
                        if (s) {
                                printf("\t%s", entry->d_name);
-                               if (!get_dev(entry->d_name, &major, &minor, 
extra))
+                               if (!get_dev(entry->d_name, &major, &minor, 
extra)) {
                                        if (*extra)
                                                printf(":%s (dev %d,%d)",
                                                        extra, major, minor);
                                        else
                                                printf(" (dev %d,%d)",
                                                        major, minor);
+                               }
                                printf("\n");
                        }
                }


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/8ff376c1e896ce6cf43099cb30cedf2fc3f779e6

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to