コード例 #1
0
int main(int argc, char *argv[]){
	VideoStream *vs;
	const char *devname="/dev/video0";
	int i;
	ms_init();

	/* this is to test the sequence start/stop */
	for(i=0;i<1;++i){
		vs=video_preview_start(devname);
#ifdef WIN32
		Sleep(5000);
#else
		sleep(5);
#endif
		video_preview_stop(vs);
	}
	return 0;
}
コード例 #2
0
int main(int argc, char *argv[]){
	VideoStream *vs;
	MSWebCam *cam;
	MSVideoSize vsize;
	MSFactory* factory;
	int i;

	vsize.width=MS_VIDEO_SIZE_CIF_W;
	vsize.height=MS_VIDEO_SIZE_CIF_H;

	ortp_init();
	ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
	//ms_init();

	factory = ms_factory_new();
	ms_factory_init_voip(factory);
	ms_factory_init_plugins(factory);

	cam=ms_web_cam_manager_get_cam(ms_factory_get_web_cam_manager(factory),"StaticImage: Static picture");
	//cam=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"StaticImage: Static picture");

	signal(SIGINT,stop);
	/* this is to test the sequence start/stop */
	for(i=0;i<1;++i){
		int n;
		vs=video_preview_new(factory);

		/*video_preview_set_display_filter_name(vs,"MSVideoOut");*/
		video_preview_set_size(vs,vsize);
		video_preview_start(vs, cam);

        for(n=0;n<60000 && !stopped;++n){
#ifdef _WIN32
			MSG msg;
			Sleep(100);
			while (PeekMessage(&msg, NULL, 0, 0,1)){
        			TranslateMessage(&msg);
        			DispatchMessage(&msg);
			}
#else
			struct timespec ts;
			ts.tv_sec=0;
			ts.tv_nsec=10000000;
			nanosleep(&ts,NULL);

			if (vs) video_stream_iterate(vs);
#endif

/* test code */
			if (n==400)
			  {
			    ms_ticker_detach (vs->ms.sessions.ticker, vs->source);

			    vs->tee = ms_factory_create_filter(factory, MS_TEE_ID);

			    ms_filter_unlink(vs->pixconv,0, vs->output2,0);

			    ms_filter_link(vs->pixconv,0,vs->tee,0);
			    ms_filter_link(vs->tee,0,vs->output2,0);
			    ms_filter_link(vs->tee,1,vs->output2,1);

			    //ms_filter_unlink(vs->tee,0,vs->output,0);
			    ms_ticker_attach (vs->ms.sessions.ticker, vs->source);

			  }
			if (n==500)
			  {
			    int corner=1;
			    ms_filter_call_method(vs->output2,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==600)
			  {
			    int corner=2;
			    ms_filter_call_method(vs->output2,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==700)
			  {
			    int corner=3;
			    ms_filter_call_method(vs->output2,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==800)
			  {
			    int corner=-1;
			    ms_filter_call_method(vs->output2,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==900)
			  {
			    ms_ticker_detach (vs->ms.sessions.ticker, vs->source);

			    ms_filter_unlink(vs->pixconv,0,vs->tee,0);
			    ms_filter_unlink(vs->tee,0,vs->output2,0);
			    ms_filter_unlink(vs->tee,1,vs->output2,1);
			    ms_filter_destroy(vs->tee);
			    vs->tee=NULL;

			    ms_filter_link(vs->pixconv,0, vs->output2,0);


			    ms_ticker_attach (vs->ms.sessions.ticker, vs->source);
			  }
		}
		video_preview_stop(vs);
	}
	return 0;
}
コード例 #3
0
int main(int argc, char *argv[]){
	VideoStream *vs;
	MSWebCam *cam;
	MSVideoSize vsize;
	int i;

	vsize.width=MS_VIDEO_SIZE_CIF_W;
	vsize.height=MS_VIDEO_SIZE_CIF_H;

	ortp_init();
	ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
	ms_init();
	cam=ms_web_cam_manager_get_default_cam(ms_web_cam_manager_get());
	/* this is to test the sequence start/stop */
	for(i=0;i<1;++i){
		int n;
		vs=video_preview_start(cam,vsize);

        	for(n=0;n<1000;++n){
#ifdef WIN32
			MSG msg;
    		Sleep(100);
			while (PeekMessage(&msg, NULL, 0, 0,1)){
        			TranslateMessage(&msg);
        			DispatchMessage(&msg);
			}
#else
			struct timespec ts;
			ts.tv_sec=0;
			ts.tv_nsec=10000000;
			nanosleep(&ts,NULL);

			if (vs) video_stream_iterate(vs);
#endif

/* test code */
			if (n==400)
			  {
			    ms_ticker_detach (vs->ticker, vs->source);

			    vs->tee = ms_filter_new(MS_TEE_ID);

			    ms_filter_unlink(vs->pixconv,0, vs->output,0);

			    ms_filter_link(vs->pixconv,0,vs->tee,0);
			    ms_filter_link(vs->tee,0,vs->output,0);
			    ms_filter_link(vs->tee,1,vs->output,1);
			    
			    //ms_filter_unlink(vs->tee,0,vs->output,0);
			    ms_ticker_attach (vs->ticker, vs->source);

			  }
			if (n==500)
			  {
			    int corner=1;
			    ms_filter_call_method(vs->output,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==600)
			  {
			    int corner=2;
			    ms_filter_call_method(vs->output,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==700)
			  {
			    int corner=3;
			    ms_filter_call_method(vs->output,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==800)
			  {
			    int corner=-1;
			    ms_filter_call_method(vs->output,MS_VIDEO_DISPLAY_SET_LOCAL_VIEW_MODE,&corner);
			  }
			if (n==900)
			  {
			    ms_ticker_detach (vs->ticker, vs->source);

			    ms_filter_unlink(vs->pixconv,0,vs->tee,0);
			    ms_filter_unlink(vs->tee,0,vs->output,0);
			    ms_filter_unlink(vs->tee,1,vs->output,1);
			    ms_filter_destroy(vs->tee);
			    vs->tee=NULL;

			    ms_filter_link(vs->pixconv,0, vs->output,0);

			    
			    ms_ticker_attach (vs->ticker, vs->source);
			  }
		}
		video_preview_stop(vs);
	}
	return 0;
}