public StreamerMessage() { Header = new RtpHeader() { PayloadType = NanoPayloadType.Streamer }; StreamerSize = 0; StreamerHeader = new StreamerHeader(); }
public StreamerMessageWithHeader(ControlOpCode opCode) { Header = new RtpHeader() { PayloadType = NanoPayloadType.Streamer }; StreamerHeader = new StreamerHeader() { PacketType = 0 }; ControlHeader = new StreamerControlHeader(opCode); }
public StreamerMessage(uint StreamerType) { Header = new RtpHeader() { PayloadType = NanoPayloadType.Streamer }; StreamerSize = 0; StreamerHeader = new StreamerHeader() { PacketType = StreamerType }; }
public void Serialize(EndianWriter writer) { // Write out payload first to get its size EndianWriter tmpWriter = new EndianWriter(); SerializeStreamer(tmpWriter); byte[] streamerData = tmpWriter.ToBytes(); StreamerSize = (uint)streamerData.Length; StreamerHeader.Serialize(writer); writer.WriteLE(StreamerSize); writer.Write(streamerData); }
public void Serialize(BinaryWriter writer) { // Write out payload first to get its size BinaryWriter tmpWriter = new BinaryWriter(new MemoryStream()); SerializeStreamer(tmpWriter); byte[] streamerData = tmpWriter.ToBytes(); StreamerSize = (uint)streamerData.Length; StreamerHeader.Serialize(writer); writer.Write(StreamerSize); writer.Write(streamerData); }
private static INanoPacket CreateFromStreamerHeader(EndianReader reader, NanoChannel channel) { if (channel == NanoChannel.Unknown) { throw new NanoPackingException( $"Received Streamer Msg on UNKNOWN channel"); } StreamerHeader streamerHeader = new StreamerHeader(); streamerHeader.Deserialize(reader); uint streamerType = streamerHeader.PacketType; switch (channel) { case NanoChannel.Audio: case NanoChannel.ChatAudio: return(CreateFromAudioPayloadType((AudioPayloadType)streamerType)); case NanoChannel.Video: return(CreateFromVideoPayloadType((VideoPayloadType)streamerType)); case NanoChannel.Input: case NanoChannel.InputFeedback: return(CreateFromInputPayloadType((InputPayloadType)streamerType)); case NanoChannel.Control: // Skip to opCode reader.Seek(8, SeekOrigin.Current); ushort opCode = reader.ReadUInt16LE(); return(CreateFromControlOpCode((ControlOpCode)opCode)); default: throw new NanoPackingException( $"Received Streamer Msg on INVALID channel: {channel}"); } }
public void Serialize(EndianWriter writer) { StreamerHeader.Serialize(writer); ControlHeader.Serialize(writer); SerializeStreamer(writer); }
public void Deserialize(EndianReader reader) { StreamerHeader.Deserialize(reader); ControlHeader.Deserialize(reader); DeserializeStreamer(reader); }
public void Deserialize(EndianReader reader) { StreamerHeader.Deserialize(reader); StreamerSize = reader.ReadUInt32LE(); DeserializeStreamer(reader); }
public void Serialize(BinaryWriter writer) { StreamerHeader.Serialize(writer); ControlHeader.Serialize(writer); SerializeStreamer(writer); }
public void Deserialize(BinaryReader reader) { StreamerHeader.Deserialize(reader); ControlHeader.Deserialize(reader); DeserializeStreamer(reader); }
public void Deserialize(BinaryReader reader) { StreamerHeader.Deserialize(reader); StreamerSize = reader.ReadUInt32(); DeserializeStreamer(reader); }