]> git.vomp.tv Git - vompserver.git/blob - transceiver.h
Fix for server thread hang if no data available on getblock
[vompserver.git] / transceiver.h
1 /*
2      Edited for VOMP by Chris Tallon
3      Edits Copyright 2004-2005 Chris Tallon
4
5      This class will be replaced soon.
6 */
7
8 /*
9  *   MediaMVP Plugin
10  *
11  *   (C) 2003 Dominic Morris
12  *
13  *   $Id$
14  *   $Date$
15  *
16  *
17  *   Transceiver stuff, stolen from streamdev again...
18  */
19
20 #ifndef VDR_MEDIAMVP_TRANSCEIVER_H
21 #define VDR_MEDIAMVP_TRANSCEIVER_H
22
23 #include <vdr/receiver.h>
24
25 #include <vdr/thread.h>
26 #include <vdr/status.h>
27
28 class cRingBufferLinear;
29 class cRemux;
30 class cTSRemux;
31 class cServerConnection;
32 class cChannel;
33
34
35 #include <pthread.h>
36 #include "ringbuffer.h"
37 #include "log.h"
38
39 class cMediamvpTransceiver: public cReceiver, public cThread {
40 //    friend class cMediamvpVdrURL;
41 private:
42         cDevice *m_Device;
43         cRingBufferLinear *m_RingBuffer;
44         cTSRemux *m_Remux;
45     int       m_Socket;
46
47         bool m_Active;
48 #if VDRVERSNUM >= 10300
49   cTimeMs lastTime;
50 #endif
51         // CJT
52         Ringbuffer rb;
53         pthread_mutex_t ringLock;
54         Log* log;
55
56
57 protected:
58         virtual void Receive(uchar *Data, int Length);
59         virtual void Action(void);
60
61 public:
62         cMediamvpTransceiver(const cChannel *Channel, int Priority, int Socket, cDevice *Device);
63         virtual ~cMediamvpTransceiver(void);
64
65         bool Attach(void) { return m_Device->AttachReceiver(this); }
66         void Detach(void) { cReceiver::Detach(); }
67
68         void Stop(void);
69
70
71         // CJT
72         unsigned long getBlock(unsigned char* buffer, unsigned long amount);
73         virtual void Activate(bool On);
74
75 };
76
77 #endif // VDR_MEDIAMVP_TRANSCEIVER_H