コード例 #1
0
ファイル: XnFileDevice.cpp プロジェクト: RikeshThapa/VirtueX
XnStatus XnFileDevice::Init()
{
    XnStatus nRetVal = XN_STATUS_OK;

    nRetVal = XnStreamDataCreate(&m_pStreamData, "", XN_FILE_MAX_UNCOMPRESSED_DATA_SIZE);
    XN_IS_STATUS_OK(nRetVal);

    return (XN_STATUS_OK);
}
コード例 #2
0
XnStatus XnStreamReaderStream::Init()
{
	XnStatus nRetVal = XN_STATUS_OK;

	nRetVal = XnDeviceStream::Init();
	XN_IS_STATUS_OK(nRetVal);

	// register for size change (so we can realloc stream data)
	nRetVal = RequiredSizeProperty().OnChangeEvent().Register(RequiredSizeChangedCallback, this);
	XN_IS_STATUS_OK(nRetVal);

	// and create stream data
	nRetVal = XnStreamDataCreate(&m_pLastData, GetName(), GetRequiredDataSize());
	XN_IS_STATUS_OK(nRetVal);

	return (XN_STATUS_OK);
}
XnStatus XnFrameStream::CreateStreamData(XnStreamData** ppStreamData)
{
	XnStatus nRetVal = XN_STATUS_OK;
	
	XnStreamData* pStreamData;

	// NOTE: in any case, we must make sure data is not null, because some old applications
	// counts on it (they might read the data before the first frame).

	// check if the buffer pool has been set yet
	if (m_pBufferPool == NULL)
	{
		// Create it with a buffer. This buffer will be later on freed when buffers from 
		// the buffer pool will be used.
		nRetVal = XnStreamDataCreate(&pStreamData, GetName(), GetRequiredDataSize());
		XN_IS_STATUS_OK(nRetVal);
	}
	else
	{
		// we create a StreamData object with no buffer allocated. The buffer will just be 
		// a pointer from the buffer pool
		nRetVal = XnStreamDataCreateNoBuffer(&pStreamData, GetName());
		XN_IS_STATUS_OK(nRetVal);

		// take a buffer from the pool
		nRetVal = m_pBufferPool->GetBuffer(&pStreamData->pInternal->pLockedBuffer);
		if (nRetVal != XN_STATUS_OK)
		{
			XnStreamDataDestroy(&pStreamData);
			return (nRetVal);
		}

		pStreamData->pData = (void*)pStreamData->pInternal->pLockedBuffer->GetData();
	}

	*ppStreamData = pStreamData;
	
	return (XN_STATUS_OK);
}
コード例 #4
0
XnStatus XnDeviceStream::CreateStreamData(XnStreamData** ppStreamData)
{
	return XnStreamDataCreate(ppStreamData, GetName(), GetRequiredDataSize());
}