vdr  2.2.0
section.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2003 by Marcel Wiesweg *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * $Id: section.h 3.0 2012/02/26 13:58:26 kls Exp $
10  * *
11  ***************************************************************************/
12 
13 #ifndef LIBSI_SECTION_H
14 #define LIBSI_SECTION_H
15 
16 #include <time.h>
17 
18 #include "si.h"
19 #include "headers.h"
20 
21 namespace SI {
22 
23 class PAT : public NumberedSection {
24 public:
25  PAT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
26  PAT() {}
27  class Association : public LoopElement {
28  public:
29  int getServiceId() const;
30  int getPid() const;
31  bool isNITPid() const { return getServiceId()==0; }
32  virtual int getLength() { return int(sizeof(pat_prog)); }
33  protected:
34  virtual void Parse();
35  private:
36  const pat_prog *s;
37  };
38  int getTransportStreamId() const;
40 protected:
41  virtual void Parse();
42 private:
43  const pat *s;
44 };
45 
46 class CAT : public NumberedSection {
47 public:
48  CAT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
49  CAT() {}
51 protected:
52  virtual void Parse();
53 };
54 
55 class PMT : public NumberedSection {
56 public:
57  PMT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
58  PMT() {}
59  class Stream : public LoopElement {
60  public:
61  int getPid() const;
62  int getStreamType() const;
64  virtual int getLength() { return int(sizeof(pmt_info)+streamDescriptors.getLength()); }
65  protected:
66  virtual void Parse();
67  private:
68  const pmt_info *s;
69  };
72  int getServiceId() const;
73  int getPCRPid() const;
74 protected:
75  virtual void Parse();
76 private:
77  const pmt *s;
78 };
79 
80 class TSDT : public NumberedSection {
81 public:
82  TSDT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
83  TSDT() {}
85 protected:
86  virtual void Parse();
87 private:
88  const tsdt *s;
89 };
90 
91 class NIT : public NumberedSection {
92 public:
93  NIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
94  NIT() {}
95  class TransportStream : public LoopElement {
96  public:
97  int getTransportStreamId() const;
98  int getOriginalNetworkId() const;
99  virtual int getLength() { return int(sizeof(ni_ts)+transportStreamDescriptors.getLength()); }
101  protected:
102  virtual void Parse();
103  private:
104  const ni_ts *s;
105  };
108  int getNetworkId() const;
109 protected:
110  virtual void Parse();
111 private:
112  const nit *s;
113 };
114 
115 //BAT has the same structure as NIT but different allowed descriptors
116 class BAT : public NIT {
117 public:
118  BAT(const unsigned char *data, bool doCopy=true) : NIT(data, doCopy) {}
119  BAT() {}
120  int getBouquetId() const { return getNetworkId(); }
121 };
122 
123 class SDT : public NumberedSection {
124 public:
125  SDT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
126  SDT() {}
127  class Service : public LoopElement {
128  public:
129  int getServiceId() const;
130  int getEITscheduleFlag() const;
131  int getEITpresentFollowingFlag() const;
132  RunningStatus getRunningStatus() const;
133  int getFreeCaMode() const;
134  virtual int getLength() { return int(sizeof(sdt_descr)+serviceDescriptors.getLength()); }
136  protected:
137  virtual void Parse();
138  private:
139  const sdt_descr *s;
140  };
141  int getTransportStreamId() const;
142  int getOriginalNetworkId() const;
144 protected:
145  virtual void Parse();
146 private:
147  const sdt *s;
148 };
149 
150 class EIT : public NumberedSection {
151 public:
152  EIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
153  EIT() {}
154  class Event : public LoopElement {
155  public:
156  int getEventId() const;
157  time_t getStartTime() const; //UTC
158  time_t getDuration() const;
159 
160  int getMJD() const;
161  int getStartTimeHour() const; //UTC
162  int getStartTimeMinute() const; //UTC
163  int getStartTimeSecond() const; //UTC
164  int getDurationHour() const;
165  int getDurationMinute() const;
166  int getDurationSecond() const;
167  RunningStatus getRunningStatus() const;
168  int getFreeCaMode() const;
169 
171  virtual int getLength() { return int(sizeof(eit_event)+eventDescriptors.getLength()); }
172  protected:
173  virtual void Parse();
174  private:
175  const eit_event *s;
176  };
177  int getServiceId() const;
178  int getTransportStreamId() const;
179  int getOriginalNetworkId() const;
180  int getSegmentLastSectionNumber() const;
181  int getLastTableId() const;
183 
184  //true if table conveys present/following information, false if it conveys schedule information
185  bool isPresentFollowing() const;
186  //true if table describes TS on which it is broadcast, false if it describes other TS
187  bool isActualTS() const;
188 protected:
189  virtual void Parse();
190 private:
191  const eit *s;
192 };
193 
194 class TDT : public Section {
195 public:
196  TDT(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {}
197  TDT() {}
198  time_t getTime() const; //UTC
199 protected:
200  virtual void Parse();
201 private:
202  const tdt *s;
203 };
204 
205 class TOT : public CRCSection {
206 public:
207  TOT(const unsigned char *data, bool doCopy=true) : CRCSection(data, doCopy) {}
208  TOT() {}
209  time_t getTime() const;
211 protected:
212  virtual void Parse();
213 private:
214  const tot *s;
215 };
216 
217 class RST : public Section {
218 public:
219  RST(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {}
220  RST() {}
221  class RunningInfo : public LoopElement {
222  public:
223  int getTransportStreamId() const;
224  int getOriginalNetworkId() const;
225  int getServiceId() const;
226  int getEventId() const;
227  RunningStatus getRunningStatus() const;
228  virtual int getLength() { return int(sizeof(rst_info)); }
229  protected:
230  virtual void Parse();
231  private:
232  const rst_info *s;
233  };
235 protected:
236  virtual void Parse();
237 };
238 
239 class AIT : public NumberedSection {
240 public:
241  AIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
242  AIT() {}
243  class Application : public LoopElement {
244  public:
245  virtual int getLength() { return int(sizeof(ait_app)+applicationDescriptors.getLength()); }
246  long getOrganisationId() const;
247  int getApplicationId() const;
248  int getControlCode() const;
250  protected:
251  virtual void Parse();
252  const ait_app *s;
253  };
256  int getApplicationType() const;
257  int getAITVersion() const;
258 protected:
259  const ait *first;
260  virtual void Parse();
261 };
262 
263 /* Premiere Content Information Table */
264 
265 class PremiereCIT : public NumberedSection {
266 public:
267  PremiereCIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {}
269  int getContentId() const;
270  time_t getDuration() const;
272 protected:
273  virtual void Parse();
274 private:
275  const pcit *s;
276 };
277 
278 } //end of namespace
279 
280 #endif //LIBSI_TABLE_H
StructureLoop< RunningInfo > infoLoop
Definition: section.h:234
MHP_DescriptorLoop applicationDescriptors
Definition: section.h:249
virtual int getLength()
Definition: section.h:32
MHP_DescriptorLoop commonDescriptors
Definition: section.h:254
StructureLoop< Event > eventLoop
Definition: section.h:182
RunningStatus
Definition: si.h:197
time_t getTime(unsigned char date_hi, unsigned char date_lo, unsigned char timehr, unsigned char timemi, unsigned char timese)
Definition: util.c:190
PMT()
Definition: section.h:58
SDT(const unsigned char *data, bool doCopy=true)
Definition: section.h:125
virtual int getLength()
Definition: section.h:171
int getBouquetId() const
Definition: section.h:120
virtual int getLength()
Definition: si.h:294
const eit_event * s
Definition: section.h:175
const nit * s
Definition: section.h:112
DescriptorLoop transportStreamDescriptors
Definition: section.h:84
const eit * s
Definition: section.h:191
StructureLoop< Association > associationLoop
Definition: section.h:39
AIT(const unsigned char *data, bool doCopy=true)
Definition: section.h:241
StructureLoop< Stream > streamLoop
Definition: section.h:71
virtual int getLength()
Definition: section.h:64
StructureLoop< Service > serviceLoop
Definition: section.h:143
DescriptorLoop commonDescriptors
Definition: section.h:70
PremiereCIT(const unsigned char *data, bool doCopy=true)
Definition: section.h:267
time_t getDuration(unsigned char timehr, unsigned char timemi, unsigned char timese)
Definition: util.c:213
EIT()
Definition: section.h:153
DescriptorLoop transportStreamDescriptors
Definition: section.h:100
int getPid() const
Definition: section.c:34
DescriptorLoop commonDescriptors
Definition: section.h:106
Definition: descriptor.c:16
const tsdt * s
Definition: section.h:88
virtual int getLength()
Definition: section.h:134
PMT(const unsigned char *data, bool doCopy=true)
Definition: section.h:57
BAT()
Definition: section.h:119
virtual int getLength()
Definition: section.h:228
NIT(const unsigned char *data, bool doCopy=true)
Definition: section.h:93
NIT()
Definition: section.h:94
const tot * s
Definition: section.h:214
const pmt_info * s
Definition: section.h:68
const pat_prog * s
Definition: section.h:36
BAT(const unsigned char *data, bool doCopy=true)
Definition: section.h:118
StructureLoop< TransportStream > transportStreamLoop
Definition: section.h:107
TDT(const unsigned char *data, bool doCopy=true)
Definition: section.h:196
DescriptorLoop serviceDescriptors
Definition: section.h:135
RST()
Definition: section.h:220
const pat * s
Definition: section.h:43
const sdt_descr * s
Definition: section.h:139
TOT(const unsigned char *data, bool doCopy=true)
Definition: section.h:207
virtual void Parse()
Definition: section.c:38
TOT()
Definition: section.h:208
SDT()
Definition: section.h:126
RST(const unsigned char *data, bool doCopy=true)
Definition: section.h:219
bool isNITPid() const
Definition: section.h:31
TSDT()
Definition: section.h:83
int getServiceId() const
Definition: section.c:30
PCIT_DescriptorLoop eventDescriptors
Definition: section.h:271
DescriptorLoop descriptorLoop
Definition: section.h:210
const tdt * s
Definition: section.h:202
StructureLoop< Application > applicationLoop
Definition: section.h:255
const rst_info * s
Definition: section.h:232
const ait_app * s
Definition: section.h:252
const pmt * s
Definition: section.h:77
EIT(const unsigned char *data, bool doCopy=true)
Definition: section.h:152
AIT()
Definition: section.h:242
int getTransportStreamId() const
Definition: section.c:26
DescriptorLoop streamDescriptors
Definition: section.h:63
TDT()
Definition: section.h:197
const ni_ts * s
Definition: section.h:104
CAT(const unsigned char *data, bool doCopy=true)
Definition: section.h:48
const sdt * s
Definition: section.h:147
TSDT(const unsigned char *data, bool doCopy=true)
Definition: section.h:82
CharArray data
Definition: si.h:241
const pcit * s
Definition: section.h:275
virtual int getLength()
Definition: section.h:245
DescriptorLoop loop
Definition: section.h:50
PAT()
Definition: section.h:26
const ait * first
Definition: section.h:259
DescriptorLoop eventDescriptors
Definition: section.h:170
PAT(const unsigned char *data, bool doCopy=true)
Definition: section.h:25
CAT()
Definition: section.h:49
virtual int getLength()
Definition: section.h:99