public void Push(ArraySegment <Byte> bytes) { if (Header == null) { m_buffer.AddRange(bytes.ToE()); var index = m_buffer.IndexOf(0x0A); if (index == -1) { return; } var tmp = m_buffer.Take(index).ToArray(); Header = YUVHeader.Parse(Encoding.ASCII.GetString(tmp)); m_current = new YUVFrameReader(Header); m_next = new YUVFrameReader(Header); PushBody(new ArraySegment <Byte>(m_buffer.Skip(index + 1).ToArray())); m_buffer.Clear(); } else { PushBody(bytes); } }
public YUVFrameReader(YUVHeader header) { m_body = new Byte[header.BodyByteLength]; }