ReceiveBinaryData() public method

Receives all available binary data sent from the xbox.
public ReceiveBinaryData ( ) : byte[]
return byte[]
Ejemplo n.º 1
0
        // received at start of video session
        //struct vsheader
        //{
        //    int sizeof
        //    int frame_width
        //    int frame_height
        //    short unk1
        //    short bpp
        //    int unk2
        //    int frame_size
        //    int unk3
        //    int unk4
        //    int unk5
        //    int block_size
        //}

        /// <summary>
        /// Begins a new video stream.
        /// </summary>
        public void Begin()
        {
            try
            {
                End();
                Xbox.SendCommand("VSSnap first={0} last={1} flags=0x2000000 marker=0", (int)Size | (int)Interval | (int)Quality, timeBetweenFrames);
                byte[] header = Xbox.ReceiveBinaryData(40);
                uint   size   = BitConverter.ToUInt32(header, 0);
                Width  = BitConverter.ToUInt32(header, 4);
                Height = BitConverter.ToUInt32(header, 8);
                int Format = BitConverter.ToUInt16(header, 12); // 1 = X8R8G8B8 ???
                BitsPerPixel = BitConverter.ToUInt16(header, 14);
                uint unk2 = BitConverter.ToUInt32(header, 16);
                FrameSize = BitConverter.ToUInt32(header, 20);
                uint unk3      = BitConverter.ToUInt32(header, 24);
                uint unk4      = BitConverter.ToUInt32(header, 28);
                uint unk5      = BitConverter.ToUInt32(header, 32);
                uint blockSize = BitConverter.ToUInt32(header, 36);
                System.Threading.Thread.Sleep(100); // wait for it to fully activate
                isActive = true;
            }
            catch (Exception /*ex*/)
            {
                End();
            }
        }