vdr
1.7.27
|
00001 /*************************************************************************** 00002 * Copyright (c) 2003 by Marcel Wiesweg * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 * $Id: section.h 2.1 2012/02/26 13:58:26 kls Exp $ 00010 * * 00011 ***************************************************************************/ 00012 00013 #ifndef LIBSI_SECTION_H 00014 #define LIBSI_SECTION_H 00015 00016 #include <time.h> 00017 00018 #include "si.h" 00019 #include "headers.h" 00020 00021 namespace SI { 00022 00023 class PAT : public NumberedSection { 00024 public: 00025 PAT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00026 PAT() {} 00027 class Association : public LoopElement { 00028 public: 00029 int getServiceId() const; 00030 int getPid() const; 00031 bool isNITPid() const { return getServiceId()==0; } 00032 virtual int getLength() { return int(sizeof(pat_prog)); } 00033 protected: 00034 virtual void Parse(); 00035 private: 00036 const pat_prog *s; 00037 }; 00038 int getTransportStreamId() const; 00039 StructureLoop<Association> associationLoop; 00040 protected: 00041 virtual void Parse(); 00042 private: 00043 const pat *s; 00044 }; 00045 00046 class CAT : public NumberedSection { 00047 public: 00048 CAT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00049 CAT() {} 00050 DescriptorLoop loop; 00051 protected: 00052 virtual void Parse(); 00053 }; 00054 00055 class PMT : public NumberedSection { 00056 public: 00057 PMT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00058 PMT() {} 00059 class Stream : public LoopElement { 00060 public: 00061 int getPid() const; 00062 int getStreamType() const; 00063 DescriptorLoop streamDescriptors; 00064 virtual int getLength() { return int(sizeof(pmt_info)+streamDescriptors.getLength()); } 00065 protected: 00066 virtual void Parse(); 00067 private: 00068 const pmt_info *s; 00069 }; 00070 DescriptorLoop commonDescriptors; 00071 StructureLoop<Stream> streamLoop; 00072 int getServiceId() const; 00073 int getPCRPid() const; 00074 protected: 00075 virtual void Parse(); 00076 private: 00077 const pmt *s; 00078 }; 00079 00080 class TSDT : public NumberedSection { 00081 public: 00082 TSDT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00083 TSDT() {} 00084 DescriptorLoop transportStreamDescriptors; 00085 protected: 00086 virtual void Parse(); 00087 private: 00088 const tsdt *s; 00089 }; 00090 00091 class NIT : public NumberedSection { 00092 public: 00093 NIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00094 NIT() {} 00095 class TransportStream : public LoopElement { 00096 public: 00097 int getTransportStreamId() const; 00098 int getOriginalNetworkId() const; 00099 virtual int getLength() { return int(sizeof(ni_ts)+transportStreamDescriptors.getLength()); } 00100 DescriptorLoop transportStreamDescriptors; 00101 protected: 00102 virtual void Parse(); 00103 private: 00104 const ni_ts *s; 00105 }; 00106 DescriptorLoop commonDescriptors; 00107 StructureLoop<TransportStream> transportStreamLoop; 00108 int getNetworkId() const; 00109 protected: 00110 virtual void Parse(); 00111 private: 00112 const nit *s; 00113 }; 00114 00115 //BAT has the same structure as NIT but different allowed descriptors 00116 class BAT : public NIT { 00117 public: 00118 BAT(const unsigned char *data, bool doCopy=true) : NIT(data, doCopy) {} 00119 BAT() {} 00120 int getBouquetId() const { return getNetworkId(); } 00121 }; 00122 00123 class SDT : public NumberedSection { 00124 public: 00125 SDT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00126 SDT() {} 00127 class Service : public LoopElement { 00128 public: 00129 int getServiceId() const; 00130 int getEITscheduleFlag() const; 00131 int getEITpresentFollowingFlag() const; 00132 RunningStatus getRunningStatus() const; 00133 int getFreeCaMode() const; 00134 virtual int getLength() { return int(sizeof(sdt_descr)+serviceDescriptors.getLength()); } 00135 DescriptorLoop serviceDescriptors; 00136 protected: 00137 virtual void Parse(); 00138 private: 00139 const sdt_descr *s; 00140 }; 00141 int getTransportStreamId() const; 00142 int getOriginalNetworkId() const; 00143 StructureLoop<Service> serviceLoop; 00144 protected: 00145 virtual void Parse(); 00146 private: 00147 const sdt *s; 00148 }; 00149 00150 class EIT : public NumberedSection { 00151 public: 00152 EIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00153 EIT() {} 00154 class Event : public LoopElement { 00155 public: 00156 int getEventId() const; 00157 time_t getStartTime() const; //UTC 00158 time_t getDuration() const; 00159 00160 int getMJD() const; 00161 int getStartTimeHour() const; //UTC 00162 int getStartTimeMinute() const; //UTC 00163 int getStartTimeSecond() const; //UTC 00164 int getDurationHour() const; 00165 int getDurationMinute() const; 00166 int getDurationSecond() const; 00167 RunningStatus getRunningStatus() const; 00168 int getFreeCaMode() const; 00169 00170 DescriptorLoop eventDescriptors; 00171 virtual int getLength() { return int(sizeof(eit_event)+eventDescriptors.getLength()); } 00172 protected: 00173 virtual void Parse(); 00174 private: 00175 const eit_event *s; 00176 }; 00177 int getServiceId() const; 00178 int getTransportStreamId() const; 00179 int getOriginalNetworkId() const; 00180 int getSegmentLastSectionNumber() const; 00181 int getLastTableId() const; 00182 StructureLoop<Event> eventLoop; 00183 00184 //true if table conveys present/following information, false if it conveys schedule information 00185 bool isPresentFollowing() const; 00186 //true if table describes TS on which it is broadcast, false if it describes other TS 00187 bool isActualTS() const; 00188 protected: 00189 virtual void Parse(); 00190 private: 00191 const eit *s; 00192 }; 00193 00194 class TDT : public Section { 00195 public: 00196 TDT(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {} 00197 TDT() {} 00198 time_t getTime() const; //UTC 00199 protected: 00200 virtual void Parse(); 00201 private: 00202 const tdt *s; 00203 }; 00204 00205 class TOT : public CRCSection { 00206 public: 00207 TOT(const unsigned char *data, bool doCopy=true) : CRCSection(data, doCopy) {} 00208 TOT() {} 00209 time_t getTime() const; 00210 DescriptorLoop descriptorLoop; 00211 protected: 00212 virtual void Parse(); 00213 private: 00214 const tot *s; 00215 }; 00216 00217 class RST : public Section { 00218 public: 00219 RST(const unsigned char *data, bool doCopy=true) : Section(data, doCopy) {} 00220 RST() {} 00221 class RunningInfo : public LoopElement { 00222 public: 00223 int getTransportStreamId() const; 00224 int getOriginalNetworkId() const; 00225 int getServiceId() const; 00226 int getEventId() const; 00227 RunningStatus getRunningStatus() const; 00228 virtual int getLength() { return int(sizeof(rst_info)); } 00229 protected: 00230 virtual void Parse(); 00231 private: 00232 const rst_info *s; 00233 }; 00234 StructureLoop<RunningInfo> infoLoop; 00235 protected: 00236 virtual void Parse(); 00237 }; 00238 00239 class AIT : public NumberedSection { 00240 public: 00241 AIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00242 AIT() {} 00243 class Application : public LoopElement { 00244 public: 00245 virtual int getLength() { return int(sizeof(ait_app)+applicationDescriptors.getLength()); } 00246 long getOrganisationId() const; 00247 int getApplicationId() const; 00248 int getControlCode() const; 00249 MHP_DescriptorLoop applicationDescriptors; 00250 protected: 00251 virtual void Parse(); 00252 const ait_app *s; 00253 }; 00254 MHP_DescriptorLoop commonDescriptors; 00255 StructureLoop<Application> applicationLoop; 00256 int getApplicationType() const; 00257 int getAITVersion() const; 00258 protected: 00259 const ait *first; 00260 virtual void Parse(); 00261 }; 00262 00263 /* Premiere Content Information Table */ 00264 00265 class PremiereCIT : public NumberedSection { 00266 public: 00267 PremiereCIT(const unsigned char *data, bool doCopy=true) : NumberedSection(data, doCopy) {} 00268 PremiereCIT() {} 00269 int getContentId() const; 00270 time_t getDuration() const; 00271 PCIT_DescriptorLoop eventDescriptors; 00272 protected: 00273 virtual void Parse(); 00274 private: 00275 const pcit *s; 00276 }; 00277 00278 } //end of namespace 00279 00280 #endif //LIBSI_TABLE_H