summaryrefslogtreecommitdiffstats
path: root/HBFifo.h
blob: a46d46158cf2407ba851e7c7588e8c94be659f32 (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
/* $Id: HBFifo.h,v 1.9 2003/08/24 13:27:41 titer Exp $ */

#ifndef _HB_FIFO_H
#define _HB_FIFO_H

#define DVD_DATA     0x01
#define MPEG2_VIDEO  0x02
#define RAW_VIDEO    0x04
#define RAW2_VIDEO   0x08
#define MPEG4_VIDEO  0x10
#define AC3_AUDIO    0x20
#define RAW_AUDIO    0x40
#define MP3_AUDIO    0x80

class BLocker;

class HBBuffer
{
    public:
        /* Common functions */
        HBBuffer( int size );
        ~HBBuffer();
        void      ReAlloc( int size );
        
        /* Common members */
        uint32_t  fAllocSize;
        uint32_t  fSize;
        uint8_t * fData;

        /* Misc */
        float     fPosition;
        uint32_t  fStreamId;
        bool      fKeyFrame;
        uint64_t  fPTS;
};

class HBFifo
{
    public:
        HBFifo( int capacity );
        void Die();
        ~HBFifo();

        int Size();
        int Capacity();
        bool Push( HBBuffer * buffer );
        HBBuffer * Pop();
        
    private:
        void Lock();
        void Unlock();

        int fCapacity;
        int fWhereToPush;
        int fWhereToPop;
        HBBuffer ** fBuffers;
        BLocker * fLocker;
        volatile bool fDie;
};

#endif