コード例 #1
0
        public KinectReplay(Stream stream)
        {
            this.stream = stream;
            reader      = new BinaryReader(stream);

            synchronizationContext = SynchronizationContext.Current;

            KinectRecordOptions options = (KinectRecordOptions)reader.ReadInt32();

            if ((options & KinectRecordOptions.Color) != 0)
            {
                colorReplay = new ReplaySystem <ReplayColorImageFrame>();
            }
            //if ((options & KinectRecordOptions.Depth) != 0)
            //{
            //    depthReplay = new ReplaySystem<ReplayDepthImageFrame>();
            //}
            //if ((options & KinectRecordOptions.Skeletons) != 0)
            //{
            //    skeletonReplay = new ReplaySystem<ReplaySkeletonFrame>();
            //}

            while (reader.BaseStream.Position + 4 < reader.BaseStream.Length)
            {
                if (reader.BaseStream.Position > 67580000)
                {
                    Console.WriteLine("Position: " + reader.BaseStream.Position + " of " + reader.BaseStream.Length);
                }

                KinectRecordOptions header = (KinectRecordOptions)reader.ReadInt32();
                switch (header)
                {
                case KinectRecordOptions.Color:
                    colorReplay.AddFrame(reader);
                    break;
                    //case KinectRecordOptions.Depth:
                    //    depthReplay.AddFrame(reader);
                    //    break;
                    //case KinectRecordOptions.Skeletons:
                    //    skeletonReplay.AddFrame(reader);
                    //    break;
                }
            }
        }
コード例 #2
0
        public void Dispose()
        {
            Stop();

            colorReplay = null;
            //depthReplay = null;
            //skeletonReplay = null;

            if (reader != null)
            {
                reader.Dispose();
                reader = null;
            }

            if (stream != null)
            {
                stream.Dispose();
                stream = null;
            }
        }