本文整理汇总了C++中XnDeviceStream::AddProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ XnDeviceStream::AddProperty方法的具体用法?C++ XnDeviceStream::AddProperty怎么用?C++ XnDeviceStream::AddProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XnDeviceStream
的用法示例。
在下文中一共展示了XnDeviceStream::AddProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnStreamAdded
XnStatus XnServerSensorInvoker::OnStreamAdded(const XnChar* StreamName)
{
XnStatus nRetVal = XN_STATUS_OK;
// get all props
XN_PROPERTY_SET_CREATE_ON_STACK(props);
nRetVal = m_sensor.GetAllProperties(&props, FALSE, StreamName);
XN_IS_STATUS_OK(nRetVal);
// register to all props
nRetVal = RegisterToProps(&props);
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pStreamProps = props.pData->Begin()->Value();
// create stream data
SensorInvokerStream serverStream;
xnOSMemSet(&serverStream, 0, sizeof(serverStream));
strcpy(serverStream.strType, StreamName);
XN_VALIDATE_NEW(serverStream.pNewDataEvent, NewStreamDataEvent);
// check if this is a frame stream
XnProperty* pIsFrameBased;
nRetVal = pStreamProps->Get(XN_STREAM_PROPERTY_IS_FRAME_BASED, pIsFrameBased);
if (nRetVal == XN_STATUS_OK)
{
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pIsFrameBased;
serverStream.bFrameStream = (pIntProp->GetValue() == TRUE);
}
if (serverStream.bFrameStream)
{
// create the "shared memory name" property
XN_VALIDATE_NEW(serverStream.pSharedMemoryName, XnActualStringProperty, XN_STREAM_PROPERTY_SHARED_BUFFER_NAME);
// and add it to the stream
XnDeviceStream* pStream;
nRetVal = m_sensor.GetStream(StreamName, &pStream);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return nRetVal;
}
nRetVal = pStream->AddProperty(serverStream.pSharedMemoryName);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return nRetVal;
}
// create a shared memory buffer pool for it
nRetVal = SetStreamSharedMemory(&serverStream);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return nRetVal;
}
}
// create a stream data object for the stream
nRetVal = m_sensor.CreateStreamData(StreamName, &serverStream.pStreamData);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return (nRetVal);
}
// and add it to our list of streams
nRetVal = m_streams.Set(StreamName, serverStream);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return (nRetVal);
}
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:84,代码来源:XnServerSensorInvoker.cpp