forked from berolinaro/dvbv5-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProgramMapTable.h
73 lines (66 loc) · 2 KB
/
ProgramMapTable.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
#pragma once
#include "DVBTable.h"
#include "DVBDescriptor.h"
#include <iostream>
#include <vector>
#include <map>
class Stream {
public:
Stream(uint8_t streamType, uint16_t pid, std::vector<DVBDescriptor*> descriptors):_streamType(streamType),_pid(pid),_descriptors(descriptors) { }
uint8_t streamType() const { return _streamType; }
uint16_t pid() const { return _pid; }
std::vector<DVBDescriptor*> descriptors() const { return _descriptors; }
void dump(std::ostream &where=std::cerr, std::string const &indent="") const;
bool isAudio() const;
bool isVideo() const;
bool isTeletext() const;
bool isSubtitle() const;
bool isPcr() const;
enum StreamType {
Video,
Audio,
Teletext,
Subtitle,
PCR,
Other,
Any
};
StreamType type() const;
protected:
uint8_t _streamType;
uint16_t _pid;
std::vector<DVBDescriptor*> _descriptors;
};
class ProgramMapTable:public DVBTable {
friend class Program;
public:
ProgramMapTable(DVBTable *t):DVBTable(t) { }
uint16_t programNumber() const { return _number; }
uint16_t pcrPid() const { return _pcrPid; }
virtual void dump(std::ostream &where=std::cerr, std::string const &indent="") const override;
static constexpr uint8_t tableFilter = ProgramMap;
static constexpr uint8_t tableMask = 0xff;
protected:
uint16_t _pcrPid;
};
class Program;
class ProgramMapTables:public DVBTables<ProgramMapTable> {
public:
ProgramMapTables():DVBTables<ProgramMapTable>() { }
ProgramMapTables(ProgramMapTable *t):DVBTables<ProgramMapTable>(t) { }
std::map<uint16_t,uint16_t> pids() const;
Program program() const;
};
class Program {
public:
Program(ProgramMapTables const &pmts);
std::vector<DVBDescriptor*> const &descriptors() const { return _descriptors; }
std::vector<Stream> const &streams() const { return _streams; }
void dump(std::ostream &where=std::cerr, std::string const &indent="") const;
uint16_t pcrPid() const { return _pcrPid; }
protected:
uint16_t _programNumber;
uint16_t _pcrPid;
std::vector<DVBDescriptor*> _descriptors;
std::vector<Stream> _streams;
};