Ejemplo n.º 1
0
        private bool InitStreamProfiles(PXCMCapture.Device device)
        {
            uint ProfileCount = 0;
            if (device !=null)
            {
                PXCMCapture.Device.StreamProfileSet profile = new PXCMCapture.Device.StreamProfileSet();

                for (int s = 0; s < PXCMCapture.STREAM_LIMIT; s++)
                {
                    PXCMCapture.StreamType st = PXCMCapture.StreamTypeFromIndex(s);

                    PXCMCapture.DeviceInfo dinfo;
                    device.QueryDeviceInfo(out dinfo);

                    if (((int)dinfo.streams & (int)st) != 0)
                    {

                        int num = device.QueryStreamProfileSetNum(st);

                        for (int p = 0; p < num; p++)
                        {
                            if (device.QueryStreamProfileSet(st, p, out profile) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;

                            PXCMCapture.Device.StreamProfile sprofile = profile[st];

                            //filter out all Color non RGB32 stream modes out
                            if((st == PXCMCapture.StreamType.STREAM_TYPE_COLOR) && (sprofile.imageInfo.format != PXCMImage.PixelFormat.PIXEL_FORMAT_RGB32 ))
                            continue;

                            if(!SenseSession.StreamProfiles.ContainsKey(st))
                            {
                                SenseSession.StreamProfiles.Add(st, new Dictionary<string, PXCMCapture.Device.StreamProfile>());
                            }

                            var StreamTypeProfileSet = SenseSession.StreamProfiles[st];
                            var ProfileDescr = ProfileToString(st, sprofile);

                            if(!StreamTypeProfileSet.ContainsKey(ProfileDescr))
                            {
                                StreamTypeProfileSet.Add(ProfileDescr, sprofile);
                                ProfileCount++;
                            }

                        }

                        //add to enums
                        string[] defaultMode = {"Disabled"};
                        string[] streamModes = defaultMode.Concat(SenseSession.StreamProfiles[st].Keys.ToArray()).ToArray();
                        EnumManager.UpdateEnum("RealSenseStreamMode_" + st.ToString().Substring(12), "Disabled", streamModes);

                    }
                    else if (((int)dinfo.streams & (int)st) == 0)
                    {

                    }
                }

            }
            else FLogger.Log(LogType.Debug,"Device is null");

            return ProfileCount > 0;
        }