1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* (c) BayCom GmbH, http://www.baycom.de, info@baycom.de
*
* See the COPYING file for copyright information and
* how to reach the author.
*
*/
#ifndef VDR_MCLI_PACKETBUFFER_H
#define VDR_MCLI_PACKETBUFFER_H
#define USE_VDR_PACKET_BUFFER
#ifdef USE_VDR_PACKET_BUFFER
#include <vdr/ringbuffer.h>
#endif
//--------------------------------------------------------------------------
// Packetized Buffer
//--------------------------------------------------------------------------
typedef struct
{
int offset;
int size;
int realSize; // incl. alignment
int flags;
uint64_t timestamp;
} posData;
class cMyPacketBuffer
{
int dataSize;
int posSize;
uchar *dataBuffer;
posData *posBuffer;
int rp, wp;
posData *posRead, *posWrite;
int posReadNum;
int invalidate;
int putTimeout, getTimeout;
pthread_mutex_t m_lock;
int FindSpace (int size);
uchar *GetStartSub (int *readp, int timeout, int *size, int *flags, uint64_t * timestamp);
public:
cMyPacketBuffer (int Size, int Packets);
~cMyPacketBuffer ();
uchar *PutStart (int size);
void PutEnd (int size, int flags, uint64_t timestamp);
uchar *GetStart (int *size, int *flags, uint64_t * timestamp);
uchar *GetStartMultiple (int maxsize, int *size, int *flags, uint64_t * timestamp);
void GetEnd (void);
// void GetEndMultiple(void);
void Invalidate (void);
void SetTimeouts (int PutTimeout, int GetTimeout);
};
#endif
|