kstars
v4l1_base.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef V4L1_BASE_H
00023 #define V4L1_BASE_H
00024
00025 #include <stdio.h>
00026 #include <stdlib.h>
00027 #include "videodev.h"
00028 #include "../eventloop.h"
00029
00030 class V4L1_Base
00031 {
00032 public:
00033 V4L1_Base();
00034 virtual ~V4L1_Base();
00035
00036
00037 virtual int connectCam(const char * devpath, char *errmsg);
00038 virtual void disconnectCam();
00039 char * getDeviceName();
00040
00041
00042 int getBrightness();
00043 int getContrast();
00044 int getColor();
00045 int getHue();
00046 int getWhiteness();
00047 void setContrast(int val);
00048 void setBrightness(int val);
00049 void setColor(int val);
00050 void setHue(int val);
00051 void setWhiteness(int val);
00052
00053
00054 static void updateFrame(int d, void * p);
00055 void newFrame();
00056 void setPictureSettings();
00057 void getPictureSettings();
00058
00059
00060 int getWidth();
00061 int getHeight();
00062 void checkSize(int & x, int & y);
00063 virtual bool setSize(int x, int y);
00064 virtual void getMaxMinSize(int & xmax, int & ymax, int & xmin, int & ymin);
00065
00066
00067 void setFPS(int fps);
00068 int getFPS();
00069
00070 void init(int preferedPalette);
00071 void allocBuffers();
00072 int mmapInit();
00073 void mmapCapture();
00074 void mmapSync();
00075
00076 unsigned char * mmapFrame();
00077 unsigned char * getY();
00078 unsigned char * getU();
00079 unsigned char * getV();
00080 unsigned char * getColorBuffer();
00081
00082 int start_capturing(char *errmsg);
00083 int stop_capturing(char *errmsg);
00084 void registerCallback(WPF *fp, void *ud);
00085
00086 protected:
00087
00088 int fd;
00089 WPF *callback;
00090 void *uptr;
00091 unsigned long options;
00092
00093 struct video_capability capability;
00094 struct video_window window;
00095 struct video_picture picture_format;
00096 struct video_mbuf mmap_buffer;
00097
00098 unsigned char * buffer_start;
00099
00100 long mmap_sync_buffer;
00101 long mmap_capture_buffer;
00102
00103 int frameRate;
00104 bool streamActive;
00105 int selectCallBackID;
00106 unsigned char * YBuf,*UBuf,*VBuf, *colorBuffer;
00107
00108 };
00109
00110 #endif