Example #1
0
static void _vfw_engine_unconfigure(VfwEngine *obj){
	if (!capCaptureStop(obj->capvideo)){
		ms_error("vfw: fail to stop capture !");
	}
	obj->thread_running=FALSE;
	ms_thread_join(obj->thread,NULL);
	obj->configured=FALSE;
}
Example #2
0
void cap_stop(cap_cx *cx)
{
	if(cx->started)
	{
		cx->started = 0;
		capCaptureStop(cx->hwnd);
		cap_que_clear(cx);
		cap_decode_finish(cx);
		free(cx->pfmt);
	}
}
Example #3
0
void CWinVideoGrabber::StopRecording()
{
	if (!inited)
		return;

	if (videomode == VIDEOGRABBERMODE_RECORDING)
	{
		capCaptureStop(videowindow);
		videomode = VIDEOGRABBERMODE_NONE;
	}
}
// Standard AVIcap window message 
// macro: capCaptureSequenceNoFile && capCaptureStop
BOOL	CAviCap::StartSeq(BOOL offOn)
{
	CHECKWIN();
	CHECKCNCT();
	if(offOn)
	{
	if(_fSeqIsOn)	return TRUE;
	_getSetup();
	_captureParms.fYield = TRUE;    // Watch out!
	_setSetup();
	return capCaptureSequenceNoFile(GetSafeHwnd()) ;
	}
	if(_fSeqIsOn)
		capCaptureStop(GetSafeHwnd());
	_fSeqIsOn=offOn;
	return TRUE;
}
Example #5
0
DWORD WINAPI ListeningRoutine(LPVOID lpParam) 
{
	const int SAMPLING_FRAME_RATE = 1; // per second

	BOOL isCapturing = FALSE;
	VideoGrabber* videoGrabber = (VideoGrabber*)lpParam;
	static PTSTR captureFileName;
	
	while (videoGrabber->IsEnabled())
	{
		videoGrabber->GrabFrame(isCapturing);
		int recode;
		if (videoGrabber->mMotionDetectedDuringLastSecond) 
		{
			if (!isCapturing)
			{
				captureFileName = videoGrabber->GetNewDataFileName();
				MakeSureDirectoryPathExists(captureFileName);
				recode = capFileSetCaptureFile(videoGrabber->camhwnd, captureFileName);
				recode = capCaptureSequence(videoGrabber->camhwnd);
				isCapturing = TRUE;
			}
		} 
		else if (isCapturing)
		{
			// ISSUE: Sometimes motion detected when there is no motion in the scene actually.
			//        This is caused by automatic aperture enabled in webcam: the cam adjusting
			//        its aperture to avoid under/overexposition. Hence brightness of pixels is 
			//        changed and motion detection mechanism makes false alarm. However this can
			//        be patched because the effect causes capture of 2-3 sec. video stream. So
			//        quick and dirty solution would be to filter all streams shorter than 4 sec.
			recode = capCaptureStop(videoGrabber->camhwnd);
			recode = GetLastError();
			videoGrabber->GetDataAccumulator()->LogVideo(captureFileName);
			isCapturing = FALSE;
		}

		Sleep(1000/SAMPLING_FRAME_RATE); 
	}
	return FALSE;
}
BOOL CWebCam::StopRecord()
{
	capCaptureStop(m_hCam); //캡처동작 정지. 캡처한 영상을 파일에 저장. 

	return capPreview(m_hCam, TRUE);
}