PatParse.h
上传用户:thjx518
上传日期:2022-03-16
资源大小:179k
文件大小:3k
源码类别:

mpeg/mp3

开发平台:

Visual C++

  1. // PatParse.h: interface for the CPatParse class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #ifndef __PATPARSE_H__
  5. #define __PATPARSE_H__
  6. #include"PrivateSection.h"
  7. #define PSI_MAX_PROGRAMS 32
  8. #define PSI_MAX_DESCRIPTORS 32
  9. #define PSI_MAX_SI_STREAMS 32
  10. #define PSI_MAX_DESCRIPTORS 32
  11. #define PSI_MAX_SERVICES 32
  12. #define PSI_MAX_EVENTS 32 //perhaps must be large than 32 events
  13. #define PSI_MAX_NIT_STREAM_DESCRIPTORS 1
  14. #define PSI_MAX_TRANSPORT_STREAMS 255
  15. #define MAX_DESCRIPTOR_LENGTH 256
  16. typedef struct
  17. {
  18. USHORT programNumber;
  19. USHORT programMapPID;
  20. } ProgramType;
  21. typedef struct
  22. {
  23. UCHAR tableId;
  24. USHORT sectionLength;
  25. USHORT streamId;
  26. UCHAR versionNo;
  27. UCHAR currentNext;
  28. UCHAR sectionNo;
  29. UCHAR lastSectionNo;
  30. UCHAR numProgs;
  31. ProgramType programs[PSI_MAX_PROGRAMS];
  32. } PATType;
  33. typedef struct
  34. {
  35. UCHAR tag;
  36. UCHAR length;
  37. UCHAR data[MAX_DESCRIPTOR_LENGTH];
  38. } DescriptorType;
  39. typedef struct
  40. {
  41. UCHAR typeOfStream;
  42. USHORT pid;
  43. UCHAR numDescriptors;
  44. DescriptorType descriptor[PSI_MAX_DESCRIPTORS];
  45. } SIStreamType;
  46. typedef struct
  47. {
  48. UCHAR tableId;
  49. USHORT sectionLength;
  50. USHORT programNumber;
  51. UCHAR versionNo;
  52. USHORT pcrPid;
  53. UCHAR numDescriptors;
  54. UCHAR numStreams;
  55. DescriptorType descriptor[PSI_MAX_DESCRIPTORS];
  56. SIStreamType stream[PSI_MAX_SI_STREAMS];
  57. } PMTType;
  58. typedef struct
  59. {
  60. USHORT streamId;
  61. USHORT networkId;
  62. UCHAR numDescriptors;
  63. DescriptorType descriptor[PSI_MAX_NIT_STREAM_DESCRIPTORS];
  64. } NITStreamType;
  65. typedef struct
  66. {
  67. UCHAR tableId;
  68. USHORT sectionLength;
  69. UCHAR sectionNo;
  70. UCHAR lastSectionNo;
  71. USHORT networkId;
  72. UCHAR versionNo;
  73. UCHAR numDescriptors;
  74. UCHAR numStreams;
  75. DescriptorType descriptor[PSI_MAX_DESCRIPTORS];
  76. NITStreamType stream[PSI_MAX_TRANSPORT_STREAMS];
  77. } NITType;
  78. /* Service description structures */
  79. typedef struct
  80. {
  81. USHORT serviceId;
  82. UCHAR eitSchedule;
  83. UCHAR eitPresent;
  84. UCHAR runningStatus;
  85. UCHAR freeCAMode;
  86. UCHAR numDescriptors;
  87. DescriptorType descriptor[PSI_MAX_DESCRIPTORS];
  88. } ServiceType;
  89. typedef struct
  90. {
  91. UCHAR tableId;
  92. USHORT sectionLength;
  93. USHORT streamId;
  94. UCHAR versionNo;
  95. UCHAR sectionNo;
  96. UCHAR lastSectionNo;
  97. USHORT origNetId;
  98. USHORT numServices;
  99. ServiceType service[PSI_MAX_SERVICES];
  100. } SDTType;
  101. /* Event information structures */
  102. typedef enum
  103. {
  104. UNDEFINED,
  105. NOT_RUNNING,
  106. START_IN_FEW_SECS,
  107. PAUSING,
  108. RUNNING
  109. } RunStatusType;
  110. typedef enum
  111. {
  112. UNSCRAMBLED,
  113. SCRAMBLED
  114. } CAModeType;
  115. typedef struct
  116. {
  117. USHORT eventId;
  118. UINT startTimeHi;
  119. UCHAR startTimeLo;
  120. UINT duration;
  121. RunStatusType runningStatus;
  122. CAModeType caMode;
  123. UCHAR numDescriptors;
  124. DescriptorType descriptor[PSI_MAX_DESCRIPTORS];
  125. } EventType;
  126. typedef struct
  127. {
  128. UCHAR tableId;
  129. USHORT sectionLength;
  130. USHORT serviceId;
  131. UCHAR versionNo;
  132. USHORT streamId;
  133. USHORT numEvents;
  134. EventType event[PSI_MAX_EVENTS];
  135. } EITType;
  136. extern void GetDateTimeFromMJD(__int64 mjd,char*tmstr);
  137. extern int ParsePat(CTSParse*ts,PATType*pat);
  138. extern int ParsePmt(CTSParse*ts,PMTType*pmt,USHORT pmtpid);
  139. extern int ParseNit(CTSParse*ts,NITType*nit,bool actual);
  140. extern int ParseSdt(CTSParse*ts,SDTType*sdt,bool actual);
  141. extern int ParseEit(CTSParse*ts,EITType*eit,UCHAR tableid,USHORT serviceid);
  142. #endif