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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pddvclas.cpp

?? wince 下
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
			} 
			else
			{
				DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Next Frame event not signaled rc %d\r\n"), rc));
				__leave;
			}

			// Get lastest buffer, and its size. Skip past the frame header
			*ppFrameBuff = pPDD->pstrStream->pFrame[pPDD->pstrStream->dwLastGoodBuff].pBuff + sizeof (USBVIDPAYLOADHDR);
			*pdwFrameBytes = pPDD->pstrStream->pFrame[pPDD->pstrStream->dwLastGoodBuff].dwSize;

			// Take it out of the list
			pPDD->pstrStream->pFrame[pPDD->pstrStream->dwLastGoodBuff].pBuff = 0;

			// Tell the caller how many frames have gone by since last call
			if (pdwValidFrames)
				*pdwValidFrames = pPDD->pstrStream->dwValidFrames;
			pPDD->pstrStream->dwValidFrames = 0;
		}
	}
	__finally 
	{
		if (fLeaveCS)
			LeaveCriticalSection (&pPDD->pstrStream->csBuffSync);
	}

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("pdd_GetNextVideoFrame--  rc %d\r\n"), rc));
	return rc;
}
//-----------------------------------------------------------------------
// pdd_StopVidStream - Set streaming video from camera
// 
int pdd_StopVidStream (PDRVCONTEXT pDrv) 
{
	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("pdd_StopVidStream++\r\n")));

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

	StopReadThread (pPDD);
	pPDD->wCurrFormatIndex = 0xffff;
	pPDD->wCurrFrameIndex = 0xffff;

	// Change to null interface
	SetStreamInterface (pDrv, 1, 0);  

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("pdd_StopVidStream--\r\n")));
	return 0;
}
//---------------------------------------------------------------------------------------
// pdd_GetStillImage - Captures a single frame of video.  
//
int pdd_GetStillImage (PDRVCONTEXT pDrv, int nFrameIndex, int nFormatIndex, PBYTE pOut, 
					   DWORD dwOut, PDWORD pdwBytesWritten)
{
	PPDDCONTEXT pPDD = (PPDDCONTEXT)pDrv->dwPddContext; 
	int rc = 0;

	// If we can't enter the still cap CS, we're already capturing an image, so fail
	if (!TryEnterCriticalSection (&pPDD->csStill))
	{
		return ERROR_BUSY;
	}
	__try
	{
		// See if stream running, or if simply an internal stream
		if ((pPDD->wReadThreadState == STREAMTHD_STOPPED) ||
			((DWORD)pPDD->pstrStream != (DWORD)&pPDD->strStreamDefault))
		{
			// If current stream doesn't match, change it.
			if ((nFormatIndex != pPDD->wCurrFormatIndex) || (nFrameIndex != pPDD->wCurrFrameIndex))
			{
				// According to the Vid Class spec, the video stream should be running for a still capture
				rc = pdd_StartVidStream (pDrv, nFormatIndex, nFrameIndex, NULL, -1); 
				DEBUGMSG( 1, (TEXT("StartVidStream returned %d.\n"), rc)); 
				Sleep (500); // Let the camera settle a bit
			}
		}
		if (rc)
			__leave;

		PBYTE pFrameBuff;
		DWORD dwSize;
		// Get the next frame
		rc = pdd_GetNextVideoFrame (pDrv, TRUE, &pFrameBuff, &dwSize, 0, 0, 2000);
		if (rc == 0)
		{
			__try
			{
				// Copy the frame to the output buffer
				memcpy (pOut, pFrameBuff, dwSize);
				*pdwBytesWritten = dwSize;
			}
			__except (EXCEPTION_EXECUTE_HANDLER)
			{
				DEBUGMSG (ZONE_ERROR, (TEXT("Exception writing to output buffer\r\n")));
				rc = ERROR_INVALID_PARAMETER;
			}
			// Return the frame buffer pointer
			pdd_GetNextVideoFrame (pDrv, TRUE, 0, &dwSize, 0, pFrameBuff, 0);
		}
	}
	__finally
	{
		// Leave the critical section
		LeaveCriticalSection (&pPDD->csStill);
	}
	return rc;
}

//-----------------------------------------------------------------------
// GetPower - Gets the camera power 
// 
int GetPower (PDRVCONTEXT pDrv, BOOL *pbVal)
{
	int rc = 0;
	BYTE bInterface = VID_IF_CTL;
	BYTE bUnit = 0;
	BYTE bVal;

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

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

	rc = DoVendorTransfer (pDrv, USBVID_GET_CUR, USB_VIDEO_VC_CS_VIDEO_POWER_MODE_CONTROL,
	                       bInterface, bUnit, &bVal, 1);

	if (rc)
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Error reading power setting from camera rc %d\r\n"), rc));
	if (bVal & 1)
		*pbVal = TRUE;
	else
		*pbVal = FALSE;

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("GetPower-- rc %d error code %d\r\n"), rc, bVal));
	return rc;
}

//-----------------------------------------------------------------------
// SetPower - Sets the camera power 
// 
int SetPower (PDRVCONTEXT pDrv, BOOL fOn)
{
	int rc = 0;
	BYTE buff[64];
	BYTE bInterface = VID_IF_CTL;
	BYTE bUnit = 0;

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

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

	if (fOn)
		buff[0] = 0x01;
	else
		buff[0] = 0x00;

	rc = DoVendorTransfer (pDrv, USBVID_SET_CUR, USB_VIDEO_VC_CS_VIDEO_POWER_MODE_CONTROL,
	                       bInterface, bUnit, (PBYTE)buff, 1);

	if (rc)
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Error set camera power rc %d\r\n"), rc));

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("SetPower-- rc %d error code %d\r\n"), rc, buff[0]));
	return rc;
}
//-----------------------------------------------------------------------
// DoVendorTransfer - Called to communicate with the camera.  Since I've
// noticed that the camera sometimes overruns the output buffer, this 
// function pipes the data into a fairly big buffer and then copies the
// data to the exact size buffer passed.
// 
int DoVendorTransfer (PDRVCONTEXT pDrv, BYTE bRequest, BYTE bCmd, BYTE bInterface, 
					  BYTE bUnit, PBYTE pVal, WORD wLen)
{
	USB_DEVICE_REQUEST req;
	DWORD dwBytes;
	DWORD dw, dwErr;
	BOOL fSet;
	static BYTE bTBuff[512];

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

	if (bRequest == USBVID_SET_CUR)
		fSet = TRUE;
	else
		fSet = FALSE;

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

	//
	// Set transfer flags depending on read or write
	//
	if (fSet)
		req.bmRequestType = USB_REQUEST_HOST_TO_DEVICE | USB_REQUEST_CLASS | USB_REQUEST_FOR_INTERFACE;
	else
		req.bmRequestType = USB_REQUEST_DEVICE_TO_HOST | USB_REQUEST_CLASS | USB_REQUEST_FOR_INTERFACE;

	req.bRequest = bRequest;
	req.wValue   = MAKEWORD (0, bCmd);
	req.wIndex   = MAKEWORD (bInterface, bUnit);
	req.wLength  = wLen;

	dwBytes = 0;
	dwErr = USB_NO_ERROR;
	dw = IssueVendorTransfer (pDrv->lpUsbFuncs, pDrv->hDevice, 
							DefaultTransferComplete, pPDD->hVendorEvent,
							(fSet ? USB_OUT_TRANSFER : USB_IN_TRANSFER) | USB_SHORT_TRANSFER_OK,
							&req, fSet && (req.wLength < sizeof (bTBuff)) ? pVal : bTBuff, 
							NULL, &dwBytes, 2000, &dwErr);
	if (dw)
		DEBUGMSG (ZONE_ERROR, 
		          (DTAG TEXT("Error calling IssueVendorTransfer rc: %d  ExtErr: %d\r\n"), 
				  dw, GetLastError()));

	// If no data transferred, stuff in an error
	if (!dw && (dwBytes != wLen))
		dw = ERROR_BAD_LENGTH;

	// Copy data to output buffer
	if (!dw && !fSet && (dwBytes <= req.wLength))
		memcpy (pVal, bTBuff, dwBytes);

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("DoVendorTransfer-- rc %d\r\n"), dw));
	return dw;
}
//-----------------------------------------------------------------------
// FindFeatureInfo - Look up feature in the table to get parameter 
// information.
// 
PFEATURESTRUCT FindFeatureInfo (BYTE bFeatureID)
{
	int i;
	for (i = 0; i < dim (CamFeatures); i++)
	{
		if (bFeatureID == CamFeatures[i].bFeatureID)
			return &CamFeatures[i];
	}
	for (i = 0; i < dim (ProcFeatures); i++)
	{
		if (bFeatureID == ProcFeatures[i].bFeatureID)
			return &ProcFeatures[i];
	}
	return 0;
}

//-----------------------------------------------------------------------
// EnableSupportedFeatures - Given a bit array from the interface
// descriptor, fill the feature table with the necessary data.
// 
int EnableSupportedFeatures (PBYTE pCtlBytes, int nCtlBytes, PFEATURESTRUCT pFeatArray, 
							 int nFeatArraySize, BYTE bUnit) 
{
	BYTE bm;

	// Loop through, Check the bit for each feature
	for (BYTE index = 0; index < nFeatArraySize; index++)
	{
		// Do we need another byte?
		if ((index % 8) == 0)
		{
			// if no more bytes, leave
			if (nCtlBytes == 0) return 0;
			bm = *pCtlBytes++;
			nCtlBytes--;
		}
		if (bm & 0x01)
			pFeatArray[index].bUnit = bUnit;
		else
			pFeatArray[index].bFeatureID = FEAT_UNSUPPORTED;

		bm = bm >> 1;
	}
	return 0;
}
//-----------------------------------------------------------------------
// ParseFeatureParameters - Parses the device interface descriptor to 
// see what features this camera supports.
// 
int ParseFeatureParameters (PPDDCONTEXT pPDD) 
{
	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("GetFeatureParameters++\r\n")));

	// Find the Control descriptors
	PUSBVIDCTLIFDESCRIPTOR pHdr = (PUSBVIDCTLIFDESCRIPTOR)pPDD->usbctlIF.lpepExtDesc;
	__try {
		// Sanity check on header IDs
		if ((pHdr->bType != 0x24) || (pHdr->bSubtype != 1)) 
		{
			DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Bad Extended Stream Descriptor\r\n")));
			return -1;
		}
		PBYTE pData = (PBYTE)pHdr;
		PBYTE pEnd = (PBYTE)pHdr + pHdr->wTotalLen;

		PUSBVIDSTDDESCHDR pStd = (PUSBVIDSTDDESCHDR)pHdr;
		// Loop through all the descriptors
		while (pData + pStd->bLen < pEnd)
		{
			pData += pStd->bLen;
			pStd = (PUSBVIDSTDDESCHDR)pData;

			if (pStd->bType != USB_VIDEO_CS_INTERFACE)
			{
				DEBUGMSG (ZONE_ERROR, (TEXT("Unexpected header type %xh\r\n"), pStd->bType));
				break;
			}
			switch (pStd->bSubtype) 
			{
			case USB_VIDEO_VC_PROCESSING_UNIT:
				// Verify structure length
				if (pStd->bLen >= 0x0b)
				{
					BYTE bCtlSize = *(pData+7);
					PBYTE pCtls = pData+8;
					BYTE bUnit = *(pData+3);
					EnableSupportedFeatures (pCtls, bCtlSize, ProcFeatures, 
					                         dim(ProcFeatures), bUnit);
				}
				break;
			case USB_VIDEO_VC_INPUT_TERMINAL:
				{
					WORD wType = *(LPWORD)(pData+4);
					// Verify that it's the camera
					if (wType == USB_VIDEO_ITT_CAMERA)
					{
						// Verify structure length
						if (pStd->bLen >= 0x11)
						{
							BYTE bCtlSize = *(pData+14);
							PBYTE pCtls = pData+15;
							BYTE bTerm = *(pData+3);
							EnableSupportedFeatures (pCtls, bCtlSize, CamFeatures, 
							                         dim(CamFeatures), bTerm);
						}
					}
				}
				break;
			}
		}
	}
	__except (EXCEPTION_EXECUTE_HANDLER)
	{
		DEBUGMSG (1, (TEXT("Exception scanning extended control descriptor\r\n")));
		return -2;
	}
	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("GetFeatureParameters--\r\n")));
	return 0;
}

//-----------------------------------------------------------------------
// ProcessFrameFormats - Helper function that examines the frame information
// for each format and returns information on the given frame.
// 
int ProcessFrameFormats (PPDDCONTEXT pPDD, PUSBVIDSTDDESCHDR pStd, BYTE bDescID, 
						 BYTE bFormatIndex, BYTE bFrameIndex, 
						 PFORMATPROPS pProps, BOOL *pfFound)
{
	PUSBVIDSTREAMIF_FORMATDESCRIPTOR pFmt = (PUSBVIDSTREAMIF_FORMATDESCRIPTOR)pStd;
	BYTE bCnt = pFmt->bNumFrameDescriptors;
	*pfFound = FALSE;

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

	if (bFrameIndex > bCnt)
		return -1;

	// See if this is the format we want
	if (pFmt->bFormatIndex != bFormatIndex)
		return 0;

	// Get the pointer to the first frame descriptor
	PUSBVIDSTREAMIF_MJPEGFRAMEDESCRIPTOR pFrmMJPEG = (PUSBVIDSTREAMIF_MJPEGFRAMEDESCRIPTOR)( (PBYTE)pStd+pStd->bLen);

	if (pFrmMJPEG->bSubtype != bDescID)
	{
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("ERROR: Expected Frame descriptor to follow format descriptor\r\n")));
		return -2;
	}
	// Loop through Frame descriptors looking for matching index
	for (int i = 0; i < bCnt; i++)
	{
		// See if this is the descriptor we want
		if (pFrmMJPEG->bFrameIndex == bFrameIndex)
		{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影在线播放| 欧美一二区视频| 日日欢夜夜爽一区| 国产精品视频免费| 欧美一级片在线看| 色丁香久综合在线久综合在线观看| 精品系列免费在线观看| 香蕉乱码成人久久天堂爱免费| 成人小视频免费在线观看| a美女胸又www黄视频久久| 午夜精品久久久久久久99水蜜桃| 国产亚洲精品aa午夜观看| 欧美日产在线观看| 成人18视频日本| 麻豆91在线观看| 亚洲综合精品久久| 国产精品卡一卡二卡三| 精品对白一区国产伦| 91精品在线观看入口| 99re成人精品视频| 国产精品自在在线| 久久成人久久爱| 亚洲不卡在线观看| 一区二区三区日韩精品视频| 国产精品白丝在线| 国产精品久久久久9999吃药| 欧美精彩视频一区二区三区| 国产亚洲精品超碰| 国产免费成人在线视频| 久久久久国产精品人| 欧美成人一级视频| 精品国产污网站| 欧美在线免费观看亚洲| 国产一区福利在线| 蜜桃av一区二区| 日本成人在线不卡视频| 午夜精品视频一区| 亚洲午夜影视影院在线观看| 亚洲一二三区视频在线观看| 亚洲一区二区三区四区的| 亚洲无线码一区二区三区| 亚洲一区二区高清| 午夜精品久久久久影视| 日本中文在线一区| 久久精品国产**网站演员| 男人的天堂久久精品| 麻豆91精品视频| 精品一二三四在线| 日本欧美在线观看| 91免费在线看| 懂色av中文字幕一区二区三区| 亚洲成av人片一区二区| 成人免费在线视频| 国产欧美日韩另类视频免费观看| 777色狠狠一区二区三区| 欧日韩精品视频| 懂色av一区二区三区蜜臀 | 韩日av一区二区| 免费的成人av| 韩国毛片一区二区三区| 国产精品99久| 波多野结衣中文字幕一区二区三区| a4yy欧美一区二区三区| 91极品美女在线| 欧美一级日韩不卡播放免费| 久久综合99re88久久爱| 欧美视频中文字幕| 91视视频在线直接观看在线看网页在线看| 99re6这里只有精品视频在线观看| 一本久久a久久免费精品不卡| 欧美三级日韩三级| 欧美v亚洲v综合ⅴ国产v| 国产精品乱人伦| 亚洲国产精品影院| 国产精品一区二区视频| 日本道色综合久久| 欧美va亚洲va| 亚洲伦理在线免费看| 蜜乳av一区二区三区| 成人国产精品免费观看动漫 | 久久久精品综合| 一区二区在线电影| 久久 天天综合| 一本色道久久综合亚洲aⅴ蜜桃| 欧美一区二区三区性视频| 国产日韩三级在线| 五月综合激情网| 成人午夜av电影| 91精品国产91久久久久久最新毛片| 欧美国产日韩在线观看| 日本aⅴ精品一区二区三区 | 91香蕉视频mp4| 日韩精品综合一本久道在线视频| 中文字幕一区二区三区视频| 美国精品在线观看| 欧美在线观看一二区| 国产日产精品一区| 免费高清视频精品| 欧洲av一区二区嗯嗯嗯啊| 国产欧美一区二区精品性色| 日韩国产欧美视频| 一本久道久久综合中文字幕 | 欧美日韩你懂得| 国产精品久久久久一区二区三区 | 丝袜脚交一区二区| www.日韩精品| 日本一区二区三区四区在线视频| 日韩黄色免费电影| 欧美亚洲国产一区二区三区| 国产精品久久久久一区| 国产成人午夜精品5599| 日韩欧美色综合网站| 亚洲六月丁香色婷婷综合久久| 18成人在线视频| 99国产精品久| 欧美成人video| 午夜影院在线观看欧美| 色悠悠久久综合| 亚洲天天做日日做天天谢日日欢 | 美日韩一区二区| 欧美色图12p| 一区二区三区不卡在线观看| a级精品国产片在线观看| 中文字幕高清不卡| 国产成人亚洲精品青草天美| 久久久久国产免费免费| 精品一区二区综合| 精品成a人在线观看| 日本最新不卡在线| 欧美一级夜夜爽| 捆绑调教美女网站视频一区| 337p亚洲精品色噜噜| 日韩一区精品视频| 欧美精品123区| 视频一区二区国产| 91精品国产aⅴ一区二区| 日韩精品欧美精品| 精品欧美乱码久久久久久| 久久99久久久久| 久久精品视频一区二区| 国产激情一区二区三区四区 | 欧美日本一区二区| 亚洲欧美日韩电影| 欧美这里有精品| 亚洲午夜激情av| 欧美亚洲免费在线一区| 日韩激情中文字幕| 久久综合色天天久久综合图片| 久久国产精品无码网站| 欧美精品一区二区三区蜜桃视频| 精品一区二区三区在线视频| 久久噜噜亚洲综合| 成人avav在线| 亚洲国产aⅴ成人精品无吗| 正在播放亚洲一区| 国产成人综合亚洲网站| 国产精品久久久久影院色老大| 91国产成人在线| 人人狠狠综合久久亚洲| 国产日本欧洲亚洲| 欧美性受极品xxxx喷水| 激情六月婷婷久久| 国产精品麻豆99久久久久久| 欧美在线免费播放| 久草在线在线精品观看| 国产精品国产三级国产aⅴ原创 | 欧美精品在线视频| 亚洲综合精品久久| 欧美电影免费观看高清完整版| 激情综合网最新| 日韩毛片视频在线看| 91精品国产色综合久久ai换脸| 国产河南妇女毛片精品久久久| 一区二区中文字幕在线| 正在播放亚洲一区| zzijzzij亚洲日本少妇熟睡| 天天av天天翘天天综合网| 国产亚洲欧美在线| 欧美视频你懂的| 国产精品69毛片高清亚洲| 亚洲午夜av在线| 亚洲国产精品二十页| 欧美日韩国产小视频在线观看| 国产一区欧美一区| 天堂成人免费av电影一区| 久草在线在线精品观看| 日韩伦理av电影| 日韩午夜激情视频| 91香蕉视频在线| 精品一区二区影视| 亚洲成人av在线电影| 欧美激情自拍偷拍| 日韩一区二区电影在线| 91亚洲精品久久久蜜桃| 国产在线看一区| 视频一区欧美日韩| 亚洲特级片在线| 亚洲精品在线三区| 8v天堂国产在线一区二区| 91啪九色porn原创视频在线观看|