Beispiel #1
0
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 = hNode->pContext;
	XnNodeHandle hOther = NULL;
	nRetVal = xnGetRefNodeHandleByName(pContext, strName, &hOther);
	XN_IS_STATUS_OK(nRetVal);

	// find codec
	if (strlen(strCodec) != sizeof(XnCodecID))
	{
		xnProductionNodeRelease(hOther);
		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);
	xnProductionNodeRelease(hOther);
	XN_IS_STATUS_OK(nRetVal);

	return (XN_STATUS_OK);
}
Beispiel #2
0
XnStatus xnConfigureFrameSync(XnNodeHandle hNode, const TiXmlElement* pOpcode)
{
	XnStatus nRetVal = XN_STATUS_OK;

	XnContext* pContext = hNode->pContext;
	XnNodeHandle hOther = NULL;

	nRetVal = xnGetRefNodeHandleByName(pContext, pOpcode->GetText(), &hOther);
	XN_IS_STATUS_OK(nRetVal);

	nRetVal = xnFrameSyncWith(hNode, hOther);
	xnProductionNodeRelease(hOther);
	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;
}
Beispiel #4
0
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 = hNode->pContext;
	XnNodeHandle hOther = NULL;

	nRetVal = xnGetRefNodeHandleByName(pContext, pOpcode->GetText(), &hOther);
	XN_IS_STATUS_OK(nRetVal);

	nRetVal = xnSetViewPoint(hNode, hOther);
	xnProductionNodeRelease(hOther);
	XN_IS_STATUS_OK(nRetVal);

	return (XN_STATUS_OK);
}