From: Vikas Kumar Agrawal Date: Mon, 12 Mar 2018 18:07:58 +0000 (+0530) Subject: Replacing deprecated API of sound manager X-Git-Tag: submit/tizen/20180315.063100~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f7e46ea4a08951600d989dd7df4be63f37e2a46;p=profile%2Fmobile%2Fapps%2Fnative%2Fmusic-player.git Replacing deprecated API of sound manager Change-Id: Ibfff24119230591ae1b3de28b89a02bebbc7f205 --- diff --git a/music-chooser/src/include/mc-list-play.h b/music-chooser/src/include/mc-list-play.h index 36a8667..5644e77 100644 --- a/music-chooser/src/include/mc-list-play.h +++ b/music-chooser/src/include/mc-list-play.h @@ -79,8 +79,6 @@ void mc_player_play(void); void mc_pre_play_control_play_no_pause_music_item(list_item_data_t * item_data); void mc_pre_play_control_play_music_item(list_item_data_t * item_data); -void mc_vol_reset_default_value(void *data); -void mc_vol_type_set(sound_type_e type); int mc_get_volume(sound_type_e type); diff --git a/music-chooser/src/mc-list-play.c b/music-chooser/src/mc-list-play.c index 4823ffb..63d5504 100644 --- a/music-chooser/src/mc-list-play.c +++ b/music-chooser/src/mc-list-play.c @@ -25,9 +25,6 @@ list_item_data_t *previous_item_data = NULL; list_item_data_t *pre_item_data = NULL; list_item_data_t *cur_item_data = NULL; -sound_type_e g_init_current_type; -int g_init_volume = -1; - int g_position = 0; static void _mc_pre_play_mgr_play_new_uri(void *data); @@ -48,17 +45,6 @@ static void _mc_pre_play_mgr_player_unprepare(); Evas_Object *g_popup; -sound_type_e mc_get_sound_type() -{ - startfunc; - sound_type_e type = SOUND_TYPE_SYSTEM; - int ret = 0; - ret = sound_manager_get_current_sound_type(&type); - DEBUG_TRACE("ret is [%d]", ret); - endfunc; - return type; -} - int mc_get_volume(sound_type_e type) { startfunc; @@ -68,37 +54,6 @@ int mc_get_volume(sound_type_e type) return volume; } -void mc_vol_type_set(sound_type_e type) -{ - startfunc; - sound_type_e current_type; - int volume = 0; - current_type = mc_get_sound_type(); - volume = mc_get_volume(current_type); - if (g_init_volume == -1) { - g_init_current_type = current_type; - g_init_volume = volume; - } - sound_manager_set_current_sound_type(type); -} - -void mc_vol_reset_default_value(void *data) -{ - startfunc; - MP_CHECK(data); - struct app_data *ad = data; - - sound_type_e current_type; - current_type = mc_get_sound_type(); - DEBUG_TRACE("current type is %d", current_type); - if (ad->select_type == MC_SELECT_SINGLE_RINGTONE) { - if (g_init_current_type != current_type) { - mc_vol_type_set(g_init_current_type); - } - } -} - - bool mc_player_mgr_is_active(void) { return (mc_player != NULL) ? TRUE : FALSE; diff --git a/music-chooser/src/music-chooser.c b/music-chooser/src/music-chooser.c index f0205f8..9dc7727 100644 --- a/music-chooser/src/music-chooser.c +++ b/music-chooser/src/music-chooser.c @@ -235,10 +235,6 @@ static void mc_app_control(app_control_h app_control, void *data) mc_library_view_create(ad); } - if (ad->select_type == MC_SELECT_SINGLE_RINGTONE) { - mc_vol_type_set(SOUND_TYPE_MEDIA); - } - elm_object_content_set(ad->conformant, ad->base_layout); evas_object_show(parent); @@ -249,10 +245,6 @@ static void mc_pause(void *data) { DEBUG_TRACE(""); mc_pre_play_mgr_destroy_play(); - struct app_data *ad = NULL; - ad = (struct app_data *) data; - MP_CHECK(ad); - mc_vol_reset_default_value(ad); return; } @@ -260,13 +252,6 @@ static void mc_pause(void *data) static void mc_resume(void *data) { DEBUG_TRACE(""); - struct app_data *ad = NULL; - ad = (struct app_data *) data; - MP_CHECK(ad); - - if (ad->select_type == MC_SELECT_SINGLE_RINGTONE) { - mc_vol_type_set(SOUND_TYPE_MEDIA); - } return; } @@ -284,7 +269,6 @@ static void mc_destroy(void *data) ad->base_layout = NULL; } //elm_theme_free(ad->th); - mc_vol_reset_default_value(ad); elm_win_lower(ad->win); diff --git a/src/common/mp-app.c b/src/common/mp-app.c index bbd1ceb..64d0c17 100644 --- a/src/common/mp-app.c +++ b/src/common/mp-app.c @@ -60,7 +60,7 @@ typedef struct { mp_app_pipe_cb_type_e type; void *user_data; //Replaced for _prod dependency - sound_device_changed_info_e out; + sound_device_state_e out; } mp_app_pipe_data_s; #ifdef MP_FEATURE_USB_OTG @@ -254,7 +254,7 @@ _mp_add_available_route_changed_cb(sound_device_h device, bool available, */ static void _mp_app_active_device_chaged_cb(sound_device_h in, - sound_device_changed_info_e out, + sound_device_state_e out, void *user_data) { EVENT_TRACE("input=[0x%x], output=[0x%x]", in, out); @@ -464,9 +464,9 @@ bool mp_app_noti_init(void *data) //Replaced for _prod dependency start WARN_TRACE("Enter sound_manager_set_available_route_changed_cb"); int ret = - sound_manager_set_device_connected_cb(SOUND_DEVICE_ALL_MASK, + sound_manager_add_device_connection_changed_cb(SOUND_DEVICE_ALL_MASK, _mp_add_available_route_changed_cb, - ad); + ad, &ad->device_conn_changed_cb_id); if (ret != SOUND_MANAGER_ERROR_NONE) { ERROR_TRACE ("sound_manager_set_available_route_changed_cb().. [0x%x]", diff --git a/src/common/mp-util.c b/src/common/mp-util.c index 6e5b204..80458a5 100644 --- a/src/common/mp-util.c +++ b/src/common/mp-util.c @@ -1134,13 +1134,13 @@ void mp_util_get_sound_path(mp_snd_path * snd_path) case SOUND_DEVICE_AUDIO_JACK: *snd_path = MP_SND_PATH_EARPHONE; break; - case SOUND_DEVICE_BLUETOOTH: + case SOUND_DEVICE_BLUETOOTH_MEDIA: *snd_path = MP_SND_PATH_BT; break; case SOUND_DEVICE_HDMI: *snd_path = MP_SND_PATH_HDMI; break; - case SOUND_DEVICE_MIRRORING: + case SOUND_DEVICE_FORWARDING: *snd_path = MP_SND_PATH_MIRRORING; break; case SOUND_DEVICE_USB_AUDIO: diff --git a/src/core/include/mp-player-mgr.h b/src/core/include/mp-player-mgr.h index df69681..6d9d139 100644 --- a/src/core/include/mp-player-mgr.h +++ b/src/core/include/mp-player-mgr.h @@ -72,8 +72,6 @@ void mp_player_mgr_unset_seek_done_cb(); bool mp_player_mgr_set_play_speed(double speed); int mp_player_mgr_get_position(void); int mp_player_mgr_get_duration(void); -int mp_player_mgr_vol_type_set(void); -int mp_player_mgr_vol_type_unset(void); bool mp_player_mgr_session_init(void); bool mp_player_mgr_session_finish(void); diff --git a/src/core/mp-player-mgr.c b/src/core/mp-player-mgr.c index 7a64843..6f50874 100644 --- a/src/core/mp-player-mgr.c +++ b/src/core/mp-player-mgr.c @@ -1153,15 +1153,6 @@ int mp_player_mgr_get_duration(void) return duration; } -int mp_player_mgr_vol_type_set(void) -{ - return sound_manager_set_current_sound_type(SOUND_TYPE_MEDIA); -} - -int mp_player_mgr_vol_type_unset(void) -{ - return sound_manager_unset_current_sound_type(); -} int mp_player_mgr_safety_volume_set(int foreground) { diff --git a/src/core/mp-volume.c b/src/core/mp-volume.c index 87a88c0..c773717 100644 --- a/src/core/mp-volume.c +++ b/src/core/mp-volume.c @@ -62,7 +62,6 @@ void mp_volume_finalize(void) return; } - /* sound_manager_unset_volume_changed_cb(); */ endfunc; } diff --git a/src/include/music.h b/src/include/music.h index fa6dec2..5a39989 100644 --- a/src/include/music.h +++ b/src/include/music.h @@ -466,6 +466,8 @@ struct appdata { bool prepare_by_init; //to indicate if player created and prepared to ready state in init idler int mmc_id; app_event_low_battery_status_e low_battery_status; + + int device_conn_changed_cb_id; }; diff --git a/src/mp-main.c b/src/mp-main.c index 1c80f2c..849d4de 100644 --- a/src/mp-main.c +++ b/src/mp-main.c @@ -232,7 +232,6 @@ static void _mp_main_win_visibility_withdrawn_cb(void *data, struct appdata *ad = (struct appdata *) data; mp_retm_if(ad == NULL, "ad is null"); ad->app_is_foreground = false; - mp_player_mgr_vol_type_unset(); mp_player_mgr_safety_volume_set(ad->app_is_foreground); mp_view_view_pause(mp_view_mgr_get_top_view(GET_VIEW_MGR)); DEBUG_TRACE("ad->app_is_foreground: %d", ad->app_is_foreground); @@ -246,7 +245,6 @@ static void _mp_main_win_visibility_normal_cb(void *data, mp_retm_if(ad == NULL, "ad is null"); ad->app_is_foreground = true; - mp_player_mgr_vol_type_set(); mp_player_mgr_safety_volume_set(ad->app_is_foreground); mp_view_view_resume(mp_view_mgr_get_top_view(GET_VIEW_MGR)); DEBUG_TRACE("ad->app_is_foreground: %d", ad->app_is_foreground); @@ -506,7 +504,6 @@ static Eina_Bool _mp_main_app_init_idler_cb(void *data) struct appdata *ad = data; MP_CHECK_FALSE(ad); - mp_player_mgr_vol_type_set(); mp_player_mgr_safety_volume_set(ad->app_is_foreground); if (!mp_app_noti_init(ad)) { ERROR_TRACE("Error when noti init"); @@ -1397,7 +1394,6 @@ static void mp_terminate(void *data) list = NULL; } - mp_player_mgr_vol_type_unset(); mp_player_mgr_safety_volume_set(0); if (!mp_player_mgr_session_finish()) { @@ -1454,9 +1450,6 @@ static void mp_terminate(void *data) static void mp_pause(void *data) { eventfunc; - int ret = 0; - ret = mp_player_mgr_vol_type_unset(); - DEBUG_TRACE("sound_manager_unset_current_sound_type = %d", ret); return; } diff --git a/src/view/mp-player-view.c b/src/view/mp-player-view.c index f76298b..1b19fc0 100644 --- a/src/view/mp-player-view.c +++ b/src/view/mp-player-view.c @@ -624,7 +624,7 @@ void mp_player_view_set_snd_path_sensitivity(void *data) DEBUG_TRACE("SOUND_DEVICE_AUDIO_JACK"); view->available_route |= MP_SND_PATH_EARPHONE; break; - case SOUND_DEVICE_BLUETOOTH: + case SOUND_DEVICE_BLUETOOTH_MEDIA: DEBUG_TRACE("SOUND_DEVICE_BLUETOOTH"); view->available_route |= MP_SND_PATH_BT; view->available_route_count++; @@ -634,7 +634,7 @@ void mp_player_view_set_snd_path_sensitivity(void *data) view->available_route |= MP_SND_PATH_HDMI; view->available_route_count++; break; - case SOUND_DEVICE_MIRRORING: + case SOUND_DEVICE_FORWARDING: DEBUG_TRACE("SOUND_DEVICE_MIRRORING"); view->available_route |= MP_SND_PATH_MIRRORING; view->available_route_count++; diff --git a/src/widget/mp-popup.c b/src/widget/mp-popup.c index 97e2455..27f7d56 100644 --- a/src/widget/mp-popup.c +++ b/src/widget/mp-popup.c @@ -306,9 +306,9 @@ static Evas_Object *_mp_popup_sound_path_create(Evas_Object * parent, ERROR_TRACE("failed to get device type, ret[0x%x]\n", ret); } switch (type) { - case SOUND_DEVICE_BLUETOOTH: + case SOUND_DEVICE_BLUETOOTH_MEDIA: case SOUND_DEVICE_HDMI: - case SOUND_DEVICE_MIRRORING: + case SOUND_DEVICE_FORWARDING: case SOUND_DEVICE_USB_AUDIO: cnt++; break;