XnStatus XnFileDevice::ReadNewStream() { XnStatus nRetVal = XN_STATUS_OK; XnChar strType[XN_DEVICE_MAX_STRING_LENGTH]; XnChar strName[XN_DEVICE_MAX_STRING_LENGTH]; // create property set XnPropertySet* pPropertySet = NULL; nRetVal = XnPropertySetCreate(&pPropertySet); XN_IS_STATUS_OK(nRetVal); // read from stream nRetVal = m_pDataPacker->ReadNewStream(strType, strName, pPropertySet); if (nRetVal == XN_STATUS_OK) { // create it nRetVal = HandleNewStream(strType, strName, pPropertySet->pData->Begin()->Value()); } XnPropertySetDestroy(&pPropertySet); return (nRetVal); }
XnStatus XnStreamReaderDevice::InitImpl(const XnDeviceConfig* pDeviceConfig) { XnStatus nRetVal = XN_STATUS_OK; // we will init the device using state from the stream, instead of the one from user. // the one from user will be used to set properties afterwards. // first open the stream nRetVal = InitPacker(pDeviceConfig->cpConnectionString); XN_IS_STATUS_OK(nRetVal); // create a property set XnPropertySet* pSet; nRetVal = XnPropertySetCreate(&pSet); XN_IS_STATUS_OK(nRetVal); // read initial state (we assume first object in the stream is the initial state) nRetVal = ReadInitialState(pSet); if (nRetVal != XN_STATUS_OK) { XnPropertySetDestroy(&pSet); return (nRetVal); } nRetVal = SetInitialState(pDeviceConfig, pSet); if (nRetVal != XN_STATUS_OK) { XnPropertySetDestroy(&pSet); return (nRetVal); } // destroy the property set (we don't need it anymore) nRetVal = XnPropertySetDestroy(&pSet); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }