[media] ov7670: implement VIDIOC_ENUM_FRAMESIZES
authorDaniel Drake <dsd@laptop.org>
Fri, 24 Sep 2010 17:17:37 +0000 (14:17 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:17:06 +0000 (01:17 -0200)
GStreamer uses this.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/ov7670.c

index ffccac5..a18dcd0 100644 (file)
@@ -906,6 +906,22 @@ static int ov7670_enum_frameintervals(struct v4l2_subdev *sd,
        return 0;
 }
 
+/*
+ * Frame size enumeration
+ */
+static int ov7670_enum_framesizes(struct v4l2_subdev *sd,
+               struct v4l2_frmsizeenum *fsize)
+{
+       __u32 index = fsize->index;
+       if (index >= N_WIN_SIZES)
+               return -EINVAL;
+
+       fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
+       fsize->discrete.width = ov7670_win_sizes[index].width;
+       fsize->discrete.height = ov7670_win_sizes[index].height;
+       return 0;
+}
+
 /*
  * Code for dealing with controls.
  */
@@ -1453,6 +1469,7 @@ static const struct v4l2_subdev_video_ops ov7670_video_ops = {
        .s_parm = ov7670_s_parm,
        .g_parm = ov7670_g_parm,
        .enum_frameintervals = ov7670_enum_frameintervals,
+       .enum_framesizes = ov7670_enum_framesizes,
 };
 
 static const struct v4l2_subdev_ops ov7670_ops = {