Debian Codegraph @

samples/qtvidcap/ccap.h

raw
1 #ifndef CCAP_H
2 #define CCAP_H
3
4 #include <avm_stl.h>
5 #include <avm_locker.h>
6
7 class v4lxif;
8
9 class ClosedCaption
10 {
11 public:
12 typedef void (*callbackproc) (void*, const char*);
13
14 //ClosedCaption(const char* pcDevName="/dev/vbi");
15 ClosedCaption(v4lxif* pv4l);
16 ~ClosedCaption();
17
18 const char* getBuffer() { return storage; }
19 void add_callback(callbackproc p, void* arg);
20 void remove_callback(callbackproc p, void* arg);
21
22 void addref() { m_iRefcnt++; }
23 void release() { m_iRefcnt--; if (m_iRefcnt==0) delete this; }
24 void lock() { m_mutex.Lock(); }
25 void unlock() { m_mutex.Unlock(); }
26 private:
27 int CCdecode(int data);
28 int decode(unsigned char *vbiline);
29 void* mainloop();
30 static void* threadstarter(void*);
31
32 int m_iRefcnt;
33 struct callback_info
34 {
35 callbackproc proc;
36 void* arg;
37 void exec(const char* p) { return proc(arg, p); }
38 };
39 avm::vector<callback_info> m_callbacks;
40
41
42 // Member variables
43 v4lxif* m_pV4l;
44 avm::PthreadTask* m_pThread;
45 avm::PthreadMutex m_mutex;
46 int m_iDev;
47 int m_iQuit;
48 int lastcode;
49 int ccmode; //cc1 or cc2
50 char plain;
51 char ccbuf[3][256]; //cc is 32 columns per row, this allows for extra characters
52 char storage[256];
53
54 // Global constants
55 static const char* const ratings[];
56 static const int rowdata[];
57 static const char* const specialchar[];
58 static const char* const modes[];
59 };
60
61 #endif // CCAP_H