-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpat.hpp
More file actions
43 lines (34 loc) · 745 Bytes
/
pat.hpp
File metadata and controls
43 lines (34 loc) · 745 Bytes
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
#ifndef _TSD_PAT_HPP_
#define _TSD_PAT_HPP_
#include <cstdint>
#include <map>
#include "util.hpp"
namespace tsd
{
class program_association_table
{
public:
struct association_pair
{
association_pair(uint16_t pnum, uint16_t pmt) :
program_number(pnum),
pmt_pid(pmt) {}
uint16_t program_number;
uint16_t pmt_pid;
};
public:
std::vector<association_pair> association;
public:
program_association_table() {}
void unpack(const char* data, size_t size) {
const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
const uint8_t* pend = p+size;
while(pend - p >= 4+4) {
association.push_back(
association_pair(get16(p), get16(p+2) & 0x1FFF));
p += 4;
}
}
};
}
#endif