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 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 (xnGetRefNodeHandleByName(m_hPlayer->pContext, strNodeName, &playedNodeInfo.hNode) != XN_STATUS_OK) { XnStatus nRetVal = xnCreateMockNode(m_hPlayer->pContext, type, strNodeName, &playedNodeInfo.hNode); XN_IS_STATUS_OK(nRetVal); // mark this node as needed node. We need this in order to make sure if xnForceShutdown() is called, // the player will be destroyed *before* mock node is (so we can release it). nRetVal = xnAddNeededNode(m_hPlayer, playedNodeInfo.hNode); if (nRetVal != XN_STATUS_OK) { xnProductionNodeRelease(playedNodeInfo.hNode); return (nRetVal); } } // lock it, so no one can change configuration (this is a file recording) nRetVal = xnLockNodeForChanges(playedNodeInfo.hNode, &playedNodeInfo.hLock); if (nRetVal != XN_STATUS_OK) { xnProductionNodeRelease(playedNodeInfo.hNode); return (nRetVal); } nRetVal = m_playedNodes.Set(strNodeName, playedNodeInfo); if (nRetVal != XN_STATUS_OK) { xnProductionNodeRelease(playedNodeInfo.hNode); return (nRetVal); } return XN_STATUS_OK; }