Exemplo n.º 1
0
 public byte[] GetBytes()
 {
     using (var stream = new MemoryStream()) {
         using (var bw = new HDSBinaryWriter(stream)) {
             bw.WriteByte((byte)Type);
             bw.WriteUInt24((uint)Data.Length);
             byte extendedTimestamp = (byte)((Timestamp & 0xFF000000) >> 24);
             bw.WriteUInt24(Timestamp & 0x00FFFFFF);
             bw.WriteByte(extendedTimestamp);
             bw.WriteUInt24(0);
             bw.Write(Data);
             bw.WriteUInt32((uint)(Data.Length + TAG_HEADER_BYTE_COUNT));
             return(stream.ToArray());
         }
     }
 }
Exemplo n.º 2
0
        private void WriteMetadata()
        {
            if (onMetaData == null)
            {
                return;
            }

            byte[] data = onMetaData.ToByteArray();

            uint mediaMetadataSize = (uint)data.Length;

            using (var stream = new MemoryStream()) {
                using (HDSBinaryWriter bw = new HDSBinaryWriter(stream)) {
                    bw.WriteByte(Constants.SCRIPT_DATA);
                    bw.WriteUInt24(mediaMetadataSize);
                    bw.WriteUInt24(0);
                    bw.WriteUInt32(0);
                    bw.Write(data);
                    bw.WriteUInt32(FLVTag.TAG_HEADER_BYTE_COUNT + mediaMetadataSize);
                    WriteData(stream.ToArray());
                }
            }
        }