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

27 行
819 B

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