| Line | |
|---|
| 1 | #ifndef PngReader_H
|
|---|
| 2 | #define PngReader_H
|
|---|
| 3 |
|
|---|
| 4 | #ifdef __CINT__
|
|---|
| 5 | typedef unsigned long int pthread_t;
|
|---|
| 6 | struct pthread_mutex_t;
|
|---|
| 7 | struct pthread_cond_t;
|
|---|
| 8 | struct timeval;
|
|---|
| 9 | #else
|
|---|
| 10 | #include <TROOT.h>
|
|---|
| 11 | #include <pthread.h>
|
|---|
| 12 | #include <unistd.h>
|
|---|
| 13 | #include <sys/time.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | class PixClient;
|
|---|
| 17 |
|
|---|
| 18 | typedef unsigned char byte;
|
|---|
| 19 |
|
|---|
| 20 | class PngReader
|
|---|
| 21 | {
|
|---|
| 22 | private:
|
|---|
| 23 | //
|
|---|
| 24 | // Geometry
|
|---|
| 25 | //
|
|---|
| 26 | static const int gfCols = 768;
|
|---|
| 27 | static const int gfRows = 576;
|
|---|
| 28 | static const int gfDepth = 3;
|
|---|
| 29 |
|
|---|
| 30 | int fStop;
|
|---|
| 31 | int fIsRunning;
|
|---|
| 32 |
|
|---|
| 33 | //
|
|---|
| 34 | // Thread interface
|
|---|
| 35 | //
|
|---|
| 36 | unsigned long fNum;
|
|---|
| 37 |
|
|---|
| 38 | char fImg[gfCols*gfRows];
|
|---|
| 39 | struct timeval fTime;
|
|---|
| 40 |
|
|---|
| 41 | pthread_t fThread;
|
|---|
| 42 |
|
|---|
| 43 | PixClient &fClient;
|
|---|
| 44 |
|
|---|
| 45 | //
|
|---|
| 46 | // Hardware dependant functions
|
|---|
| 47 | //
|
|---|
| 48 | char *GetImg(unsigned int frame);
|
|---|
| 49 |
|
|---|
| 50 | //
|
|---|
| 51 | // Execution thread which processes the pictures
|
|---|
| 52 | //
|
|---|
| 53 | void Thread();
|
|---|
| 54 | static void *MapThread(void *arg);
|
|---|
| 55 |
|
|---|
| 56 | public:
|
|---|
| 57 | PngReader(PixClient &client);
|
|---|
| 58 | virtual ~PngReader();
|
|---|
| 59 |
|
|---|
| 60 | //
|
|---|
| 61 | // Starts, stops the execution
|
|---|
| 62 | //
|
|---|
| 63 | void ExitLoop()
|
|---|
| 64 | {
|
|---|
| 65 | fStop = 1;
|
|---|
| 66 | while (IsRunning())
|
|---|
| 67 | usleep(1);
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | //
|
|---|
| 71 | // flag if the execution is running or not
|
|---|
| 72 | //
|
|---|
| 73 | int IsRunning() const { return fIsRunning; }
|
|---|
| 74 |
|
|---|
| 75 | ClassDef(PngReader, 0)
|
|---|
| 76 | };
|
|---|
| 77 |
|
|---|
| 78 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.