/* at this point, the buffer must be a complete dirac packet */ private void Dispatch(Buffer b) { if (b.GetInt(5) != b.Size()) throw new Exception("Incorrect buffer sizes"); byte c = b.GetByte(4); switch(c) { case 0x00: VideoFormat tmp = new VideoFormat(b); if(format == null) { format = tmp; status = Status.OK; } else if(!tmp.Equals(format)) { throw new Exception("Stream Error: Inequal Video Formats"); } break; case 0x10: status = Status.DONE; break; case 0x20: case 0x30: break; default: if(format == null) throw new Exception("Stream Error: Picture Before Header"); Picture pic = new Picture(b, this); pic.Parse(); inQueue.Push(pic); break; } }