Beispiel #1
0
MSWebCam * ms_web_cam_manager_get_cam(MSWebCamManager *m, const char *id){
	MSList *elem;
	for (elem=m->cams;elem!=NULL;elem=elem->next){
		MSWebCam *cam=(MSWebCam*)elem->data;
		if (id==NULL) return cam;
		if (strcmp(ms_web_cam_get_string_id(cam),id)==0)	return cam;
	}
	if (id!=NULL) ms_warning("no camera with id %s",id);
	return NULL;
}
static void enable_disable_camera_after_camera_switches() {
	LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
	LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
	const char *currentCamId = (char*)linphone_core_get_video_device(marie->lc);
	const char **cameras=linphone_core_get_video_devices(marie->lc);
	const char *newCamId=NULL;
	int i;


	video_call_base_2(marie,pauline,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE);

	for (i=0;cameras[i]!=NULL;++i){
		if (strcmp(cameras[i],currentCamId)!=0){
			newCamId=cameras[i];
			break;
		}
	}
	if (newCamId){
		LinphoneCall *call = linphone_core_get_current_call(marie->lc);
		ms_message("Switching from [%s] to [%s]", currentCamId, newCamId);
		linphone_core_set_video_device(marie->lc, newCamId);
		if(call != NULL) {
			linphone_core_update_call(marie->lc, call, NULL);
		}
		BC_ASSERT_STRING_EQUAL(newCamId,ms_web_cam_get_string_id(linphone_call_get_video_device(call)));
		linphone_call_enable_camera(call,FALSE);
		linphone_core_iterate(marie->lc);
		linphone_call_enable_camera(call,TRUE);
		BC_ASSERT_STRING_EQUAL(newCamId,ms_web_cam_get_string_id(linphone_call_get_video_device(call)));
	}


	linphone_core_terminate_all_calls(pauline->lc);
	BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
	BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}
Beispiel #3
0
void ms_web_cam_manager_prepend_cam(MSWebCamManager *m, MSWebCam *c){
	ms_message("Webcam %s prepended",ms_web_cam_get_string_id(c));
	m->cams=ms_list_prepend(m->cams,c);
}