[0.3.144] Add PLAYER_DISPLAY_OVERLAY_SYNC_UI type for sync UI and video
[platform/core/api/player.git] / src / player.c
index 22b493d..461f6bb 100644 (file)
@@ -60,7 +60,6 @@ typedef struct {
        int int_data;
        callback_cb_info_s *cb_info;
        _player_recv_data *recv_data;
-       GMutex event_mutex;
 } _player_cb_data;
 
 typedef struct {
@@ -177,8 +176,6 @@ static bool _player_get_param_value(char *buf, ...)
        char *param_name = NULL;
        void *value = NULL;
 
-       LOGE("ENTER");
-
        void *jobj = muse_core_msg_object_new(buf, NULL, &err);
 
        if (!jobj) {
@@ -800,15 +797,15 @@ static void __player_remove_tsurf_list(player_cli_s *pc)
        return;
 }
 
-static player_tsurf_info_s *__player_get_tsurf_from_list(callback_cb_info_s *cb_info, int *key, int height, int width)
+static player_tsurf_info_s *__player_get_tsurf_from_list(callback_cb_info_s *cb_info, intptr_t key, int height, int width)
 {
        GList *l = NULL;
 
        g_mutex_lock(&cb_info->data_mutex);
        for (l = g_list_first(cb_info->tsurf_list); l; l = g_list_next(l)) {
                player_tsurf_info_s *tmp = (player_tsurf_info_s *)l->data;
-               if (tmp && key && (tmp->key[0] == key[0])) {
-                       LOGD("found tsurf_data of tbm_key %d", key[0]);
+               if (tmp && key && (tmp->key == key)) {
+                       LOGD("found tsurf_data of tbm_key %" PRIdPTR, key);
 
                        /* need to check tsuf info to support DRC */
                        if ((tbm_surface_get_height(tmp->tsurf) != height) ||
@@ -857,7 +854,6 @@ static media_packet_rotate_method_e __convert_packet_orient_info(int orientation
 static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
 {
        tbm_bo bo[4] = { NULL, };
-       int key[4] = { INVALID_DEFAULT_VALUE, };
        tbm_surface_info_s sinfo;
        char *surface_info = (char *)&sinfo;
        media_packet_h pkt = NULL;
@@ -868,6 +864,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _
        bool make_pkt_fmt = false;
        int ret = MEDIA_FORMAT_ERROR_NONE;
        _media_pkt_video_fin_data *fin_data = NULL;
+       intptr_t key = 0;
        intptr_t v_data = 0;
        uint64_t pts = 0;
        int i = 0, orientation = 0;
@@ -875,10 +872,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _
 
        void *jobj = muse_core_msg_object_new(recv_data->buffer, NULL, &err);
        if (!jobj ||
-               !muse_core_msg_object_get_value("key[0]", jobj, MUSE_TYPE_ANY, &key[0]) ||
-               !muse_core_msg_object_get_value("key[1]", jobj, MUSE_TYPE_ANY, &key[1]) ||
-               !muse_core_msg_object_get_value("key[2]", jobj, MUSE_TYPE_ANY, &key[2]) ||
-               !muse_core_msg_object_get_value("key[3]", jobj, MUSE_TYPE_ANY, &key[3]) ||
+               !muse_core_msg_object_get_value("key", jobj, MUSE_TYPE_POINTER, &key) ||
                !muse_core_msg_object_get_value("v_data", jobj, MUSE_TYPE_POINTER, &v_data) ||
                !muse_core_msg_object_get_value("mimetype", jobj, MUSE_TYPE_ANY, &mimetype) ||
                !muse_core_msg_object_get_value("pts", jobj, MUSE_TYPE_INT64, &pts) ||
@@ -920,25 +914,24 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _
                        bo[i] = tbm_bo_import_fd(cb_info->bufmgr, recv_data->tfd[i]);
                }
 
-               tsurf_data = g_new(player_tsurf_info_s, 1);
-               if (!tsurf_data) {
-                       LOGE("failed to alloc tsurf info");
-                       goto ERROR;
-               }
-               memset(tsurf_data->key, INVALID_DEFAULT_VALUE, sizeof(tsurf_data->key));
-
                tsurf = tbm_surface_internal_create_with_bos(&sinfo, bo, bo_num);
                if (!tsurf) {
                        LOGE("failed to create tbm surface");
-                       g_free(tsurf_data);
                        goto ERROR;
                }
-               memcpy(tsurf_data->key, key, sizeof(tsurf_data->key));
-               tsurf_data->tsurf = tsurf;
+
                if (cb_info->use_tsurf_pool) {
+                       tsurf_data = g_try_new(player_tsurf_info_s, 1);
+                       if (!tsurf_data) {
+                               LOGE("failed to alloc tsurf info");
+                               goto ERROR;
+                       }
+                       tsurf_data->key = key;
+                       tsurf_data->tsurf = tsurf;
+
                        g_mutex_lock(&cb_info->data_mutex);
                        cb_info->tsurf_list = g_list_append(cb_info->tsurf_list, tsurf_data);
-                       LOGD("key %d is added to the pool", key[0]);
+                       LOGD("key %" PRIdPTR " is added to the pool", key);
                        if (cb_info->video_frame_pool_size < g_list_length(cb_info->tsurf_list))
                                LOGE("need to check the pool size: %d < %d", cb_info->video_frame_pool_size, g_list_length(cb_info->tsurf_list));
                        g_mutex_unlock(&cb_info->data_mutex);
@@ -982,7 +975,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _
                }
        }
 
-       fin_data = g_new0(_media_pkt_video_fin_data, 1);
+       fin_data = g_try_new0(_media_pkt_video_fin_data, 1);
        if (!fin_data) {
                LOGE("failed to alloc fin_data");
                goto ERROR;
@@ -1033,6 +1026,8 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _
 ERROR:
        if (pkt)
                media_packet_destroy(pkt);
+       else if (!tsurf_data && tsurf)
+               tbm_surface_destroy(tsurf);
 
        if (fin_data)
                g_free(fin_data);
@@ -1319,8 +1314,8 @@ gboolean _player_event_job_function(void *user_data)
        _player_cb_data *data = (_player_cb_data *)user_data;
        muse_player_event_e ev;
 
-       if (data == NULL) {
-               LOGE("data is null");
+       if (!data || !data->cb_info) {
+               LOGE("invalid user data");
                return FALSE;
        }
 
@@ -1329,14 +1324,6 @@ gboolean _player_event_job_function(void *user_data)
                (ev != MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME))
                LOGD("enter ev:%d(%p)", ev, data);
 
-       g_mutex_lock(&data->event_mutex);
-
-       if (data->cb_info == NULL) {
-               /* tried to remove before at _player_remove_idle_event */
-               LOGW("cb_info is NULL. event %d", data->int_data);
-               goto DONE;
-       }
-
        /* remove event from list */
        g_mutex_lock(&data->cb_info->event_queue.idle_ev_mutex);
        if (data->cb_info->event_queue.idle_ev_list) {
@@ -1351,18 +1338,6 @@ gboolean _player_event_job_function(void *user_data)
        else
                LOGW("user callback is unset. type : %d", ev);
 
-DONE:
-       /* unlock and release event */
-       g_mutex_unlock(&data->event_mutex);
-       g_mutex_clear(&data->event_mutex);
-       if (data->recv_data) {
-               g_free(data->recv_data->buffer);
-               data->recv_data->buffer = NULL;
-               g_free(data->recv_data);
-               data->recv_data = NULL;
-       }
-       g_free(data);
-
        return FALSE; /* remove from the event list */
 }
 
@@ -1381,6 +1356,26 @@ static bool _player_need_sync_context(int event_id)
        }
 }
 
+static void _destroy_event_data(gpointer user_data)
+{
+       _player_cb_data *data = (_player_cb_data *)user_data;
+
+       if (data == NULL) {
+               LOGW("data is null");
+               return;
+       }
+
+       LOGD("remove event data %p (%d)", data, data->int_data);
+       if (data->recv_data) {
+               g_free(data->recv_data->buffer);
+               data->recv_data->buffer = NULL;
+               g_free(data->recv_data);
+               data->recv_data = NULL;
+       }
+
+       g_free(data);
+}
+
 static void *_player_event_queue_loop(void *param)
 {
        if (!param) {
@@ -1406,54 +1401,53 @@ static void *_player_event_queue_loop(void *param)
                        g_mutex_lock(&ev->qlock);
                        event_data = (_player_cb_data *)g_queue_pop_head(ev->queue);
                        g_mutex_unlock(&ev->qlock);
-                       if (event_data) {
-                               muse_player_event_e event_type = event_data->int_data;
-
-                               if (event_type == MUSE_PLAYER_EVENT_TYPE_SEEK) {
-                                       g_mutex_lock(&cb_info->seek_cb_mutex);
-                                       if (cb_info->seek_cb_state == PLAYER_SEEK_CB_STATE_WAIT) {
-                                               /* push event into queue again. */
-                                               _player_event_queue_add(ev, event_data);
-                                               g_mutex_unlock(&cb_info->seek_cb_mutex);
-                                               break;
-                                       }
+
+                       if (!event_data)
+                               break;
+
+                       muse_player_event_e event_type = event_data->int_data;
+
+                       if (event_type == MUSE_PLAYER_EVENT_TYPE_SEEK) {
+                               g_mutex_lock(&cb_info->seek_cb_mutex);
+                               if (cb_info->seek_cb_state == PLAYER_SEEK_CB_STATE_WAIT) {
+                                       /* push event into queue again. */
+                                       _player_event_queue_add(ev, event_data);
                                        g_mutex_unlock(&cb_info->seek_cb_mutex);
-                               } else if (event_type == MUSE_PLAYER_EVENT_TYPE_BUFFERING) {
-                                       g_mutex_lock(&cb_info->buffering_cb_mutex);
-                                       if (cb_info->drop_buffering_message) {
-                                               LOGD("Drop buffering event");
-                                               g_mutex_unlock(&cb_info->buffering_cb_mutex);
-                                               break;
-                                       }
+                                       break;
+                               }
+                               g_mutex_unlock(&cb_info->seek_cb_mutex);
+                       } else if (event_type == MUSE_PLAYER_EVENT_TYPE_BUFFERING) {
+                               g_mutex_lock(&cb_info->buffering_cb_mutex);
+                               if (cb_info->drop_buffering_message) {
+                                       LOGD("Drop buffering event");
                                        g_mutex_unlock(&cb_info->buffering_cb_mutex);
+
+                                       _destroy_event_data(event_data);
+                                       break;
                                }
+                               g_mutex_unlock(&cb_info->buffering_cb_mutex);
+                       }
 
-                               if (_player_need_sync_context(event_type)) {
-                                       if ((cb_info->user_cb[event_type] || (event_type == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED)) &&
-                                               _user_callbacks[event_type]) {
-                                               g_mutex_lock(&ev->idle_ev_mutex);
-                                               ev->idle_ev_list = g_list_append(ev->idle_ev_list, (gpointer)event_data);
-                                               g_mutex_unlock(&ev->idle_ev_mutex);
-
-                                               LOGD("add ev %d to main loop", event_type);
-
-                                               g_idle_add_full(G_PRIORITY_DEFAULT,
-                                                                               (GSourceFunc)_player_event_job_function,
-                                                                               (gpointer)event_data,
-                                                                               NULL);
-                                       } else {
-                                               LOGW("there is no registered cb for ev:%d", event_type);
-                                               if (event_data->recv_data) {
-                                                       g_free(event_data->recv_data->buffer);
-                                                       g_free(event_data->recv_data);
-                                               }
-                                               g_free(event_data);
-                                       }
+                       if (_player_need_sync_context(event_type)) {
+                               if ((cb_info->user_cb[event_type] || (event_type == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED)) &&
+                                       _user_callbacks[event_type]) {
+                                       g_mutex_lock(&ev->idle_ev_mutex);
+                                       ev->idle_ev_list = g_list_append(ev->idle_ev_list, (gpointer)event_data);
+                                       g_mutex_unlock(&ev->idle_ev_mutex);
+
+                                       LOGD("add ev %d to main loop", event_type);
+
+                                       g_idle_add_full(G_PRIORITY_DEFAULT,
+                                                                       (GSourceFunc)_player_event_job_function,
+                                                                       (gpointer)event_data,
+                                                                       (GDestroyNotify)_destroy_event_data);
                                } else {
-                                       _player_event_job_function(event_data);
+                                       LOGW("there is no registered cb for ev:%d", event_type);
+                                       _destroy_event_data(event_data);
                                }
                        } else {
-                               break;
+                               _player_event_job_function(event_data);
+                               _destroy_event_data(event_data);
                        }
                }
        }
@@ -1512,54 +1506,19 @@ static void _player_remove_idle_event(callback_cb_info_s *cb_info, muse_player_e
                        continue;
                }
 
-               if (g_mutex_trylock(&event_data->event_mutex)) {
-
-                       gboolean ret = FALSE;
-                       if (remove_all || (event_data->int_data == event_type)) {
-                               GSource *source = NULL;
-                               gboolean check_in_call = FALSE;
-
-                               LOGD("remove idle event [%p:%d]", event_data, event_data->int_data);
-                               source = g_main_context_find_source_by_user_data (
-                                                       g_main_context_default (), event_data);
-                               ret = g_idle_remove_by_data(event_data);
-                               if (source)
-                                       check_in_call = source->flags & G_HOOK_FLAG_IN_CALL;
-
-                               if (!ret || check_in_call) {
-                                       /* will be handled at _player_event_job_function() as an exception */
-                                       event_data->cb_info = NULL;
-                                       LOGW("failed to remove, idle callback will be called later");
-                               }
+               if ((event_data->int_data != event_type) && !remove_all)
+                       continue;
 
-                               /* set cb to null */
-                               if (remove_all)
-                                       set_null_user_cb(cb_info, event_data->int_data);
+               LOGD("remove idle event [%p:%d]", event_data, event_data->int_data);
 
-                               ev->idle_ev_list = g_list_remove(ev->idle_ev_list, (gpointer)event_data);
+               /* set cb to null */
+               if (remove_all)
+                       set_null_user_cb(cb_info, event_data->int_data);
 
-                               g_mutex_unlock(&event_data->event_mutex);
+               ev->idle_ev_list = g_list_remove(ev->idle_ev_list, (gpointer)event_data);
 
-                               if (ret && !check_in_call) {
-                                       g_mutex_clear(&event_data->event_mutex);
-                                       if (event_data->recv_data) {
-                                               g_free(event_data->recv_data->buffer);
-                                               event_data->recv_data->buffer = NULL;
-                                               g_free(event_data->recv_data);
-                                               event_data->recv_data = NULL;
-                                       }
-                                       g_free(event_data);
-                                       event_data = NULL;
-                                       LOGD("remove idle event done");
-                               } /* else : will be handled if the cb is called. */
-                       } else {
-                               g_mutex_unlock(&event_data->event_mutex);
-                       }
-               } else {
-                       LOGW("event(%d) lock failed. it's being called...", event_data->int_data);
-               }
-
-               /* continue: keep checking next event_data */
+               if (!g_idle_remove_by_data(event_data))
+                       LOGW("failed to find source with %p", event_data);
        }
 
        if (remove_all) {
@@ -1653,7 +1612,6 @@ static bool _user_callback_handler(callback_cb_info_s *cb_info, muse_player_even
                        data->int_data = (int)event;
                        data->cb_info = cb_info;
                        data->recv_data = recv_data;
-                       g_mutex_init(&data->event_mutex);
                        _player_event_queue_add(&cb_info->event_queue, data);
 
                        return true;
@@ -1733,7 +1691,6 @@ static void _notify_disconnected(callback_cb_info_s *cb_info)
                data->int_data = (int)event;
                data->cb_info = cb_info;
                data->recv_data = NULL;
-               g_mutex_init(&data->event_mutex);
                _player_event_queue_add(&cb_info->event_queue, data);
        }
 }
@@ -1867,8 +1824,9 @@ static callback_cb_info_s *callback_new(gint sockfd)
 
        g_atomic_int_set(&cb_info->running, 1);
        cb_info->fd = sockfd;
-       cb_info->thread = g_thread_new("callback_thread", client_cb_handler, (gpointer) cb_info);
        cb_info->tfd = INVALID_DEFAULT_VALUE;
+       cb_info->data_fd = INVALID_DEFAULT_VALUE;
+       cb_info->thread = g_thread_new("callback_thread", client_cb_handler, (gpointer) cb_info);
 
        return cb_info;
 }
@@ -2024,9 +1982,8 @@ int player_create(player_h *player)
        muse_player_api_e api = MUSE_PLAYER_API_CREATE;
        int module_index = INVALID_DEFAULT_VALUE;
        player_cli_s *pc = NULL;
-       char *ret_buf = NULL;
+       gchar *ret_buf = NULL;
        int retry_count = CONNECTION_RETRY;
-       bool retry = false;
 
        PLAYER_INSTANCE_CHECK(player);
 
@@ -2036,19 +1993,19 @@ int player_create(player_h *player)
        if (pc == NULL)
                return PLAYER_ERROR_OUT_OF_MEMORY;
 
-       while (--retry_count) {
+       while (retry_count--) {
                ret = PLAYER_ERROR_NONE;
                sock_fd = muse_client_new();
                if (sock_fd <= INVALID_DEFAULT_VALUE) {
                        LOGE("connection failure %d", errno);
                        ret = PLAYER_ERROR_INVALID_OPERATION;
-                       retry = true;
                        usleep(CONNECTION_TIME_OUT * G_TIME_SPAN_MILLISECOND);
-                       goto ERROR;
+                       goto ERROR_RETRY;
                }
 
                if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
                        LOGE("muse client get module index failed");
+                       ret = PLAYER_ERROR_INVALID_OPERATION;
                        goto ERROR;
                }
 
@@ -2066,11 +2023,8 @@ int player_create(player_h *player)
                }
 
                ret = client_wait_for_server_ack(api, pc->cb_info, CREATE_CB_TIME_OUT);
-               if (ret == PLAYER_ERROR_INVALID_OPERATION) {
-                       retry = true;
-                       goto ERROR;
-               }
-               retry = false;
+               if (ret == PLAYER_ERROR_INVALID_OPERATION)
+                       goto ERROR_RETRY;
 
                if (!_player_event_queue_new(pc->cb_info)) {
                        LOGE("fail to create event queue");
@@ -2120,6 +2074,8 @@ int player_create(player_h *player)
                return ret;
 
 ERROR:
+               retry_count = 0;
+ERROR_RETRY:
                if (pc && pc->cb_info) {
                        if (pc->cb_info->event_queue.running)
                                _player_event_queue_destroy(pc->cb_info);
@@ -2129,11 +2085,10 @@ ERROR:
                        muse_client_close(sock_fd);
                }
                sock_fd = INVALID_DEFAULT_VALUE;
+
                g_free(ret_buf);
                ret_buf = NULL;
                LOGE("ret value : %d, retry #%d", ret, CONNECTION_RETRY - retry_count);
-               if (!retry)
-                       break;
        }
        g_free(pc);
        pc = NULL;
@@ -2313,7 +2268,6 @@ _PLAYER_UNPREPARE:
        _player_release_internal_memory(pc, false);
        pc->cb_info->video_frame_pool_size = 0;
        __player_remove_tsurf_list(pc);
-       pc->is_audio_only = FALSE;
 
        g_free(ret_buf);
 
@@ -3071,6 +3025,9 @@ int _player_convert_display_type(player_display_type_e type, mm_display_type_e *
        case PLAYER_DISPLAY_TYPE_OVERLAY:
                *out_type = MM_DISPLAY_TYPE_OVERLAY;
                break;
+       case PLAYER_DISPLAY_TYPE_OVERLAY_SYNC_UI:
+               *out_type = MM_DISPLAY_TYPE_OVERLAY_SYNC_UI;
+               break;
        case PLAYER_DISPLAY_TYPE_EVAS:
                *out_type = MM_DISPLAY_TYPE_EVAS;
                break;
@@ -3138,7 +3095,9 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                        return PLAYER_ERROR_INVALID_OPERATION;
                }
 
-               if (conv_type == MM_DISPLAY_TYPE_EVAS) {
+               if (conv_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+                       g_strlcpy(wl_win.exported_shell_handle, (char *)display, MAX_EXPORTED_SHELL_HANDLE_LEN);
+               } else if (conv_type == MM_DISPLAY_TYPE_EVAS) {
                        /* before evas handle is created, user could set display information */
                        player_display_mode_e mode = PLAYER_DISPLAY_MODE_LETTER_BOX;
                        player_display_rotation_e rotation = PLAYER_DISPLAY_ROTATION_NONE;
@@ -3212,6 +3171,11 @@ int player_set_display_mode(player_h player, player_display_mode_e mode)
 
        PLAYER_GET_DISPLAY_TYPE(pc, display_type);
 
+       if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+               LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+               return PLAYER_ERROR_NOT_AVAILABLE;
+       }
+
        if (display_type == MM_DISPLAY_TYPE_EVAS) {
                mm_ret = mm_display_interface_evas_set_mode(DP_INTERFACE(pc), mode);
                if (mm_ret != MM_ERROR_NONE) {
@@ -3234,12 +3198,20 @@ int player_get_display_mode(player_h player, player_display_mode_e *pmode)
        player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        int mode = -1;
+       mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
 
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(pmode);
 
        LOGD("ENTER");
 
+       PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+       if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+               LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+               return PLAYER_ERROR_NOT_AVAILABLE;
+       }
+
        PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {
@@ -3267,6 +3239,11 @@ int player_set_video_roi_area(player_h player, double x_scale, double y_scale,
 
        PLAYER_GET_DISPLAY_TYPE(pc, display_type);
 
+       if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+               LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+               return PLAYER_ERROR_NOT_AVAILABLE;
+       }
+
        if (display_type == MM_DISPLAY_TYPE_EVAS) {
                LOGE("Display type is EVAS, video display interface is not supported");
                return PLAYER_ERROR_INVALID_OPERATION;
@@ -3295,8 +3272,16 @@ int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale,
        player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        double scale_x = 0, scale_y = 0, scale_w = 0, scale_h = 0;
+       mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
 
        PLAYER_INSTANCE_CHECK(player);
+       PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+       if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+               LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+               return PLAYER_ERROR_NOT_AVAILABLE;
+       }
+
        PLAYER_NULL_ARG_CHECK(x_scale && y_scale && w_scale && h_scale);
 
        PLAYER_SEND_MSG(api, pc, ret_buf, ret);
@@ -3409,6 +3394,11 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat
 
        PLAYER_GET_DISPLAY_TYPE(pc, display_type);
 
+       if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+               LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+               return PLAYER_ERROR_NOT_AVAILABLE;
+       }
+
        if (display_type == MM_DISPLAY_TYPE_EVAS) {
                mm_ret = mm_display_interface_evas_set_rotation(DP_INTERFACE(pc), rotation);
                if (mm_ret != MM_ERROR_NONE) {
@@ -3431,8 +3421,16 @@ int player_get_display_rotation(player_h player, player_display_rotation_e *prot
        muse_player_api_e api = MUSE_PLAYER_API_GET_DISPLAY_ROTATION;
        char *ret_buf = NULL;
        int rotation = -1;
+       mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
 
        PLAYER_INSTANCE_CHECK(player);
+       PLAYER_GET_DISPLAY_TYPE(pc, display_type);
+
+       if (display_type == MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
+               LOGE("Function is not available in MM_DISPLAY_TYPE_OVERLAY_SYNC_UI type");
+               return PLAYER_ERROR_NOT_AVAILABLE;
+       }
+
        PLAYER_NULL_ARG_CHECK(protation);
 
        LOGD("ENTER");
@@ -4867,7 +4865,6 @@ int player_set_audio_only(player_h player, bool audio_only)
        muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_ONLY;
        char *ret_buf = NULL;
        player_state_e state = PLAYER_STATE_NONE;
-       mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
 
        PLAYER_INSTANCE_CHECK(player);
 
@@ -4884,12 +4881,6 @@ int player_set_audio_only(player_h player, bool audio_only)
                return PLAYER_ERROR_INVALID_STATE;
        }
 
-       if (mm_display_interface_get_type(DP_INTERFACE(pc), &display_type) == MM_ERROR_NONE &&
-               display_type == MM_DISPLAY_TYPE_EVAS) {
-               pc->is_audio_only = (gboolean)audio_only;
-               return PLAYER_ERROR_NONE;
-       }
-
        PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "audio_only", (int)audio_only);
 
        g_free(ret_buf);
@@ -4906,19 +4897,12 @@ int player_is_audio_only(player_h player, bool *paudio_only)
        player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        int audio_only = 0;
-       mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE;
 
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(paudio_only);
 
        LOGD("ENTER");
 
-       if (mm_display_interface_get_type(DP_INTERFACE(pc), &display_type) == MM_ERROR_NONE &&
-               display_type == MM_DISPLAY_TYPE_EVAS) {
-               *paudio_only = (bool)pc->is_audio_only;
-               return PLAYER_ERROR_NONE;
-       }
-
        PLAYER_SEND_MSG(api, pc, ret_buf, ret);
 
        if (ret == PLAYER_ERROR_NONE) {