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

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