[PATCH] libv4l1: move v4l1 ioctls from kernel to libv4l1: VIDIOCSCHAN move VIDIOCSCHAN to libv4l1 Signed-off-by: Huzaifa Sidhpurwala huzai...@redhat.com
From: Huzaifa Sidhpurwala huzai...@fedora-12.(none) --- lib/libv4l1/libv4l1.c | 39 ++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/lib/libv4l1/libv4l1.c b/lib/libv4l1/libv4l1.c index f64025a..077d57c 100644 --- a/lib/libv4l1/libv4l1.c +++ b/lib/libv4l1/libv4l1.c @@ -702,7 +702,44 @@ int v4l1_ioctl(int fd, unsigned long int request, ...) struct video_channel *chan = arg; if ((devices[index].flags V4L1_SUPPORTS_ENUMINPUT) (devices[index].flags V4L1_SUPPORTS_ENUMSTD)) { - result = SYS_IOCTL(fd, request, arg); + + v4l2_std_id sid; + + input2.index = chan-channel; + result = SYS_IOCTL(fd, VIDIOC_ENUMINPUT, input2); + if (result 0) + break; + + chan-channel = input2.index; + memcpy(chan-name, input2.name, + min(sizeof(chan-name), sizeof(input2.name))); + + chan-name[sizeof(chan-name) - 1] = 0; + chan-tuners = + (input2.type == V4L2_INPUT_TYPE_TUNER) ? 1 : 0; + + chan-flags = (chan-tuners) ? VIDEO_VC_TUNER : 0; + switch (input2.type) { + case V4L2_INPUT_TYPE_TUNER: + chan-type = VIDEO_TYPE_TV; + break; + default: + case V4L2_INPUT_TYPE_CAMERA: + chan-type = VIDEO_TYPE_CAMERA; + break; + } + chan-norm = 0; + if (SYS_IOCTL(fd, VIDIOC_G_STD, sid) == 0) { + if (sid V4L2_STD_PAL) + chan-norm = VIDEO_MODE_PAL; + if (sid V4L2_STD_NTSC) + chan-norm = VIDEO_MODE_NTSC; + if (sid V4L2_STD_SECAM) + chan-norm = VIDEO_MODE_SECAM; + if (sid == V4L2_STD_ALL) + chan-norm = VIDEO_MODE_AUTO; + } + break; } /* In case of no ENUMSTD support, ignore the norm member of the -- 1.6.6.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libv4l1: move v4l1 ioctls from kernel to libv4l1: VIDIOCSCHAN move VIDIOCSCHAN to libv4l1 Signed-off-by: Huzaifa Sidhpurwala huzai...@redhat.com
From: Huzaifa Sidhpurwala huzai...@redhat.com --- lib/libv4l1/libv4l1.c | 39 ++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/lib/libv4l1/libv4l1.c b/lib/libv4l1/libv4l1.c index f64025a..077d57c 100644 --- a/lib/libv4l1/libv4l1.c +++ b/lib/libv4l1/libv4l1.c @@ -702,7 +702,44 @@ int v4l1_ioctl(int fd, unsigned long int request, ...) struct video_channel *chan = arg; if ((devices[index].flags V4L1_SUPPORTS_ENUMINPUT) (devices[index].flags V4L1_SUPPORTS_ENUMSTD)) { - result = SYS_IOCTL(fd, request, arg); + + v4l2_std_id sid; + + input2.index = chan-channel; + result = SYS_IOCTL(fd, VIDIOC_ENUMINPUT, input2); + if (result 0) + break; + + chan-channel = input2.index; + memcpy(chan-name, input2.name, + min(sizeof(chan-name), sizeof(input2.name))); + + chan-name[sizeof(chan-name) - 1] = 0; + chan-tuners = + (input2.type == V4L2_INPUT_TYPE_TUNER) ? 1 : 0; + + chan-flags = (chan-tuners) ? VIDEO_VC_TUNER : 0; + switch (input2.type) { + case V4L2_INPUT_TYPE_TUNER: + chan-type = VIDEO_TYPE_TV; + break; + default: + case V4L2_INPUT_TYPE_CAMERA: + chan-type = VIDEO_TYPE_CAMERA; + break; + } + chan-norm = 0; + if (SYS_IOCTL(fd, VIDIOC_G_STD, sid) == 0) { + if (sid V4L2_STD_PAL) + chan-norm = VIDEO_MODE_PAL; + if (sid V4L2_STD_NTSC) + chan-norm = VIDEO_MODE_NTSC; + if (sid V4L2_STD_SECAM) + chan-norm = VIDEO_MODE_SECAM; + if (sid == V4L2_STD_ALL) + chan-norm = VIDEO_MODE_AUTO; + } + break; } /* In case of no ENUMSTD support, ignore the norm member of the -- 1.6.6.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libv4l1: move v4l1 ioctls from kernel to libv4l1: VIDIOCSCHAN
From: Huzaifa Sidhpurwala huzai...@redhat.com move VIDIOCSCHAN to libv4l1 Signed-Off-by: Huzaifa Sidhpurwala huzai...@redhat.com --- lib/libv4l1/libv4l1.c | 30 +- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/lib/libv4l1/libv4l1.c b/lib/libv4l1/libv4l1.c index f64025a..c9b6bf9 100644 --- a/lib/libv4l1/libv4l1.c +++ b/lib/libv4l1/libv4l1.c @@ -702,7 +702,35 @@ int v4l1_ioctl(int fd, unsigned long int request, ...) struct video_channel *chan = arg; if ((devices[index].flags V4L1_SUPPORTS_ENUMINPUT) (devices[index].flags V4L1_SUPPORTS_ENUMSTD)) { - result = SYS_IOCTL(fd, request, arg); + + v4l2_std_id sid = 0; + struct v4l2_input input2; + + result = SYS_IOCTL(fd, VIDIOC_ENUMINPUT, input2); + if (result 0) + break; + + switch (chan-norm) { + case VIDEO_MODE_PAL: + sid = V4L2_STD_PAL; + break; + case VIDEO_MODE_NTSC: + sid = V4L2_STD_NTSC; + break; + case VIDEO_MODE_SECAM: + sid = V4L2_STD_SECAM; + break; + case VIDEO_MODE_AUTO: + sid = V4L2_STD_ALL; + break; + } + + if (0 != sid) { + result = SYS_IOCTL(fd, VIDIOC_S_STD, sid); + if (result 0) + break; + } + break; } /* In case of no ENUMSTD support, ignore the norm member of the -- 1.6.6.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html