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

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

?? mexddgrab.cpp

?? 在matlab環(huán)境下講視頻文件讀入
?? CPP
字號:
/***************************************************
This is the matlab interface code to the grabber code.
It just wraps the grabber functions and does some error
conversion.

Written by Micah Richert.
07/14/2005
**************************************************/

#include "mex.h"
#include "DDGrab.h"

TCHAR str[200];

TCHAR* message(HRESULT hr)
{
	if (hr == S_OK)
	{
		return "";
	} else {
		if (AMGetErrorText(hr,str,200) != 0) return str;
		return "Unknown error";
	}
}

DDGrabber DDG;

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
	if (nrhs < 1 || !mxIsChar(prhs[0])) mexErrMsgTxt("First parameter must be the command (a string)");

	char cmd[100];
	mxGetString(prhs[0],cmd,100);

	if (!strcmp("buildGraph",cmd))
	{
		if (nrhs < 2 || !mxIsChar(prhs[1])) mexErrMsgTxt("buildGraph: second parameter must be the filename (as a string)");
		if (nlhs > 0) mexErrMsgTxt("buildGraph: there are no outputs");
		int filenamelen = mxGetN(prhs[1])+1;
		char* filename = new char[filenamelen];
		if (!filename) mexErrMsgTxt("buildGraph: out of memory");
		mxGetString(prhs[1],filename,filenamelen);

		char* errmsg =  message(DDG.buildGraph(filename));
		free(filename);

		if (strcmp("",errmsg)) mexErrMsgTxt(errmsg);
		plhs[0] = NULL;
	} else if (!strcmp("doCapture",cmd)) {
		if (nlhs > 0) mexErrMsgTxt("doCapture: there are no outputs");
		char* errmsg =  message(DDG.doCapture());
		if (strcmp("",errmsg)) mexErrMsgTxt(errmsg);
		plhs[0] = NULL;
	} else if (!strcmp("getVideoInfo",cmd)) {
		if (nrhs < 2 || !mxIsNumeric(prhs[1])) mexErrMsgTxt("getVideoInfo: second parameter must be the video stream id (as a number)");
		if (nlhs > 5) mexErrMsgTxt("getVideoInfo: there are only 5 output values: width, height, rate, nrFramesCaptured, nrFramesTotal");

		unsigned int id = mxGetScalar(prhs[1]);
		int width,height,rate,nrFramesCaptured,nrFramesTotal;
		char* errmsg =  message(DDG.getVideoInfo(id, &width, &height,&rate, &nrFramesCaptured, &nrFramesTotal));

		if (strcmp("",errmsg)) mexErrMsgTxt(errmsg);

		if (nlhs >= 1) {plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[0])[0] = width; }
		if (nlhs >= 2) {plhs[1] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[1])[0] = height; }
		if (nlhs >= 3) {plhs[2] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[2])[0] = rate; }
		if (nlhs >= 4) {plhs[3] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[3])[0] = nrFramesCaptured; }
		if (nlhs >= 5) {plhs[4] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[4])[0] = nrFramesTotal; }
	} else if (!strcmp("getAudioInfo",cmd)) {
		if (nrhs < 2 || !mxIsNumeric(prhs[1])) mexErrMsgTxt("getAudioInfo: second parameter must be the audio stream id (as a number)");
		if (nlhs > 5) mexErrMsgTxt("getAudioInfo: there are only 5 output values: nrChannels, rate, bits, nrFramesCaptured, nrFramesTotal");

		unsigned int id = mxGetScalar(prhs[1]);
		int nrChannels,rate,bits,nrFramesCaptured,nrFramesTotal;
		char* errmsg =  message(DDG.getAudioInfo(id, &nrChannels, &rate, &bits, &nrFramesCaptured, &nrFramesTotal));

		if (strcmp("",errmsg)) mexErrMsgTxt(errmsg);

		if (nlhs >= 1) {plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[0])[0] = nrChannels; }
		if (nlhs >= 2) {plhs[1] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[1])[0] = rate; }
		if (nlhs >= 3) {plhs[2] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[2])[0] = bits; }
		if (nlhs >= 4) {plhs[3] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[3])[0] = nrFramesCaptured; }
		if (nlhs >= 5) {plhs[4] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[4])[0] = nrFramesTotal; }
	} else if (!strcmp("getCaptureInfo",cmd)) {
		if (nlhs > 2) mexErrMsgTxt("getCaptureInfo: there are only 2 output values: nrVideo, nrAudio");

		int nrVideo, nrAudio;
		DDG.getCaptureInfo(&nrVideo, &nrAudio);

		if (nlhs >= 1) {plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[0])[0] = nrVideo; }
		if (nlhs >= 2) {plhs[1] = mxCreateDoubleMatrix(1,1,mxREAL); mxGetPr(plhs[1])[0] = nrAudio; }
	} else if (!strcmp("getVideoFrame",cmd)) {
		if (nrhs < 3 || !mxIsNumeric(prhs[1]) || !mxIsNumeric(prhs[2])) mexErrMsgTxt("getVideoFrame: second parameter must be the audio stream id (as a number) and third parameter must be the frame number");
		if (nlhs > 1) mexErrMsgTxt("getVideoFrame: there are only 1 output value: data");

		unsigned int id = mxGetScalar(prhs[1]);
		int frameNr = mxGetScalar(prhs[2]);
		char* data;
		int nrBytes;
		int dims[] = {1,1};
		char* errmsg =  message(DDG.getVideoFrame(id, frameNr, &data, &nrBytes));

		if (strcmp("",errmsg)) mexErrMsgTxt(errmsg);

		dims[0] = nrBytes;
		plhs[0] = mxCreateNumericArray(2, dims, mxUINT8_CLASS, mxREAL); // empty 2d matrix
		memcpy(mxGetPr(plhs[0]),data,nrBytes);
		free(data);
	} else if (!strcmp("getAudioFrame",cmd)) {
		if (nrhs < 3 || !mxIsNumeric(prhs[1]) || !mxIsNumeric(prhs[2])) mexErrMsgTxt("getAudioFrame: second parameter must be the audio stream id (as a number) and third parameter must be the frame number");
		if (nlhs > 1) mexErrMsgTxt("getAudioFrame: there are only 1 output value: data");

		unsigned int id = mxGetScalar(prhs[1]);
		int frameNr = mxGetScalar(prhs[2]);
		char* data;
		int nrBytes;
		int dims[] = {1,1};
		mxClassID mxClass;
		char* errmsg =  message(DDG.getAudioFrame(id, frameNr, &data, &nrBytes));

		if (strcmp("",errmsg)) mexErrMsgTxt(errmsg);

		int nrChannels,rate,bits,nrFramesCaptured,nrFramesTotal;
		DDG.getAudioInfo(id, &nrChannels, &rate, &bits, &nrFramesCaptured, &nrFramesTotal);

		switch (bits)
		{
			case 4:
			{
				char* tmpdata = (char*)malloc(nrBytes*2);
				int i;

				for (i=0;i<nrBytes;i++)
				{
					tmpdata[i*2] = ((0x8&data[i])?-1:1)*(0x7&data[i]);
					tmpdata[i*2+1] = ((0x80&data[i])?-1:1)*((0x70&data[i])>>4);
				}

				free(data);
				data = tmpdata;
				mxClass = mxINT8_CLASS;
				dims[0] = nrBytes*2;
				break;
			}
			case 8:
			{
		 		dims[0] = nrBytes;
				mxClass = mxINT8_CLASS;
				break;
			}
			case 16:
			{
				mxClass = mxINT16_CLASS;
				dims[0] = nrBytes/2;
				break;
			}
			case 24:
			{
				int* tmpdata = (int*)malloc(nrBytes/3*4);
				int i;

				for (i=0;i<nrBytes/3;i++)
				{
					tmpdata[i] = ((0x80&data[i*3+2])?-1:1)*(((0x7F&data[i+2])<<16)+(data[i]<<8)+data[i]);
				}

				free(data);
				data = (char*)tmpdata;

				mxClass = mxINT32_CLASS;
				dims[0] = nrBytes/3;
				break;
			}
			case 32:
			{
				mxClass = mxINT32_CLASS;
				dims[0] = nrBytes/4;
				break;
			}
			default:
			{
		 		dims[0] = nrBytes;
				mxClass = mxINT8_CLASS;
				break;
			}
		}

		plhs[0] = mxCreateNumericArray(2, dims, mxClass, mxREAL); // empty 2d matrix
		memcpy(mxGetPr(plhs[0]),data,nrBytes);
		free(data);
	} else if (!strcmp("setFrames",cmd)) {
		if (nrhs < 2 || !mxIsDouble(prhs[1])) mexErrMsgTxt("setFrames: second parameter must be the frame numbers (as doubles)");
		if (nlhs > 0) mexErrMsgTxt("setFrames: there are no outputs");
		int nrFrames = mxGetN(prhs[1]) * mxGetM(prhs[1]);
		int* frameNrs = new int[nrFrames];
		if (!frameNrs) mexErrMsgTxt("setFrames: out of memory");
		double* data = mxGetPr(prhs[1]);
		for (int i=0; i<nrFrames; i++) frameNrs[i] = data[i];

		DDG.setFrames(frameNrs, nrFrames);
		plhs[0] = NULL;
	} else if (!strcmp("setTime",cmd)) {
		if (nrhs < 3 || !mxIsDouble(prhs[1]) || !mxIsDouble(prhs[2])) mexErrMsgTxt("setTime: start and stop time are required (as doubles)");
		if (nlhs > 0) mexErrMsgTxt("setTime: there are no outputs");

		DDG.setTime(mxGetScalar(prhs[1]), mxGetScalar(prhs[2]));
		plhs[0] = NULL;
	} else if (!strcmp("disableVideo",cmd)) {
		if (nlhs > 0) mexErrMsgTxt("disableVideo: there are no outputs");
		DDG.disableVideo();
		plhs[0] = NULL;
	} else if (!strcmp("disableAudio",cmd)) {
		if (nlhs > 0) mexErrMsgTxt("disableAudio: there are no outputs");
		DDG.disableAudio();
		plhs[0] = NULL;
	} else if (!strcmp("cleanUp",cmd)) {
		if (nlhs > 0) mexErrMsgTxt("cleanUp: there are no outputs");
		DDG.cleanUp();
		plhs[0] = NULL;
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日产欧美一区| 麻豆91在线观看| 久久国产精品99久久人人澡| 国产精品69毛片高清亚洲| 在线观看亚洲一区| 欧美国产精品中文字幕| 性感美女久久精品| 91在线观看一区二区| 日韩精品一区二区在线| 亚洲一区二区视频在线| 成人av集中营| 26uuu亚洲综合色| 免费久久99精品国产| 色综合久久综合中文综合网| 久久美女艺术照精彩视频福利播放| 一区二区三区在线免费视频| 成人免费视频网站在线观看| 欧美一区二区精品久久911| 亚洲精品大片www| 99精品国产一区二区三区不卡| 久久综合狠狠综合| 日韩综合小视频| 精品视频1区2区| 亚洲午夜av在线| 色妹子一区二区| 1区2区3区欧美| 成人动漫av在线| 日本一区二区三区dvd视频在线| 韩国精品主播一区二区在线观看 | 亚洲超丰满肉感bbw| av电影在线观看完整版一区二区| 国产日韩精品一区二区三区| 国产在线一区二区| 日韩美女天天操| 激情av综合网| 日本一区二区三区电影| 丰满放荡岳乱妇91ww| 国产日韩欧美精品一区| 国产精品一区二区三区四区| 久久精品欧美日韩| 成人一区二区三区视频在线观看| 中文字幕成人在线观看| av激情综合网| 亚洲精品国产视频| 欧美无砖专区一中文字| 午夜视频在线观看一区二区| 91精品中文字幕一区二区三区| 青青草精品视频| 久久亚洲精品国产精品紫薇| 粉嫩久久99精品久久久久久夜| 国产精品国产三级国产专播品爱网| jlzzjlzz亚洲日本少妇| 一区二区三区在线免费视频| 欧美高清精品3d| 国产麻豆欧美日韩一区| 日韩毛片视频在线看| 精品视频色一区| 国产剧情在线观看一区二区| 日本一区二区三区国色天香 | 日本不卡一二三| 久久夜色精品一区| 成人av电影观看| 无码av免费一区二区三区试看| 日韩欧美成人激情| 不卡av在线免费观看| 五月激情六月综合| 国产清纯美女被跳蛋高潮一区二区久久w| av一区二区不卡| 奇米影视7777精品一区二区| 久久你懂得1024| 国产婷婷色一区二区三区四区| 99久久免费国产| 中文一区二区完整视频在线观看| 56国语精品自产拍在线观看| 1024精品合集| 91麻豆精品91久久久久久清纯| 欧美视频一区二区三区四区 | 国产欧美日韩亚州综合| 精品国产sm最大网站免费看| 日韩欧美成人一区二区| 欧美一区二区三区小说| 宅男噜噜噜66一区二区66| 欧美日韩第一区日日骚| 欧美乱妇23p| 欧美精品99久久久**| 欧美一区二区在线不卡| 日韩欧美一区电影| 26uuu国产在线精品一区二区| 欧美精品一区二区久久久| 久久久精品欧美丰满| 国产清纯在线一区二区www| 国产精品久久久久久亚洲毛片 | 国产精品久久久久影视| 一色屋精品亚洲香蕉网站| 亚洲三级在线观看| 亚洲国产精品一区二区尤物区| 亚洲成人动漫在线观看| 看电视剧不卡顿的网站| 国产中文字幕精品| 成人app网站| 欧美性受xxxx| 欧美刺激午夜性久久久久久久| 久久久一区二区三区捆绑**| 国产精品久久久久影院| 午夜欧美大尺度福利影院在线看| 蜜桃在线一区二区三区| 波多野结衣亚洲| 欧美日韩国产综合草草| 欧美不卡一区二区三区| 国产精品乱人伦一区二区| 亚洲午夜久久久久久久久电影网| 免费观看一级欧美片| www.亚洲色图| 欧美人伦禁忌dvd放荡欲情| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲欧美在线观看| 天堂久久一区二区三区| 粉嫩av一区二区三区| 欧美网站大全在线观看| 久久久天堂av| 夜夜爽夜夜爽精品视频| 狠狠v欧美v日韩v亚洲ⅴ| 色悠久久久久综合欧美99| 日韩欧美不卡一区| 亚洲免费成人av| 国产一区二区三区精品欧美日韩一区二区三区| www.66久久| 18欧美亚洲精品| 久99久精品视频免费观看| 一本色道**综合亚洲精品蜜桃冫| 91精品国产高清一区二区三区 | 中文字幕亚洲综合久久菠萝蜜| 午夜伦欧美伦电影理论片| 国产成人av一区二区三区在线观看| 欧美影院午夜播放| 久久伊人蜜桃av一区二区| 亚洲成av人片一区二区三区| 国产超碰在线一区| 91精品国产麻豆| 亚洲制服丝袜av| 99在线热播精品免费| 久久综合99re88久久爱| 日韩精品亚洲一区二区三区免费| eeuss鲁片一区二区三区| 久久久www成人免费无遮挡大片| 偷窥国产亚洲免费视频| 91碰在线视频| 中国av一区二区三区| 国产一区二区三区在线看麻豆| 欧美人xxxx| 亚洲最新在线观看| av动漫一区二区| 国产欧美一区二区精品性色超碰| 蜜桃一区二区三区在线| 在线播放一区二区三区| 一区二区三区精品在线观看| 成人性生交大合| 国产性色一区二区| 国产在线不卡视频| 欧美xxxxxxxxx| 麻豆精品国产传媒mv男同| 91精品国产欧美一区二区| 天使萌一区二区三区免费观看| 在线观看日韩av先锋影音电影院| 亚洲人成人一区二区在线观看| 成人精品小蝌蚪| 中文字幕一区二区在线观看| 国产成人免费视频网站高清观看视频| 精品国产污网站| 国产一区二区三区免费| 久久精品人人爽人人爽| 国产91精品在线观看| 国产精品久久二区二区| 97se亚洲国产综合自在线观| 中文字幕不卡的av| 成人白浆超碰人人人人| 中文字幕视频一区| 一本到不卡免费一区二区| 亚洲影院久久精品| 欧美色区777第一页| 丝袜a∨在线一区二区三区不卡| 欧美一卡二卡三卡| 激情欧美日韩一区二区| 中文一区一区三区高中清不卡| 99精品1区2区| 亚洲h精品动漫在线观看| 91精品国产91久久久久久一区二区| 男女男精品网站| 久久久久久一级片| www.爱久久.com| 午夜精品123| 精品成a人在线观看| 国产不卡视频在线播放| 亚洲日本在线a| 制服丝袜国产精品| 国产丶欧美丶日本不卡视频| 亚洲欧美日韩一区二区三区在线观看| 欧美日本在线播放| 黄一区二区三区| 国产精品久久久久久久久图文区 |