-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathproTsFile.h
74 lines (46 loc) · 1.42 KB
/
proTsFile.h
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
//////////////////////////////////////////////////////////////////////
#include "VBufferT.h"
#include <stdio.h>
#define DWORD unsigned long
#define INT int
#define INT64 long long
#define PVOID void*
#define BOOL unsigned char
#define BYTE char
const int TS_PACKET_BUFFER_SIZE_MAX = 1024 * 1024 * 100;
const int TS_PACKET_SIZE_MAX = 204;
const int TS_PACKET_SIZE_MIN = 188;
const int TS_PACKET_188 = 188;
const int TS_PACKET_196 = 196;
const int TS_PACKET_204 = 204;
const int PCR_BASS_FREQUENCY = 90000;
const int PCR_BASS = 90;
typedef void (*GetTsPacketDataCB)(void* p_user_data);
class Source_TsFile
{
public:
Source_TsFile();
~Source_TsFile();
BOOL Open(char *ts_file_path);
BOOL Close();
BOOL SetGetTsPacketDataCB(GetTsPacketDataCB pCB, void* p_user_data, DWORD packet_get_size);
BOOL GetTsPacketData(BYTE*& p_data, DWORD& data_size);
BOOL m_bFinish;
private:
static PVOID ReadTSThread(PVOID param);
DWORD ReadTS();
DWORD GetTickCount();
void FillBuffer(const BYTE* pData, DWORD dataSize);
BOOL GetPcr(const BYTE* p_ts_packet, INT64* p_pcr, INT* p_pcr_pid);
BOOL GotoSync();
BOOL ReadBuffer();
FILE *m_hFile;
GetTsPacketDataCB m_pGetDataCB;
void* m_pCBUserData;
DWORD m_PacketGetSize;
Buffer m_BufferSync;
Buffer m_Buffer;
int m_nTsPacketSize;
VBufferT m_vTsPacket;
Buffer m_TsPacketData;
};