You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

  1. using JT1078.Hls.Enums;
  2. using JT1078.Hls.Formatters;
  3. using JT1078.Hls.MessagePack;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. namespace JT1078.Hls
  8. {
  9. public class TS_PMT_Component: ITSMessagePackFormatter
  10. {
  11. /// <summary>
  12. /// 流类型,标志是Video还是Audio还是其他数据,h.264编码对应0x1b,aac编码对应0x0f,mp3编码对应0x03
  13. /// 8bit
  14. /// </summary>
  15. public StreamType StreamType { get; set; }
  16. /// <summary>
  17. /// 固定为二进制111(7)
  18. /// 0111_0000_0000_0000
  19. /// 3bit
  20. /// </summary>
  21. internal byte Reserved1 { get; set; } = 0x07;
  22. /// <summary>
  23. /// 与StreamType对应的PID
  24. /// 13bit
  25. /// </summary>
  26. public ushort ElementaryPID { get; set; }
  27. /// <summary>
  28. /// 固定为二进制1111(15)
  29. /// 1111_0000_0000_0000
  30. /// 4bit
  31. /// </summary>
  32. internal byte Reserved2 { get; set; } = 0x0F;
  33. /// <summary>
  34. /// 描述信息,指定为0x000表示没有
  35. /// 12bit
  36. /// </summary>
  37. internal ushort ESInfoLength { get; set; } = 0x000;
  38. public void ToBuffer(ref TSMessagePackWriter writer)
  39. {
  40. writer.WriteByte((byte)StreamType);
  41. writer.WriteUInt16((ushort)(0111_0000_0000_0000| ElementaryPID));
  42. writer.WriteUInt16((ushort)(1111_0000_0000_0000| ESInfoLength));
  43. }
  44. }
  45. }