Skip to content

Commit

Permalink
V4L/DVB (11870): gspca - main: VIDIOC_ENUM_FRAMESIZES ioctl added.
Browse files Browse the repository at this point in the history
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans de Goede authored and Mauro Carvalho Chehab committed Jun 16, 2009
1 parent 9fd6418 commit 11c635a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,32 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
return ret;
}

static int vidioc_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *fsize)
{
struct gspca_dev *gspca_dev = priv;
int i;
__u32 index = 0;

for (i = 0; i < gspca_dev->cam.nmodes; i++) {
if (fsize->pixel_format !=
gspca_dev->cam.cam_mode[i].pixelformat)
continue;

if (fsize->index == index) {
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsize->discrete.width =
gspca_dev->cam.cam_mode[i].width;
fsize->discrete.height =
gspca_dev->cam.cam_mode[i].height;
return 0;
}
index++;
}

return -EINVAL;
}

static void gspca_release(struct video_device *vfd)
{
struct gspca_dev *gspca_dev = container_of(vfd, struct gspca_dev, vdev);
Expand Down Expand Up @@ -1858,6 +1884,7 @@ static const struct v4l2_ioctl_ops dev_ioctl_ops = {
.vidioc_g_parm = vidioc_g_parm,
.vidioc_s_parm = vidioc_s_parm,
.vidioc_s_std = vidioc_s_std,
.vidioc_enum_framesizes = vidioc_enum_framesizes,
#ifdef CONFIG_VIDEO_V4L1_COMPAT
.vidiocgmbuf = vidiocgmbuf,
#endif
Expand Down

0 comments on commit 11c635a

Please sign in to comment.