{ // depth frame data requested, be sure it is configured if( nullptr == m_pDepthStream ) { EnableDepthStream(); } // get the frame format data if( nullptr != m_pDepthStream ) { m_pDepthStream->GetFrameFormat( pFrame ); } } // get the color frame data from the stream HRESULT KinectSensor::GetColorFrame( ULONG cbBufferSize, _Out_cap_(cbBufferSize) BYTE* pColorBuffer, _Out_opt_ LONGLONG* liTimeStamp ) { // is the buffer valid if( nullptr == pColorBuffer ) { return E_INVALIDARG; } // be sure the color stream is running HRESULT hr = StartColorStream(); if( FAILED(hr) ) { return hr; } // grab the frame
kcbHandle = KCB_INVALID_HANDLE; } // gets the current amount of senosrs on the list UINT SensorManager::GetSensorCount() { AutoLock sensorLock( m_csSensorLock ); AutoLock handleLock( m_csHandleLock ); UINT count = (UINT)m_kinectSensors.size(); return count; } // gets the PortID based on the number of sensors it found. bool SensorManager::GetPortIDByIndex( UINT index, ULONG cchPortID, _Out_cap_(cchPortID) WCHAR* pwcPortID ) { // set the lock AutoLock sensorLock( m_csSensorLock ); AutoLock handleLock( m_csHandleLock ); if( index >= m_kinectSensors.size() ) { return false; } UINT count = 0; for(auto iter = m_kinectSensors.begin(); iter != m_kinectSensors.end(); ++iter ) { if( count++ == index ) {
// Contains functions that provide memory alloc/dealloc services // Shishir Bhat (http://www.shishirbhat.com) // History // 06/23/13 Initial version // 09/09/14 Refactor to store defs in individual headers. // 09/12/14 Naming convention modifications // #include "InternalDefines.h" #include "MemFunctions.h" // fChlMmAlloc() // Allocates the requested size in bytes of memory. // Allocated area is initialized to all zeroes. // HRESULT CHL_MmAlloc(_Out_cap_(uSizeBytes) PVOID *ppvAddr, _In_ size_t uSizeBytes, _In_opt_ PDWORD pdwError) { void *pv = NULL; ASSERT(ppvAddr); ASSERT(uSizeBytes > 0); if ((pv = malloc(uSizeBytes)) == NULL) { goto error_return; } ZeroMemory(pv, uSizeBytes); *ppvAddr = pv; IFPTR_SETVAL(pdwError, 0);