private void writeToVideoStream(DateTime time, DataType type, byte[] buffer) { if (type != DataType.StopSign) { StreamPacket data = new StreamPacket(time, type, buffer); byte[] block = StreamPacket.Encode(data); writeBuffer(_fsStream, block); } }
public static byte[] Encode(VideoStreamsPacket packet) { using (MemoryStream ms = new MemoryStream()) { PacketBase.WriteBytes(ms, TimePeriodPacket.Encode(packet.TimePeriod)); PacketBase.WriteBytes(ms, packet.VideoStreams.Length); for (int i = 0; i < packet.VideoStreams.Length; i++) { PacketBase.WriteBytes(ms, StreamPacket.Encode(packet.VideoStreams[i])); } return(ms.ToArray()); } }