* [PATCH] libv4l1: move v4l1 ioctls from kernel to libv4l1:VIDIOCGCHAN
@ 2010-05-25 10:06 huzaifas
2010-05-25 10:32 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: huzaifas @ 2010-05-25 10:06 UTC (permalink / raw)
To: linux-media; +Cc: hdegoede, Huzaifa Sidhpurwala
From: Huzaifa Sidhpurwala <huzaifas@redhat.com>
move VIDIOCGCHAN to libv4l1
Signed-off-by: Huzaifa Sidhpurwala <huzaifas@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 9bfddd3..f64025a 100644
--- a/lib/libv4l1/libv4l1.c
+++ b/lib/libv4l1/libv4l1.c
@@ -624,7 +624,44 @@ int v4l1_ioctl(int fd, unsigned long int request, ...)
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;
}
--
1.6.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libv4l1: move v4l1 ioctls from kernel to libv4l1:VIDIOCGCHAN
2010-05-25 10:06 [PATCH] libv4l1: move v4l1 ioctls from kernel to libv4l1:VIDIOCGCHAN huzaifas
@ 2010-05-25 10:32 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2010-05-25 10:32 UTC (permalink / raw)
To: huzaifas; +Cc: linux-media
Hi,
Thanks, added to my tree and pushed.
Regards,
Hans
On 05/25/2010 12:06 PM, huzaifas@redhat.com wrote:
> From: Huzaifa Sidhpurwala<huzaifas@redhat.com>
>
> move VIDIOCGCHAN to libv4l1
>
> Signed-off-by: Huzaifa Sidhpurwala<huzaifas@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 9bfddd3..f64025a 100644
> --- a/lib/libv4l1/libv4l1.c
> +++ b/lib/libv4l1/libv4l1.c
> @@ -624,7 +624,44 @@ int v4l1_ioctl(int fd, unsigned long int request, ...)
>
> 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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-25 10:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 10:06 [PATCH] libv4l1: move v4l1 ioctls from kernel to libv4l1:VIDIOCGCHAN huzaifas
2010-05-25 10:32 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).