diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-12-10 10:02:42 +0100 |
---|---|---|
committer | Jean-Francois Moine <moinejf@free.fr> | 2008-12-10 10:02:42 +0100 |
commit | 52e7cacf69005e1a115cceac3f79808852bb09dd (patch) | |
tree | 25a17846380bbec541d04299bebd9f0bec1e135c /linux | |
parent | e826ea04411b7254088a42b69162390d6432f3bc (diff) | |
download | mediapointer-dvb-s2-52e7cacf69005e1a115cceac3f79808852bb09dd.tar.gz mediapointer-dvb-s2-52e7cacf69005e1a115cceac3f79808852bb09dd.tar.bz2 |
gspca - main: Allow subdrivers to handle v4l2_streamparm requests.
From: Jim Paris <jim@jtan.com>
Add get_streamparm and set_streamparm operations so subdrivers can
get/set stream parameters such as framerate.
Priority: normal
Signed-off-by: Jim Paris <jim@jtan.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/gspca/gspca.c | 22 | ||||
-rw-r--r-- | linux/drivers/media/video/gspca/gspca.h | 4 |
2 files changed, 26 insertions, 0 deletions
diff --git a/linux/drivers/media/video/gspca/gspca.c b/linux/drivers/media/video/gspca/gspca.c index 7066c9daf..71e7afe1b 100644 --- a/linux/drivers/media/video/gspca/gspca.c +++ b/linux/drivers/media/video/gspca/gspca.c @@ -1337,6 +1337,17 @@ static int vidioc_g_parm(struct file *filp, void *priv, memset(parm, 0, sizeof *parm); parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; parm->parm.capture.readbuffers = gspca_dev->nbufread; + + if (gspca_dev->sd_desc->get_streamparm) { + int ret; + + if (mutex_lock_interruptible(&gspca_dev->usb_lock)) + return -ERESTARTSYS; + ret = gspca_dev->sd_desc->get_streamparm(gspca_dev, parm); + mutex_unlock(&gspca_dev->usb_lock); + return ret; + } + return 0; } @@ -1351,6 +1362,17 @@ static int vidioc_s_parm(struct file *filp, void *priv, parm->parm.capture.readbuffers = gspca_dev->nbufread; else gspca_dev->nbufread = n; + + if (gspca_dev->sd_desc->set_streamparm) { + int ret; + + if (mutex_lock_interruptible(&gspca_dev->usb_lock)) + return -ERESTARTSYS; + ret = gspca_dev->sd_desc->set_streamparm(gspca_dev, parm); + mutex_unlock(&gspca_dev->usb_lock); + return ret; + } + return 0; } diff --git a/linux/drivers/media/video/gspca/gspca.h b/linux/drivers/media/video/gspca/gspca.h index 15db13296..79cef31a5 100644 --- a/linux/drivers/media/video/gspca/gspca.h +++ b/linux/drivers/media/video/gspca/gspca.h @@ -74,6 +74,8 @@ typedef void (*cam_v_op) (struct gspca_dev *); typedef int (*cam_cf_op) (struct gspca_dev *, const struct usb_device_id *); typedef int (*cam_jpg_op) (struct gspca_dev *, struct v4l2_jpegcompression *); +typedef int (*cam_streamparm_op) (struct gspca_dev *, + struct v4l2_streamparm *); typedef int (*cam_qmnu_op) (struct gspca_dev *, struct v4l2_querymenu *); typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev, @@ -106,6 +108,8 @@ struct sd_desc { cam_jpg_op get_jcomp; cam_jpg_op set_jcomp; cam_qmnu_op querymenu; + cam_streamparm_op get_streamparm; + cam_streamparm_op set_streamparm; }; /* packet types when moving from iso buf to frame buf */ |