XnStatus XnSensor::GetBufferPool(const XnChar* strStream, XnBufferPool** ppBufferPool) { XnStatus nRetVal = XN_STATUS_OK; XnDeviceModuleHolder* pHolder; nRetVal = FindStream(strStream, &pHolder); XN_IS_STATUS_OK(nRetVal); XnSensorStreamHolder* pSensorStreamHolder = (XnSensorStreamHolder*)(pHolder); XnDeviceStream* pStream = pSensorStreamHolder->GetStream(); XnUInt64 nFrameBased; nRetVal = pStream->GetProperty(XN_STREAM_PROPERTY_IS_FRAME_BASED, &nFrameBased); XN_IS_STATUS_OK(nRetVal); if (nFrameBased == 0) { return XN_STATUS_BAD_TYPE; } XnFrameStream* pFrameStream = (XnFrameStream*)pStream; *ppBufferPool = pFrameStream->GetBufferPool(); return (XN_STATUS_OK); }
OniStatus XnOniDevice::getProperty(int propertyId, void* data, int* pDataSize) { switch (propertyId) { case ONI_DEVICE_PROPERTY_DRIVER_VERSION: { if (*pDataSize == sizeof(OniVersion)) { OniVersion* version = (OniVersion*)data; version->major = XN_PS_MAJOR_VERSION; version->minor = XN_PS_MINOR_VERSION; version->maintenance = XN_PS_MAINTENANCE_VERSION; version->build = XN_PS_BUILD_VERSION; } else { m_driverServices.errorLoggerAppend("Unexpected size: %d != %d\n", *pDataSize, sizeof(OniVersion)); return ONI_STATUS_ERROR; } } break; case ONI_DEVICE_PROPERTY_IMAGE_REGISTRATION: { if (*pDataSize == sizeof(OniImageRegistrationMode)) { OniImageRegistrationMode* mode = (OniImageRegistrationMode*)data; // Find the depth stream in the sensor. XnDeviceStream* pDepth = NULL; XnStatus xnrc = m_sensor.GetStream(XN_STREAM_NAME_DEPTH, &pDepth); if (xnrc != XN_STATUS_OK) { return ONI_STATUS_BAD_PARAMETER; } // Set the mode in the depth stream. XnUInt64 val; xnrc = pDepth->GetProperty(XN_STREAM_PROPERTY_REGISTRATION, &val); if (xnrc != XN_STATUS_OK) { return ONI_STATUS_ERROR; } // Update the return value. *mode = (val == 1) ? ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR : ONI_IMAGE_REGISTRATION_OFF; } else { m_driverServices.errorLoggerAppend("Unexpected size: %d != %d\n", *pDataSize, sizeof(OniImageRegistrationMode)); return ONI_STATUS_ERROR; } } break; default: XnStatus nRetVal = m_sensor.DeviceModule()->GetProperty(propertyId, data, pDataSize); if (nRetVal != XN_STATUS_OK) { return ONI_STATUS_BAD_PARAMETER; } } return ONI_STATUS_OK; }