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

28 行
818 B

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Buffers.Binary;
  5. using JT1078.Flv.Extensions;
  6. namespace JT1078.Flv.Metadata
  7. {
  8. public class Amf3Metadata_Duration : IAmf3Metadata
  9. {
  10. public ushort FieldNameLength { get; set; }
  11. public string FieldName { get; set; } = "duration";
  12. public byte DataType { get; set; } = 0x00;
  13. public object Value { get; set; }
  14. public ReadOnlySpan<byte> ToBuffer()
  15. {
  16. Span<byte> tmp = new byte[2+8+1+8];
  17. var b1 = Encoding.ASCII.GetBytes(FieldName);
  18. BinaryPrimitives.WriteUInt16BigEndian(tmp,(ushort)b1.Length);
  19. b1.CopyTo(tmp.Slice(2));
  20. tmp[10] = DataType;
  21. this.WriteDouble(tmp.Slice(11));
  22. return tmp;
  23. }
  24. }
  25. }