File: dvdspu.h

package info (click to toggle)
vdr-plugin-dvd 0.3.6~b03%2Bcvs20090426.0013-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 480 kB
  • ctags: 619
  • sloc: ansic: 4,866; sh: 624; makefile: 89
file content (60 lines) | stat: -rw-r--r-- 1,384 bytes parent folder | download | duplicates (7)
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
/*
 * DVD Player plugin for VDR
 *
 * Copyright (C) 2001.2002 Andreas Schultz <aschultz@warp10.net>
 *
 * This code is distributed under the terms and conditions of the
 * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
 *
 * parts of this file are derived from the OMS program.
 *
 */

#ifndef __DVDSPU_H__
#define __DVDSPU_H__

#include <inttypes.h>

#define SPU_BUFFER_SIZE         (128*1024)

class simpleFIFO {
 private:
    uint8_t *buffer;
    int head;
    int tail;
    int size;

 public:
    simpleFIFO(int Size);
    ~simpleFIFO();
    int Put(const uint8_t *Data, int Count);
    int Get(uint8_t *Data, int Count);
    int Release(int Count);

    int Size(void) const
	{ return size; };
    int Free(void) const
	{ return ((size + tail) - head - 1) % size; };
    int Available(void) const
	{ return ((head + size) - tail) % size; };
    uint8_t const &operator[] (int i) const
	{ return buffer[(tail + i) % size]; };
};

class cSPUassembler: public simpleFIFO
{
 private:
    uint64_t pts;
 public:
    cSPUassembler();

    bool ready(void)
	{ return ((Available() > 2) && (Available() >= getSize())); };
    int getSize(void) { return ((operator[](0)) << 8) | operator[](1); };
    uint64_t getPts(void) { return pts; };

    int Put(const uint8_t *Data, int Count, uint64_t Pts);
};

#endif