XnStatus PlayerImpl::AddNode(const XnChar* strNodeName, XnProductionNodeType type, XnCodecID compression) { XnStatus nRetVal = XN_STATUS_OK; PlayedNodeInfo playedNodeInfo = {0}; if (m_playedNodes.Get(strNodeName, playedNodeInfo) == XN_STATUS_OK) { // already in the list, just return OK. return (XN_STATUS_OK); } // check if we need to create it (maybe it's a rewind...) if (xnGetNodeHandleByName(m_hPlayer->pContext, strNodeName, &playedNodeInfo.hNode) != XN_STATUS_OK) { XnStatus nRetVal = xnCreateMockNode(m_hPlayer->pContext, type, strNodeName, &playedNodeInfo.hNode); XN_IS_STATUS_OK(nRetVal); } // lock it, so no one can change configuration (this is a file recording) nRetVal = xnLockNodeForChanges(playedNodeInfo.hNode, &playedNodeInfo.hLock); XN_IS_STATUS_OK(nRetVal); nRetVal = m_playedNodes.Set(strNodeName, playedNodeInfo); XN_IS_STATUS_OK(nRetVal); return XN_STATUS_OK; }
XnStatus RecorderImpl::AddRawNode(const XnChar* strNodeName) { if (IsRawNode(strNodeName)) { xnLogWarning(XN_MASK_OPEN_NI, "Attempted to add a raw node by name of '%s' but there is already a raw node by that name", strNodeName); XN_ASSERT(FALSE); return XN_STATUS_INVALID_OPERATION; } XnNodeHandle hNode = NULL; NodeWatcher* pNodeWatcher = NULL; if ((xnGetNodeHandleByName(m_hRecorder->pContext, strNodeName, &hNode) == XN_STATUS_OK) && (m_nodeWatchersMap.Get(hNode, pNodeWatcher) == XN_STATUS_OK)) { //There's a node by that name and we're already watching it xnLogWarning(XN_MASK_OPEN_NI, "Attempted to add a raw node by name of '%s' but there is already another node by that name that is being recorded", strNodeName); XN_ASSERT(FALSE); return XN_STATUS_INVALID_OPERATION; } XnStatus nRetVal = Notifications().OnNodeAdded(ModuleHandle(), strNodeName, (XnProductionNodeType)0, XN_CODEC_UNCOMPRESSED); XN_IS_STATUS_OK(nRetVal); RawNodeInfo rawNodeInfo; nRetVal = m_rawNodesMap.Set(strNodeName, rawNodeInfo); XN_IS_STATUS_OK(nRetVal); return XN_STATUS_OK; }
XnStatus xnConfigureAddNodeToRecording(XnNodeHandle hNode, const TiXmlElement* pOpcode) { XnStatus nRetVal = XN_STATUS_OK; const XnChar* strName; nRetVal = xnXmlReadStringAttribute(pOpcode, "name", &strName); XN_IS_STATUS_OK(nRetVal); const XnChar* strCodec; nRetVal = xnXmlReadStringAttribute(pOpcode, "codec", &strCodec); XN_IS_STATUS_OK(nRetVal); // find node XnContext* pContext = xnGetContextFromNodeHandle(hNode); XnNodeHandle hOther = NULL; nRetVal = xnGetNodeHandleByName(pContext, strName, &hOther); XN_IS_STATUS_OK(nRetVal); // find codec if (strlen(strCodec) != sizeof(XnCodecID)) { XN_LOG_ERROR_RETURN(XN_STATUS_CORRUPT_FILE, XN_MASK_OPEN_NI, "'%s' is not a valid codec ID!", strCodec); } XnCodecID codecID; xnOSMemCopy(&codecID, strCodec, sizeof(codecID)); nRetVal = xnAddNodeToRecording(hNode, hOther, codecID); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }
XnStatus xnConfigureFrameSync(XnNodeHandle hNode, const TiXmlElement* pOpcode) { XnStatus nRetVal = XN_STATUS_OK; XnContext* pContext = xnGetContextFromNodeHandle(hNode); XnNodeHandle hOther = NULL; nRetVal = xnGetNodeHandleByName(pContext, pOpcode->GetText(), &hOther); XN_IS_STATUS_OK(nRetVal); nRetVal = xnFrameSyncWith(hNode, hOther); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }
XnStatus xnConfigureAlternativeViewPoint(XnNodeHandle hNode, const TiXmlElement* pOpcode) { XnStatus nRetVal = XN_STATUS_OK; if (!xnIsCapabilitySupported(hNode, XN_CAPABILITY_ALTERNATIVE_VIEW_POINT)) { return XN_STATUS_INVALID_OPERATION; } XnContext* pContext = xnGetContextFromNodeHandle(hNode); XnNodeHandle hOther = NULL; nRetVal = xnGetNodeHandleByName(pContext, pOpcode->GetText(), &hOther); XN_IS_STATUS_OK(nRetVal); nRetVal = xnSetViewPoint(hNode, hOther); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }