aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-11 19:13:47 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:31 -0500
commit74d83fa0241f603a4067f071a88ef8b9a7c415a0 (patch)
treeaa20a469f8f87b9f856d73073eea926bacd6beec
parentf3f741e7119f93db642f06940376a1c93dd3f57b (diff)
V4L/DVB (9578): v4l core: add support for enumerating frame sizes and intervals
video_ioctl2 lacks implementation of those two ioctls: - VIDIOC_ENUM_FRAMESIZES and VIDIOC_ENUM_FRAMEINTERVALS Adds implementation for those. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/v4l2-ioctl.c67
-rw-r--r--include/media/v4l2-ioctl.h6
2 files changed, 73 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 0e648cb3b39..213c4dd6f72 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1747,6 +1747,73 @@ static int __video_do_ioctl(struct file *file,
1747 ret = ops->vidioc_s_hw_freq_seek(file, fh, p); 1747 ret = ops->vidioc_s_hw_freq_seek(file, fh, p);
1748 break; 1748 break;
1749 } 1749 }
1750 case VIDIOC_ENUM_FRAMESIZES:
1751 {
1752 struct v4l2_frmsizeenum *p = arg;
1753
1754 if (!ops->vidioc_enum_framesizes)
1755 break;
1756
1757 memset(p, 0, sizeof(*p));
1758
1759 ret = ops->vidioc_enum_framesizes(file, fh, p);
1760 dbgarg(cmd,
1761 "index=%d, pixelformat=%d, type=%d ",
1762 p->index, p->pixel_format, p->type);
1763 switch (p->type) {
1764 case V4L2_FRMSIZE_TYPE_DISCRETE:
1765 dbgarg2("width = %d, height=%d\n",
1766 p->discrete.width, p->discrete.height);
1767 break;
1768 case V4L2_FRMSIZE_TYPE_STEPWISE:
1769 dbgarg2("min %dx%d, max %dx%d, step %dx%d\n",
1770 p->stepwise.min_width, p->stepwise.min_height,
1771 p->stepwise.step_width, p->stepwise.step_height,
1772 p->stepwise.max_width, p->stepwise.max_height);
1773 break;
1774 case V4L2_FRMSIZE_TYPE_CONTINUOUS:
1775 dbgarg2("continuous\n");
1776 break;
1777 default:
1778 dbgarg2("- Unknown type!\n");
1779 }
1780
1781 break;
1782 }
1783 case VIDIOC_ENUM_FRAMEINTERVALS:
1784 {
1785 struct v4l2_frmivalenum *p = arg;
1786
1787 if (!ops->vidioc_enum_frameintervals)
1788 break;
1789
1790 memset(p, 0, sizeof(*p));
1791
1792 ret = ops->vidioc_enum_frameintervals(file, fh, p);
1793 dbgarg(cmd,
1794 "index=%d, pixelformat=%d, width=%d, height=%d, type=%d ",
1795 p->index, p->pixel_format,
1796 p->width, p->height, p->type);
1797 switch (p->type) {
1798 case V4L2_FRMIVAL_TYPE_DISCRETE:
1799 dbgarg2("fps=%d/%d\n",
1800 p->discrete.numerator,
1801 p->discrete.denominator);
1802 break;
1803 case V4L2_FRMIVAL_TYPE_STEPWISE:
1804 dbgarg2("min=%d, max=%d, step=%d\n",
1805 p->stepwise.min, p->stepwise.max,
1806 p->stepwise.step);
1807 break;
1808 case V4L2_FRMIVAL_TYPE_CONTINUOUS:
1809 dbgarg2("continuous\n");
1810 break;
1811 default:
1812 dbgarg2("- Unknown type!\n");
1813 }
1814 break;
1815 }
1816
1750 default: 1817 default:
1751 { 1818 {
1752 if (!ops->vidioc_default) 1819 if (!ops->vidioc_default)
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index f5985724c45..c884432f938 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -232,6 +232,12 @@ struct v4l2_ioctl_ops {
232 int (*vidioc_g_chip_ident) (struct file *file, void *fh, 232 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
233 struct v4l2_chip_ident *chip); 233 struct v4l2_chip_ident *chip);
234 234
235 int (*vidioc_enum_framesizes) (struct file *file, void *fh,
236 struct v4l2_frmsizeenum *fsize);
237
238 int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
239 struct v4l2_frmivalenum *fival);
240
235 /* For other private ioctls */ 241 /* For other private ioctls */
236 int (*vidioc_default) (struct file *file, void *fh, 242 int (*vidioc_default) (struct file *file, void *fh,
237 int cmd, void *arg); 243 int cmd, void *arg);