v4l2uvc.h
Go to the documentation of this file.
1 /*******************************************************************************
2 # luvcview: Sdl video Usb Video Class grabber . #
3 #This package work with the Logitech UVC based webcams with the mjpeg feature. #
4 #All the decoding is in user space with the embedded jpeg decoder #
5 #. #
6 # Copyright (C) 2005 2006 Laurent Pinchart && Michel Xhaard #
7 # #
8 # This program is free software; you can redistribute it and/or modify #
9 # it under the terms of the GNU General Public License as published by #
10 # the Free Software Foundation; either version 2 of the License, or #
11 # (at your option) any later version. #
12 # #
13 # This program is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
17 # #
18 # You should have received a copy of the GNU General Public License #
19 # along with this program; if not, write to the Free Software #
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
21 # #
22 *******************************************************************************/
23 
24 #include <stdio.h>
25 #include <string.h>
26 #include <fcntl.h>
27 #include <unistd.h>
28 #include <errno.h>
29 #include <sys/ioctl.h>
30 #include <sys/mman.h>
31 #include <sys/select.h>
32 #include <linux/videodev2.h>
33 
34 #include "uvcvideo.h"
35 #include "dynctrl-logitech.h"
36 
37 
38 #define NB_BUFFER 4
39 #define DHT_SIZE 432
40 
41 
42 
43 struct vdIn {
44  int fd;
45  char *videodevice;
46  char *status;
47  char *pictName;
48  struct v4l2_capability cap;
49  struct v4l2_format fmt;
50  struct v4l2_buffer buf;
51  struct v4l2_requestbuffers rb;
52  void *mem[NB_BUFFER];
53  unsigned char *tmpbuffer;
54  unsigned char *framebuffer;
57  int width;
58  int height;
59  float fps;
60  int formatIn;
61  int formatOut;
64  int toggleAvi;
65  int getPict;
67  /* raw frame capture */
68  unsigned int fileCounter;
69  /* raw frame stream capture */
70  unsigned int rfsFramesWritten;
71  unsigned int rfsBytesWritten;
72  /* raw stream capture */
73  FILE *captureFile;
74  unsigned int framesWritten;
75  unsigned int bytesWritten;
79 };
80 int
81 init_videoIn(struct vdIn *vd, char *device, int width, int height, float fps,
82  int format, int grabmethod, char *avifilename);
83 int enum_controls(int vd);
84 int save_controls(int vd, const char* filename);
85 int load_controls(int vd, const char* filename);
86 
87 int uvcGrab(struct vdIn *vd);
88 int close_v4l2(struct vdIn *vd);
89 
90 int v4l2GetControl(struct vdIn *vd, int control);
91 int v4l2SetControl(struct vdIn *vd, int control, int value);
92 int v4l2UpControl(struct vdIn *vd, int control);
93 int v4l2DownControl(struct vdIn *vd, int control);
94 int v4l2ToggleControl(struct vdIn *vd, int control);
95 int v4l2ResetControl(struct vdIn *vd, int control);
96 int v4l2ResetPanTilt(struct vdIn *vd);
97 int v4L2UpDownPan(struct vdIn *vd, short inc);
98 int v4L2UpDownTilt(struct vdIn *vd,short inc);
99 int v4L2UpDownPanTilt(struct vdIn *vd, short inc_p, short inc_t);
100 int v4l2SetLightFrequencyFilter(struct vdIn *vd,int flt);
101 int enum_frame_intervals(int dev, __u32 pixfmt, __u32 width, __u32 height);
102 int enum_frame_sizes(int dev, __u32 pixfmt);
103 int enum_frame_formats(int dev, unsigned int *supported_formats, unsigned int max_formats);
104 
105 //Added by Markus Bader
106 int check_videoIn(struct vdIn *vd, char *device);
107 int v4l2ResetPan(struct vdIn *vd);
108 int v4l2ResetTilt(struct vdIn *vd);
int v4l2DownControl(struct vdIn *vd, int control)
Definition: v4l2uvc.c:780
#define NB_BUFFER
Definition: v4l2uvc.h:38
int v4l2ResetPan(struct vdIn *vd)
Definition: v4l2uvc.c:845
int fd
Definition: v4l2uvc.h:44
int v4l2GetControl(struct vdIn *vd, int control)
Definition: v4l2uvc.c:714
int recordtime
Definition: v4l2uvc.h:78
int v4l2ResetTilt(struct vdIn *vd)
Definition: v4l2uvc.c:865
int v4L2UpDownPan(struct vdIn *vd, short inc)
Definition: v4l2uvc.c:906
int v4l2ToggleControl(struct vdIn *vd, int control)
Definition: v4l2uvc.c:809
int grabmethod
Definition: v4l2uvc.h:56
int signalquit
Definition: v4l2uvc.h:63
int framecount
Definition: v4l2uvc.h:76
unsigned char * tmpbuffer
Definition: v4l2uvc.h:53
int check_videoIn(struct vdIn *vd, char *device)
Definition: v4l2uvc.c:68
float fps
Definition: v4l2uvc.h:59
FILE * captureFile
Definition: v4l2uvc.h:73
char * pictName
Definition: v4l2uvc.h:47
int close_v4l2(struct vdIn *vd)
Definition: v4l2uvc.c:677
int v4l2ResetControl(struct vdIn *vd, int control)
Definition: v4l2uvc.c:826
int formatIn
Definition: v4l2uvc.h:60
unsigned int rfsFramesWritten
Definition: v4l2uvc.h:70
int v4L2UpDownTilt(struct vdIn *vd, short inc)
Definition: v4l2uvc.c:924
int rawFrameCapture
Definition: v4l2uvc.h:66
int enum_controls(int vd)
Definition: v4l2uvc.c:179
struct v4l2_requestbuffers rb
Definition: v4l2uvc.h:51
int v4l2UpControl(struct vdIn *vd, int control)
Definition: v4l2uvc.c:751
unsigned int rfsBytesWritten
Definition: v4l2uvc.h:71
int uvcGrab(struct vdIn *vd)
Definition: v4l2uvc.c:562
struct v4l2_buffer buf
Definition: v4l2uvc.h:50
int height
Definition: v4l2uvc.h:58
int isstreaming
Definition: v4l2uvc.h:55
struct v4l2_format fmt
Definition: v4l2uvc.h:49
int width
Definition: v4l2uvc.h:57
int toggleAvi
Definition: v4l2uvc.h:64
int v4L2UpDownPanTilt(struct vdIn *vd, short inc_p, short inc_t)
Definition: v4l2uvc.c:941
Definition: v4l2uvc.h:43
int enum_frame_sizes(int dev, __u32 pixfmt)
Definition: v4l2uvc.c:1080
int enum_frame_formats(int dev, unsigned int *supported_formats, unsigned int max_formats)
Definition: v4l2uvc.c:1123
int enum_frame_intervals(int dev, __u32 pixfmt, __u32 width, __u32 height)
Definition: v4l2uvc.c:1042
char * status
Definition: v4l2uvc.h:46
unsigned int bytesWritten
Definition: v4l2uvc.h:75
int v4l2SetLightFrequencyFilter(struct vdIn *vd, int flt)
Definition: v4l2uvc.c:1025
int load_controls(int vd, const char *filename)
Definition: v4l2uvc.c:321
unsigned char * framebuffer
Definition: v4l2uvc.h:54
int save_controls(int vd, const char *filename)
Definition: v4l2uvc.c:262
int init_videoIn(struct vdIn *vd, char *device, int width, int height, float fps, int format, int grabmethod, char *avifilename)
Definition: v4l2uvc.c:105
int recordstart
Definition: v4l2uvc.h:77
struct v4l2_capability cap
Definition: v4l2uvc.h:48
unsigned int framesWritten
Definition: v4l2uvc.h:74
int framesizeIn
Definition: v4l2uvc.h:62
void * mem[NB_BUFFER]
Definition: v4l2uvc.h:52
char * videodevice
Definition: v4l2uvc.h:45
unsigned int fileCounter
Definition: v4l2uvc.h:68
int v4l2SetControl(struct vdIn *vd, int control, int value)
Definition: v4l2uvc.c:729
int v4l2ResetPanTilt(struct vdIn *vd)
Definition: v4l2uvc.c:885
int formatOut
Definition: v4l2uvc.h:61
int getPict
Definition: v4l2uvc.h:65


tuw_uvc
Author(s): Markus Bader
autogenerated on Mon Jun 10 2019 15:39:24