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