From: Sangchul Lee Date: Fri, 23 Sep 2022 05:55:28 +0000 (+0900) Subject: Remove sound-manager deprecated API X-Git-Tag: tizen_7.0_src.m2_release^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen;p=profile%2Fiot%2Fapps%2Fnative%2Fmusic-player.git Remove sound-manager deprecated API Instead, sound_manager_add_device_running_changed_cb() is used. Change-Id: Ia029b69c92d05a96228abb31f357b516df3d5021 Signed-off-by: Sangchul Lee --- diff --git a/src/common/mp-app.c b/src/common/mp-app.c index b5fbb91..a6270b5 100755 --- a/src/common/mp-app.c +++ b/src/common/mp-app.c @@ -53,14 +53,14 @@ void mp_play_next_and_updateview(void *data); static Ecore_Pipe *gNotiPipe; typedef enum { MP_APP_PIPE_CB_AVAILABLE_ROUTE_CHANGED, - MP_APP_PIPE_CB_ACTIVE_DEVICE_CHANGED, + MP_APP_PIPE_CB_DEVICE_RUNNING_CHANGED, } mp_app_pipe_cb_type_e; typedef struct { mp_app_pipe_cb_type_e type; void *user_data; //Replaced for _prod dependency - sound_device_state_e out; + bool running; } mp_app_pipe_data_s; #ifdef MP_FEATURE_USB_OTG @@ -246,24 +246,27 @@ _mp_add_available_route_changed_cb(sound_device_h device, bool available, } /* -* The device state changed callback function +* The device running changed callback function * @param sound device * @param Sound device changed info * @param data appdata * @return void */ static void -_mp_app_active_device_chaged_cb(sound_device_h in, - sound_device_state_e out, +_mp_app_device_running_changed_cb(sound_device_h device, + bool is_running, void *user_data) { - EVENT_TRACE("input=[0x%x], output=[0x%x]", in, out); + sound_device_type_e type; + + sound_manager_get_device_type(device, &type); + EVENT_TRACE("device[type:%d], is_running[%u]", type, is_running); MP_CHECK(gNotiPipe); mp_app_pipe_data_s pipe_data; memset(&pipe_data, 0, sizeof(mp_app_pipe_data_s)); - pipe_data.type = MP_APP_PIPE_CB_ACTIVE_DEVICE_CHANGED; - pipe_data.out = out; + pipe_data.type = MP_APP_PIPE_CB_DEVICE_RUNNING_CHANGED; + pipe_data.running = is_running; pipe_data.user_data = user_data; ecore_pipe_write(gNotiPipe, &pipe_data, sizeof(mp_app_pipe_data_s)); @@ -291,8 +294,9 @@ _mp_app_noti_pipe_handler(void *data, void *buffer, unsigned int nbyte) mp_view_mgr_post_event(GET_VIEW_MGR, MP_ROUTE_CHANGED); break; - case MP_APP_PIPE_CB_ACTIVE_DEVICE_CHANGED: - mp_setting_update_active_device(); + case MP_APP_PIPE_CB_DEVICE_RUNNING_CHANGED: + /* FIXME: check condition to do what it really wants. */ + mp_setting_update_active_device(); /* empty function */ mp_view_mgr_post_event(GET_VIEW_MGR, MP_ROUTE_CHANGED); break; @@ -475,16 +479,16 @@ bool mp_app_noti_init(void *data) } WARN_TRACE("Leave sound_manager_set_available_route_changed_cb"); - WARN_TRACE("Enter sound_manager_set_active_device_changed_cb"); + WARN_TRACE("Enter sound_manager_add_device_running_changed_cb"); ret = - sound_manager_add_device_state_changed_cb - (SOUND_DEVICE_ALL_MASK, _mp_app_active_device_chaged_cb, ad, &ad->device_state_id); + sound_manager_add_device_running_changed_cb + (SOUND_DEVICE_ALL_MASK, _mp_app_device_running_changed_cb, ad, &ad->device_state_id); if (ret != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE - ("sound_manager_set_active_device_changed_cb().. [0x%x]", ret); + ("sound_manager_add_device_running_changed_cb().. [0x%x]", ret); res = FALSE; } - WARN_TRACE("Leave sound_manager_set_active_device_changed_cb"); + WARN_TRACE("Leave sound_manager_add_device_running_changed_cb"); ret = mp_media_info_set_db_update_cb(_mp_app_db_update_cb, NULL); if (ret != 0) { diff --git a/src/mp-main.c b/src/mp-main.c index 72d8801..af0a53e 100755 --- a/src/mp-main.c +++ b/src/mp-main.c @@ -1310,9 +1310,9 @@ static void mp_terminate(void *data) } int error = SOUND_MANAGER_ERROR_NONE; - error = sound_manager_remove_device_state_changed_cb(ad->device_state_id); + error = sound_manager_remove_device_running_changed_cb(ad->device_state_id); if (error != SOUND_MANAGER_ERROR_NONE) { - ERROR_TRACE("Cannot remove device state changed callback"); + ERROR_TRACE("Cannot remove device running changed callback"); } if (ad->stream_info) {