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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/*
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012 Her Majesty the Queen in Right of Canada (Communications
Research Center Canada)
Includes modifications
2012, Matthias P. Braendli, matthias.braendli@mpb.li
This file defines all data structures used in DabMux to represent
and save ensemble data.
*/
/*
This file is part of ODR-DabMux.
ODR-DabMux is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
ODR-DabMux is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ODR-DabMux. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MUX_ELEMENTS
#define _MUX_ELEMENTS
#include <vector>
#include <functional>
#include <algorithm>
#include <stdint.h>
#include "dabOutput/dabOutput.h"
#include "dabInput.h"
#include "Eti.h"
using namespace std;
struct dabOutput {
dabOutput(const char* proto, const char* name) :
outputProto(proto), outputName(name), output(NULL) { }
// outputs are specified with outputProto://outputName
// during config parsing
std::string outputProto;
std::string outputName;
// later, the corresponding output is then created
DabOutput* output;
};
struct dabLabel {
char text[16];
uint16_t flag;
};
struct dabService;
struct dabComponent;
struct dabSubchannel;
struct dabEnsemble {
uint16_t id;
uint8_t ecc;
dabLabel label;
uint8_t mode;
vector<dabService*> services;
vector<dabComponent*> components;
vector<dabSubchannel*> subchannels;
};
struct dabProtectionShort {
unsigned char tableSwitch;
unsigned char tableIndex;
};
struct dabProtectionLong {
unsigned char option;
};
struct dabProtection {
unsigned char level;
unsigned char form;
union {
dabProtectionShort shortForm;
dabProtectionLong longForm;
};
};
struct dabSubchannel {
const char* inputProto;
const char* inputName;
DabInputBase* input;
unsigned char id;
unsigned char type;
uint16_t startAddress;
uint16_t bitrate;
dabProtection protection;
};
class SubchannelId : public std::binary_function <dabSubchannel*, int, bool> {
public:
bool operator()(const dabSubchannel* subchannel, const int id) const {
return subchannel->id == id;
}
};
struct dabAudioComponent {
};
struct dabDataComponent {
};
struct dabFidcComponent {
};
struct dabPacketComponent {
uint16_t id;
uint16_t address;
uint16_t appType;
bool datagroup;
};
struct dabComponent {
dabLabel label;
uint32_t serviceId;
uint8_t subchId;
uint8_t type;
uint8_t SCIdS;
union {
dabAudioComponent audio;
dabDataComponent data;
dabFidcComponent fidc;
dabPacketComponent packet;
};
bool isPacketComponent(vector<dabSubchannel*>& subchannels);
};
struct dabService {
dabLabel label;
uint32_t id;
unsigned char pty;
unsigned char language;
bool program;
unsigned char getType(dabEnsemble* ensemble);
unsigned char nbComponent(vector<dabComponent*>& components);
};
vector<dabSubchannel*>::iterator getSubchannel(
vector<dabSubchannel*>& subchannels, int id);
vector<dabComponent*>::iterator getComponent(
vector<dabComponent*>& components,
uint32_t serviceId,
vector<dabComponent*>::iterator current);
vector<dabComponent*>::iterator getComponent(
vector<dabComponent*>& components,
uint32_t serviceId);
vector<dabService*>::iterator getService(
dabComponent* component,
vector<dabService*>& services);
unsigned short getSizeCu(dabSubchannel* subchannel);
unsigned short getSizeDWord(dabSubchannel* subchannel);
unsigned short getSizeByte(dabSubchannel* subchannel);
unsigned short getSizeWord(dabSubchannel* subchannel);
#endif
|