本文整理汇总了C++中XnDeviceStream::DecRef方法的典型用法代码示例。如果您正苦于以下问题:C++ XnDeviceStream::DecRef方法的具体用法?C++ XnDeviceStream::DecRef怎么用?C++ XnDeviceStream::DecRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XnDeviceStream
的用法示例。
在下文中一共展示了XnDeviceStream::DecRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DestroyStream
XnStatus XnDeviceBase::DestroyStream(const XnChar* StreamName)
{
XnStatus nRetVal = XN_STATUS_OK;
xnLogInfo(XN_MASK_DDK, "Destroying stream '%s'...", StreamName);
// keep the stream name (we now delete the module, so the name will be lost)
XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH];
strncpy(strStreamName, StreamName, XN_DEVICE_MAX_STRING_LENGTH);
xnl::AutoCSLocker lock(m_hLock);
// Find the stream
XnDeviceModuleHolder* pStreamHolder;
nRetVal = FindStream(strStreamName, &pStreamHolder);
XN_IS_STATUS_OK(nRetVal);
XnDeviceStream* pStream = (XnDeviceStream*)pStreamHolder->GetModule();
XnUInt32 nRefCount = pStream->DecRef();
if (0 == nRefCount)
{
// remove it from map
nRetVal = RemoveModule(strStreamName);
XN_IS_STATUS_OK(nRetVal);
// and free it's memory
DestroyStreamModule(pStreamHolder);
// free memory of registered properties to this stream
FreeModuleRegisteredProperties(StreamName);
xnLogVerbose(XN_MASK_DDK, "'%s' stream destroyed.", strStreamName);
}
else
{
xnLogVerbose(XN_MASK_DDK, "'%s' stream now has %d references.", strStreamName, nRefCount);
}
return XN_STATUS_OK;
}