From patchwork Sat Jun 3 09:44:10 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucian Muresan X-Patchwork-Id: 12327 Received: from moutng.kundenserver.de ([212.227.126.177]) by www.linuxtv.org with esmtp (Exim 4.50) id 1FmSgS-0007MF-6G for vdr@linuxtv.org; Sat, 03 Jun 2006 11:44:40 +0200 Received: from [84.149.24.246] (helo=gugumirx.no-ip.org) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1FmSgQ2bCZ-0005Mq; Sat, 03 Jun 2006 11:44:39 +0200 Received: from localhost (localhost [127.0.0.1]) by gugumirx.no-ip.org (Postfix) with ESMTP id 5E5C86EF2A for ; Sat, 3 Jun 2006 11:44:38 +0200 (CEST) Received: from gugumirx.no-ip.org ([127.0.0.1]) by localhost (gugumirx.no-ip.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03926-02 for ; Sat, 3 Jun 2006 11:44:11 +0200 (CEST) Received: from [192.168.178.80] (blues.gugumirx.no-ip.org [192.168.178.80]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by gugumirx.no-ip.org (Postfix) with ESMTP id 8252F6EE30 for ; Sat, 3 Jun 2006 11:44:11 +0200 (CEST) Message-ID: <448159EA.7000907@users.sourceforge.net> Date: Sat, 03 Jun 2006 11:44:10 +0200 From: Lucian Muresan User-Agent: Thunderbird 1.5.0.2 (X11/20060524) MIME-Version: 1.0 To: VDR Mailing List References: <007401c686a0$69977220$0300a8c0@InetX.com> In-Reply-To: <007401c686a0$69977220$0300a8c0@InetX.com> X-Virus-Scanned: amavisd-new at gugumirx.no-ip.org X-Provags-ID: kundenserver.de abuse@kundenserver.de login:bc0772ca0f677a4ff000d75d9f89eb79 Subject: [vdr] Re: pvrinput compile fails with vdr-1.4.0 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jun 2006 09:44:40 -0000 Status: O X-Status: X-Keywords: X-UID: 9709 Hi Simon, Simon Baxter wrote: > Hi. > I've compiled this ok against 1.3.46, but am preparing to make the leap to > 1.4.0. > > Everything other plugin I use seems ok, except pvrinput > > Plugin pvrinput: > make[1]: Entering directory > `/home/vdruser/vdr-1.4.0/PLUGINS/src/pvrinput-0.1.1' > g++ -fPIC -g -O2 -Wall -Woverloaded-virtual -c -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"pvrinput"' > -I../../../../DVB/include -I../../../include -I../../../../DVB/include > device.c > device.c: In member function 'void cPvrReadThread::PesToTs(uint8_t*, > uint32_t)' > device.c:223: warning: large integer implicitly truncated to unsigned type > device.c:255: warning: large integer implicitly truncated to unsigned type > device.c: In member function 'virtual void cPvrReadThread::Action()': > device.c:417: error: 'V4L2_BUF_TYPE_SLICED_VBI_CAPTURE' was not declared in > this scope > device.c:418: error: 'union v4l2_format::' has no member named > 'sliced' > device.c:418: error: 'V4L2_SLICED_TELETEXT_B' was not declared in this scope > make[1]: *** [device.o] Error 1 > make[1]: Leaving directory > `/home/vdruser/vdr-1.4.0/PLUGINS/src/pvrinput-0.1.1' > > Is this plugin not supported with my version of v4l? > > Can anyone help? It works for me on gentoo. However, on gentoo there is a patch regarding inclusion order of some headers for pvrinput (attached). Try this one first. If it doesn't help either, go one step further: Moreover, I also replaced ivtv.h and videodev2.h inside the pvrinput sources with the files supplied with the ivtv package I tried (0.6.2, 0.8 from CVS respectively), and the newer v4l-dvb fetched from HG (I think starting with ivtv-0.6.2 this is necessary). Try these one by one as described. Good luck! Lucian diff -Naur pvrinput-0.1.1_orig/ivtv.h pvrinput-0.1.1/ivtv.h --- pvrinput-0.1.1_orig/ivtv.h 2006-04-30 17:35:56.000000000 +0200 +++ pvrinput-0.1.1/ivtv.h 2006-05-30 21:56:49.000000000 +0200 @@ -36,59 +36,9 @@ #define IVTV_STREAM_DVD_S1 13 #define IVTV_STREAM_DVD_S2 14 -#define IVTV_SLICED_TELETEXT_B (1 << 0) -#define IVTV_SLICED_CAPTION_625 (1 << 1) -#define IVTV_SLICED_CAPTION_525 (1 << 2) -#define IVTV_SLICED_WSS_625 (1 << 3) -#define IVTV_SLICED_VPS (1 << 4) -#define IVTV_SLICED_UNKNOWN (~0) -#define IVTV_SLICED_625 (IVTV_SLICED_TELETEXT_B| \ - IVTV_SLICED_WSS_625|IVTV_SLICED_VPS) -#define IVTV_SLICED_525 (IVTV_SLICED_CAPTION_525) - #define IVTV_YUV_TYPE_HME12 0 /* Hauppauge macro block format */ #define IVTV_YUV_TYPE_FOURCC_YV12 1 -struct ivtv_sliced_vbi_format { - uint32_t service_set; /* one or more of the IVTV_SLICED_ defines */ - uint32_t packet_size; /* the size in bytes of the ivtv_sliced_data packet */ - uint32_t io_size; /* maximum number of bytes passed by one read() call */ - uint32_t reserved; -}; - -/* This structure is the same as the proposed v4l2_sliced_data structure */ -/* id is one of the VBI_SLICED_ flags. */ -struct ivtv_sliced_data { - uint32_t id; - uint32_t line; - unsigned char data[0]; -}; - -struct ivtv_sliced_fmt { - uint32_t service_set; /* one or more of the IVTV_SLICED_ defines */ - uint32_t service_lines[2][24]; - uint32_t packet_size; /* the size in bytes of the ivtv_sliced_data packet */ - uint32_t io_size; /* maximum number of bytes passed by one read() call */ - uint32_t reserved; -}; - -/* The four bit VBI data type found in the embedded VBI data of an - MPEG stream has one of the following values: */ -#define VBI_TYPE_TELETEXT 0x1 // Teletext (uses lines 6-22 for PAL, 10-21 for NTSC) -#define VBI_TYPE_CC 0x4 // Closed Captions (line 21 NTSC, line 22 PAL) -#define VBI_TYPE_WSS 0x5 // Wide Screen Signal (line 20 NTSC, line 23 PAL) -#define VBI_TYPE_VPS 0x7 // Video Programming System (PAL) (line 16) - -/* These data types are not (yet?) used but are already reserved - for future use. */ -#ifdef IVTV_INTERNAL -#define VBI_TYPE_NABST 0x2 // NABST (NTSC) -#define VBI_TYPE_MOJI 0x3 // MOJI (NTSC) -#define VBI_TYPE_VITC 0x6 // Vertical Interval Time Code -#define VBI_TYPE_GEMSTAR2X 0x7 // Gemstar TV Guide (NTSC) -#define VBI_TYPE_GEMSTAR1X 0x8 // Gemstar TV Guide (NTSC) -#endif - /* device ioctls should use the range 29-199 */ #define IVTV_IOC_START_DECODE _IOW ('@', 29, struct ivtv_cfg_start_decode) #define IVTV_IOC_STOP_DECODE _IOW ('@', 30, struct ivtv_cfg_stop_decode) @@ -96,12 +46,6 @@ #define IVTV_IOC_S_SPEED _IOW ('@', 32, struct ivtv_speed) #define IVTV_IOC_DEC_STEP _IOW ('@', 33, int) #define IVTV_IOC_DEC_FLUSH _IOW ('@', 34, int) -#define IVTV_IOC_S_VBI_MODE _IOWR('@', 35, struct ivtv_sliced_vbi_format) -#define IVTV_IOC_G_VBI_MODE _IOR ('@', 36, struct ivtv_sliced_vbi_format) -#define IVTV_IOC_S_VBI_FMT _IOWR('@', 75, struct ivtv_sliced_fmt) -#define IVTV_IOC_G_VBI_FMT _IOR ('@', 76, struct ivtv_sliced_fmt) -#define IVTV_IOC_TRY_VBI_FMT _IOWR('@', 77, struct ivtv_sliced_fmt) -#define IVTV_IOC_G_VBI_CAP _IOR ('@', 78, struct ivtv_sliced_fmt) #define IVTV_IOC_PLAY _IO ('@', 37) #define IVTV_IOC_PAUSE _IO ('@', 38) #define IVTV_IOC_FRAMESYNC _IOR ('@', 39, struct ivtv_ioctl_framesync) @@ -123,6 +67,9 @@ #define IVTV_IOC_DEC_SPLICE _IOW ('@', 58, int) #define IVTV_IOC_DEC_FAST_STOP _IOW ('@', 59, int) #define IVTV_IOC_PREP_FRAME_YUV _IOW ('@', 60, struct ivtvyuv_ioctl_dma_host_to_ivtv_args) +#define IVTV_IOC_G_YUV_INTERLACE _IOR ('@', 61, struct ivtv_ioctl_yuv_interlace) +#define IVTV_IOC_S_YUV_INTERLACE _IOW ('@', 62, struct ivtv_ioctl_yuv_interlace) +#define IVTV_IOC_G_PTS _IOR ('@', 63, u64) // Note: You only append to this structure, you never reorder the members, // you never play tricks with its alignment, you never change the size of @@ -134,13 +81,33 @@ // 7-0 = patchlevel char comment[IVTV_DRIVER_INFO_MAX_COMMENT_LENGTH]; uint32_t cardnr; // the ivtv card number (0-based) + uint32_t hw_flags; // hardware flags: which chips are used? } __attribute__((packed)); #define IVTV_DRIVER_INFO_V1_SIZE 108 #define IVTV_DRIVER_INFO_V2_SIZE 112 +#define IVTV_DRIVER_INFO_V3_SIZE 116 #define IVTV_IOC_G_DRIVER_INFO _IOWR('@', 100, struct ivtv_driver_info *) +#define IVTV_HW_CX25840 (1 << 0) +#define IVTV_HW_SAA7115 (1 << 1) +#define IVTV_HW_SAA7127 (1 << 2) +#define IVTV_HW_MSP34XX (1 << 3) +#define IVTV_HW_TUNER (1 << 4) +#define IVTV_HW_WM8775 (1 << 5) +#define IVTV_HW_CS53L32A (1 << 6) +#define IVTV_HW_TVEEPROM (1 << 7) +#define IVTV_HW_SAA7114 (1 << 8) +#define IVTV_HW_TVAUDIO (1 << 9) +#define IVTV_HW_UPD64031A (1 << 10) +#define IVTV_HW_UPD6408X (1 << 11) +#define IVTV_HW_SAA717X (1 << 12) +#define IVTV_HW_WM8739 (1 << 13) +#define IVTV_HW_GPIO (1 << 14) + +#define IVTV_HW_SAA711X (IVTV_HW_SAA7115 | IVTV_HW_SAA7114) + // Version info // Note: never use the _INTERNAL versions of these macros @@ -183,7 +150,7 @@ /* Custom v4l controls */ #ifndef V4L2_CID_PRIVATE_BASE #define V4L2_CID_PRIVATE_BASE 0x08000000 -#endif +#endif /* V4L2_CID_PRIVATE_BASE */ #define V4L2_CID_IVTV_FREQ (V4L2_CID_PRIVATE_BASE) #define V4L2_CID_IVTV_ENC (V4L2_CID_PRIVATE_BASE + 1) @@ -255,6 +222,13 @@ uint32_t pulldown; uint32_t stream_type; }; +struct ivtv_ioctl_yuv_interlace{ + int interlace_mode; /* Takes one of IVTV_YUV_MODE_xxxxxx values */ + int threshold; /* If mode is auto then if src_height <= this value treat as progressive otherwise treat as interlaced */ +}; +#define IVTV_YUV_MODE_INTERLACED 0 +#define IVTV_YUV_MODE_PROGRESSIVE 1 +#define IVTV_YUV_MODE_AUTO 2 /* Framebuffer external API */ @@ -330,6 +304,8 @@ int top; }; + + /* Framebuffer ioctls should use the range 1 - 28 */ #define IVTVFB_IOCTL_GET_STATE _IOR('@', 1, struct ivtvfb_ioctl_state_info) #define IVTVFB_IOCTL_SET_STATE _IOW('@', 2, struct ivtvfb_ioctl_state_info) @@ -353,6 +329,13 @@ /* Do not use these structures and ioctls in code that you want to release. Only to be used for testing and by the utilities ivtvctl, ivtvfbctl and fwapi. */ +/* These are the VBI types as they appear in the embedded VBI private packets. + It is very likely that this will disappear and be replaced by the DVB standard. */ +#define IVTV_SLICED_TYPE_TELETEXT_B (1) +#define IVTV_SLICED_TYPE_CAPTION_525 (4) +#define IVTV_SLICED_TYPE_WSS_625 (5) +#define IVTV_SLICED_TYPE_VPS (7) + #define IVTV_ENC_STREAM_TYPE_MPG 0 #define IVTV_ENC_STREAM_TYPE_YUV 1 #define IVTV_ENC_STREAM_TYPE_VBI 2 @@ -387,21 +370,12 @@ struct ivtv_ioctl_fwapi api; }; -struct ivtv_saa71xx_reg { - uint32_t reg; +struct ivtv_ioctl_register { + uint32_t i2c_id; /* I2C ID of the I2C chip. 0 for the I2C adapter. */ + unsigned long reg; uint32_t val; }; -struct ivtv_itvc_reg { - uint32_t reg; - uint32_t val; -}; - -struct ivtv_cx25840_setting { - uint32_t index; - uint32_t value; -}; - struct ivtv_msp_matrix { int input; int output; @@ -416,6 +390,7 @@ #define IVTV_DBGFLG_I2C (1 << 5) #define IVTV_DBGFLG_IRQ (1 << 6) #define IVTV_DBGFLG_DEC (1 << 7) +#define IVTV_DBGFLG_YUV (1 << 8) /* BLT RasterOps */ #define IVTV_BLT_RASTER_ZERO 0 @@ -441,6 +416,15 @@ #define IVTV_BLT_ALPHABLEND_DEST 0x10 #define IVTV_BLT_ALPHABLEND_DEST_X_SRC 0x11 /* dest x src +1 , = zero if both zero */ +#ifndef V4L2_COMMON_H_ +/* Routing definition, device dependent. It specifies which inputs (if any) + should be routed to which outputs (if any). */ +struct v4l2_routing { + __u32 input; + __u32 output; +}; +#endif + /* Internal ioctls should use the range 200-255 */ #define IVTV_IOC_S_DEBUG_LEVEL _IOWR('@', 200, int) #define IVTV_IOC_G_DEBUG_LEVEL _IOR ('@', 201, int) @@ -448,18 +432,15 @@ #define IVTV_IOC_ZCOUNT _IO ('@', 203) #define IVTV_IOC_FWAPI _IOWR('@', 204, struct ivtv_ioctl_fwapi) #define IVTV_IOC_EVENT_SETUP _IOWR('@', 205, struct ivtv_ioctl_event) -#define IVTV_IOC_G_SAA7115_REG _IOWR('@', 206, struct ivtv_saa71xx_reg) -#define IVTV_IOC_S_SAA7115_REG _IOW ('@', 207, struct ivtv_saa71xx_reg) -#define IVTV_IOC_G_SAA7127_REG _IOWR('@', 208, struct ivtv_saa71xx_reg) -#define IVTV_IOC_S_SAA7127_REG _IOW ('@', 209, struct ivtv_saa71xx_reg) -#define IVTV_IOC_S_MSP_MATRIX _IOW ('@', 210, struct ivtv_msp_matrix) -#define IVTV_IOC_G_ITVC_REG _IOWR('@', 211, struct ivtv_itvc_reg) -#define IVTV_IOC_S_ITVC_REG _IOW ('@', 212, struct ivtv_itvc_reg) -#define IVTV_IOC_G_CX25840_SETTING _IOWR('@', 213, struct ivtv_cx25840_setting) -#define IVTV_IOC_S_CX25840_SETTING _IOW ('@', 214, struct ivtv_cx25840_setting) -#define IVTV_IOC_G_VIDEO_STATUS _IOR ('@', 215, int *) -#define IVTV_IOC_RESET_IR _IO ('@', 216) +#define IVTV_IOC_G_DECODER_REG _IOWR('@', 206, struct ivtv_ioctl_register) +#define IVTV_IOC_S_DECODER_REG _IOW ('@', 207, struct ivtv_ioctl_register) +#define IVTV_IOC_G_ENCODER_REG _IOWR('@', 208, struct ivtv_ioctl_register) +#define IVTV_IOC_S_ENCODER_REG _IOW ('@', 209, struct ivtv_ioctl_register) +#define IVTV_IOC_S_AUDIO_ROUTING _IOW ('@', 210, struct v4l2_routing) +#define IVTV_IOC_G_ITVC_REG _IOWR('@', 211, struct ivtv_ioctl_register) +#define IVTV_IOC_S_ITVC_REG _IOW ('@', 212, struct ivtv_ioctl_register) +#define IVTV_IOC_RESET_IR _IO ('@', 213) -#endif +#endif /* IVTV_INTERNAL */ -#endif +#endif /* _LINUX_IVTV_H */ diff -Naur pvrinput-0.1.1_orig/videodev2.h pvrinput-0.1.1/videodev2.h --- pvrinput-0.1.1_orig/videodev2.h 2006-04-30 17:35:56.000000000 +0200 +++ pvrinput-0.1.1/videodev2.h 2006-05-30 21:29:29.000000000 +0200 @@ -13,8 +13,139 @@ * Justin Schoeman * et al. */ -#include /* need struct timeval */ -#include /* needed __u64 */ +#ifdef __KERNEL__ +#include /* need struct timeval */ +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69) +#include +#endif +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#include +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) +#include +#endif +#endif +#endif +#include +#include /* need __user */ + + +#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */ +#define HAVE_V4L2 1 + +/* + * Common stuff for both V4L1 and V4L2 + * Moved from videodev.h + */ + +#define VIDEO_MAX_FRAME 32 + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ + +#ifdef __KERNEL__ + +/* Minor device allocation */ +#define MINOR_VFL_TYPE_GRABBER_MIN 0 +#define MINOR_VFL_TYPE_GRABBER_MAX 63 +#define MINOR_VFL_TYPE_RADIO_MIN 64 +#define MINOR_VFL_TYPE_RADIO_MAX 127 +#define MINOR_VFL_TYPE_VTX_MIN 192 +#define MINOR_VFL_TYPE_VTX_MAX 223 +#define MINOR_VFL_TYPE_VBI_MIN 224 +#define MINOR_VFL_TYPE_VBI_MAX 255 + +#define VFL_TYPE_GRABBER 0 +#define VFL_TYPE_VBI 1 +#define VFL_TYPE_RADIO 2 +#define VFL_TYPE_VTX 3 + +struct video_device +{ + /* device info */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + struct device *dev; +#endif + char name[32]; + int type; /* v4l1 */ + int type2; /* v4l2 */ + int hardware; + int minor; + + /* device ops + callbacks */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) + const struct file_operations *fops; +#else + struct file_operations *fops; +#endif + void (*release)(struct video_device *vfd); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + /* old, obsolete interface -- dropped in 2.5.x, don't use it */ + int (*open)(struct video_device *, int mode); + void (*close)(struct video_device *); + long (*read)(struct video_device *, char *, unsigned long, int noblock); + long (*write)(struct video_device *, const char *, unsigned long, int noblock); + unsigned int (*poll)(struct video_device *, struct file *, poll_table *); + int (*ioctl)(struct video_device *, unsigned int , void *); + int (*mmap)(struct video_device *, const char *, unsigned long); + int (*initialize)(struct video_device *); +#endif + +#if OBSOLETE_OWNER /* to be removed in 2.6.15 */ + /* obsolete -- fops->owner is used instead */ + struct module *owner; + /* dev->driver_data will be used instead some day. + * Use the video_{get|set}_drvdata() helper functions, + * so the switch over will be transparent for you. + * Or use {pci|usb}_{get|set}_drvdata() directly. */ + void *priv; +#endif + + /* for videodev.c intenal usage -- please don't touch */ + int users; /* video_exclusive_{open|close} ... */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) + struct mutex lock; /* ... helper function uses these */ +#else + struct semaphore lock; /* ... helper function uses these */ +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69) + devfs_handle_t devfs_handle; /* devfs */ +#else + char devfs_name[64]; /* devfs */ +#endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + struct class_device class_dev; /* sysfs */ +#endif +}; + +#define VIDEO_MAJOR 81 + +extern int video_register_device(struct video_device *, int type, int nr); +extern void video_unregister_device(struct video_device *); +extern int video_usercopy(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, + int (*func)(struct inode *inode, struct file *file, + unsigned int cmd, void *arg)); + +/* helper functions to alloc / release struct video_device, the + later can be used for video_device->release() */ +struct video_device *video_device_alloc(void); +void video_device_release(struct video_device *vfd); + +#endif /* * M I S C E L L A N E O U S @@ -22,7 +153,7 @@ /* Four-character-code (FOURCC) */ #define v4l2_fourcc(a,b,c,d)\ - (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) + (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) /* * E N U M S @@ -63,7 +194,7 @@ V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, V4L2_BUF_TYPE_VBI_CAPTURE = 4, V4L2_BUF_TYPE_VBI_OUTPUT = 5, -#if 1 +#if 1 /*KEEP*/ /* Experimental Sliced VBI */ V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, @@ -152,20 +283,20 @@ }; /* Values for 'capabilities' field */ -#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ -#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ -#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ -#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ -#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ -#if 1 +#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ +#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ +#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ +#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ +#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ +#if 1 /*KEEP*/ #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #endif -#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ +#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ -#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ -#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ -#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ +#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ +#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ +#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ @@ -177,13 +308,13 @@ struct v4l2_pix_format { - __u32 width; - __u32 height; - __u32 pixelformat; + __u32 width; + __u32 height; + __u32 pixelformat; enum v4l2_field field; __u32 bytesperline; /* for padding, zero if unused */ - __u32 sizeimage; - enum v4l2_colorspace colorspace; + __u32 sizeimage; + enum v4l2_colorspace colorspace; __u32 priv; /* private data, depends on pixelformat */ }; @@ -230,18 +361,19 @@ #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ +#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ /* * F O R M A T E N U M E R A T I O N */ struct v4l2_fmtdesc { - __u32 index; /* Format number */ + __u32 index; /* Format number */ enum v4l2_buf_type type; /* buffer type */ __u32 flags; - __u8 description[32]; /* Description string */ - __u32 pixelformat; /* Format fourcc */ - __u32 reserved[4]; + __u8 description[32]; /* Description string */ + __u32 pixelformat; /* Format fourcc */ + __u32 reserved[4]; }; #define V4L2_FMT_FLAG_COMPRESSED 0x0001 @@ -277,6 +409,7 @@ /* The above is based on SMPTE timecodes */ +#if 1 /* * M P E G C O M P R E S S I O N P A R A M E T E R S * @@ -363,6 +496,7 @@ /* I don't expect the above being perfect yet ;) */ __u32 reserved_5[8]; }; +#endif struct v4l2_jpegcompression { @@ -391,7 +525,7 @@ #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will - * allways use APP0 */ + * allways use APP0 */ }; @@ -400,10 +534,10 @@ */ struct v4l2_requestbuffers { - __u32 count; + __u32 count; enum v4l2_buf_type type; enum v4l2_memory memory; - __u32 reserved[2]; + __u32 reserved[2]; }; struct v4l2_buffer @@ -463,7 +597,7 @@ struct v4l2_clip { struct v4l2_rect c; - struct v4l2_clip *next; + struct v4l2_clip __user *next; }; struct v4l2_window @@ -471,9 +605,9 @@ struct v4l2_rect w; enum v4l2_field field; __u32 chromakey; - struct v4l2_clip *clips; + struct v4l2_clip __user *clips; __u32 clipcount; - void *bitmap; + void __user *bitmap; }; @@ -509,9 +643,9 @@ struct v4l2_cropcap { enum v4l2_buf_type type; - struct v4l2_rect bounds; - struct v4l2_rect defrect; - struct v4l2_fract pixelaspect; + struct v4l2_rect bounds; + struct v4l2_rect defrect; + struct v4l2_fract pixelaspect; }; struct v4l2_crop { @@ -542,6 +676,8 @@ #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) +#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) +#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) @@ -550,11 +686,18 @@ #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) +#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) /* ATSC/HDTV */ #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) +/* some merged standards */ +#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) +#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) +#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) +#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK) + /* some common needed stuff */ #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ V4L2_STD_PAL_B1 |\ @@ -567,7 +710,8 @@ V4L2_STD_PAL_H |\ V4L2_STD_PAL_I) #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ - V4L2_STD_NTSC_M_JP) + V4L2_STD_NTSC_M_JP |\ + V4L2_STD_NTSC_M_KR) #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ V4L2_STD_SECAM_K |\ V4L2_STD_SECAM_K1) @@ -575,17 +719,19 @@ V4L2_STD_SECAM_G |\ V4L2_STD_SECAM_H |\ V4L2_STD_SECAM_DK |\ - V4L2_STD_SECAM_L) + V4L2_STD_SECAM_L |\ + V4L2_STD_SECAM_LC) #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ V4L2_STD_PAL_60 |\ - V4L2_STD_NTSC) + V4L2_STD_NTSC |\ + V4L2_STD_NTSC_443) #define V4L2_STD_625_50 (V4L2_STD_PAL |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc |\ V4L2_STD_SECAM) #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ - V4L2_STD_ATSC_16_VSB) + V4L2_STD_ATSC_16_VSB) #define V4L2_STD_UNKNOWN 0 #define V4L2_STD_ALL (V4L2_STD_525_60 |\ @@ -593,7 +739,7 @@ struct v4l2_standard { - __u32 index; + __u32 index; v4l2_std_id id; __u8 name[24]; struct v4l2_fract frameperiod; /* Frames, not fields */ @@ -608,9 +754,9 @@ struct v4l2_input { __u32 index; /* Which input */ - __u8 name[32]; /* Label */ + __u8 name[32]; /* Label */ __u32 type; /* Type of input */ - __u32 audioset; /* Associated audios (bitfield) */ + __u32 audioset; /* Associated audios (bitfield) */ __u32 tuner; /* Associated tuner */ v4l2_std_id std; __u32 status; @@ -645,9 +791,9 @@ struct v4l2_output { __u32 index; /* Which output */ - __u8 name[32]; /* Label */ + __u8 name[32]; /* Label */ __u32 type; /* Type of output */ - __u32 audioset; /* Associated audios (bitfield) */ + __u32 audioset; /* Associated audios (bitfield) */ __u32 modulator; /* Associated modulator */ v4l2_std_id std; __u32 reserved[4]; @@ -669,12 +815,12 @@ /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ struct v4l2_queryctrl { - __u32 id; + __u32 id; enum v4l2_ctrl_type type; __u8 name[32]; /* Whatever */ __s32 minimum; /* Note signedness */ __s32 maximum; - __s32 step; + __s32 step; __s32 default_value; __u32 flags; __u32 reserved[2]; @@ -774,13 +920,14 @@ #define V4L2_TUNER_MODE_LANG2 0x0002 #define V4L2_TUNER_MODE_SAP 0x0002 #define V4L2_TUNER_MODE_LANG1 0x0003 +#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 struct v4l2_frequency { - __u32 tuner; + __u32 tuner; enum v4l2_tuner_type type; - __u32 frequency; - __u32 reserved[8]; + __u32 frequency; + __u32 reserved[8]; }; /* @@ -834,7 +981,7 @@ #define V4L2_VBI_UNSYNC (1<< 0) #define V4L2_VBI_INTERLACED (1<< 1) -#if 1 +#if 1 /*KEEP*/ /* Sliced VBI * * This implements is a proposal V4L2 API to allow SLICED VBI @@ -844,42 +991,114 @@ struct v4l2_sliced_vbi_format { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - __u32 io_size; - __u32 reserved[2]; /* must be zero */ + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + __u32 io_size; + __u32 reserved[2]; /* must be zero */ }; +/* Teletext World System Teletext + (WST), defined on ITU-R BT.653-2 */ #define V4L2_SLICED_TELETEXT_B (0x0001) +/* Video Program System, defined on ETS 300 231*/ #define V4L2_SLICED_VPS (0x0400) +/* Closed Caption, defined on EIA-608 */ #define V4L2_SLICED_CAPTION_525 (0x1000) +/* Wide Screen System, defined on ITU-R BT1119.1 */ #define V4L2_SLICED_WSS_625 (0x4000) #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) +#if 0 +/* FIXME: Currently unused defines, needs to be discussed further */ + +/* Teletext World System Teletext + (WST), defined on ITU-R BT.653-2 */ +#define V4L2_SLICED_TELETEXT_PAL_B (0x000001) +#define V4L2_SLICED_TELETEXT_PAL_C (0x000002) +#define V4L2_SLICED_TELETEXT_NTSC_B (0x000010) +#define V4L2_SLICED_TELETEXT_SECAM (0x000020) + +/* Teletext North American Broadcast Teletext Specification + (NABTS), defined on ITU-R BT.653-2 */ +#define V4L2_SLICED_TELETEXT_NTSC_C (0x000040) +#define V4L2_SLICED_TELETEXT_NTSC_D (0x000080) + +/* Video Program System, defined on ETS 300 231*/ +#define V4L2_SLICED_VPS (0x000400) + +/* Closed Caption, defined on EIA-608 */ +#define V4L2_SLICED_CAPTION_525 (0x001000) +#define V4L2_SLICED_CAPTION_625 (0x002000) + +/* Wide Screen System, defined on ITU-R BT1119.1 */ +#define V4L2_SLICED_WSS_625 (0x004000) + +/* Wide Screen System, defined on IEC 61880 */ +#define V4L2_SLICED_WSS_525 (0x008000) + +/* Vertical Interval Timecode (VITC), defined on SMPTE 12M */ +#define V4l2_SLICED_VITC_625 (0x010000) +#define V4l2_SLICED_VITC_525 (0x020000) + +#define V4L2_SLICED_TELETEXT_B (V4L2_SLICED_TELETEXT_PAL_B |\ + V4L2_SLICED_TELETEXT_NTSC_B) + +#define V4L2_SLICED_TELETEXT (V4L2_SLICED_TELETEXT_PAL_B |\ + V4L2_SLICED_TELETEXT_PAL_C |\ + V4L2_SLICED_TELETEXT_SECAM |\ + V4L2_SLICED_TELETEXT_NTSC_B |\ + V4L2_SLICED_TELETEXT_NTSC_C |\ + V4L2_SLICED_TELETEXT_NTSC_D) + +#define V4L2_SLICED_CAPTION (V4L2_SLICED_CAPTION_525 |\ + V4L2_SLICED_CAPTION_625) + +#define V4L2_SLICED_WSS (V4L2_SLICED_WSS_525 |\ + V4L2_SLICED_WSS_625) + +#define V4L2_SLICED_VITC (V4L2_SLICED_VITC_525 |\ + V4L2_SLICED_VITC_625) + +#define V4L2_SLICED_VBI_525 (V4L2_SLICED_TELETEXT_NTSC_B |\ + V4L2_SLICED_TELETEXT_NTSC_C |\ + V4L2_SLICED_TELETEXT_NTSC_D |\ + V4L2_SLICED_CAPTION_525 |\ + V4L2_SLICED_WSS_525 |\ + V4l2_SLICED_VITC_525) + +#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_PAL_B |\ + V4L2_SLICED_TELETEXT_PAL_C |\ + V4L2_SLICED_TELETEXT_SECAM |\ + V4L2_SLICED_VPS |\ + V4L2_SLICED_CAPTION_625 |\ + V4L2_SLICED_WSS_625 |\ + V4l2_SLICED_VITC_625) +#endif + struct v4l2_sliced_vbi_cap { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - __u32 reserved[4]; /* must be 0 */ + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + __u32 reserved[4]; /* must be 0 */ }; struct v4l2_sliced_vbi_data { - __u32 id; - __u32 field; /* 0: first field, 1: second field */ - __u32 line; /* 1-23 */ - __u32 reserved; /* must be 0 */ - __u8 data[48]; + __u32 id; + __u32 field; /* 0: first field, 1: second field */ + __u32 line; /* 1-23 */ + __u32 reserved; /* must be 0 */ + __u8 data[48]; }; #endif @@ -894,10 +1113,10 @@ enum v4l2_buf_type type; union { - struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE - struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY - struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE -#if 1 + struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE + struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY + struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE +#if 1 /*KEEP*/ struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE #endif __u8 raw_data[200]; // user-defined @@ -929,8 +1148,10 @@ #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) +#if 1 /* experimental */ #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression) #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression) +#endif #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) #define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) @@ -976,9 +1197,10 @@ #define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) #define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) #define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) -#if 1 +#if 1 /*KEEP*/ #define VIDIOC_G_SLICED_VBI_CAP _IOR ('V', 69, struct v4l2_sliced_vbi_cap) #endif +#define VIDIOC_LOG_STATUS _IO ('V', 70) /* for compatibility, will go away some day */ #define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) @@ -991,6 +1213,53 @@ #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ +#ifdef __KERNEL__ +/* + * + * V 4 L 2 D R I V E R H E L P E R A P I + * + * Some commonly needed functions for drivers (v4l2-common.o module) + */ +#include + +/* Video standard functions */ +extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs); +extern int v4l2_video_std_construct(struct v4l2_standard *vs, + int id, char *name); + +/* prority handling */ +struct v4l2_prio_state { + atomic_t prios[4]; +}; +int v4l2_prio_init(struct v4l2_prio_state *global); +int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, + enum v4l2_priority new); +int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); +int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local); +enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); +int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); + +/* names for fancy debug output */ +extern char *v4l2_field_names[]; +extern char *v4l2_type_names[]; + +/* Compatibility layer interface -- v4l1-compat module */ +typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, + unsigned int cmd, void *arg); + +#ifdef CONFIG_VIDEO_V4L1_COMPAT +int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, + int cmd, void *arg, v4l2_kioctl driver_ioctl); +#else +#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL +#endif + +/* 32 Bits compatibility layer for 64 bits processors */ +extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, + unsigned long arg); + + +#endif /* __KERNEL__ */ #endif /* __LINUX_VIDEODEV2_H */ /*