您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

152 行
8.6KB

  1. #ifndef _mpeg_proto_h_
  2. #define _mpeg_proto_h_
  3. // Table 2-3 - PID table(p36)
  4. enum ETS_PID
  5. {
  6. TS_PID_PAT = 0x00, // program association table
  7. TS_PID_CAT = 0x01, // conditional access table
  8. TS_PID_TSDT = 0x02, // transport stream description table
  9. TS_PID_IPMP = 0x03, // IPMP control information table
  10. // 0x0004-0x000F Reserved
  11. // 0x0010-0x1FFE May be assigned as network_PID, Program_map_PID, elementary_PID, or for other purposes
  12. TS_PID_SDT = 0x11, // https://en.wikipedia.org/wiki/Service_Description_Table / https://en.wikipedia.org/wiki/MPEG_transport_stream
  13. TS_PID_USER = 0x0042,
  14. TS_PID_NULL = 0x1FFF, // Null packet
  15. };
  16. // 2.4.4.4 Table_id assignments
  17. // Table 2-31 - table_id assignment values(p66/p39)
  18. enum EPAT_TID
  19. {
  20. PAT_TID_PAS = 0x00, // program_association_section
  21. PAT_TID_CAS = 0x01, // conditional_access_section(CA_section)
  22. PAT_TID_PMS = 0x02, // TS_program_map_section
  23. PAT_TID_SDS = 0x03, // TS_description_section
  24. PAT_TID_MPEG4_scene = 0x04, // ISO_IEC_14496_scene_description_section
  25. PAT_TID_MPEG4_object = 0x05, // ISO_IEC_14496_object_descriptor_section
  26. PAT_TID_META = 0x06, // Metadata_section
  27. PAT_TID_IPMP = 0x07, // IPMP_Control_Information_section(defined in ISO/IEC 13818-11)
  28. PAT_TID_H222 = 0x08, // Rec. ITU-T H.222.0 | ISO/IEC 13818-1 reserved
  29. PAT_TID_USER = 0x40, // User private
  30. PAT_TID_SDT = 0x42, // service_description_section
  31. PAT_TID_Forbidden = 0xFF,
  32. };
  33. // ISO/IEC 13818-1:2015 (E)
  34. // 2.4.4.9 Semantic definition of fields in transport stream program map section
  35. // Table 2-34 - Stream type assignments(p69)
  36. enum EPSI_STREAM_TYPE
  37. {
  38. PSI_STREAM_RESERVED = 0x00, // ITU-T | ISO/IEC Reserved
  39. PSI_STREAM_MPEG1 = 0x01, // ISO/IEC 11172-2 Video
  40. PSI_STREAM_MPEG2 = 0x02, // Rec. ITU-T H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream(see Note 2)
  41. PSI_STREAM_AUDIO_MPEG1 = 0x03, // ISO/IEC 11172-3 Audio
  42. PSI_STREAM_MP3 = 0x04, // ISO/IEC 13818-3 Audio
  43. PSI_STREAM_PRIVATE_SECTION = 0x05, // Rec. ITU-T H.222.0 | ISO/IEC 13818-1 private_sections
  44. PSI_STREAM_PRIVATE_DATA = 0x06, // Rec. ITU-T H.222.0 | ISO/IEC 13818-1 PES packets containing private data
  45. PSI_STREAM_MHEG = 0x07, // ISO/IEC 13522 MHEG
  46. PSI_STREAM_DSMCC = 0x08, // Rec. ITU-T H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC
  47. PSI_STREAM_H222_ATM = 0x09, // Rec. ITU-T H.222.1
  48. PSI_STREAM_DSMCC_A = 0x0a, // ISO/IEC 13818-6(Extensions for DSM-CC) type A
  49. PSI_STREAM_DSMCC_B = 0x0b, // ISO/IEC 13818-6(Extensions for DSM-CC) type B
  50. PSI_STREAM_DSMCC_C = 0x0c, // ISO/IEC 13818-6(Extensions for DSM-CC) type C
  51. PSI_STREAM_DSMCC_D = 0x0d, // ISO/IEC 13818-6(Extensions for DSM-CC) type D
  52. PSI_STREAM_H222_Aux = 0x0e, // Rec. ITU-T H.222.0 | ISO/IEC 13818-1 auxiliary
  53. PSI_STREAM_AAC = 0x0f, // ISO/IEC 13818-7 Audio with ADTS transport syntax
  54. PSI_STREAM_MPEG4 = 0x10, // ISO/IEC 14496-2 Visual
  55. PSI_STREAM_MPEG4_AAC_LATM = 0x11, // ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3
  56. PSI_STREAM_MPEG4_PES = 0x12, // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
  57. PSI_STREAM_MPEG4_SECTIONS = 0x13, // ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC 14496_sections
  58. PSI_STREAM_MPEG2_SDP = 0x14, // ISO/IEC 13818-6 Synchronized Download Protocol
  59. PSI_STREAM_PES_META = 0x15, // Metadata carried in PES packets
  60. PSI_STREAM_SECTION_META = 0x16, // Metadata carried in metadata_sections
  61. PSI_STREAM_DSMCC_DATA = 0x17, // Metadata carried in ISO/IEC 13818-6 Data Carousel
  62. PSI_STREAM_DSMCC_OBJECT = 0x18, // Metadata carried in ISO/IEC 13818-6 Object Carousel
  63. PSI_STREAM_DSMCC_SDP = 0x19, // Metadata carried in ISO/IEC 13818-6 Synchronized Download Protocol
  64. PSI_STREAM_MPEG2_IPMP = 0x1a, // IPMP stream (defined in ISO/IEC 13818-11, MPEG-2 IPMP)
  65. PSI_STREAM_H264 = 0x1b, // H.264
  66. PSI_STREAM_MPEG4_AAC = 0x1c, // ISO/IEC 14496-3 Audio, without using any additional transport syntax, such as DST, ALS and SLS
  67. PSI_STREAM_MPEG4_TEXT = 0x1d, // ISO/IEC 14496-17 Text
  68. PSI_STREAM_AUX_VIDEO = 0x1e, // Auxiliary video stream as defined in ISO/IEC 23002-3
  69. PSI_STREAM_H264_SVC = 0x1f, // SVC video sub-bitstream of an AVC video stream conforming to one or more profiles defined in Annex G of Rec. ITU-T H.264 | ISO/IEC 14496-10
  70. PSI_STREAM_H264_MVC = 0x20, // MVC video sub-bitstream of an AVC video stream conforming to one or more profiles defined in Annex H of Rec. ITU-T H.264 | ISO/IEC 14496-10
  71. PSI_STREAM_JPEG_2000 = 0x21, // Video stream conforming to one or more profiles as defined in Rec. ITU-T T.800 | ISO/IEC 15444-1
  72. PSI_STREAM_MPEG2_3D = 0x22, // Additional view Rec. ITU-T H.262 | ISO/IEC 13818-2 video stream for service-compatible stereoscopic 3D services
  73. PSI_STREAM_MPEG4_3D = 0x23, // Additional view Rec. ITU-T H.264 | ISO/IEC 14496-10 video stream conforming to one or more profiles defined in Annex A for service-compatible stereoscopic 3D services
  74. PSI_STREAM_H265 = 0x24, // Rec. ITU-T H.265 | ISO/IEC 23008-2 video stream or an HEVC temporal video sub-bitstream
  75. PSI_STREAM_H265_subset = 0x25, // HEVC temporal video subset of an HEVC video stream conforming to one or more profiles defined in Annex A of Rec. ITU-T H.265 | ISO/IEC 23008-2
  76. PSI_STREAM_H264_MVCD = 0x26, // MVCD video sub-bitstream of an AVC video stream conforming to one or more profiles defined in Annex I of Rec. ITU-T H.264 | ISO/IEC 14496-10
  77. PSI_STREAM_VP8 = 0x9d,
  78. PSI_STREAM_VP9 = 0x9e,
  79. PSI_STREAM_AV1 = 0x9f,
  80. // 0x27-0x7E Rec. ITU-T H.222.0 | ISO/IEC 13818-1 Reserved
  81. PSI_STREAM_IPMP = 0x7F, // IPMP stream
  82. // 0x80-0xFF User Private
  83. PSI_STREAM_VIDEO_CAVS = 0x42, // ffmpeg/libavformat/mpegts.h
  84. PSI_STREAM_AUDIO_AC3 = 0x81, // ffmpeg/libavformat/mpegts.h
  85. PSI_STREAM_AUDIO_EAC3 = 0x87, // ffmpeg/libavformat/mpegts.h
  86. PSI_STREAM_AUDIO_DTS = 0x8a, // ffmpeg/libavformat/mpegts.h
  87. PSI_STREAM_VIDEO_DIRAC = 0xd1, // ffmpeg/libavformat/mpegts.h
  88. PSI_STREAM_VIDEO_VC1 = 0xea, // ffmpeg/libavformat/mpegts.h
  89. PSI_STREAM_VIDEO_SVAC = 0x80, // GBT 25724-2010 SVAC(2014)
  90. PSI_STREAM_AUDIO_SVAC = 0x9B, // GBT 25724-2010 SVAC(2014)
  91. PSI_STREAM_AUDIO_G711A = 0x90, // GBT 25724-2010 SVAC(2014)
  92. PSI_STREAM_AUDIO_G711U = 0x91,
  93. PSI_STREAM_AUDIO_G722 = 0x92,
  94. PSI_STREAM_AUDIO_G723 = 0x93,
  95. PSI_STREAM_AUDIO_G729 = 0x99,
  96. PSI_STREAM_AUDIO_OPUS = 0x9c,
  97. };
  98. // ISO/IEC 13818-1:2015 (E)
  99. // 2.4.3.7 Semantic definition of fields in PES packet
  100. // Table 2-22 - Stream_id assignments(p54)
  101. // In transport streams, the stream_id may be set to any valid value which correctly describes the elementary stream type as defined in Table 2-22.
  102. // In transport streams, the elementary stream type is specified in the program-specific information as specified in 2.4.4
  103. enum EPES_STREAM_ID
  104. {
  105. PES_SID_SUB = 0x20, // ffmpeg/libavformat/mpeg.h
  106. PES_SID_AC3 = 0x80, // ffmpeg/libavformat/mpeg.h
  107. PES_SID_DTS = 0x88, // ffmpeg/libavformat/mpeg.h
  108. PES_SID_LPCM = 0xA0, // ffmpeg/libavformat/mpeg.h
  109. PES_SID_EXTENSION = 0xB7, // PS system_header extension(p81)
  110. PES_SID_END = 0xB9, // MPEG_program_end_code
  111. PES_SID_START = 0xBA, // Pack start code
  112. PES_SID_SYS = 0xBB, // System header start code
  113. PES_SID_PSM = 0xBC, // program_stream_map
  114. PES_SID_PRIVATE_1 = 0xBD, // private_stream_1
  115. PES_SID_PADDING = 0xBE, // padding_stream
  116. PES_SID_PRIVATE_2 = 0xBF, // private_stream_2
  117. PES_SID_AUDIO = 0xC0, // ISO/IEC 13818-3/11172-3/13818-7/14496-3 audio stream '110x xxxx'
  118. PES_SID_VIDEO = 0xE0, // H.262 | H.264 | H.265 | ISO/IEC 13818-2/11172-2/14496-2/14496-10 video stream '1110 xxxx'
  119. PES_SID_ECM = 0xF0, // ECM_stream
  120. PES_SID_EMM = 0xF1, // EMM_stream
  121. PES_SID_DSMCC = 0xF2, // H.222.0 | ISO/IEC 13818-1/13818-6_DSMCC_stream
  122. PES_SID_13522 = 0xF3, // ISO/IEC_13522_stream
  123. PES_SID_H222_A = 0xF4, // Rec. ITU-T H.222.1 type A
  124. PES_SID_H222_B = 0xF5, // Rec. ITU-T H.222.1 type B
  125. PES_SID_H222_C = 0xF6, // Rec. ITU-T H.222.1 type C
  126. PES_SID_H222_D = 0xF7, // Rec. ITU-T H.222.1 type D
  127. PES_SID_H222_E = 0xF8, // Rec. ITU-T H.222.1 type E
  128. PES_SID_ANCILLARY = 0xF9, // ancillary_stream
  129. PES_SID_MPEG4_SL = 0xFA, // ISO/IEC 14496-1_SL_packetized_stream
  130. PES_SID_MPEG4_Flex = 0xFB, // ISO/IEC 14496-1_FlexMux_stream
  131. PES_SID_META = 0xFC, // metadata stream
  132. PES_SID_EXTEND = 0xFD, // extended_stream_id
  133. PES_SID_RESERVED = 0xFE, // reserved data stream
  134. PES_SID_PSD = 0xFF, // program_stream_directory
  135. };
  136. enum
  137. {
  138. MPEG_FLAG_IDR_FRAME = 0x0001,
  139. MPEG_FLAG_PACKET_LOST = 0x1000, // packet(s) lost before the packet(this packet is ok, but previous packet has missed or corrupted)
  140. MPEG_FLAG_PACKET_CORRUPT = 0x2000, // this packet miss same data(packet lost)
  141. MPEG_FLAG_H264_H265_WITH_AUD = 0x8000,
  142. };
  143. #endif /* !_mpeg_proto_h_ */