2 * FreeRDP: A Remote Desktop Protocol client.
3 * Video Redirection Virtual Channel - Audio Device Manager
5 * Copyright 2010-2011 Vic Lee
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <freerdp/utils/memory.h>
24 #include <freerdp/utils/load_plugin.h>
26 #include "tsmf_audio.h"
28 static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const char* device)
30 ITSMFAudioDevice* audio;
31 TSMF_AUDIO_DEVICE_ENTRY entry;
34 if (strrchr(name, '.') != NULL)
35 entry = (TSMF_AUDIO_DEVICE_ENTRY) freerdp_load_plugin(name, TSMF_AUDIO_DEVICE_EXPORT_FUNC_NAME);
38 fullname = xzalloc(strlen(name) + 6);
39 strcpy(fullname, "tsmf_");
40 strcat(fullname, name);
41 entry = (TSMF_AUDIO_DEVICE_ENTRY) freerdp_load_plugin(fullname, TSMF_AUDIO_DEVICE_EXPORT_FUNC_NAME);
52 DEBUG_WARN("failed to call export function in %s", name);
55 if (!audio->Open(audio, device))
63 ITSMFAudioDevice* tsmf_load_audio_device(const char* name, const char* device)
65 ITSMFAudioDevice* audio;
69 audio = tsmf_load_audio_device_by_name(name, device);
73 audio = tsmf_load_audio_device_by_name("pulse", device);
75 audio = tsmf_load_audio_device_by_name("alsa", device);