void linphone_gtk_start_record_sound(GtkWidget *w, gpointer data){
	LinphoneCore *lc = linphone_gtk_get_core();
	AudioStream *stream = NULL;
	MSSndCardManager *manager = ms_snd_card_manager_get();
	gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));

	if(active){
		gchar *path = get_record_file();
		stream=audio_stream_new(8888, 8889, FALSE);
		if(stream != NULL){
			audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,NULL,
				path,NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE);
			g_object_set_data(G_OBJECT(audio_assistant),"record_stream",stream);
		}
		gint timeout_id = gtk_timeout_add(6000,(GtkFunction)linphone_gtk_stop_record,NULL);
		g_object_set_data(G_OBJECT(audio_assistant),"timeout_id",GINT_TO_POINTER(timeout_id));
		g_object_set_data(G_OBJECT(audio_assistant),"path",path);
	} else {
		stream = (AudioStream *)g_object_get_data(G_OBJECT(audio_assistant),"record_stream");
		gint timeout_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(audio_assistant),"timeout_id"));
		gtk_timeout_remove(timeout_id);
		if(stream != NULL){
			audio_stream_stop(stream);
			g_object_set_data(G_OBJECT(audio_assistant),"record_stream",NULL);
		}
		update_record_button(FALSE);
		update_play_button(TRUE);
	}
}
Exemplo n.º 2
0
void start_record_dialog(running_machine &machine_ptr)
{
	machine = &machine_ptr;
	if (empty_driver.compare(machine->basename()) == 0) {
		MessageBox(win_window_list->hwnd,L"You can't record a movie before loading a game.",L"Record input",MB_OK | MB_ICONSTOP);
		return;
	}
	if (get_record_file(*machine) || get_playback_file(*machine)) {
		MessageBox(win_window_list->hwnd,L"There's already a movie running.",L"Record input",MB_OK | MB_ICONSTOP);
		return;
	}
	if (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_RECORDINP), win_window_list->hwnd, RecordDialogProc)) {
		schedule_record(_TtoA(szChoice));
		machine->schedule_hard_reset();
	}
}