aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-10-16 11:52:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-10-18 23:51:42 -0400
commit1c5c50685a04668a4a4431534bca804969fac3c6 (patch)
tree7428a8db5592a362fbd5ef2594b50d4161c1aec7 /drivers/media/video/em28xx/em28xx-video.c
parenta461e0ad3d27b6342140566909a80db30d151a91 (diff)
[media] em28xx: implement VIDIOC_ENUM_FRAMESIZES
Pidgin uses gstreamer (and libv4l) to work. Without implementing this ioctl, it won't detect properly the size range, and driver will fail. So, this patch is required, in order to use an em27xx webcam, like Silvercrest. The pigdin/gstreamer/libv4l needs to be fixed, as it shouldn't assume that all drivers will implement this optional ioctl, but, at least now, devices with em28xx have a better chance of working with pidgin. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 62182e311060..9b4557a2f6d0 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1802,6 +1802,45 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
1802 return 0; 1802 return 0;
1803} 1803}
1804 1804
1805static int vidioc_enum_framesizes(struct file *file, void *priv,
1806 struct v4l2_frmsizeenum *fsize)
1807{
1808 struct em28xx_fh *fh = priv;
1809 struct em28xx *dev = fh->dev;
1810 struct em28xx_fmt *fmt;
1811 unsigned int maxw = norm_maxw(dev);
1812 unsigned int maxh = norm_maxh(dev);
1813
1814 fmt = format_by_fourcc(fsize->pixel_format);
1815 if (!fmt) {
1816 em28xx_videodbg("Fourcc format (%08x) invalid.\n",
1817 fsize->pixel_format);
1818 return -EINVAL;
1819 }
1820
1821 if (dev->board.is_em2800) {
1822 if (fsize->index > 1)
1823 return -EINVAL;
1824 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
1825 fsize->discrete.width = maxw / (1 + fsize->index);
1826 fsize->discrete.height = maxh / (1 + fsize->index);
1827 return 0;
1828 }
1829
1830 if (fsize->index != 0)
1831 return -EINVAL;
1832
1833 /* Report a continuous range */
1834 fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
1835 fsize->stepwise.min_width = 48;
1836 fsize->stepwise.min_height = 32;
1837 fsize->stepwise.max_width = maxw;
1838 fsize->stepwise.max_height = maxh;
1839 fsize->stepwise.step_width = 1;
1840 fsize->stepwise.step_height = 1;
1841 return 0;
1842}
1843
1805/* Sliced VBI ioctls */ 1844/* Sliced VBI ioctls */
1806static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv, 1845static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv,
1807 struct v4l2_format *f) 1846 struct v4l2_format *f)
@@ -2356,10 +2395,10 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
2356 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 2395 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
2357 .vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap, 2396 .vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap,
2358 .vidioc_s_fmt_vbi_cap = vidioc_s_fmt_vbi_cap, 2397 .vidioc_s_fmt_vbi_cap = vidioc_s_fmt_vbi_cap,
2398 .vidioc_enum_framesizes = vidioc_enum_framesizes,
2359 .vidioc_g_audio = vidioc_g_audio, 2399 .vidioc_g_audio = vidioc_g_audio,
2360 .vidioc_s_audio = vidioc_s_audio, 2400 .vidioc_s_audio = vidioc_s_audio,
2361 .vidioc_cropcap = vidioc_cropcap, 2401 .vidioc_cropcap = vidioc_cropcap,
2362
2363 .vidioc_g_fmt_sliced_vbi_cap = vidioc_g_fmt_sliced_vbi_cap, 2402 .vidioc_g_fmt_sliced_vbi_cap = vidioc_g_fmt_sliced_vbi_cap,
2364 .vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap, 2403 .vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap,
2365 .vidioc_s_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap, 2404 .vidioc_s_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap,