Пример #1
0
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow)
{
	CPaintManagerUI::SetInstance(hInstance);
	CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("skin"));

	HRESULT Hr = ::CoInitialize(NULL);
	if (FAILED(Hr)) return 0;

	//init face
	THFI_Param param;
	param.nMinFaceSize = 150;
	param.nRollAngle = 145;
	param.bOnlyDetect = true;
	THFI_Create(1, &param);

	short ret = EF_Init(1);
	if (ret == 1)
	{
		cout << "Feature init ok" << endl;
	}
	//init database
	QFileSqlite *pDb = QFileSqlite::getInstance();
	pDb->createTable(CREATE_USER_INFO_TABLE);
	//CInitDevice	Init_Device;
	//Init_Device.InitStart();

	std::auto_ptr<CMainWnd> pFrame(new CMainWnd);
	assert(pFrame.get());
	pFrame->Create(NULL, NULL, UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE | WS_EX_ACCEPTFILES);
	pFrame->SetIcon(IDI_ICON1);
	pFrame->CenterWindow();
	pFrame->ShowWindow(true);
	
	//Camera dev;
	//Recorder r(dev);//, p(dev);
	//r.start();
	//p.start();

//	Show_HideTask(true);

	CPaintManagerUI::MessageLoop();
	//r.stop();
	//p.stop();
	::CoUninitialize();

	THFI_Release();
	EF_Release();

	return 0;
}
Пример #2
0
shared_ptr<Picture> FFmpegVideoStream::decode(PacketPtr packet) {
	AVPacket& pkt = *packet;
	adjustTimeStamps(pkt);
	shared_ptr<AVFrame> pFrame(new AVFrame());

	int gotPicture = 0;

	if (pkt.size > 0) {
		int decodedDataSize = (avStream->codec->width * avStream->codec->height
				* 3) / 2;
		/* XXX: allocate picture correctly */
		avcodec_get_frame_defaults(pFrame.get());

		int ret = avcodec_decode_video2(avStream->codec, pFrame.get(), &gotPicture,
				&pkt);
		avStream->quality = pFrame->quality;

		if (ret < 0) {
			string msg;
			msg = "Failed to decode video dts=";
			msg += avStream->cur_dts;
			msg += " pts=";
			msg += avStream->pts.val;
			msg += " - ";
			throw new TranscodeException(msg, ret);
		}
		if (gotPicture) {
			// deal with the picture
			LOG4CPLUS_DEBUG(logger,
					"Got picture dts=" << pkt.dts << " pts=" << pkt.pts);

			Picture* pict = new Picture(pFrame);
			return shared_ptr<Picture>(pict);
		}
		// deal with this
		//	if (avStream->codec->time_base.num != 0) {
		//		int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1
		//				: ist->st->codec->ticks_per_frame;
		//		ist->next_pts += ((int64_t) AV_TIME_BASE
		//				* ist->st->codec->time_base.num * ticks)
		//				/ ist->st->codec->time_base.den;
		//	}
	}
	return NoPicture;
}