usbtv: split core and video implementation
PATCH 1/2 usbtv: split core and video implementation
--- Makefile | 3 + usbtv-core.c | 136 +++++++++++++++++++++++++++++++++++++++ usbtv.c => usbtv-video.c | 163 +++-------------------------------------------- usbtv.h | 98 ++++++++++++++++++++++++++++ 4 files changed, 246 insertions(+), 154 deletions(-) create mode 100644 usbtv-core.c rename usbtv.c => usbtv-video.c (82%) create mode 100644 usbtv.h
Makefile +3 -0
@@ -1 +1,4 @@ +usbtv-y := usbtv-core.o \ + usbtv-video.o + obj-$(CONFIG_VIDEO_USBTV) += usbtv.o
usbtv-core.c new file +136 -0
136 lines not on this page · raw message
usbtv-video.c renamed from usbtv.c +9 -154
240 lines not on this page · raw message
usbtv.h new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH 2/2 usbtv: add audio support
--- Makefile | 3 +- usbtv-audio.c | 381 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ usbtv-core.c | 16 ++- usbtv-video.c | 9 +- usbtv.h | 21 +++- 5 files changed, 420 insertions(+), 10 deletions(-) create mode 100644 usbtv-audio.c
Makefile +2 -1
@@ -1,4 +1,5 @@ usbtv-y := usbtv-core.o \ - usbtv-video.o + usbtv-video.o \ + usbtv-audio.o obj-$(CONFIG_VIDEO_USBTV) += usbtv.o
usbtv-audio.c new file +381 -0
381 lines not on this page · raw message
usbtv-core.c +12 -4
@@ -1,5 +1,5 @@/* -* Fushicai USBTV007 Video Grabber Driver +* Fushicai USBTV007 Audio-Video Grabber Driver * * Product web site: * http://www.fushicai.com/products_detail/&productId=d05449ee-b690-42f9-a661-aa7353894bed.html
@@ -86,12 +86,19 @@ static int usbtv_probe(struct usb_interface *intf,if (ret <0 ) goto usbtv_video_fail; + ret =usbtv_audio_init (usbtv); +if (ret <0 ) + goto usbtv_audio_fail; +/* for simplicity we exploit the v4l2_device reference counting */ v4l2_device_get (&usbtv->v4l2_dev); -dev_info (dev,"Fushicai USBTV007 Video Grabber\n" ); +dev_info (dev,"Fushicai USBTV007 Audio-Video Grabber\n" );return 0 ; +usbtv_audio_fail: +usbtv_video_free (usbtv); + usbtv_video_fail:kfree (usbtv);
@@ -106,6 +113,7 @@ static void usbtv_disconnect(struct usb_interface *intf)if (!usbtv)return ; +usbtv_audio_free (usbtv);usbtv_video_free (usbtv);usb_put_dev (usbtv->udev);
@@ -122,8 +130,8 @@ struct usb_device_id usbtv_id_table[] = { };MODULE_DEVICE_TABLE (usb, usbtv_id_table); -MODULE_AUTHOR ("Lubomir Rintel" ); -MODULE_DESCRIPTION ("Fushicai USBTV007 Video Grabber Driver" ); +MODULE_AUTHOR ("Lubomir Rintel, Federico Simoncelli" ); +MODULE_DESCRIPTION ("Fushicai USBTV007 Audio-Video Grabber Driver" );MODULE_LICENSE ("Dual BSD/GPL" );struct usb_driver usbtv_usb_driver = {
usbtv-video.c +5 -4
@@ -1,5 +1,5 @@/* -* Fushicai USBTV007 Video Grabber Driver +* Fushicai USBTV007 Audio-Video Grabber Driver * * Product web site: * http://www.fushicai.com/products_detail/&productId=d05449ee-b690-42f9-a661-aa7353894bed.html
@@ -79,7 +79,6 @@ static int usbtv_select_input(struct usbtv *usbtv, int input) { USBTV_BASE + 0x011f, 0x00f2 }, { USBTV_BASE + 0x0127, 0x0060 }, { USBTV_BASE + 0x00ae, 0x0010 }, - { USBTV_BASE + 0x0284, 0x00aa }, { USBTV_BASE + 0x0239, 0x0060 }, };
@@ -88,7 +87,6 @@ static int usbtv_select_input(struct usbtv *usbtv, int input) { USBTV_BASE + 0x011f, 0x00ff }, { USBTV_BASE + 0x0127, 0x0060 }, { USBTV_BASE + 0x00ae, 0x0030 }, - { USBTV_BASE + 0x0284, 0x0088 }, { USBTV_BASE + 0x0239, 0x0060 }, };
@@ -225,7 +223,6 @@ static int usbtv_setup_capture(struct usbtv *usbtv) { USBTV_BASE + 0x0159, 0x0006 }, { USBTV_BASE + 0x015d, 0x0000 }, - { USBTV_BASE + 0x0284, 0x0088 }, { USBTV_BASE + 0x0003, 0x0004 }, { USBTV_BASE + 0x0100, 0x00d3 }, { USBTV_BASE + 0x0115, 0x0015 },
@@ -434,6 +431,8 @@ static int usbtv_start(struct usbtv *usbtv)int i;int ret; +usbtv_audio_suspend (usbtv); + ret =usb_set_interface (usbtv->udev,0 ,0 );if (ret <0 )return ret;
@@ -446,6 +445,8 @@ static int usbtv_start(struct usbtv *usbtv)if (ret <0 )return ret; +usbtv_audio_resume (usbtv); +for (i =0 ; i <USBTV_ISOC_TRANSFERS ; i++) {struct urb *ip;
usbtv.h +20 -1
@@ -1,5 +1,5 @@/* -* Fushicai USBTV007 Video Grabber Driver +* Fushicai USBTV007 Audio-Video Grabber Driver * * Copyright (c) 2013 Lubomir Rintel * All rights reserved.
@@ -27,6 +27,7 @@/* Hardware. */ #define USBTV_VIDEO_ENDP 0x81 +#define USBTV_AUDIO_ENDP 0x83#define USBTV_BASE 0xc000#define USBTV_REQUEST_REG 12
@@ -38,6 +39,10 @@#define USBTV_CHUNK_SIZE 256#define USBTV_CHUNK 240 +#define USBTV_AUDIO_URBSIZE 20480 +#define USBTV_AUDIO_HDRSIZE 4 +#define USBTV_AUDIO_BUFFER 65536 +/* Chunk header. */ #define USBTV_MAGIC_OK (chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ == 0x88000000)
@@ -90,9 +95,23 @@ struct usbtv {int iso_size;unsigned int sequence;struct urb *isoc_urbs[USBTV_ISOC_TRANSFERS ]; + +/* audio */ +struct snd_card *snd; +struct snd_pcm_substream *snd_substream; +atomic_t snd_stream; +struct work_struct snd_trigger; +struct urb *snd_bulk_urb; +size_t snd_buffer_pos; +size_t snd_period_pos; };int usbtv_set_regs (struct usbtv *usbtv,const u16 regs[][2 ],int size);int usbtv_video_init (struct usbtv *usbtv);void usbtv_video_free (struct usbtv *usbtv); + +int usbtv_audio_init (struct usbtv *usbtv); +void usbtv_audio_free (struct usbtv *usbtv); +void usbtv_audio_suspend (struct usbtv *usbtv); +void usbtv_audio_resume (struct usbtv *usbtv);
Signature · 1 line
1.8.4.2
Re: [PATCH 2/2] usbtv: add audio support
On Sun, 2014-01-05 at 16:38 +0100, Federico Simoncelli wrote:
...
Review
Quoted 2 lines
(quoted diff) +2
-0+ static const u16 setup[][2] = { +/* { USBTV_BASE + 0x00a2, 0x0013 }, */
A minor style issue here, please avoid useless comments.
usbtv-audio.c line 340
Quoted 3 lines
usbtv-audio.c new file +3
-0+strncpy (card->driver, usbtv->dev->driver->name, +sizeof (card->driver) -1 ); +strncpy (card->shortname,"usbtv" ,sizeof (card->shortname) -1 );
I suggest you use the strlcpy() instead, as is used in the rest of the driver. Aside from that it is more consistent, it would make it a bit easier to verify that the string is properly terminated without having to take a look at snd_card_create() to see whether zeroes out the structure for you.
usbtv-audio.c line 353
Quoted 1 line
usbtv-audio.c new file +1
-0+strncpy (pcm->name,"USBTV Audio Input" ,sizeof (pcm->name) -1 );
Ditto.
Thank you!
Lubo
Hi Federico,
please apply this patch (and I guess the other one too) against the Linux kernel tree (so that the filenames are not usbtv.c, but drivers/media/usb/usbtv.c instead). They will likely get into mainline via the media tree (the other one still needs to be cc-ed to alsa list) and therefore need to be send to the linux media list too.
Once you apply the patches to the Linux tree, scripts/get_maintainer.pl is very helpful in finding out where to send the patches.
Thank you!
Lubo
Quoted 521 lines · Federico Simoncelli
Signed-off-by Federico Simoncelli <[email protected]>Reviewed-by Lubomir Rintel <[email protected]>--- Makefile | 3 + usbtv-core.c | 136 +++++++++++++++++++++++++++++++++++++++ usbtv.c => usbtv-video.c | 163 +++-------------------------------------------- usbtv.h | 98 ++++++++++++++++++++++++++++ 4 files changed, 246 insertions(+), 154 deletions(-) create mode 100644 usbtv-core.c rename usbtv.c => usbtv-video.c (82%) create mode 100644 usbtv.hMakefile +3
-0@@ -1 +1,4 @@ +usbtv-y := usbtv-core.o \ + usbtv-video.o + obj-$(CONFIG_VIDEO_USBTV) += usbtv.ousbtv-core.c new file +136
-0@@ -0,0 +1,136 @@ +/* +* Fushicai USBTV007 Video Grabber Driver +* +* Product web site: +* http://www.fushicai.com/products_detail/&productId=d05449ee-b690-42f9-a661-aa7353894bed.html +* +* Following LWN articles were very useful in construction of this driver: +* Video4Linux2 API series: http://lwn.net/Articles/203924/ +* videobuf2 API explanation: http://lwn.net/Articles/447435/ +* Thanks go to Jonathan Corbet for providing this quality documentation. +* He is awesome. +* +* Copyright (c) 2013 Lubomir Rintel +* All rights reserved. +* No physical hardware was harmed running Windows during the +* reverse-engineering activity +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions, and the following disclaimer, +* without modification. +* 2. The name of the author may not be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* Alternatively, this software may be distributed under the terms of the +* GNU General Public License ("GPL"). +*/ + +#include <linux/module.h> + +#include "usbtv.h" + +int usbtv_set_regs (struct usbtv *usbtv,const u16 regs[][2 ],int size) +{ +int ret; +int pipe =usb_rcvctrlpipe (usbtv->udev,0 ); +int i; + +for (i =0 ; i < size; i++) { +u16 index = regs[i][0 ]; +u16 value = regs[i][1 ]; + + ret =usb_control_msg (usbtv->udev, pipe,USBTV_REQUEST_REG , +USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE , + value, index,NULL ,0 ,0 ); +if (ret <0 ) +return ret; + } + +return 0 ; +} + +static int usbtv_probe (struct usb_interface *intf, +const struct usb_device_id *id) +{ +int ret; +int size; +struct device *dev = &intf->dev; +struct usbtv *usbtv; + +/* Checks that the device is what we think it is. */ +if (intf->num_altsetting !=2 ) +return -ENODEV ; +if (intf->altsetting[1 ].desc.bNumEndpoints !=4 ) +return -ENODEV ; + +/* Packet size is split into 11 bits of base size and count of +* extra multiplies of it.*/ + size =usb_endpoint_maxp (&intf->altsetting[1 ].endpoint[0 ].desc); + size = (size &0x07ff ) * (((size &0x1800 ) >>11 ) +1 ); + +/* Device structure */ + usbtv =kzalloc (sizeof (struct usbtv ),GFP_KERNEL ); +if (usbtv ==NULL ) +return -ENOMEM ; + usbtv->dev = dev; + usbtv->udev =usb_get_dev (interface_to_usbdev (intf)); + + usbtv->iso_size = size; + +usb_set_intfdata (intf, usbtv); + + ret =usbtv_video_init (usbtv); +if (ret <0 ) + goto usbtv_video_fail; + +/* for simplicity we exploit the v4l2_device reference counting */ +v4l2_device_get (&usbtv->v4l2_dev); + +dev_info (dev,"Fushicai USBTV007 Video Grabber\n" ); +return 0 ; + +usbtv_video_fail: +kfree (usbtv); + +return ret; +} + +static void usbtv_disconnect (struct usb_interface *intf) +{ +struct usbtv *usbtv =usb_get_intfdata (intf); +usb_set_intfdata (intf,NULL ); + +if (!usbtv) +return ; + +usbtv_video_free (usbtv); + +usb_put_dev (usbtv->udev); + usbtv->udev =NULL ; + +/* the usbtv structure will be deallocated when v4l2 will be +done using it */ +v4l2_device_put (&usbtv->v4l2_dev); +} + +struct usb_device_id usbtv_id_table[] = { + {USB_DEVICE (0x1b71 ,0x3002 ) }, + {} +}; +MODULE_DEVICE_TABLE (usb, usbtv_id_table); + +MODULE_AUTHOR ("Lubomir Rintel" ); +MODULE_DESCRIPTION ("Fushicai USBTV007 Video Grabber Driver" ); +MODULE_LICENSE ("Dual BSD/GPL" ); + +struct usb_driver usbtv_usb_driver = { + .name ="usbtv" , + .id_table = usbtv_id_table, + .probe = usbtv_probe, + .disconnect = usbtv_disconnect, +}; + +module_usb_driver (usbtv_usb_driver);usbtv-video.c renamed from usbtv.c +9
-154@@ -28,45 +28,10 @@* GNU General Public License ("GPL"). */ -#include <linux/init.h> -#include <linux/list.h> -#include <linux/module.h> -#include <linux/slab.h> -#include <linux/usb.h> -#include <linux/videodev2.h> - -#include <media/v4l2-device.h> #include <media/v4l2-ioctl.h> #include <media/videobuf2-core.h> -#include <media/videobuf2-vmalloc.h> - -/* Hardware. */ -#define USBTV_VIDEO_ENDP 0x81 -#define USBTV_BASE 0xc000 -#define USBTV_REQUEST_REG 12 - -/* Number of concurrent isochronous urbs submitted. -* Higher numbers was seen to overly saturate the USB bus. */ -#define USBTV_ISOC_TRANSFERS 16 -#define USBTV_ISOC_PACKETS 8 - -#define USBTV_CHUNK_SIZE 256 -#define USBTV_CHUNK 240 - -/* Chunk header. */ -#define USBTV_MAGIC_OK (chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ - == 0x88000000) -#define USBTV_FRAME_ID (chunk) ((be32_to_cpu(chunk[0]) & 0x00ff0000) >> 16) -#define USBTV_ODD (chunk) ((be32_to_cpu(chunk[0]) & 0x0000f000) >> 15) -#define USBTV_CHUNK_NO (chunk) (be32_to_cpu(chunk[0]) & 0x00000fff) - -#define USBTV_TV_STD (V4L2_STD_525_60 | V4L2_STD_PAL) - -/* parameters for supported TV norms */ -struct usbtv_norm_params { -v4l2_std_id norm; -int cap_width, cap_height; -}; + +#include "usbtv.h" static struct usbtv_norm_params norm_params[] = { {@@ -81,43 +46,6 @@ static struct usbtv_norm_params norm_params[] = { } }; -/* A single videobuf2 frame buffer. */ -struct usbtv_buf { -struct vb2_buffer vb; -struct list_head list; -}; - -/* Per-device structure. */ -struct usbtv { -struct device *dev; -struct usb_device *udev; -struct v4l2_device v4l2_dev; -struct video_device vdev; -struct vb2_queue vb2q; -struct mutex v4l2_lock; -struct mutex vb2q_lock; - -/* List of videobuf2 buffers protected by a lock. */ -spinlock_t buflock; -struct list_head bufs; - -/* Number of currently processed frame, useful find -* out when a new one begins. */ -u32 frame_id; -int chunks_done; - -enum { -USBTV_COMPOSITE_INPUT , -USBTV_SVIDEO_INPUT , - } input; -v4l2_std_id norm; -int width, height; -int n_chunks; -int iso_size; -unsigned int sequence; -struct urb *isoc_urbs[USBTV_ISOC_TRANSFERS ]; -}; -static int usbtv_configure_for_norm (struct usbtv *usbtv,v4l2_std_id norm) {int i, ret =0 ;@@ -142,26 +70,6 @@ static int usbtv_configure_for_norm(struct usbtv *usbtv, v4l2_std_id norm)return ret; } -static int usbtv_set_regs (struct usbtv *usbtv,const u16 regs[][2 ],int size) -{ -int ret; -int pipe =usb_rcvctrlpipe (usbtv->udev,0 ); -int i; - -for (i =0 ; i < size; i++) { -u16 index = regs[i][0 ]; -u16 value = regs[i][1 ]; - - ret =usb_control_msg (usbtv->udev, pipe,USBTV_REQUEST_REG , -USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE , - value, index,NULL ,0 ,0 ); -if (ret <0 ) -return ret; - } - -return 0 ; -} -static int usbtv_select_input (struct usbtv *usbtv,int input) {int ret;@@ -560,12 +468,6 @@ start_fail:return ret; } -struct usb_device_id usbtv_id_table[] = { - {USB_DEVICE (0x1b71 ,0x3002 ) }, - {} -}; -MODULE_DEVICE_TABLE (usb, usbtv_id_table); -static int usbtv_querycap (struct file *file,void *priv,struct v4l2_capability *cap) {@@ -759,33 +661,9 @@ static void usbtv_release(struct v4l2_device *v4l2_dev)kfree (usbtv); } -static int usbtv_probe (struct usb_interface *intf, -const struct usb_device_id *id) +int usbtv_video_init (struct usbtv *usbtv) {int ret; -int size; -struct device *dev = &intf->dev; -struct usbtv *usbtv; - -/* Checks that the device is what we think it is. */ -if (intf->num_altsetting !=2 ) -return -ENODEV ; -if (intf->altsetting[1 ].desc.bNumEndpoints !=4 ) -return -ENODEV ; - -/* Packet size is split into 11 bits of base size and count of -* extra multiplies of it.*/ - size =usb_endpoint_maxp (&intf->altsetting[1 ].endpoint[0 ].desc); - size = (size &0x07ff ) * (((size &0x1800 ) >>11 ) +1 ); - -/* Device structure */ - usbtv =kzalloc (sizeof (struct usbtv ),GFP_KERNEL ); -if (usbtv ==NULL ) -return -ENOMEM ; - usbtv->dev = dev; - usbtv->udev =usb_get_dev (interface_to_usbdev (intf)); - - usbtv->iso_size = size; (void )usbtv_configure_for_norm (usbtv,V4L2_STD_525_60 );@@ -805,20 +683,18 @@ static int usbtv_probe(struct usb_interface *intf, usbtv->vb2q.lock = &usbtv->vb2q_lock; ret =vb2_queue_init (&usbtv->vb2q);if (ret <0 ) { -dev_warn (dev,"Could not initialize videobuf2 queue\n" ); - goto usbtv_fail; +dev_warn (usbtv->dev,"Could not initialize videobuf2 queue\n" ); +return ret; }/* v4l2 structure */ usbtv->v4l2_dev.release = usbtv_release; - ret =v4l2_device_register (dev, &usbtv->v4l2_dev); + ret =v4l2_device_register (usbtv->dev, &usbtv->v4l2_dev);if (ret <0 ) { -dev_warn (dev,"Could not register v4l2 device\n" ); +dev_warn (usbtv->dev,"Could not register v4l2 device\n" ); goto v4l2_fail; } -usb_set_intfdata (intf, usbtv); -/* Video structure */ strlcpy (usbtv->vdev.name,"usbtv" ,sizeof (usbtv->vdev.name)); usbtv->vdev.v4l2_dev = &usbtv->v4l2_dev;@@ -832,52 +708,31 @@ static int usbtv_probe(struct usb_interface *intf,video_set_drvdata (&usbtv->vdev, usbtv); ret =video_register_device (&usbtv->vdev,VFL_TYPE_GRABBER ,-1 );if (ret <0 ) { -dev_warn (dev,"Could not register video device\n" ); +dev_warn (usbtv->dev,"Could not register video device\n" ); goto vdev_fail; } -dev_info (dev,"Fushicai USBTV007 Video Grabber\n" );return 0 ; vdev_fail:v4l2_device_unregister (&usbtv->v4l2_dev); v4l2_fail:vb2_queue_release (&usbtv->vb2q); -usbtv_fail: -kfree (usbtv);return ret; } -static void usbtv_disconnect (struct usb_interface *intf) +void usbtv_video_free (struct usbtv *usbtv) { -struct usbtv *usbtv =usb_get_intfdata (intf); -mutex_lock (&usbtv->vb2q_lock);mutex_lock (&usbtv->v4l2_lock);usbtv_stop (usbtv); -usb_set_intfdata (intf,NULL );video_unregister_device (&usbtv->vdev);v4l2_device_disconnect (&usbtv->v4l2_dev); -usb_put_dev (usbtv->udev); - usbtv->udev =NULL ;mutex_unlock (&usbtv->v4l2_lock);mutex_unlock (&usbtv->vb2q_lock);v4l2_device_put (&usbtv->v4l2_dev); } - -MODULE_AUTHOR ("Lubomir Rintel" ); -MODULE_DESCRIPTION ("Fushicai USBTV007 Video Grabber Driver" ); -MODULE_LICENSE ("Dual BSD/GPL" ); - -struct usb_driver usbtv_usb_driver = { - .name ="usbtv" , - .id_table = usbtv_id_table, - .probe = usbtv_probe, - .disconnect = usbtv_disconnect, -}; - -module_usb_driver (usbtv_usb_driver);usbtv.h new file +98
-0@@ -0,0 +1,98 @@ +/* +* Fushicai USBTV007 Video Grabber Driver +* +* Copyright (c) 2013 Lubomir Rintel +* All rights reserved. +* No physical hardware was harmed running Windows during the +* reverse-engineering activity +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions, and the following disclaimer, +* without modification. +* 2. The name of the author may not be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* Alternatively, this software may be distributed under the terms of the +* GNU General Public License ("GPL"). +*/ + +#include <linux/slab.h> +#include <linux/usb.h> + +#include <media/v4l2-device.h> +#include <media/videobuf2-vmalloc.h> + +/* Hardware. */ +#define USBTV_VIDEO_ENDP 0x81 +#define USBTV_BASE 0xc000 +#define USBTV_REQUEST_REG 12 + +/* Number of concurrent isochronous urbs submitted. +* Higher numbers was seen to overly saturate the USB bus. */ +#define USBTV_ISOC_TRANSFERS 16 +#define USBTV_ISOC_PACKETS 8 + +#define USBTV_CHUNK_SIZE 256 +#define USBTV_CHUNK 240 + +/* Chunk header. */ +#define USBTV_MAGIC_OK (chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ + == 0x88000000) +#define USBTV_FRAME_ID (chunk) ((be32_to_cpu(chunk[0]) & 0x00ff0000) >> 16) +#define USBTV_ODD (chunk) ((be32_to_cpu(chunk[0]) & 0x0000f000) >> 15) +#define USBTV_CHUNK_NO (chunk) (be32_to_cpu(chunk[0]) & 0x00000fff) + +#define USBTV_TV_STD (V4L2_STD_525_60 | V4L2_STD_PAL) + +/* parameters for supported TV norms */ +struct usbtv_norm_params { +v4l2_std_id norm; +int cap_width, cap_height; +}; + +/* A single videobuf2 frame buffer. */ +struct usbtv_buf { +struct vb2_buffer vb; +struct list_head list; +}; + +/* Per-device structure. */ +struct usbtv { +struct device *dev; +struct usb_device *udev; + +/* video */ +struct v4l2_device v4l2_dev; +struct video_device vdev; +struct vb2_queue vb2q; +struct mutex v4l2_lock; +struct mutex vb2q_lock; + +/* List of videobuf2 buffers protected by a lock. */ +spinlock_t buflock; +struct list_head bufs; + +/* Number of currently processed frame, useful find +* out when a new one begins. */ +u32 frame_id; +int chunks_done; + +enum { +USBTV_COMPOSITE_INPUT , +USBTV_SVIDEO_INPUT , + } input; +v4l2_std_id norm; +int width, height; +int n_chunks; +int iso_size; +unsigned int sequence; +struct urb *isoc_urbs[USBTV_ISOC_TRANSFERS ]; +}; + +int usbtv_set_regs (struct usbtv *usbtv,const u16 regs[][2 ],int size); + +int usbtv_video_init (struct usbtv *usbtv); +void usbtv_video_free (struct usbtv *usbtv);