TsDescriptor.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Diagnostics;
  6. namespace MatrixIO.IO.MpegTs
  7. {
  8. public enum DescriptorTag : byte
  9. {
  10. // 0-1 RESERVED
  11. VideoStream = 2,
  12. AudioStream = 3,
  13. Hierarchy = 4,
  14. Registration = 5,
  15. DataStreamAlignment = 6,
  16. TargetBackgroundGrid = 7,
  17. VideoWindow = 8,
  18. CA = 9,
  19. Iso639Language = 10,
  20. SystemClock = 11,
  21. MultiplexBufferUtilization = 12,
  22. Copyright = 13,
  23. MaximumBitrate = 14,
  24. PrivateDataIndicator = 15,
  25. SmoothingBuffer = 16,
  26. STD = 17,
  27. IBP = 18,
  28. // 19-26 Defined in ISO/IEC 13818-6
  29. AssociationTag = 20,
  30. //
  31. MPEG4Video = 27,
  32. MPEG4Audio = 28,
  33. IOD = 29,
  34. SL = 30,
  35. FMC = 31,
  36. ExternalEsId = 32,
  37. MuxCode = 33,
  38. FmxBufferSize = 34,
  39. MultiplexBuffer = 35,
  40. FlexMuxTiming = 36,
  41. // 37-63 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 RESERVED
  42. // 64-255 User Private
  43. // DVB Descriptors
  44. DVB_NetworkName = 0x40,
  45. DVB_ServiceList = 0x41,
  46. DVB_Stuffing = 0x42,
  47. DVB_SatelliteDeliverySystem = 0x43,
  48. DVB_CableDeliverySystem = 0x44,
  49. DVB_VBIData = 0x45,
  50. DVB_VBITeletext = 0x46,
  51. DVB_BouquetName = 0x47,
  52. DVB_Service = 0x48,
  53. DVB_CountryAvailability = 0x49,
  54. DVB_Linkage = 0x4A,
  55. DVB_NVODReference = 0x4B,
  56. DVB_TimeShiftedService = 0x4C,
  57. DVB_ShortEvent = 0x4D,
  58. DVB_ExtendedEvent = 0x4E,
  59. DVB_TimeShiftedEvent = 0x4F,
  60. DVB_Component = 0x50,
  61. DVB_Mosaic = 0x51,
  62. DVB_StreamIdentifier = 0x52,
  63. DVB_CAIdentifier = 0x53,
  64. DVB_Content = 0x54,
  65. DVB_ParentalRating = 0x55,
  66. DVB_Teletext = 0x56,
  67. DVB_Telephone = 0x57,
  68. DVB_LocalTimeOffset = 0x58,
  69. DVB_Subtitling = 0x59,
  70. DVB_TerrestrialDeliverySystem = 0x5A,
  71. DVB_MultilingualNetworkName = 0x5B,
  72. DVB_MultilingualBouquetName = 0x5C,
  73. DVB_MultilingualServiceName = 0x5D,
  74. DVB_MultilingualComponentName = 0x5E,
  75. DVB_PrivateDataSpecifier = 0x5F,
  76. DVB_ServiceMode = 0x60,
  77. DVB_ShortSmoothingBuffer = 0x61,
  78. DVB_FrequencyList = 0x62,
  79. DVB_PartialTransportStream = 0x63,
  80. DVB_DataBroadcast = 0x64,
  81. DVB_CASystem = 0x65,
  82. DVB_DataBroadcastId = 0x66,
  83. DVB_TransportStream = 0x67,
  84. DVB_DSNG = 0x68,
  85. DVB_PDC = 0x69,
  86. DVB_AC3 = 0x6A,
  87. DVB_AncillaryData = 0x6B,
  88. DVB_CellList = 0x6C,
  89. DVB_CellFrequencyLink = 0x6D,
  90. DVB_AnnouncementSupport = 0x6E,
  91. // ATSC Descriptors
  92. ATSC_Stuffing = 0x80,
  93. ATSC_AC3 = 0x81,
  94. ATSC_TimeShiftedService = 0x82,
  95. ATSC_CaptionService = 0x86,
  96. ATSC_ContentAdvisory = 0x87,
  97. ATSC_DCCArrivingRequest = 0x89,
  98. ATSC_ExtendedChannelName = 0xA0,
  99. ATSC_ServiceLocation = 0xA1,
  100. ATSC_ComponentName = 0xA3,
  101. ATSC_DataService = 0xA4,
  102. ATSC_PIDCount = 0xA5,
  103. ATSC_Download = 0xA6,
  104. ATSC_MultiprotocolEncapsulation = 0xA7,
  105. ATSC_DCCDepartingRequest = 0xA8,
  106. ATSC_RedistributionControl = 0xAA,
  107. ATSC_Genre = 0xAB,
  108. ATSC_PrivateInformation = 0xAD,
  109. ATSC_ContentIdentifier = 0xB6,
  110. }
  111. public abstract class TsDescriptor
  112. {
  113. protected int _position;
  114. protected int _length;
  115. public DescriptorTag Tag { get; set; }
  116. public virtual int Length { get { return 2 + _length; } protected set { _length = value - 2; } }
  117. protected TsDescriptor(byte[] buffer, int offset)
  118. {
  119. _position = offset;
  120. Tag = (DescriptorTag) buffer[_position++];
  121. _length = buffer[_position++];
  122. Debug.WriteLine("Loading Descriptor: " + Tag);
  123. }
  124. }
  125. }