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

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