コード例 #1
0
 public StreamerMessage()
 {
     Header = new RtpHeader()
     {
         PayloadType = NanoPayloadType.Streamer
     };
     StreamerSize   = 0;
     StreamerHeader = new StreamerHeader();
 }
コード例 #2
0
 public StreamerMessageWithHeader(ControlOpCode opCode)
 {
     Header = new RtpHeader()
     {
         PayloadType = NanoPayloadType.Streamer
     };
     StreamerHeader = new StreamerHeader()
     {
         PacketType = 0
     };
     ControlHeader = new StreamerControlHeader(opCode);
 }
コード例 #3
0
 public StreamerMessage(uint StreamerType)
 {
     Header = new RtpHeader()
     {
         PayloadType = NanoPayloadType.Streamer
     };
     StreamerSize   = 0;
     StreamerHeader = new StreamerHeader()
     {
         PacketType = StreamerType
     };
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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}");
            }
        }
コード例 #7
0
 public void Serialize(EndianWriter writer)
 {
     StreamerHeader.Serialize(writer);
     ControlHeader.Serialize(writer);
     SerializeStreamer(writer);
 }
コード例 #8
0
 public void Deserialize(EndianReader reader)
 {
     StreamerHeader.Deserialize(reader);
     ControlHeader.Deserialize(reader);
     DeserializeStreamer(reader);
 }
コード例 #9
0
 public void Deserialize(EndianReader reader)
 {
     StreamerHeader.Deserialize(reader);
     StreamerSize = reader.ReadUInt32LE();
     DeserializeStreamer(reader);
 }
コード例 #10
0
 public void Serialize(BinaryWriter writer)
 {
     StreamerHeader.Serialize(writer);
     ControlHeader.Serialize(writer);
     SerializeStreamer(writer);
 }
コード例 #11
0
 public void Deserialize(BinaryReader reader)
 {
     StreamerHeader.Deserialize(reader);
     ControlHeader.Deserialize(reader);
     DeserializeStreamer(reader);
 }
コード例 #12
0
 public void Deserialize(BinaryReader reader)
 {
     StreamerHeader.Deserialize(reader);
     StreamerSize = reader.ReadUInt32();
     DeserializeStreamer(reader);
 }