From ff1b19064628e108e7025e586931a6530b3c0a4f Mon Sep 17 00:00:00 2001 From: Jaechul Lee Date: Thu, 26 Mar 2020 17:10:39 +0900 Subject: [PATCH] Changes playback interface to org.pulseaudio.SoundPlayer [Version] 0.12.68 [Issue Type] Improvement Change-Id: I7301167c3bf0bb6101a7e2064fdba863b5f383dc Signed-off-by: Jaechul Lee --- common/mm_sound_dbus.c | 21 +++++++++++++-------- include/mm_sound_intf.h | 7 ++++--- include/mm_sound_proxy.h | 2 +- mm_sound_client.c | 2 +- mm_sound_proxy.c | 14 +++++++------- packaging/libmm-sound.spec | 2 +- server/mm_sound_mgr_ipc_dbus.c | 10 +++++----- 7 files changed, 32 insertions(+), 26 deletions(-) diff --git a/common/mm_sound_dbus.c b/common/mm_sound_dbus.c index a8f964b..66f600f 100644 --- a/common/mm_sound_dbus.c +++ b/common/mm_sound_dbus.c @@ -45,6 +45,11 @@ static const struct dbus_path g_paths[AUDIO_PROVIDER_MAX] = { .bus_name = "org.tizen.AudioClient", .object = "/org/tizen/AudioClient1", .interface = "org.tizen.AudioClient1" + }, + [AUDIO_PROVIDER_SOUND_PLAYER] = { + .bus_name = "org.pulseaudio.Server", + .object = "/org/pulseaudio/SoundPlayer", + .interface = "org.pulseaudio.SoundPlayer" } }; @@ -52,11 +57,11 @@ static const mm_sound_dbus_method_info_t g_methods[AUDIO_METHOD_MAX] = { [AUDIO_METHOD_TEST] = { .name = "MethodTest1", }, - [AUDIO_METHOD_PLAY_FILE_START_WITH_STREAM_INFO] = { - .name = "PlayFileStartWithStreamInfo", + [AUDIO_METHOD_SOUND_PLAY] = { + .name = "SoundPlay", }, - [AUDIO_METHOD_PLAY_FILE_STOP] = { - .name = "PlayFileStop", + [AUDIO_METHOD_SOUND_STOP] = { + .name = "SoundStop", }, [AUDIO_METHOD_PLAY_DTMF_WITH_STREAM_INFO] = { .name = "PlayDTMFWithStreamInfo", @@ -100,8 +105,8 @@ static const mm_sound_dbus_signal_info_t g_events[AUDIO_EVENT_MAX] = { [AUDIO_EVENT_TEST] = { .name = "SignalTest1", }, - [AUDIO_EVENT_PLAY_FILE_END] = { - .name = "PlayFileEnd", + [AUDIO_EVENT_SOUND_PLAY_EOS] = { + .name = "EOS", }, [AUDIO_EVENT_VOLUME_CHANGED] = { .name = "VolumeChanged", @@ -403,8 +408,8 @@ static void _dbus_signal_callback(GDBusConnection *connection, (cb_data->user_cb)(AUDIO_EVENT_FOCUS_CHANGED, params, cb_data->user_data); else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_WATCH].name)) (cb_data->user_cb)(AUDIO_EVENT_FOCUS_WATCH, params, cb_data->user_data); - else if (!strcmp(signal_name, g_events[AUDIO_EVENT_PLAY_FILE_END].name)) - (cb_data->user_cb)(AUDIO_EVENT_PLAY_FILE_END, params, cb_data->user_data); + else if (!strcmp(signal_name, g_events[AUDIO_EVENT_SOUND_PLAY_EOS].name)) + (cb_data->user_cb)(AUDIO_EVENT_SOUND_PLAY_EOS, params, cb_data->user_data); else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_RUNNING_CHANGED].name)) (cb_data->user_cb)(AUDIO_EVENT_DEVICE_RUNNING_CHANGED, params, cb_data->user_data); else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DUCKING_STATE_CHANGED].name)) diff --git a/include/mm_sound_intf.h b/include/mm_sound_intf.h index 020818c..5fbd64b 100644 --- a/include/mm_sound_intf.h +++ b/include/mm_sound_intf.h @@ -40,13 +40,14 @@ typedef enum audio_provider { AUDIO_PROVIDER_STREAM_MANAGER, AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_PROVIDER_AUDIO_CLIENT, + AUDIO_PROVIDER_SOUND_PLAYER, AUDIO_PROVIDER_MAX } audio_provider_t; typedef enum audio_method { AUDIO_METHOD_TEST, - AUDIO_METHOD_PLAY_FILE_START_WITH_STREAM_INFO, - AUDIO_METHOD_PLAY_FILE_STOP, + AUDIO_METHOD_SOUND_PLAY, + AUDIO_METHOD_SOUND_STOP, AUDIO_METHOD_PLAY_DTMF_WITH_STREAM_INFO, AUDIO_METHOD_GET_BT_A2DP_STATUS, AUDIO_METHOD_SET_PATH_FOR_ACTIVE_DEVICE, @@ -70,7 +71,7 @@ typedef enum audio_method { typedef enum audio_event { AUDIO_EVENT_TEST, - AUDIO_EVENT_PLAY_FILE_END, + AUDIO_EVENT_SOUND_PLAY_EOS, AUDIO_EVENT_VOLUME_CHANGED, AUDIO_EVENT_DEVICE_CONNECTED, AUDIO_EVENT_DEVICE_INFO_CHANGED, diff --git a/include/mm_sound_proxy.h b/include/mm_sound_proxy.h index ee662a3..5ba3e5e 100644 --- a/include/mm_sound_proxy.h +++ b/include/mm_sound_proxy.h @@ -39,7 +39,7 @@ typedef void (*mm_sound_proxy_userdata_free) (void *data); int mm_sound_proxy_play_tone_with_stream_info(int client_pid, int tone, char *stream_type, int stream_id, int volume, int repeat, int *codechandle); -int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat, int volume, +int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat, int client_pid, int *codechandle, char *stream_type, int stream_index); int mm_sound_proxy_stop_sound(int handle); int mm_sound_proxy_add_play_sound_end_callback(mm_sound_stop_callback_wrapper_func func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id); diff --git a/mm_sound_client.c b/mm_sound_client.c index a3b4cff..64c5f12 100644 --- a/mm_sound_client.c +++ b/mm_sound_client.c @@ -248,7 +248,7 @@ int mm_sound_client_play_sound_with_stream_info(MMSoundPlayParam *param, int *ha struct callback_data *cb_data = NULL; play_sound_end_callback_data_t *end_cb_data; - ret = mm_sound_proxy_play_sound_with_stream_info(param->filename, param->loop, param->volume, + ret = mm_sound_proxy_play_sound_with_stream_info(param->filename, param->loop, getpid(), handle, stream_type, stream_id); if (ret != MM_ERROR_NONE) { debug_error("Play Sound Failed"); diff --git a/mm_sound_proxy.c b/mm_sound_proxy.c index eff92b9..ba97be4 100644 --- a/mm_sound_proxy.c +++ b/mm_sound_proxy.c @@ -238,7 +238,7 @@ static void dbus_callback(audio_event_t event, GVariant *params, void *userdata) int test_var = 0; g_variant_get(params, "(i)", &test_var); ((mm_sound_test_cb)(cb_data->user_cb))(test_var, cb_data->user_data); - } else if (event == AUDIO_EVENT_PLAY_FILE_END) { + } else if (event == AUDIO_EVENT_SOUND_PLAY_EOS) { int ended_handle = 0; g_variant_get(params, "(i)", &ended_handle); ((mm_sound_stop_callback_wrapper_func)(cb_data->user_cb))(ended_handle, cb_data->user_data); @@ -929,8 +929,8 @@ int mm_sound_proxy_play_tone_with_stream_info(int client_pid, int tone, char *st return ret; } -int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat, int volume, - int client_pid, int *codechandle, char *stream_type, int stream_index) +int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat, + int client_pid, int *codechandle, char *stream_type, int stream_id) { int ret = MM_ERROR_NONE; int handle = 0; @@ -943,12 +943,12 @@ int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat, debug_fenter(); - if ((params = g_variant_new("(siiisi)", filename, repeat, volume, client_pid, stream_type, stream_index)) == NULL) { + if ((params = g_variant_new("(siisi)", filename, repeat, client_pid, stream_type, stream_id)) == NULL) { debug_error("Construct Param for method call failed"); return MM_ERROR_SOUND_INTERNAL; } - if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_FILE_START_WITH_STREAM_INFO, params, &result)) != MM_ERROR_NONE) { + if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_PLAYER, AUDIO_METHOD_SOUND_PLAY, params, &result)) != MM_ERROR_NONE) { debug_error("dbus play file failed"); return ret; } @@ -974,7 +974,7 @@ int mm_sound_proxy_stop_sound(int handle) debug_fenter(); - if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_FILE_STOP, g_variant_new("(i)", handle), &result)) != MM_ERROR_NONE) + if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_PLAYER, AUDIO_METHOD_SOUND_STOP, g_variant_new("(i)", handle), &result)) != MM_ERROR_NONE) debug_error("dbus stop file playing failed"); g_variant_unref(result); @@ -992,7 +992,7 @@ int mm_sound_proxy_add_play_sound_end_callback(mm_sound_stop_callback_wrapper_fu CB_DATA_NEW(cb_data, func, userdata, freefunc); - if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_EVENT_PLAY_FILE_END, dbus_callback, cb_data, simple_callback_data_free_func, &cb_data->subs_id)) != MM_ERROR_NONE) + if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_SOUND_PLAYER, AUDIO_EVENT_SOUND_PLAY_EOS, dbus_callback, cb_data, simple_callback_data_free_func, &cb_data->subs_id)) != MM_ERROR_NONE) debug_error("add play sound end callback failed"); else *subs_id = cb_data->subs_id; diff --git a/packaging/libmm-sound.spec b/packaging/libmm-sound.spec index e27a814..3eb158f 100644 --- a/packaging/libmm-sound.spec +++ b/packaging/libmm-sound.spec @@ -1,6 +1,6 @@ Name: libmm-sound Summary: MMSound Package contains client lib and sound_server binary -Version: 0.12.67 +Version: 0.12.68 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/server/mm_sound_mgr_ipc_dbus.c b/server/mm_sound_mgr_ipc_dbus.c index f45e29b..0992d9c 100644 --- a/server/mm_sound_mgr_ipc_dbus.c +++ b/server/mm_sound_mgr_ipc_dbus.c @@ -78,15 +78,15 @@ static mm_sound_dbus_method_intf_t methods[AUDIO_METHOD_MAX] = { }, .handler = handle_method_test }, - [AUDIO_METHOD_PLAY_FILE_START_WITH_STREAM_INFO] = { + [AUDIO_METHOD_SOUND_PLAY] = { .info = { - .name = "PlayFileStartWithStreamInfo", + .name = "SoundPlay", }, .handler = handle_method_play_file_start_with_stream_info }, - [AUDIO_METHOD_PLAY_FILE_STOP] = { + [AUDIO_METHOD_SOUND_STOP] = { .info = { - .name = "PlayFileStop", + .name = "SoundStop", }, .handler = handle_method_play_file_stop }, @@ -435,7 +435,7 @@ int __mm_sound_mgr_ipc_dbus_notify_play_file_end(int handle) param = g_variant_new("(i)", handle); if (param) { - if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_PLAY_FILE_END, param)) != MM_ERROR_NONE) + if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_SOUND_PLAY_EOS, param)) != MM_ERROR_NONE) debug_error("Send play file end for '%d' failed", handle); } else { debug_error("Build variant for dbus param failed"); -- 2.7.4