source: trunk/MagicSoft/Cosy/videodev/Camera.h@ 850

Last change on this file since 850 was 808, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 1.7 KB
Line 
1#ifndef CAMERA_H
2#define CAMERA_H
3
4#include <pthread.h>
5#include <sys/time.h>
6
7typedef unsigned char byte;
8
9class Camera
10{
11private:
12 //
13 // Geometry
14 //
15 static const int cols = 768;
16 static const int rows = 576;
17 static const int depth = 3;
18
19 //
20 // Hardware Descriptors
21 //
22 int fd;
23 int iBufferSize;
24 int iOffsets[2];
25
26 char *pMapBuffer;
27
28 //
29 // Thread interface
30 //
31 unsigned long fNum;
32
33 int fStop;
34 int fRunning;
35
36 char fImg[cols*rows];
37 struct timeval fTime;
38
39 pthread_t fThread;
40 pthread_mutex_t fMux;
41 pthread_cond_t fCond;
42
43 //
44 // Hardware dependant functions
45 //
46 static void SigAlarm(int signal);
47
48 int Ioctl(int req, void *opt, const char *str=NULL);
49
50 void SigInit();
51 void Error(const char *str, int fatal=true);
52
53 int StartGrab(unsigned int frame);
54
55 char *GetImg(unsigned int frame);
56
57 //
58 // Execution thread which processes the pictures
59 //
60 void Thread();
61 static void *MapThread(void *arg);
62
63 void LoopStep(const unsigned long n);
64
65public:
66 Camera();
67 virtual ~Camera();
68
69 //
70 // Starts, stops the execution
71 //
72 void Loop(const unsigned long nof=0);
73 void ExitLoop()
74 {
75 fStop = 1;
76 while (IsRunning())
77 usleep(1);
78 }
79
80 //
81 // flag if the execution is running or not
82 //
83 int IsRunning() const { return fRunning; }
84
85 //
86 // Execution of one frame - this function may be overloaded!
87 //
88 virtual void Execute(const unsigned long n,
89 byte *img, struct timeval *tm);
90
91 //
92 // hardware features
93 //
94 void SetPicPar(int bright, int hue, int contrast);
95 void GetPicPar(int *bright, int *hue, int *contrast);
96
97};
98
99#endif
Note: See TracBrowser for help on using the repository browser.