亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? pddvclas.cpp

?? wince 下
?? CPP
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):

	// Find an interface that has the packet size we need
	lpIF = FindStreamInterface (pPDD, nInterface, TRUE, wPacketSize);

	// See if interface not found
	if (lpIF == 0)
		return -1;

	hTransfer = pDrv->lpUsbFuncs->lpSetInterface (pDrv->hDevice, NULL, NULL, 0, nInterface, 
	                                              lpIF->ifDesc.bAlternateSetting);
	if (hTransfer == 0)
	{
		DEBUGMSG (ZONE_ERROR, (TEXT("Error calling SetInterface rc=%d\r\n"), GetLastError()));
		return GetLastError();
	}
	if (!CloseTransferHandle (pDrv->lpUsbFuncs, hTransfer))
		rc = GetLastError();

	rc = 0;
	// Open a pipe to the end point
	if (lpIF->fEndpoint)
	{
		// Open the pipe
		pPDD->pipeStream.hPipe = pDrv->lpUsbFuncs->lpOpenPipe (pDrv->hDevice, &lpIF->epDesc);
		// Check for sucessful open
		if (pPDD->pipeStream.hPipe)
		{
			// Copy some pipe attributes
			pPDD->pipeStream.ucAddr = lpIF->epDesc.bEndpointAddress;
			pPDD->pipeStream.wPacketSize = lpIF->epDesc.wMaxPacketSize;

			// First, create an event for handshaking
			pPDD->pipeStream.hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
		} 
		else
		{
			rc = GetLastError();
			if (rc == 0) rc = ERROR_NOT_ENOUGH_MEMORY; // Sometimes, there isn't an extended error here
			DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Error opening pipe  rc: %d\r\n"), rc));
		}
	}
	if (rc)
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Error in SetStreamInterface  rc: %d  ExtErr: %d\r\n"), rc, GetLastError()));
	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("SetStreamInterface--  rc %d\r\n"), rc));
	return rc;
}
//-----------------------------------------------------------------------
// ParseStreamInterfaces - Walks the camera's USB interface descriptors
// to determine the supported freaturs of the camera.
//
BOOL ParseStreamInterfaces (PPDDCONTEXT pPDD, LPCUSB_DEVICE lpUsbDev, BYTE bIFCtl,
							BYTE bIFSubCtl, BYTE bIFStrm, BYTE bIFSubStrm)
{
    DEBUGMSG (ZONE_USBLOAD, (DTAG TEXT("ParseStreamInterfaces++\r\n")));

    DEBUGMSG (ZONE_USBLOAD, (DTAG TEXT("Looking for Ctl IF %d %d and Stream IF %d %d\r\n"), bIFCtl, bIFSubCtl, bIFStrm, bIFSubStrm));
	__try {
	
		if (lpUsbDev->lpConfigs->dwCount != sizeof (USB_CONFIGURATION))
		{
			DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Unexpected CUSB_CONFIGURATION dwCount: %d  ***********\r\n"), lpUsbDev->lpConfigs->dwCount));
			return FALSE;
		}

		DWORD i;
		LPCUSB_INTERFACE lpIF;
		int nStreamAlts = 0;
		int nOtherStreams = 0;
		int nStreamID = -1;

		// Walk interface table to find the number of Video stream interface alternates and if there are 
		// other video streams that aren't alts.
		for (i = 0; i < lpUsbDev->lpConfigs->dwNumInterfaces; i++)
		{
			lpIF = &lpUsbDev->lpConfigs->lpInterfaces[i];

			if ((lpIF->Descriptor.bInterfaceClass == bIFStrm) && (lpIF->Descriptor.bInterfaceSubClass == bIFSubStrm))
			{
				// Is first stream?
				if (nStreamID == -1)
					nStreamID = lpIF->Descriptor.bInterfaceNumber;
				else if (nStreamID == lpIF->Descriptor.bInterfaceNumber)
					nStreamAlts++;
				else
					nOtherStreams++;
			}
		}
		if (nStreamID == -1)
		{
			DEBUGMSG (ZONE_ERROR, (DTAG TEXT("No stream interfaces\r\n")));
			return FALSE;
		}
		pPDD->nStreamInterfaces = nStreamAlts + 1;
	    DEBUGMSG (ZONE_USBLOAD, (DTAG TEXT("Found %d stream interfaces. ID %d\r\n"), pPDD->nStreamInterfaces, nStreamID));
		if (nOtherStreams)
		{
			DEBUGMSG (ZONE_WARNING, (DTAG TEXT("Multiple stream interfaces found on device.  Using first one.\r\n")));
		}

		// Allocate the array for the stream interface descriptors
		if (pPDD->nStreamInterfaces)
		{
			pPDD->usbstrmIF = (PUSBSTRMIF)LocalAlloc (LPTR, pPDD->nStreamInterfaces * sizeof (USBSTRMIF));
		}

		nStreamAlts = 0;  // We'll use this to keep track of which stream and alt we've found.
		// Walk interface table again to get the info we need
		for (i = 0; i < lpUsbDev->lpConfigs->dwNumInterfaces; i++)
		{
			lpIF = &lpUsbDev->lpConfigs->lpInterfaces[i];

			//	
			// See if this is the video control interface
			//
			if ((lpIF->Descriptor.bInterfaceClass == bIFCtl) && (lpIF->Descriptor.bInterfaceSubClass == bIFSubCtl))
			{
				// Copy descriptor info
				pPDD->usbctlIF.ifDesc = lpIF->Descriptor;
				if (lpIF->lpvExtended)
				{
					// Cast the extended ptr as a video control extended header ptr
					PUSBVIDCTLIFDESCRIPTOR lpExDesc = (PUSBVIDCTLIFDESCRIPTOR)lpIF->lpvExtended;


					// Verify the header length
					if (lpExDesc->bLen > 0x0a)
					{
						// Allocate the space for the descriptor
						pPDD->usbctlIF.lpepExtDesc = LocalAlloc (LPTR, lpExDesc->wTotalLen);
						if (pPDD->usbctlIF.lpepExtDesc)
						{
							// Copy over the extended descriptor
							memcpy (pPDD->usbctlIF.lpepExtDesc, lpExDesc, lpExDesc->wTotalLen); 
						} 
						else
						{
							DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Out of memory allocating extended if descriptor\r\n")));
							return FALSE;
						}
					}
					else
					{
						DEBUGMSG (ZONE_ERROR | ZONE_USBLOAD, 
						          (DTAG TEXT("Unexpected extended Ctl header format")));
						return FALSE;
					}
				} 
				else
					pPDD->usbctlIF.lpifExtDesc = 0;

				// Grab the interrupt end point if specified
				if (lpIF->lpEndpoints)
				{
					pPDD->usbctlIF.epDesc = lpIF->lpEndpoints->Descriptor;
					pPDD->usbctlIF.fEndpoint = TRUE;
				}
				else
					pPDD->usbctlIF.fEndpoint = FALSE;
			}
			//
			// See if this is the video stream interface
			//
			if ((lpIF->Descriptor.bInterfaceClass == bIFStrm) && 
				(lpIF->Descriptor.bInterfaceSubClass == bIFSubStrm) &&
				(lpIF->Descriptor.bInterfaceNumber == nStreamID))   // Also check for matching interface number found above
			{
				// Copy descriptor info
				pPDD->usbstrmIF[nStreamAlts].ifDesc = lpIF->Descriptor;
				if (lpIF->lpvExtended)
				{
					// Cast the extended ptr as a video control extended header ptr
					PUSBVIDSTREAMIFDESCRIPTOR lpExDesc = (PUSBVIDSTREAMIFDESCRIPTOR)lpIF->lpvExtended;

					// Verify the header length
					if (lpExDesc->bLen > 0x0a)
					{
						// Allocate the space for the descriptor
						pPDD->usbstrmIF[nStreamAlts].lpepExtDesc = LocalAlloc (LPTR, lpExDesc->wTotalLen);
						if (pPDD->usbstrmIF[nStreamAlts].lpepExtDesc)
						{
							// Copy over the extended descriptor
							memcpy (pPDD->usbstrmIF[nStreamAlts].lpepExtDesc, lpExDesc, lpExDesc->wTotalLen); 
						} 
						else
						{
							DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Out of memory allocating extended if descriptor\r\n")));
							return FALSE;
						}
					} 
					else
					{
						DEBUGMSG (ZONE_ERROR | ZONE_USBLOAD, 
						          (DTAG TEXT("Unexpected extended Stream header format")));
						return FALSE;
					}

				} 
				else
					pPDD->usbstrmIF[nStreamAlts].lpifExtDesc = 0;

				// Grab the interrupt end point if specified
				if (lpIF->lpEndpoints)
				{
					pPDD->usbstrmIF[nStreamAlts].epDesc = lpIF->lpEndpoints->Descriptor;
					pPDD->usbstrmIF[nStreamAlts].fEndpoint = TRUE;
				}
				else
					pPDD->usbstrmIF[nStreamAlts].fEndpoint = FALSE;
				
				nStreamAlts++;  // Inc index into stream interface array
			}
		}
	}
	__except (EXCEPTION_EXECUTE_HANDLER)
	{
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Exception walking device interfaces\r\n")));
		return FALSE;
	}
    DEBUGMSG (ZONE_USBLOAD, (DTAG TEXT("ParseStreamInterfaces--\r\n")));
	return TRUE;
}

//-----------------------------------------------------------------------
// GetCameraError - Queries the error code from the device
// 
int GetCameraError (PDRVCONTEXT pDrv, BYTE *pErr)
{
	int rc = 0;
	BYTE bInterface = VID_IF_STREAM;
	BYTE bUnit = 0;

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("GetCameraError++\r\n")));

	// Get our pdd specific context
	PPDDCONTEXT pPDD = (PPDDCONTEXT)pDrv->dwPddContext; 

	*pErr = 0;
	rc = DoVendorTransfer (pDrv, USBVID_SET_CUR, USB_VIDEO_VS_CS_PROBE_CTL,
	                       bInterface, bUnit, pErr, 1);

	if (rc)
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Error reading error code from camera rc %d\r\n"), rc));

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("GetCameraError++ rc %d error code %d\r\n"), rc, *pErr));
	return rc;
}

//=========================================================================
// ReadIsocThread - Thread that calls the Iscoh transfer function to 
// read the image data from the camera.
//
#define MAXFRAMES 1
DWORD WINAPI ReadIsocThread (PVOID pArg) {

	PDRVCONTEXT pDrv = (PDRVCONTEXT)pArg;
	PPDDCONTEXT pPDD = (PPDDCONTEXT)pDrv->dwPddContext; 
	PBYTE pDataBuff, pEnd;
	int nNumFrames;
	DWORD dw;
	DWORD dwFrameLen[MAXFRAMES];
	DWORD dwUsbRc[MAXFRAMES];
	DWORD dwBytes;
#ifdef DEBUG
	DWORD dwTicksAtFrameEnd = 0;
#endif
	BYTE bSaveBytes[16];
	DWORD dwFrameBytes;
	BYTE bError;

    DEBUGMSG (ZONE_FUNC | ZONE_THREAD, 
	          (DTAG TEXT("ReaReadIsocThreaddThread++ ID:%08x\r\n"), GetCurrentThread()));

	// Tweak the thread priority since we need priority over apps 
	// to read the pipe on time.
	SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);
	
	// Initialize the ptrs
	pPDD->pstrStream->dwCurrBuff = 0;  
	pPDD->pstrStream->dwValidFrames = 0;  // No valid frames yet...
	pDataBuff = pPDD->pstrStream->pFrame[pPDD->pstrStream->dwCurrBuff].pBuff;
	pEnd = pDataBuff + pPDD->pstrStream->dwBuffSize;

	memset (dwFrameLen, 0, sizeof (dwFrameLen));
	memset (dwUsbRc, 0, sizeof (dwUsbRc));

	// Compare the buffer size with the packet size to make sure we at least can
	// read something.
	if (pPDD->pstrStream->dwBuffSize < pPDD->pipeStream.wPacketSize)
	{
	    DEBUGMSG (ZONE_ERROR, (DTAG TEXT("ReadThread failure, read buff size smaller than packet size\r\n")));
		return -1;
	}
#if MAXFRAMES > 1
	// See if we need multiple packets because stream packet size is > 1024
	{
		nNumFrames = (pPDD->pipeStream.wPacketSize / 1024) + 1;
		if (nNumFrames > MAXFRAMES)
		{
			DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Packetsize %d > larger than supported\r\n"), pPDD->pipeStream.wPacketSize));
			return -2;
		}
	}
#endif	
	//
	//  Isoc pipe read loop
	//
	while (pPDD->wReadThreadState != STREAMTHD_STOPPED)	
	{
		// If we're looking for the first frame, reset ptr to start of first buffer
		if (pPDD->wReadThreadState == STREAMTHD_FRAMESYNC)
		{
			pDataBuff = pPDD->pstrStream->pFrame[pPDD->pstrStream->dwCurrBuff].pBuff;
			pEnd = pDataBuff + pPDD->pstrStream->dwBuffSize;
		}

		// Init size of frame buffers
#if MAXFRAMES > 1
		int nPacket = pPDD->pipeStream.wPacketSize;
		
		for (nNumFrames = 0; (nPacket > 0) && (nNumFrames < MAXFRAMES); nNumFrames++)
		{
			// Max transfer in USB is 1K
			dwFrameLen[nNumFrames] = min (nPacket, 1024);
			nPacket -= dwFrameLen[nNumFrames];
		}
#else	
		dwFrameLen[0] = min (pPDD->pipeStream.wPacketSize, 1024);
		nNumFrames = 1;
#endif

		// Limit check on buffer
		if (pDataBuff + dwFrameLen[0] >= pEnd)
		{
			DEBUGMSG (ZONE_ERROR | ZONE_THREAD, (DTAG TEXT("Buffer too small for next isoc data packet!\r\n")));
			break;
		}

		__try {


			dw = IssueIsochTransfer (pDrv->lpUsbFuncs, pPDD->pipeStream.hPipe, 
									 DefaultTransferComplete, pPDD->pipeStream.hEvent,
									 USB_IN_TRANSFER | USB_SHORT_TRANSFER_OK | USB_START_ISOCH_ASAP | USB_COMPRESS_ISOCH,
									 0,               // Using USB_START_ISOCH_ASAP precludes the need for a start frame
									 nNumFrames,      // Number of frames to read
									 dwFrameLen,      // Array that receives the length of each frame
									 pDataBuff,       // Pointer to transfer buffer
									 0,               // Specifies the physical address, which may be NULL, of the data buffer
									 &dwBytes,	      // Number of bytes transferred by USB
									 1500,            // Timeout in msec
									 dwUsbRc);	      // Returns USB_ERROR or USB_TRANSFER

			DEBUGMSG (ZONE_READDATA && (dwBytes > 12), (DTAG TEXT("Read %5d bytes at %x  dw: %d\r\n"), dwBytes, pDataBuff, dw));
		}
		__except (EXCEPTION_EXECUTE_HANDLER)
		{
			DEBUGMSG (ZONE_ERROR | ZONE_THREAD, (DTAG TEXT ("Exception calling IssueIsochTransfer %d %d\r\n"), dw, GetLastError()));
			break;
		}
		if (dw)
		{
			DEBUGMSG (ZONE_ERROR | ZONE_THREAD, (DTAG TEXT ("Error calling IssueIsochTransfer %d %d\r\n"), dw, GetLastError()));
			if ((dw == 8) || (dw == 9)) // USB overrun and underrun errors.
				continue;
//			else
//				break;

			int rc = GetCameraError (pDrv, &bError);
			if (rc)
				DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Can't read camera error code rc %d\r\n"), rc));
			else
				DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Camera error code %d\r\n"), bError));
		
		
		}
		// See if we read at least the header
		if (dwBytes == 0)
		{
			DEBUGMSG (ZONE_READDATA, (DTAG TEXT("packet size read if %d bytes smaller than standard header\r\n"), dwBytes));
			continue;
		}

		// Look at payload header
		PUSBVIDPAYLOADHDR pPktHdr = (PUSBVIDPAYLOADHDR)pDataBuff;
		BYTE bPktFlags;
		if (pPktHdr->bLen != sizeof (USBVIDPAYLOADHDR))
		{
			DEBUGMSG (ZONE_PACKETS, (DTAG TEXT("===============

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区在线视频| 在线电影院国产精品| 久久先锋影音av| 欧美亚洲尤物久久| 在线区一区二视频| 日本不卡123| 日本不卡一区二区| 热久久国产精品| 亚洲国产欧美另类丝袜| 中文字幕一区二区在线观看| 中文字幕欧美国产| 国产精品毛片大码女人| 国产精品九色蝌蚪自拍| 一区在线观看视频| 亚洲综合色视频| 日韩精品成人一区二区在线| 三级一区在线视频先锋| 蜜桃在线一区二区三区| 狠狠v欧美v日韩v亚洲ⅴ| 国产精品亚洲第一区在线暖暖韩国| 韩国v欧美v亚洲v日本v| 高清国产一区二区三区| 99麻豆久久久国产精品免费| 91精品福利在线| 日韩一区二区免费高清| 精品国产污网站| 久久精品视频免费| 亚洲欧美激情小说另类| 亚洲成在人线在线播放| 蜜桃视频免费观看一区| 国产馆精品极品| 91麻豆视频网站| 欧美日韩一区成人| 精品99一区二区| 国产精品久久久久aaaa樱花 | 国产女人aaa级久久久级| 中文字幕乱码一区二区免费| 亚洲欧洲99久久| 丝袜脚交一区二区| 国产成人午夜精品影院观看视频| 色综合色综合色综合| 91麻豆精品国产91久久久久 | 亚洲欧美日韩综合aⅴ视频| 夜夜爽夜夜爽精品视频| 美国十次综合导航| 99久久99久久精品免费观看| 制服丝袜亚洲色图| 国产精品情趣视频| 日本成人超碰在线观看| 99久久国产综合精品色伊 | 一区二区成人在线视频| 美国三级日本三级久久99| 成人黄动漫网站免费app| 欧美日本乱大交xxxxx| 国产日本一区二区| 天堂一区二区在线免费观看| 国产成人啪免费观看软件| 欧美性受极品xxxx喷水| 久久新电视剧免费观看| 亚洲在线视频一区| 懂色av一区二区三区蜜臀| 在线成人av影院| 综合网在线视频| 国内精品免费在线观看| 欧美性色综合网| 中文字幕乱码日本亚洲一区二区| 日本女人一区二区三区| 一本色道亚洲精品aⅴ| 精品国产凹凸成av人网站| 国产一区在线看| 在线观看一区二区精品视频| 国产视频一区在线播放| 日韩高清在线电影| 欧洲日韩一区二区三区| 国产精品五月天| 黑人巨大精品欧美黑白配亚洲| 欧美日韩国产色站一区二区三区| 国产精品久久久久久久久图文区| 麻豆精品在线播放| 欧美日韩国产一区二区三区地区| 国产精品拍天天在线| 美腿丝袜亚洲三区| 欧美性猛交xxxx乱大交退制版 | 亚洲激情六月丁香| 国产精品123| 精品国产免费人成电影在线观看四季| 亚洲一二三区不卡| av在线不卡免费看| 久久久久久久综合日本| 久久精品国产亚洲一区二区三区| 欧美午夜精品理论片a级按摩| 亚洲男人的天堂在线观看| 成人免费观看av| 国产亚洲一区字幕| 狠狠色丁香九九婷婷综合五月| 欧美一级视频精品观看| 亚洲第一二三四区| 精品污污网站免费看| 亚洲精品成人天堂一二三| 色系网站成人免费| 亚洲免费观看视频| 色综合久久久网| 亚洲色欲色欲www| 99r国产精品| 一区二区三区丝袜| 色av综合在线| 亚洲一级不卡视频| 欧美日韩成人综合在线一区二区| 亚洲一区中文在线| 欧美日韩中文一区| 日韩国产精品91| 日韩一区二区三区精品视频| 麻豆成人久久精品二区三区小说| 日韩欧美在线综合网| 婷婷开心激情综合| 欧美电视剧在线看免费| 另类欧美日韩国产在线| 欧美精品一区在线观看| 国产ts人妖一区二区| 国产精品嫩草影院com| 成人免费观看男女羞羞视频| 亚洲欧洲av另类| 欧美性videosxxxxx| 天天色综合成人网| 精品国产伦一区二区三区观看体验| 国产一区视频在线看| 国产欧美日产一区| 一本久道中文字幕精品亚洲嫩| 亚洲综合久久久| 91精品午夜视频| 国产一区二区三区免费| 中文字幕精品一区二区精品绿巨人| av在线播放不卡| 亚洲第一二三四区| xvideos.蜜桃一区二区| 99免费精品视频| 日韩在线一区二区三区| 精品少妇一区二区三区日产乱码| 国产精品77777| 亚洲美女淫视频| 日韩一二在线观看| 成人精品国产一区二区4080| 艳妇臀荡乳欲伦亚洲一区| 欧美一区二区精美| 成人免费高清视频在线观看| 国产乱子轮精品视频| 亚洲日本在线看| 在线播放/欧美激情| 国产精品夜夜嗨| 又紧又大又爽精品一区二区| 欧美一区午夜视频在线观看| 国产剧情一区二区| 一区二区三区不卡在线观看| 欧美一级夜夜爽| 99re这里只有精品首页| 午夜在线成人av| 国产精品青草综合久久久久99| 欧美日韩国产综合久久| 成人免费毛片app| 午夜精品国产更新| 亚洲国产精品激情在线观看| 欧美女孩性生活视频| 成人午夜碰碰视频| 日本亚洲一区二区| 亚洲另类在线一区| 久久精品视频免费观看| 在线电影国产精品| 色综合婷婷久久| 国产乱人伦偷精品视频免下载 | 另类小说欧美激情| 亚洲在线视频免费观看| 国产区在线观看成人精品| 911精品国产一区二区在线| 成人性视频网站| 麻豆精品一区二区av白丝在线| 亚洲品质自拍视频网站| 国产日韩三级在线| 欧美一级日韩一级| 色婷婷av一区二区三区软件| 粉嫩绯色av一区二区在线观看| 日韩极品在线观看| 亚洲一区二区成人在线观看| 国产嫩草影院久久久久| 日韩精品一区二区三区四区| 欧洲生活片亚洲生活在线观看| 不卡一区中文字幕| 国产成人亚洲精品青草天美| 久久精品国产精品青草| 亚洲成人手机在线| 一个色妞综合视频在线观看| 国产精品免费av| 国产偷国产偷亚洲高清人白洁| 日韩欧美在线123| 制服丝袜亚洲网站| 欧美日韩国产高清一区二区三区 | 日韩精品一区二区三区蜜臀| 欧美精品免费视频| 欧美日韩中字一区| 欧美日韩一级黄| 色88888久久久久久影院野外|