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

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