⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbvideo.h

📁 一种linux下的看摄像头的画面的软件
💻 H
📖 第 1 页 / 共 2 页
字号:
	unsigned char ifaceAltInactive; /* Alt settings */	unsigned long flags;		/* FLAGS_USBVIDEO_xxx */	unsigned long paletteBits;	/* Which palettes we accept? */	unsigned short defaultPalette;	/* What palette to use for read() */	struct semaphore lock;	int user;		/* user count for exclusive use */	videosize_t videosize;	/* Current setting */	videosize_t canvas;	/* This is the width,height of the V4L canvas */	int max_frame_size;	/* Bytes in one video frame */	int uvd_used;        	/* Is this structure in use? */	int streaming;		/* Are we streaming Isochronous? */	int grabbing;		/* Are we grabbing? */	int settingsAdjusted;	/* Have we adjusted contrast etc.? */	int last_error;		/* What calamity struck us? */	char *fbuf;		/* Videodev buffer area */	int fbuf_size;		/* Videodev buffer size */	int curframe;	int iso_packet_len;	/* Videomode-dependent, saves bus bandwidth */	struct RingQueue dp;	/* Isoc data pump */	struct usbvideo_frame frame[USBVIDEO_NUMFRAMES];	struct usbvideo_sbuf sbuf[USBVIDEO_NUMSBUF];	volatile int remove_pending;	/* If set then about to exit */	struct video_picture vpic, vpic_old;	/* Picture settings */	struct video_capability vcap;		/* Video capabilities */	struct video_channel vchan;	/* May be used for tuner support */	struct usbvideo_statistics stats;	struct proc_dir_entry *procfs_vEntry;	/* /proc/video/MYDRIVER/video2 */	char videoName[32];		/* Holds name like "video7" */};/* * usbvideo callbacks (virtual methods). They are set when usbvideo * services are registered. All of these default to NULL, except those * that default to usbvideo-provided methods. */struct usbvideo_cb {	void *(*probe)(struct usb_device *, unsigned int,const struct usb_device_id *);	void (*userFree)(struct uvd *);	void (*disconnect)(struct usb_device *, void *);	int (*setupOnOpen)(struct uvd *);	void (*videoStart)(struct uvd *);	void (*videoStop)(struct uvd *);	void (*processData)(struct uvd *, struct usbvideo_frame *);	void (*postProcess)(struct uvd *, struct usbvideo_frame *);	void (*adjustPicture)(struct uvd *);	int (*getFPS)(struct uvd *);	int (*overlayHook)(struct uvd *, struct usbvideo_frame *);	int (*getFrame)(struct uvd *, int);	int (*procfs_read)(char *page,char **start,off_t off,int count,int *eof,void *data);	int (*procfs_write)(struct file *file,const char *buffer,unsigned long count,void *data);	int (*startDataPump)(struct uvd *uvd);	void (*stopDataPump)(struct uvd *uvd);	int (*setVideoMode)(struct uvd *uvd, struct video_window *vw);};struct usbvideo {	int num_cameras;		/* As allocated */	struct usb_driver usbdrv;	/* Interface to the USB stack */	char drvName[80];		/* Driver name */	struct semaphore lock;		/* Mutex protecting camera structures */	struct usbvideo_cb cb;		/* Table of callbacks (virtual methods) */	struct video_device vdt;	/* Video device template */	struct uvd *cam;			/* Array of camera structures */	int uses_procfs;		/* Non-zero if we create /proc entries */	struct proc_dir_entry *procfs_dEntry;	/* /proc/video/MYDRIVER */	struct module *md_module;	/* Minidriver module */};/* * This macro retrieves callback address from the struct uvd object. * No validity checks are done here, so be sure to check the * callback beforehand with VALID_CALLBACK. */#define	GET_CALLBACK(uvd,cbName) ((uvd)->handle->cb.cbName)/* * This macro returns either callback pointer or NULL. This is safe * macro, meaning that most of components of data structures involved * may be NULL - this only results in NULL being returned. You may * wish to use this macro to make sure that the callback is callable. * However keep in mind that those checks take time. */#define	VALID_CALLBACK(uvd,cbName) ((((uvd) != NULL) && \		((uvd)->handle != NULL)) ? GET_CALLBACK(uvd,cbName) : NULL)int  RingQueue_Dequeue(struct RingQueue *rq, unsigned char *dst, int len);int  RingQueue_Enqueue(struct RingQueue *rq, const unsigned char *cdata, int n);void RingQueue_WakeUpInterruptible(struct RingQueue *rq);void RingQueue_Flush(struct RingQueue *rq);static inline int RingQueue_GetLength(const struct RingQueue *rq){	return (rq->wi - rq->ri + rq->length) & (rq->length-1);}static inline int RingQueue_GetFreeSpace(const struct RingQueue *rq){	return rq->length - RingQueue_GetLength(rq);}void usbvideo_CollectRawData(struct uvd *uvd, struct usbvideo_frame *frame);void usbvideo_DrawLine(	struct usbvideo_frame *frame,	int x1, int y1,	int x2, int y2,	unsigned char cr, unsigned char cg, unsigned char cb);void usbvideo_HexDump(const unsigned char *data, int len);void usbvideo_OverlayChar(struct uvd *uvd, struct usbvideo_frame *frame, int x, int y, int ch);void usbvideo_OverlayString(struct uvd *uvd, struct usbvideo_frame *frame, int x, int y, const char *str);void usbvideo_OverlayStats(struct uvd *uvd, struct usbvideo_frame *frame);void usbvideo_ReportStatistics(const struct uvd *uvd);void usbvideo_SayAndWait(const char *what);void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode);void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs);/* Memory allocation routines */unsigned long usbvideo_uvirt_to_kva(pgd_t *pgd, unsigned long adr);unsigned long usbvideo_kvirt_to_pa(unsigned long adr);void *usbvideo_rvmalloc(unsigned long size);void usbvideo_rvfree(void *mem, unsigned long size);int usbvideo_register(	struct usbvideo **pCams,	const int num_cams,	const int num_extra,	const char *driverName,	const struct usbvideo_cb *cbTable,	struct module *md,	const struct usb_device_id *id_table);struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams);int usbvideo_RegisterVideoDevice(struct uvd *uvd);void usbvideo_Deregister(struct usbvideo **uvt);void usbvideo_Disconnect(struct usb_device *dev, void *ptr);void usbvideo_CameraRelease(struct uvd *uvd);void usbvideo_v4l_close(struct video_device *dev);int usbvideo_v4l_initialize(struct video_device *dev);int usbvideo_v4l_ioctl(struct video_device *dev, unsigned int cmd, void *arg);int usbvideo_v4l_mmap(struct video_device *dev, const char *adr, unsigned long size);int usbvideo_v4l_open(struct video_device *dev, int flags);long usbvideo_v4l_read(struct video_device *dev, char *buf,			unsigned long count, int noblock);long usbvideo_v4l_write(struct video_device *dev, const char *buf,			unsigned long count, int noblock);int usbvideo_GetFrame(struct uvd *uvd, int frameNum);int usbvideo_NewFrame(struct uvd *uvd, int framenum);int usbvideo_StartDataPump(struct uvd *uvd);void usbvideo_StopDataPump(struct uvd *uvd);void usbvideo_DeinterlaceFrame(struct uvd *uvd, struct usbvideo_frame *frame);void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, struct usbvideo_frame *frame);/* * This code performs bounds checking - use it when working with * new formats, or else you may get oopses all over the place. * If pixel falls out of bounds then it gets shoved back (as close * to place of offence as possible) and is painted bright red. * * There are two important concepts: frame width, height and * V4L canvas width, height. The former is the area requested by * the application -for this very frame-. The latter is the largest * possible frame that we can serve (we advertise that via V4L ioctl). * The frame data is expected to be formatted as lines of length * VIDEOSIZE_X(fr->request), total VIDEOSIZE_Y(frame->request) lines. */static inline void RGB24_PUTPIXEL(	struct usbvideo_frame *fr,	int ix, int iy,	unsigned char vr,	unsigned char vg,	unsigned char vb){	register unsigned char *pf;	int limiter = 0, mx, my;	mx = ix;	my = iy;	if (mx < 0) {		mx=0;		limiter++;	} else if (mx >= VIDEOSIZE_X((fr)->request)) {		mx= VIDEOSIZE_X((fr)->request) - 1;		limiter++;	}	if (my < 0) {		my = 0;		limiter++;	} else if (my >= VIDEOSIZE_Y((fr)->request)) {		my = VIDEOSIZE_Y((fr)->request) - 1;		limiter++;	}	pf = (fr)->data + V4L_BYTES_PER_PIXEL*((iy)*VIDEOSIZE_X((fr)->request) + (ix));	if (limiter) {		*pf++ = 0;		*pf++ = 0;		*pf++ = 0xFF;	} else {		*pf++ = (vb);		*pf++ = (vg);		*pf++ = (vr);	}}#endif /* usbvideo_h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -