Wince摄像头缓冲管理三种模式:
typedef enum {
CSPROPERTY_BUFFER_DRIVER = 1,
CSPROPERTY_BUFFER_CLIENT_LIMITED = 2,
CSPROPERTY_BUFFER_CLIENT_UNLIMITED = 4
} CSPROPERTY_BUFFER_MODE;
1、CSPROPERTY_BUFFER_CLIENT的两种模式是由CLIENT分配内存,让底层来填充;但并不是如PB帮助所说:
-
CSPROPERTY_BUFFER_CLIENT_LIMITED
-
Indicates that the driver's DMA preparation time is slow and that the then the driver needs to know in advance about all of the buffers that it will receive from the client.
-
CSPROPERTY_BUFFER_CLIENT_UNLIMITED
-
Indicates that the driver's DMA preparation time is fast and that the client can allocate, initialize, and release buffers as they are needed.
供DMA来传递数据给该缓冲。如果利用提供的测试程序,可看出代码流程:
BOOL CStreamTest::AllocateBuffers()
{
BOOL bReturnValue = TRUE;
ULONG ulBufferIndex;
WaitForSingleObject(m_hMutex, INFINITE);
if(m_dwAllocationType != CSPROPERTY_BUFFER_CLIENT_LIMITED &&
m_dwAllocationType != CSPROPERTY_BUFFER_CLIENT_UNLIMITED &&
m_dwAllocationType != CSPROPERTY_BUFFER_DRIVER)
{
ERRFAIL(TEXT("AllocateBuffers : Invalid buffering mode."));
bReturnValue = FALSE;
goto cleanup;
}
PSTREAM_BUFFERNODE pcsCurrentBufferNode = m_pcsBufferNode;
// get to the end of the list.
if(pcsCurrentBufferNode)
{
while(pcsCurrentBufferNode->pNext)
pcsCurrentBufferNode = pcsCurrentBuff