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

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

?? pddvclas.cpp

?? wince 下
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
	}
	else
		rc = ERROR_NOT_SUPPORTED;

	DEBUGMSG (ZONE_FUNC | ZONE_FEATURE, 
	          (DTAG TEXT("pdd_SetParameter--  rc %d\r\n"), rc));
	return rc;
}
//-----------------------------------------------------------------------
// GetFormatParameters - This routine parses the video class control 
// interface descriptor to find information on the requested format
// 
int pdd_GetFormatParameters (PDRVCONTEXT pDrv, BYTE bFormatIndex, BYTE bFrameIndex, 
							 BOOL fStill, PFORMATPROPS pProps) 
{
	int rc;
	BYTE bLastSubType = USB_VIDEO_VS_UNDEFINED;
	BOOL fFound = FALSE;

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

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

	// Find the Frame descriptors
	PUSBVIDSTREAMIFDESCRIPTOR pHdr = (PUSBVIDSTREAMIFDESCRIPTOR)pPDD->usbstrmIF->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)pPDD->usbstrmIF->lpepExtDesc;
		PBYTE pEnd = (PBYTE)pPDD->usbstrmIF->lpepExtDesc + 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 (1, (TEXT("Unexpected header type %xh\r\n"), pStd->bType));
				break;
			}
			// Are we looking for still formats or stream?
			if (!fStill)
			{
				switch (pStd->bSubtype) 
				{
				//TODO:: Need to support other formats
				case USB_VIDEO_VS_FORMAT_MJPEG:
					rc = ProcessFrameFormats (pPDD, pStd, VIDFORMAT_MJPEG, 
					                          bFormatIndex, bFrameIndex, pProps, &fFound);
					break;
				case USB_VIDEO_VS_FORMAT_UNCOMPRESSED:
					rc = ProcessFrameFormats (pPDD, pStd, VIDFORMAT_UNCOMPRESSED, 
					                          bFormatIndex, bFrameIndex, pProps, &fFound);
					break;
				case USB_VIDEO_VS_FORMAT_FRAME_BASED:
					rc = ProcessFrameFormats (pPDD, pStd, USB_VIDEO_VS_FRAME_FRAME_BASED, 
					                          bFormatIndex, bFrameIndex, pProps, &fFound);
					break;
				case USB_VIDEO_VS_FORMAT_MPEG2TS:
					break;
				case USB_VIDEO_VS_FORMAT_DV:
					break;
				default:
					break;
				}
				if (fFound)
					return rc;
			}
			else
			{
				if (pStd->bSubtype == USB_VIDEO_VS_STILL_IMAGE_FRAME)
				{
					PUSBVIDSTREAMIF_STILLIMGDESCRIPTOR pFrmStill = (PUSBVIDSTREAMIF_STILLIMGDESCRIPTOR)pStd;
					// See if index is within range
					if (bFrameIndex < pFrmStill->bNumImageSizePatterns)
					{
						memset (pProps, 0, sizeof (FORMATPROPS));
						pProps->cbSize = sizeof (FORMATPROPS);
						pProps->wFormatType = bLastSubType;
						pProps->wFormatIndex = bFormatIndex;
						pProps->wFrameIndex = bFrameIndex;
						pProps->dwHeight = pFrmStill->sStillFmt[bFrameIndex].wHeight;
						pProps->dwWidth = pFrmStill->sStillFmt[bFrameIndex].wWidth;
						//Maxbuff below assumes worst case 32bpp
						pProps->dwMaxBuff = pProps->dwHeight * pProps->dwWidth * 4; 
						return 0;
					}
					return -4;
				}
			}
			// Save the last format type
			bLastSubType = pStd->bSubtype;
		}
	}
	__except (EXCEPTION_EXECUTE_HANDLER)
	{
		DEBUGMSG (1, (TEXT("Exception scanning extended stream descriptor\r\n")));
		return -2;
	}

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("pdd_GetFormatParameters--\r\n")));
	return -3;
}	

//-----------------------------------------------------------------------
// pdd_GetCurrentFormat - Returns the format of the current stream
// but only if the stream is not internal. 
// 
int pdd_GetCurrentFormat (PDRVCONTEXT pDrv, PFORMATPROPS pProps) 
{
	int rc = ERROR_VC_DISCONNECTED;

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

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

	// See if stream running
	if (pPDD->wReadThreadState != STREAMTHD_STOPPED)
	{
		// Make sure its not an internal stream for still capture
		if ((DWORD)pPDD->pstrStream != (DWORD)&pPDD->strStreamDefault)
		{
			rc = pdd_GetFormatParameters (pDrv, (BYTE)pPDD->wCurrFormatIndex,
										  (BYTE)pPDD->wCurrFrameIndex, FALSE, 
										  pProps);
			// Save the stream rate
			pProps->nNumInterval = 1;
			pProps->dwInterval[0] = pPDD->dwCurrValidInterval;
		}
	}
	if (rc == ERROR_VC_DISCONNECTED)
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Error No stream active\r\n")));

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("pdd_GetCurrentFormat-- rc %d\r\n"), rc));
	return rc;
}
//-----------------------------------------------------------------------
// pdd_StartVidStream - Set streaming video from camera
// 
int pdd_StartVidStream (PDRVCONTEXT pDrv, BYTE bFormatIndex, BYTE bFrameIndex, 
						PVIDSTREAMSTRUCT pstrStream, DWORD dwFrameInterval) 
{
	int i, rc = 0;
	BYTE bInterface = VID_IF_STREAM;
	BYTE bUnit = 0;
	DWORD dwValidInterval;
	int nIntIndex;

	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("pdd_StartVidStream++  Fmt %d\r\n"), bFrameIndex));

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

	//
	// If we're starting just for a still capture, if any streaming is going
	// on, we'll take it and return.
	//
	if ((bFormatIndex == 0xff) && (bFrameIndex == 0xff))
	{
		if (pPDD->pstrStream != 0)
		{
			DEBUGMSG (ZONE_STILL, (DTAG TEXT("StartVidStream already running.  Exiting\r\n")));
			return ERROR_STREAM_ALREADY_RUNNING;
		}
		bFormatIndex = 1;
		bFrameIndex = 1;
		dwFrameInterval = 0;
	}
	//
	// Query the parameters for the new format.  This validates format and frame values
	//
	FORMATPROPS Props;
	rc = pdd_GetFormatParameters (pDrv, bFormatIndex, bFrameIndex, FALSE, &Props);
	if (rc)
	{
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Bad format or frame fmt:%d frame:%d rc %d\r\n"),
		          bFormatIndex, bFrameIndex, rc));
		return ERROR_INVALID_PARAMETER;
	}

	//
	// Validate the frame interval
	//

	// Discrete intervals?
	if (Props.nNumInterval != 0)
	{
		// See if min
		if (dwFrameInterval == -1)
			nIntIndex = Props.nNumInterval-1;

		// If 0, set to fastest interval
		else if (dwFrameInterval == 0)
			nIntIndex = 0;

		// Else look up to see if valid
		else
		{
			// Loop through the allowed descrete intervals
			for (nIntIndex = 0; nIntIndex < Props.nNumInterval; nIntIndex++)
			{
				if (dwFrameInterval == Props.dwInterval[nIntIndex])
					break;
			}
			if (nIntIndex == Props.nNumInterval)
				rc = ERROR_INVALID_PARAMETER;
		}
	}
	else
	{
		// See if min
		if (dwFrameInterval == -1)
			dwValidInterval = Props.dwInterval[0]; //Min value

		// If 0, set to fastest interval
		else if (dwFrameInterval == 0)
			dwValidInterval = Props.dwInterval[1]; //Max value

		// Else see if in proper range
		else
			if ((dwFrameInterval >= Props.dwInterval[0]) && (dwFrameInterval <= Props.dwInterval[1]))
				dwValidInterval = dwFrameInterval;
			else
				rc = ERROR_INVALID_PARAMETER;
	}
	if (rc)
	{
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT ("Bad frame interval %d specified\r\n"), dwFrameInterval));
		return rc;
	}

	//
	// Do probe commit for video stream
	//
	// Discrete intervals?
	if (Props.nNumInterval != 0)
	{
		// Try all frame intervals for a given Format/Frame size setting
		for (i = nIntIndex; i < Props.nNumInterval; i++)
		{
			// See if any quality setting for these parameters can work
			rc = NegotiateQuality (pDrv, bFormatIndex, bFrameIndex, Props.dwInterval[i]);
			if (rc == 0)
				break;
		}
	}
	else
	{
		// Starting with specified interval increment until over max
		while (dwValidInterval <= Props.dwInterval[1])
		{
			// See if any quality setting for these parameters can work
			rc = NegotiateQuality (pDrv, bFormatIndex, bFrameIndex, dwValidInterval);
			if (rc == 0)
				break;
			// Increment by granularity
			dwValidInterval += Props.dwInterval[2]; // rate granularity
		}
	}
	if (rc)
		DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Probe/Commit failed.  Not enough bandwidth for Fmt: %d  Frm: %d\r\n"), 
		          bFormatIndex, bFrameIndex));

	//
	// Allocate the streaming buffers if an internal stream just for a still
	//
	if (rc == 0)
	{
		// See if we need to set up a default stream or if we're changing the dest buffers
		if (pstrStream == 0) 
		{
			// Allocate buffers internally for the stream
			rc = AllocateInternalStreamBuffers (pPDD, Props.dwMaxBuff);
			if (rc == 0)
			{
				pPDD->pstrStream = (PVIDSTREAMSTRUCT)&pPDD->strStreamDefault;
			} 
		}
		// Else, we have a stream strcture passed to us.  Use it.
		else
		{
			pPDD->pstrStream = pstrStream;
		}
	}

	//
	// Start the read thread to get the data
	//
	if (rc == 0)
	{
		// Start of read thread if not already started
		if (pPDD->wReadThreadState == STREAMTHD_STOPPED)
		{
			// Create the thread
			pPDD->wReadThreadState = 1;
			pPDD->hReadThread = CreateThread (NULL, 0, ReadIsocThread, (PVOID)pDrv, 0, NULL);
			if (pPDD->hReadThread == 0)
			{
				DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Error creating read thread  ExtErr: %d\r\n"), GetLastError()));
				pPDD->wReadThreadState = 0;
				rc = -1;
			} else	
				Sleep (10);
		}
	}
	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("StartVidStream--  rc %d\r\n"), rc));
	return rc;
}	
//---------------------------------------------------------------------------------------
// pdd_GetNextVideoFrame - Returns the latest valid frame in the frame buffer.
//
int pdd_GetNextVideoFrame (PDRVCONTEXT pDrv, BOOL fGetLatest, PBYTE *ppFrameBuff, 
						   DWORD *pdwFrameBytes, DWORD *pdwValidFrames, PBYTE pFrameReturn, 
						   DWORD dwTimeout)
{
	int rc = 0; 
	DWORD i;
	BOOL fLeaveCS = TRUE;
	DEBUGMSG (ZONE_FUNC, (DTAG TEXT("pdd_GetNextVideoFrame++\r\n")));

	PPDDCONTEXT pPDD = (PPDDCONTEXT)pDrv->dwPddContext; 

	// Sync with read thread
	EnterCriticalSection (&pPDD->pstrStream->csBuffSync);
	__try 
	{
		//
		// See if there is a frame to return
		//
		if (pFrameReturn != 0)
		{
			// Trivial sanity check for returned buffer. Buffer addresses will always
			// be above the first entry in the buffer array.
			if ((DWORD)pFrameReturn < (DWORD)&pPDD->pstrStream->pFrame[0].pBuff)
			{
				rc = ERROR_INVALID_PARAMETER;
				DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Returned buffer pointer %08x not valid \r\n"), 
				          pFrameReturn));
				__leave;
			}
			// Find a free slot in the array
			for (i = 0; i < pPDD->pstrStream->dwNumBuffs; i++)
			{
				// If slot free, add the buffer back.  Correct for packet header offset
				if (pPDD->pstrStream->pFrame[i].pBuff == 0)
					pPDD->pstrStream->pFrame[i].pBuff = pFrameReturn - sizeof (USBVIDPAYLOADHDR);
			}
		}
		//
		// See if they want a new frame
		//
		if (ppFrameBuff != 0)
		{
			int nCnt = 0;
			// See if we have enough buffers remaining for this task. We
			// need to leave at least 2 buffers in the list
			for (i = 0; (i < pPDD->pstrStream->dwNumBuffs) && (nCnt < 2); i++)
			{
				// If slot free, add the buffer back
				if (pPDD->pstrStream->pFrame[i].pBuff != 0)
					nCnt++;
			}
			if (nCnt < 2)
			{
				rc = ERROR_NOT_ENOUGH_MEMORY;
				DEBUGMSG (ZONE_ERROR, (DTAG TEXT("Not enough free buffers to return one\r\n")));
				__leave;
			}

			// We need to leave the CS to allow the isoc thread to complete
			// a frame.
			LeaveCriticalSection (&pPDD->pstrStream->csBuffSync);
			fLeaveCS = FALSE;

			// Wait for new frame event
			rc = WaitForSingleObject ((HANDLE)pPDD->pstrStream->dwReserved, dwTimeout);
			if (rc == WAIT_OBJECT_0)
			{
				// Retake the CS so we can access the struct again
				EnterCriticalSection (&pPDD->pstrStream->csBuffSync);
				fLeaveCS = TRUE;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区在线免费观看| 中文在线一区二区| 亚洲综合另类小说| 日韩欧美一级在线播放| 精品在线一区二区| 国产精品成人一区二区三区夜夜夜| heyzo一本久久综合| 亚洲成人自拍网| 欧美变态tickling挠脚心| 国产成人在线观看免费网站| 亚洲欧美激情插 | 久久色在线视频| 成人18视频在线播放| 奇米综合一区二区三区精品视频| 天天色图综合网| 亚洲国产成人av| 欧美精品欧美精品系列| 亚洲一区二区三区四区的 | 欧美xxx久久| 色成年激情久久综合| 国产精品123| 免费精品99久久国产综合精品| 日一区二区三区| 国产福利91精品一区二区三区| 国产福利一区在线观看| av电影在线观看完整版一区二区| 一本久久综合亚洲鲁鲁五月天 | 国产福利一区在线观看| 亚洲国产精品传媒在线观看| 欧美不卡激情三级在线观看| 91在线免费看| 亚洲免费看黄网站| 欧美精品 日韩| 五月综合激情婷婷六月色窝| 一区二区三区四区五区视频在线观看| 亚洲另类春色校园小说| 欧美一区二区三区的| 99久久国产综合精品色伊| 免费观看成人鲁鲁鲁鲁鲁视频| 精品国产3级a| 欧美日韩一区二区三区在线 | 欧美经典一区二区三区| 在线一区二区视频| 亚洲成人激情综合网| 激情偷乱视频一区二区三区| 天天综合天天综合色| 国产午夜精品一区二区三区四区| 欧美三级视频在线| 制服丝袜亚洲色图| 亚洲乱码精品一二三四区日韩在线 | 国产乱子伦视频一区二区三区| 91精品福利在线一区二区三区| 亚洲一区二区三区影院| 色播五月激情综合网| 午夜欧美电影在线观看| 高清国产一区二区三区| 91免费版在线看| 日韩免费高清电影| 一区二区三区在线看| 国产91清纯白嫩初高中在线观看| 欧美日韩在线播放三区四区| 国产丝袜在线精品| 美女视频黄免费的久久| 欧美日韩高清在线播放| 日韩精品最新网址| 日韩一区二区在线看片| 欧美视频精品在线| 欧美老肥妇做.爰bbww视频| 精品一区二区三区久久| 精品一区二区日韩| 国产精品资源网| 一本一本大道香蕉久在线精品 | 亚洲福中文字幕伊人影院| www.av精品| 国产精品久久三区| 日本韩国视频一区二区| 亚洲欧美成人一区二区三区| 国产一区二区三区四| 久久色视频免费观看| 国产最新精品精品你懂的| 777奇米成人网| 美女精品一区二区| 中文字幕精品在线不卡| 成人av电影在线| 亚洲综合视频在线| 久久久精品影视| jvid福利写真一区二区三区| 亚洲精品中文在线| 日韩精品最新网址| av成人老司机| 久久se精品一区二区| 国产精品美日韩| 欧美精品 国产精品| kk眼镜猥琐国模调教系列一区二区| 亚洲欧美激情一区二区| 91精品国产综合久久久蜜臀粉嫩| 成人在线一区二区三区| 天天色天天爱天天射综合| 色88888久久久久久影院野外| 性久久久久久久| 国产夜色精品一区二区av| 精品视频在线免费看| 韩国成人精品a∨在线观看| 亚洲综合网站在线观看| 国产精品理论在线观看| 久久精品日产第一区二区三区高清版| 99久久久精品免费观看国产蜜| 国产又黄又大久久| 蜜臀久久99精品久久久画质超高清| 国产精品久久久久久久久快鸭 | 在线播放一区二区三区| 91影视在线播放| 成人综合激情网| caoporm超碰国产精品| 粉嫩高潮美女一区二区三区| 成人av集中营| 91色在线porny| 亚洲国产综合在线| 欧美午夜不卡在线观看免费| 热久久久久久久| 欧美成人a视频| 91最新地址在线播放| 免费不卡在线观看| 亚洲一区视频在线观看视频| 国产喷白浆一区二区三区| 日韩免费性生活视频播放| 欧美电视剧在线看免费| 日韩欧美电影一二三| 久久先锋影音av| 亚洲精品日日夜夜| 久久精品国产网站| 亚洲成人精品一区| 久久久久久综合| 日本久久精品电影| 亚洲激情男女视频| 日韩亚洲欧美成人一区| 欧美国产欧美综合| 日韩欧美一级二级三级久久久| 国产精品 欧美精品| 99久久精品免费看国产| 欧美性大战xxxxx久久久| 欧美精品123区| 国产精品毛片大码女人| 婷婷国产在线综合| 懂色一区二区三区免费观看| 欧美日韩一区二区三区在线看| 久久网站最新地址| 日本在线不卡视频| 91精品1区2区| 亚洲欧美自拍偷拍色图| 国产专区综合网| 欧美一区中文字幕| 亚洲精品免费播放| 99久久免费国产| 国产欧美精品一区| 国产乱码一区二区三区| 日韩一级片网址| 爽爽淫人综合网网站| 91福利国产成人精品照片| 国产精品不卡一区| 成人美女视频在线观看18| 欧美极品美女视频| 成人免费av资源| 亚洲精品视频自拍| 久久国产综合精品| 欧美经典三级视频一区二区三区| 国产一区二区三区高清播放| 久久久另类综合| 高清不卡在线观看av| 中文字幕一区二区三区av| 国产成人免费在线| 一区二区三区色| 欧美蜜桃一区二区三区| 久久国产尿小便嘘嘘| 久久亚洲精精品中文字幕早川悠里| 国产宾馆实践打屁股91| 1024国产精品| 日韩美女一区二区三区| k8久久久一区二区三区| 麻豆精品一区二区三区| 久久精品亚洲精品国产欧美| 欧美在线观看视频一区二区三区| 日本不卡的三区四区五区| 中文av字幕一区| 欧美一区欧美二区| 欧美在线视频你懂得| 麻豆高清免费国产一区| 夜夜精品视频一区二区 | 成人中文字幕电影| 日本中文字幕一区二区有限公司| 国产欧美精品一区二区三区四区| 欧美三级日韩三级国产三级| 粉嫩一区二区三区性色av| 久久狠狠亚洲综合| 中文字幕国产精品一区二区| 日韩女优视频免费观看| 欧美裸体一区二区三区| 免费看欧美美女黄的网站| 午夜久久久久久电影| 亚洲成人自拍一区|