Changes playback interface to org.pulseaudio.SoundPlayer 05/228905/5 submit/tizen/20200403.080755
authorJaechul Lee <jcsing.lee@samsung.com>
Thu, 26 Mar 2020 08:10:39 +0000 (17:10 +0900)
committerJaechul Lee <jcsing.lee@samsung.com>
Fri, 3 Apr 2020 05:51:10 +0000 (14:51 +0900)
[Version] 0.12.68
[Issue Type] Improvement

Change-Id: I7301167c3bf0bb6101a7e2064fdba863b5f383dc
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
common/mm_sound_dbus.c
include/mm_sound_intf.h
include/mm_sound_proxy.h
mm_sound_client.c
mm_sound_proxy.c
packaging/libmm-sound.spec
server/mm_sound_mgr_ipc_dbus.c

index a8f964b..66f600f 100644 (file)
@@ -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))
index 020818c..5fbd64b 100644 (file)
@@ -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,
index ee662a3..5ba3e5e 100644 (file)
@@ -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);
index a3b4cff..64c5f12 100644 (file)
@@ -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");
index eff92b9..ba97be4 100644 (file)
@@ -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;
index e27a814..3eb158f 100644 (file)
@@ -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
index f45e29b..0992d9c 100644 (file)
@@ -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");