From: Zhang,Vivian Date: Thu, 21 Mar 2013 06:15:39 +0000 (+0800) Subject: Enable initial audio hal in sound server which handles audio path set X-Git-Tag: 2.1b_release~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=795900c1be8f00d1c905fc62663893fe7bb1e26e;p=framework%2Fmultimedia%2Flibmm-sound.git Enable initial audio hal in sound server which handles audio path set Change-Id: I77817046da6834d27c00e2b8e3bafa212b8c5aaa --- diff --git a/Makefile.am b/Makefile.am index efa0c75..9c7e296 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,9 @@ lib_LTLIBRARIES = libmmfsound.la includelibmmfsounddir = $(includedir)/mmf includelibmmfsound_HEADERS = include/mm_sound.h \ - include/mm_sound_private.h + include/mm_sound_private.h \ + server/include/mm_sound_plugin.h \ + server/include/mm_sound_plugin_hal.h libmmfsound_la_SOURCES = mm_sound.c \ mm_sound_client.c diff --git a/packaging/libmm-sound.spec b/packaging/libmm-sound.spec index 38e87c4..d33b6da 100644 --- a/packaging/libmm-sound.spec +++ b/packaging/libmm-sound.spec @@ -131,6 +131,8 @@ ln -s %{_sysconfdir}/rc.d/init.d/soundserver %{buildroot}%{_sysconfdir}/rc.d/rc4 %{_libdir}/libmmfsound.so %{_libdir}/libmmfsoundcommon.so %{_includedir}/mmf/mm_sound_private.h +%{_includedir}/mmf/mm_sound_plugin.h +%{_includedir}/mmf/mm_sound_plugin_hal.h %files sdk-devel diff --git a/server/Makefile.am b/server/Makefile.am index 08cf4de..e9231f3 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -14,7 +14,8 @@ sound_server_SOURCES = mm_sound_mgr_codec.c \ mm_sound_mgr_run.c \ mm_sound_plugin.c \ mm_sound_server.c \ - mm_sound_thread_pool.c + mm_sound_thread_pool.c \ + mm_sound_hal.c sound_server_CFLAGS = -I$(srcdir)/../include \ -I$(srcdir)/include \ @@ -23,6 +24,7 @@ sound_server_CFLAGS = -I$(srcdir)/../include \ -DMMF_LOG_OWNER=0x020 \ -DMMF_DEBUG_PREFIX=\"MMF-SOUND\" \ -D__DEBUG_MODE__ -DUSE_VCONF -D__USE_LOGMANAGER__ \ + -rdynamic \ $(MMSESSION_CFLAGS) \ $(AVSYSTEM_CFLAGS) \ $(AUDIOSESSIONMGR_CFLAGS) \ diff --git a/server/include/mm_sound_hal.h b/server/include/mm_sound_hal.h new file mode 100644 index 0000000..ae19800 --- /dev/null +++ b/server/include/mm_sound_hal.h @@ -0,0 +1,39 @@ +/* + * libmm-sound + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seungbae Shin + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __MM_SOUND_HAL_H__ +#define __MM_SOUND_HAL_H__ + +int MMSoundMgrHALInit(const char *targetdir); +int MMSoundMgrHALFini(void); + +int audio_hal_pulse_sink_route(int device); + +int audio_hal_pulse_source_route(int device); + +int audio_hal_set_sound_path(int gain, int output, int input, int option); + +int audio_hal_init(); + +int audio_hal_fini(); + + +#endif//__MM_SOUND_HAL_H__ diff --git a/server/include/mm_sound_plugin.h b/server/include/mm_sound_plugin.h index e7bbdaf..3c17513 100644 --- a/server/include/mm_sound_plugin.h +++ b/server/include/mm_sound_plugin.h @@ -27,6 +27,7 @@ enum { MM_SOUND_PLUGIN_TYPE_NONE = 0, MM_SOUND_PLUGIN_TYPE_CODEC, MM_SOUND_PLUGIN_TYPE_RUN, + MM_SOUND_PLUGIN_TYPE_HAL, MM_SOUND_PLUGIN_TYPE_LAST, }; diff --git a/server/include/mm_sound_plugin_hal.h b/server/include/mm_sound_plugin_hal.h new file mode 100644 index 0000000..5a25197 --- /dev/null +++ b/server/include/mm_sound_plugin_hal.h @@ -0,0 +1,47 @@ +/* + * libmm-sound + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seungbae Shin + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __MM_SOUND_PLUGIN_HAL_H__ +#define __MM_SOUND_PLUGIN_HAL_H__ + +#include "mm_sound_plugin.h" +#include + +typedef struct { + int (*pulse_sink_route)(int device); + int (*pulse_source_route)(int device); + int (*set_sound_path)(int gain, int output, int input, int option); + int (*init)(); + int (*fini)(); +} mmsound_hal_interface_t; + +/* Utility Functions */ +#define HAL_GET_INTERFACE_FUNC_NAME "MMSoundPlugHALGetInterface" +#define MMSoundPlugHALCastGetInterface(func) ((int (*)(mmsound_hal_interface_t*))(func)) + +#define AUDIO_HAL_STATE_SUCCESS 0x0 +#define AUDIO_HAL_ROUTE_SUCCESS_AND_GOTOEND 0x1 +#define AUDIO_HAL_STATE_ERROR_INTERNAL 0x2 + +int MMSoundPlugHALGetInterface(mmsound_hal_interface_t *intf); + +#endif /* __MM_SOUND_PLUGIN_HAL_H__ */ + diff --git a/server/mm_sound_hal.c b/server/mm_sound_hal.c new file mode 100644 index 0000000..bcfc11a --- /dev/null +++ b/server/mm_sound_hal.c @@ -0,0 +1,184 @@ +/* + * libmm-sound + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Seungbae Shin + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#include +#include +#include + +#include +#include +#include + +#include "mm_sound_hal.h" + +#include "include/mm_sound_plugin_hal.h" +#include "include/mm_sound_mgr_pulse.h" + +static MMSoundPluginType* g_hal_plugin = NULL; +static mmsound_hal_interface_t g_plugin_interface; + +#define DEVICE_API_BLUETOOTH "bluez" +#define DEVICE_API_ALSA "alsa" +#ifdef USE_PULSE_WFD /* Not enabled yet */ +#define DEVICE_API_WFD "wfd" +#endif + +#define DEVICE_BUS_BLUETOOTH "bluetooth" +#define DEVICE_BUS_USB "usb" +#define DEVICE_BUS_BUILTIN "builtin" + +int audio_hal_pulse_sink_route(int device) +{ + debug_fenter(); + if (g_plugin_interface.pulse_sink_route) { + return g_plugin_interface.pulse_sink_route(device); + } + + debug_log("g_plugin_interface.pulse_sink_route is null!"); + if (device & MM_SOUND_DEVICE_OUT_BT_A2DP) { + debug_log("BT A2DP is active, Set default sink to BLUEZ"); + MMSoundMgrPulseSetDefaultSink (DEVICE_API_BLUETOOTH, DEVICE_BUS_BLUETOOTH); + return AUDIO_HAL_ROUTE_SUCCESS_AND_GOTOEND; + } else if (device & MM_SOUND_DEVICE_OUT_WFD) { +#ifdef USE_PULSE_WFD /* Not enabled yet */ + debug_log("WFD is active, Set default sink to WFD"); + MMSoundMgrPulseSetDefaultSink (DEVICE_API_WFD, DEVICE_BUS_BUILTIN); + return AUDIO_HAL_ROUTE_SUCCESS_AND_GOTOEND; +#endif + } else if (device & MM_SOUND_DEVICE_OUT_USB_AUDIO) { + debug_log("USB Audio is active, Set default sink to USB Audio"); + MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_USB); + return AUDIO_HAL_ROUTE_SUCCESS_AND_GOTOEND; + } + debug_log("Set default sink to ALSA with BUILTIN"); + MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_BUILTIN); + debug_fleave(); + return AUDIO_HAL_STATE_SUCCESS; +} + +int audio_hal_pulse_source_route(int device) +{ + debug_fenter(); + if (g_plugin_interface.pulse_source_route) { + return g_plugin_interface.pulse_source_route(device); + } + debug_log("g_plugin_interface.pulse_source_route is null!"); + debug_fleave(); + return AUDIO_HAL_STATE_SUCCESS; +} + +EXPORT_API +int audio_hal_set_sound_path(int gain, int output, int input, int option) +{ + int err = MM_ERROR_NONE; + + debug_fenter(); + if (g_plugin_interface.set_sound_path) { + err = g_plugin_interface.set_sound_path(gain, output, input, option); + } + else { + err = avsys_audio_set_path_ex(gain, output, input, option); + } + debug_fleave(); + return err; +} + +int audio_hal_init() +{ + debug_fenter(); + if (g_plugin_interface.init) { + return g_plugin_interface.init(); + } + debug_fleave(); + return AUDIO_HAL_STATE_SUCCESS; +} + +int audio_hal_fini() +{ + debug_fenter(); + if (g_plugin_interface.fini) { + return g_plugin_interface.fini(); + } + debug_fleave(); + return AUDIO_HAL_STATE_SUCCESS; +} + +int MMSoundMgrHALInit(const char *targetdir) +{ + int err = MM_ERROR_NONE; + + debug_fenter(); + if (g_hal_plugin) { + debug_error("Please Check Init\n"); + return MM_ERROR_SOUND_INTERNAL; + } + err = MMSoundPluginScan(targetdir, MM_SOUND_PLUGIN_TYPE_HAL, &g_hal_plugin); + debug_log("MMSoundPluginScan return %d", err); + + if (g_hal_plugin) { + void* func = NULL; + + err = MMSoundPluginGetSymbol(g_hal_plugin, HAL_GET_INTERFACE_FUNC_NAME, &func); + if (err != MM_ERROR_NONE) { + debug_error("Get Symbol %s fail : %x\n", HAL_GET_INTERFACE_FUNC_NAME, err); + goto err_out_and_free; + } + err = MMSoundPlugHALCastGetInterface(func)(&g_plugin_interface); + if (err != AUDIO_HAL_STATE_SUCCESS) { + debug_error("Get interface fail : %x\n", err); + goto err_out_and_free; + } + + debug_log("g_plugin_interface.pulse_sink_route=%p", g_plugin_interface.pulse_sink_route); + debug_log("g_plugin_interface.pulse_source_route=%p", g_plugin_interface.pulse_source_route); + debug_log("g_plugin_interface.set_sound_path=%p", g_plugin_interface.set_sound_path); + debug_log("g_plugin_interface.init=%p", g_plugin_interface.init); + debug_log("g_plugin_interface.fini=%p", g_plugin_interface.fini); + + err = audio_hal_init(); + if (err != AUDIO_HAL_STATE_SUCCESS) { + debug_error("audio_hal_init failed : %x\n", err); + goto err_out_and_free; + } + } + + debug_fleave(); + return AUDIO_HAL_STATE_SUCCESS; + +err_out_and_free: + free(g_hal_plugin); + g_hal_plugin = NULL; + debug_fleave(); + return AUDIO_HAL_STATE_ERROR_INTERNAL; +} + +int MMSoundMgrHALFini(void) +{ + int err = MM_ERROR_NONE; + + debug_fenter(); + err = audio_hal_fini(); + if (err != AUDIO_HAL_STATE_SUCCESS) { + debug_error("audio_hal_fini failed"); + return err; + } + debug_fleave(); + return AUDIO_HAL_STATE_SUCCESS; +} diff --git a/server/mm_sound_mgr_pulse.c b/server/mm_sound_mgr_pulse.c index bcd8a6c..158f1d8 100644 --- a/server/mm_sound_mgr_pulse.c +++ b/server/mm_sound_mgr_pulse.c @@ -460,6 +460,7 @@ int MMSoundMgrPulseHandleIsBtA2DPOnReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ip return ret; } +EXPORT_API void MMSoundMgrPulseSetDefaultSink (char* device_api_name, char* device_bus_name) { debug_enter("\n"); diff --git a/server/mm_sound_mgr_session.c b/server/mm_sound_mgr_session.c index 9c5d561..b0c743d 100644 --- a/server/mm_sound_mgr_session.c +++ b/server/mm_sound_mgr_session.c @@ -44,24 +44,12 @@ #include "include/mm_sound_mgr_headset.h" #include "include/mm_sound_mgr_pulse.h" #include "include/mm_sound_mgr_asm.h" +#include "include/mm_sound_hal.h" #define EARJACK_WITH_MIC 2 #define MAX_STRING_LEN 256 -#define DEVICE_API_BLUETOOTH "bluez" -#define DEVICE_API_ALSA "alsa" -#ifdef USE_PULSE_WFD /* Not enabled yet */ -#define DEVICE_API_WFD "wfd" -#endif - -#define DEVICE_BUS_BLUETOOTH "bluetooth" -#define DEVICE_BUS_USB "usb" -#define DEVICE_BUS_BUILTIN "builtin" -#ifdef SEPARATE_SPEAKER_AND_WIRED_ACCESSORY -#define DEVICE_BUS_WIRED "wired" -#endif - #define MM_SOUND_DEVICE_OUT_ANY 0x000FFF00 #define MM_SOUND_DEVICE_IN_ANY 0x000000FF @@ -346,10 +334,10 @@ static int __set_playback_route_communication (session_state_t state) } - if (AVSYS_FAIL(avsys_audio_set_path_ex( gain, + if (audio_hal_set_sound_path(gain, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_NONE, - AVSYS_AUDIO_PATH_OPTION_NONE ))) { - debug_error ("avsys_audio_set_path_ex() failed [%x]\n", ret); + AVSYS_AUDIO_PATH_OPTION_NONE)) { + debug_error ("audio_hal_set_sound_path() failed\n"); ret = MM_ERROR_SOUND_INTERNAL; goto ROUTE_COMM_EXIT; } @@ -390,21 +378,20 @@ static int __set_playback_route_fmradio (session_state_t state) out = AVSYS_AUDIO_PATH_EX_A2DP; /* PATH SET */ - if (AVSYS_FAIL(avsys_audio_set_path_ex( AVSYS_AUDIO_GAIN_EX_FMRADIO, + if (audio_hal_set_sound_path(AVSYS_AUDIO_GAIN_EX_FMRADIO, out, AVSYS_AUDIO_PATH_EX_FMINPUT, - AVSYS_AUDIO_PATH_OPTION_NONE))) { - debug_error ("avsys_audio_set_path_ex() failed\n"); + AVSYS_AUDIO_PATH_OPTION_NONE)) { + debug_error ("audio_hal_set_sound_path() failed\n"); ret = MM_ERROR_SOUND_INTERNAL; goto ROUTE_FMRADIO_EXIT; } - } else { /* SESSION_END */ /* PATH RELEASE */ - if (AVSYS_FAIL(avsys_audio_set_path_ex( AVSYS_AUDIO_GAIN_EX_FMRADIO, + if (audio_hal_set_sound_path(AVSYS_AUDIO_GAIN_EX_FMRADIO, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_NONE, - AVSYS_AUDIO_PATH_OPTION_NONE ))) { - debug_error ("avsys_audio_set_path_ex() failed\n"); + AVSYS_AUDIO_PATH_OPTION_NONE)) { + debug_error ("audio_hal_set_sound_path() failed\n"); ret = MM_ERROR_SOUND_INTERNAL; goto ROUTE_FMRADIO_EXIT; } @@ -487,28 +474,13 @@ static int __set_sound_path_for_current_active (void) } /* Pulseaudio route */ - if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) { - debug_log ("BT A2DP is active, Set default sink to BLUEZ"); - MMSoundMgrPulseSetDefaultSink (DEVICE_API_BLUETOOTH, DEVICE_BUS_BLUETOOTH); + if (audio_hal_pulse_sink_route(g_info.device_active)) { goto CURRENT_ACTIVE_END; - } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_WFD)) { -#ifdef USE_PULSE_WFD /* Not enabled yet */ - debug_log ("WFD is active, Set default sink to WFD"); - MMSoundMgrPulseSetDefaultSink (DEVICE_API_WFD, DEVICE_BUS_BUILTIN); - goto CURRENT_ACTIVE_END; -#endif - } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_USB_AUDIO)) { - debug_log ("USB Audio is active, Set default sink to USB Audio"); - MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_USB); + } + if (audio_hal_pulse_source_route(g_info.device_active)) { goto CURRENT_ACTIVE_END; } -#ifndef SEPARATE_SPEAKER_AND_WIRED_ACCESSORY - /* ALSA route */ - debug_log ("Set default sink to ALSA with BUILTIN"); - MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_BUILTIN); -#endif - /* prepare IN */ if (IS_ACTIVE(MM_SOUND_DEVICE_IN_MIC)) { in = AVSYS_AUDIO_PATH_EX_MIC; @@ -587,24 +559,9 @@ static int __set_sound_path_for_current_active (void) break; } -#ifdef SEPARATE_SPEAKER_AND_WIRED_ACCESSORY - if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) { - debug_log ("BT A2DP is not active, Set default sink to ALSA_XX"); - if (out == AVSYS_AUDIO_PATH_EX_HEADSET) { - debug_log ("Set default sink to ALSA_WIRED_ACCESSORY"); - MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_WIRED); - } else if (out == AVSYS_AUDIO_PATH_EX_SPK) { - debug_log ("Set default sink to ALSA_SPEAKER"); - MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_BUILTIN); - } - } -#endif - - debug_log ("Trying to set avsys set path gain[%d], out[%d], in[%d], option[%d]\n", gain, out, in, option); - /* Set Path (GAIN, OUT, IN) */ - if (AVSYS_FAIL(avsys_audio_set_path_ex(gain, out, in, option))) { - debug_error ("avsys_audio_set_path_ex failed\n"); + if (audio_hal_set_sound_path(gain, out, in, option)) { + debug_error ("audio_hal_set_sound_path failed\n"); ret = MM_ERROR_SOUND_INTERNAL; } @@ -622,10 +579,10 @@ static int __set_sound_path_to_dual (void) /* Sound path for ALSA */ debug_log ("Set path to DUAL.\n"); - if (AVSYS_FAIL(avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_KEYTONE, + if (audio_hal_set_sound_path(AVSYS_AUDIO_GAIN_EX_KEYTONE, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, - AVSYS_AUDIO_PATH_OPTION_DUAL_OUT))) { - debug_error ("avsys_audio_set_path_ex failed\n"); + AVSYS_AUDIO_PATH_OPTION_DUAL_OUT)) { + debug_error ("audio_hal_set_sound_path() failed\n"); ret = MM_ERROR_SOUND_INTERNAL; } @@ -642,10 +599,10 @@ static int __set_sound_path_to_speaker (void) /* Sound path for ALSA */ debug_log ("Set path to SPEAKER.\n"); - if(AVSYS_FAIL(avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_KEYTONE, + if (audio_hal_set_sound_path(AVSYS_AUDIO_GAIN_EX_KEYTONE, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, - AVSYS_AUDIO_PATH_OPTION_NONE))) { - debug_error ("avsys_audio_set_path_ex failed\n"); + AVSYS_AUDIO_PATH_OPTION_NONE)) { + debug_error ("audio_hal_set_sound_path failed\n"); ret = MM_ERROR_SOUND_INTERNAL; } diff --git a/server/mm_sound_plugin.c b/server/mm_sound_plugin.c index 689e219..8640842 100644 --- a/server/mm_sound_plugin.c +++ b/server/mm_sound_plugin.c @@ -42,6 +42,7 @@ char* MMSoundPluginGetTypeName(int type) "ERROR", "SOUND", "RUN", + "HAL", }; if (type < MM_SOUND_PLUGIN_TYPE_LAST && type > -1) @@ -138,11 +139,13 @@ int MMSoundPluginOpen(char *file, MMSoundPluginType *plugin) debug_msg("%s is %s\n", file, t == MM_SOUND_PLUGIN_TYPE_CODEC ? "CODEC": - t == MM_SOUND_PLUGIN_TYPE_RUN ? "RUN" : "Unknown"); + t == MM_SOUND_PLUGIN_TYPE_RUN ? "RUN" : + t == MM_SOUND_PLUGIN_TYPE_HAL ? "HAL": "Unknown"); switch(t) { case MM_SOUND_PLUGIN_TYPE_CODEC: case MM_SOUND_PLUGIN_TYPE_RUN: + case MM_SOUND_PLUGIN_TYPE_HAL: plugin->type = t; plugin->module = pdll; break; diff --git a/server/mm_sound_server.c b/server/mm_sound_server.c index 2ab6ad3..c738b3b 100644 --- a/server/mm_sound_server.c +++ b/server/mm_sound_server.c @@ -248,6 +248,7 @@ int main(int argc, char **argv) MMSoundThreadPoolInit(); MMSoundMgrRunInit(serveropt.plugdir); MMSoundMgrCodecInit(serveropt.plugdir); + MMSoundMgrHALInit(serveropt.plugdir); if (!serveropt.testmode) MMSoundMgrIpcInit(); @@ -283,6 +284,7 @@ int main(int argc, char **argv) MMSoundMgrCodecFini(); MMSoundMgrRunFini(); + MMSoundMgrHALFini(); MMSoundThreadPoolFini(); MMSoundMgrWfdFini(); diff --git a/server/plugin/wav/mm_sound_plugin_codec_wave.c b/server/plugin/wav/mm_sound_plugin_codec_wave.c index 82cb862..32e993c 100644 --- a/server/plugin/wav/mm_sound_plugin_codec_wave.c +++ b/server/plugin/wav/mm_sound_plugin_codec_wave.c @@ -35,6 +35,7 @@ #include "../../include/mm_ipc.h" #include "../../include/mm_sound_thread_pool.h" #include "../../include/mm_sound_plugin_codec.h" +#include "../../include/mm_sound_hal.h" #include "../../../include/mm_sound_private.h" @@ -408,7 +409,7 @@ static void _runing(void *param) /* if current out is not speaker, then force set path to speaker */ if (out != AVSYS_AUDIO_PATH_EX_SPK) { debug_msg("[CODEC WAV] current out is not SPEAKER, set path to SPEAKER now!!!\n"); - avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_NONE); + audio_hal_set_sound_path(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_NONE); } break; case MM_SOUND_HANDLE_ROUTE_USING_CURRENT: @@ -476,8 +477,7 @@ static void _runing(void *param) if (gain_after != gain || out_after != out || in_after != in || option_after != option) { debug_msg("[CODEC WAV] Restore path to previous one\n"); - ret = avsys_audio_set_path_ex(gain, out, in, option); - if(AVSYS_FAIL(ret)) { + if (audio_hal_set_sound_path(gain, out, in, option)) { debug_error("[CODEC WAV] Can not restore sound path\n"); } }