Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
52 lines (45 loc) · 1.8 KB

File metadata and controls

52 lines (45 loc) · 1.8 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// Format of the Program Association Table (PAT) is defined in
// ISO/IEC 13818-1, available here:
// http://www.ece.cmu.edu/~ece796/documents/MPEG-2_Systems_IS.doc
#include "ProgramAssociationTable.h"
#include "Util.h"
std::map<uint16_t,uint16_t> ProgramAssociationTable::pids() const {
if(!_pids.empty())
return _pids;
std::cerr << "PAT:" << std::endl;
for(uint16_t i=0; i<_dataLength; i+=4) {
std::cerr << "\t" << static_cast<int>((_data[i]<<8)+_data[i+1]) << " => " << static_cast<int>(((_data[i+2]&0b00011111)<<8)+_data[i+3]) << std::endl;
_pids.insert(std::make_pair((_data[i]<<8)+_data[i+1], ((_data[i+2]&0b00011111)<<8)+_data[i+3]));
}
return _pids;
}
uint16_t ProgramAssociationTable::pid(uint16_t programNumber) const {
if(pids().find(programNumber) != _pids.end())
return _pids[programNumber];
return 0;
}
void ProgramAssociationTable::dump(std::ostream &where, std::string const &indent) const {
Util::SaveIOState isr(where);
DVBTable::dump(where, indent);
std::map<uint16_t,uint16_t> PIDs=pids();
where << std::hex << std::setfill('0');
for(auto const &p: PIDs) {
where << indent << "Program number " << std::setw(4) << p.first << " PID " << std::setw(4) << p.second << std::endl;
}
}
std::map<uint16_t,uint16_t> ProgramAssociationTables::pids() const {
std::map<uint16_t,uint16_t> result;
for(auto const &p: *this) {
std::map<uint16_t,uint16_t> inSection = p->pids();
result.insert(inSection.begin(), inSection.end());
}
return result;
}
void ProgramAssociationTables::dump(std::ostream &where, std::string const &indent) const {
Util::SaveIOState isr(where);
std::map<uint16_t,uint16_t> PIDs=pids();
where << std::hex << std::setfill('0');
for(auto const &p: PIDs) {
where << indent << "Program number " << std::setw(4) << p.first << " PID " << std::setw(4) << p.second << std::endl;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.