XnStatus LinkOniMapStream::Init() { XnStatus nRetVal = XN_STATUS_OK; nRetVal = LinkOniStream::Init(); XN_IS_STATUS_OK(nRetVal); nRetVal = FillSupportedVideoModes(); XN_IS_STATUS_OK(nRetVal); // read video mode XnChar videoModeSection[255]; sprintf(videoModeSection, "%s.VideoMode", m_configSection); OniVideoMode videoMode; GetVideoMode(&videoMode); // override with streams default values GetDefaultVideoMode(&videoMode); // override with INI config XnInt32 temp32; if (XN_STATUS_OK == xnOSReadIntFromINI(m_configFile, videoModeSection, "XResolution", &temp32)) { videoMode.resolutionX = (int)temp32; } if (XN_STATUS_OK == xnOSReadIntFromINI(m_configFile, videoModeSection, "YResolution", &temp32)) { videoMode.resolutionY = (int)temp32; } if (XN_STATUS_OK == xnOSReadIntFromINI(m_configFile, videoModeSection, "FPS", &temp32)) { videoMode.fps = (int)temp32; } if (XN_STATUS_OK == xnOSReadIntFromINI(m_configFile, videoModeSection, "PixelFormat", &temp32)) { videoMode.pixelFormat = (OniPixelFormat)temp32; } nRetVal = SetVideoMode(&videoMode); XN_IS_STATUS_OK(nRetVal); nRetVal = setIntPropertyFromINI("LinkPixelFormat", LINK_PROP_PIXEL_FORMAT); XN_IS_STATUS_OK(nRetVal); nRetVal = setIntPropertyFromINI("Compression", LINK_PROP_COMPRESSION); XN_IS_STATUS_OK(nRetVal); OniBool bMirror = TRUE; if (XN_STATUS_OK == xnOSReadIntFromINI(m_configFile, m_configSection, "Mirror", &temp32)) { bMirror = (temp32 == 1); } nRetVal = SetMirror(bMirror); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }
XnStatus XnOniDevice::Init() { XnDeviceConfig config; config.cpConnectionString = m_info.uri; config.pInitialValues = NULL; XnStatus retVal = m_sensor.Init(&config); XN_IS_STATUS_OK(retVal); return FillSupportedVideoModes(); }