blob: 665dd6ee4be30e576cb8eb52cb4401b9213b3714 (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
* ringbuffer.h: A ring buffer
*
* See the main source file 'genindex.c' for copyright information and
* how to reach the author.
*
* This was taken from the VDR package, which was released under the GPL.
* Stripped down to make the PES parser happy
*
*-------------------------------------------------------------------------------
* Revision History
* $Log: ringbuffer.h,v $
* Revision 1.2 2016/09/01 15:37:42 richard
* Extensively updated to V0.2 for EN 300 743 compliant subtitles
* added -b and -n flags
*
*-------------------------------------------------------------------------------
*/
#ifndef __RINGBUFFER_H
#define __RINGBUFFER_H
#include "thread.h"
#include "tools.h"
class cRingBuffer {
private:
protected:
void WaitForPut(void);
void WaitForGet(void);
void EnablePut(void);
void EnableGet(void);
virtual void Clear(void) = 0;
virtual int Available(void) = 0;
int Free(void) { return 0; }
void Lock(void) { }
void Unlock(void) { }
int Size(void) { return 0; }
public:
cRingBuffer(int Size, bool Statistics = false);
virtual ~cRingBuffer();
void SetTimeouts(int PutTimeout, int GetTimeout);
};
enum eFrameType { ftUnknown, ftVideo, ftAudio, ftDolby };
class cFrame {
friend class cRingBufferFrame;
private:
public:
cFrame(const uchar *Data, int Count, eFrameType = ftUnknown, int Index = -1);
~cFrame();
uchar *Data(void) const { return 0; }
int Count(void) const { return 0; }
eFrameType Type(void) const { return ftUnknown; }
int Index(void) const { return 0; }
};
class cRingBufferFrame : public cRingBuffer {
private:
public:
cRingBufferFrame(int Size, bool Statistics = false);
virtual ~cRingBufferFrame();
virtual int Available(void);
virtual void Clear(void);
// Immediately clears the ring buffer.
bool Put(cFrame *Frame);
// Puts the Frame into the ring buffer.
// Returns true if this was possible.
cFrame *Get(void);
// Gets the next frame from the ring buffer.
// The actual data still remains in the buffer until Drop() is called.
void Drop(cFrame *Frame);
// Drops the Frame that has just been fetched with Get().
};
#endif // __RINGBUFFER_H
// --------- $Id: ringbuffer.h,v 1.2 2016/09/01 15:37:42 richard Exp $ ---------- END
|