CSharpRTMP.Core.Protocols.Rtmp.Header.Write C# (CSharp) Метод

Write() публичный Метод

public Write ( Channel channel, Stream writer ) : bool
channel Channel
writer Stream
Результат bool
        public bool Write(Channel channel, Stream writer)
        { 
            
            if (channel.lastOutStreamId == StreamId)
            {
                if (IsAbsolute)
                {
                    if (channel.lastOutProcBytes == 0)
                    {
                        HeaderType = HT_FULL;
                        channel.lastOutAbsTs = TimeStramp;
                    }
                    else
                    {
                        HeaderType = HT_CONTINUATION;
                    }
                }
                else
                {
                    if (channel.lastOutProcBytes == 0)
                    {
                        HeaderType = HT_SAME_STREAM;
                        if (MessageType == channel.lastOutHeader.MessageType && MessageLength == channel.lastOutHeader.MessageLength)
                        {
                            HeaderType = HT_SAME_LENGTH_AND_STREAM;
                            if (TimeStramp == channel.lastOutHeader.TimeStramp)
                            {
                                HeaderType = HT_CONTINUATION;
                            }
                        }
                        channel.lastOutAbsTs += TimeStramp;
                    }
                    else
                    {
                        HeaderType = HT_CONTINUATION;
                    }
                }
            }
            else
            {
                HeaderType = HT_FULL;
                IsAbsolute = true;
                channel.lastOutAbsTs = TimeStramp;
                channel.lastOutStreamId = StreamId;
            }
            
            channel.lastOutHeader = this;
            return Write(writer);
        }

Same methods

Header::Write ( Stream writer ) : bool

Usage Example

Пример #1
0
        //public override bool AllowNearProtocol(ulong type)
        //{
        //    Logger.FATAL("This protocol doesn't allow any near protocols");
        //    return false;
        //}

        //public override bool AllowFarProtocol(ulong type)
        //{
        //    return type == ProtocolTypes.PT_TCP || type == ProtocolTypes.PT_RTMPE || type == ProtocolTypes.PT_INBOUND_SSL ||
        //           type == ProtocolTypes.PT_INBOUND_HTTP_FOR_RTMP;
        //}
        public void ChunkAmfMessage(Header header, BufferWithOffset input, MemoryStream output)
        {
            var  channel = GetChannel(header.ChannelId);
            long available;

            while ((available = input.Length) != 0)
            {
                header.Write(channel, output);
                if (available > _outboundChunkSize)
                {
                    available = _outboundChunkSize;
                }
                output.Write(input.Buffer, input.Offset, (int)available);
                channel.lastOutProcBytes += (uint)available;
                input.Offset             += (int)available;
            }
            channel.lastOutProcBytes = 0;
        }
All Usage Examples Of CSharpRTMP.Core.Protocols.Rtmp.Header::Write