示例#1
0
static int
tsmf_pulse_open(ITSMFAudioDevice * audio, const char * device)
{
	TSMFPulseAudioDevice * pulse = (TSMFPulseAudioDevice *) audio;

	if (device)
	{
		strcpy(pulse->device, device);
	}

	pulse->mainloop = pa_threaded_mainloop_new();
	if (!pulse->mainloop)
	{
		LLOGLN(0, ("tsmf_pulse_open: pa_threaded_mainloop_new failed"));
		return 1;
	}
	pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp");
	if (!pulse->context)
	{
		LLOGLN(0, ("tsmf_pulse_open: pa_context_new failed"));
		return 1;
	}
	pa_context_set_state_callback(pulse->context, tsmf_pulse_context_state_callback, pulse);
	if (tsmf_pulse_connect(pulse))
	{
		LLOGLN(0, ("tsmf_pulse_open: tsmf_pulse_connect failed"));
		return 1;
	}

	LLOGLN(0, ("tsmf_pulse_open: open device %s", pulse->device));
	return 0;
}
示例#2
0
static BOOL tsmf_pulse_open(ITSMFAudioDevice *audio, const char *device)
{
	TSMFPulseAudioDevice *pulse = (TSMFPulseAudioDevice *) audio;
	if(device)
	{
		strcpy(pulse->device, device);
	}
	pulse->mainloop = pa_threaded_mainloop_new();
	if(!pulse->mainloop)
	{
		DEBUG_WARN("pa_threaded_mainloop_new failed");
		return FALSE;
	}
	pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp");
	if(!pulse->context)
	{
		DEBUG_WARN("pa_context_new failed");
		return FALSE;
	}
	pa_context_set_state_callback(pulse->context, tsmf_pulse_context_state_callback, pulse);
	if(tsmf_pulse_connect(pulse))
	{
		DEBUG_WARN("tsmf_pulse_connect failed");
		return FALSE;
	}
	DEBUG_TSMF("open device %s", pulse->device);
	return TRUE;
}