Merge "Add checking invalid wl_surface_id" into tizen
[platform/core/api/player.git] / src / player.c
old mode 100755 (executable)
new mode 100644 (file)
index 73a9412..10da14d
@@ -40,7 +40,7 @@
 #include "player_private.h"
 #include "player_display.h"
 #include "player_msg.h"
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
 #include <mm_evas_renderer.h>
 #endif
 #define INVALID_SOCKET -1
@@ -448,9 +448,8 @@ static void __subtitle_cb_handler(callback_cb_info_s * cb_info, char *recvMsg)
        bool ret = TRUE;
 
        player_msg_get1_string(recvMsg, duration, INT, text, ret);
-       if (ret) {
+       if (ret)
                ((player_subtitle_updated_cb) cb_info->user_cb[ev]) (duration, text, cb_info->user_data[ev]);
-       }
 }
 
 static void __capture_cb_handler(callback_cb_info_s * cb_info, char *recvMsg)
@@ -642,9 +641,8 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s * cb_info,
                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]);
-               if (cb_info->video_frame_pool_size < g_list_length(cb_info->tsurf_list)) {
+               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);
        } else {
                if (tsurf_data->tsurf) {
@@ -1406,7 +1404,7 @@ int player_destroy(player_h player)
        LOGD("ENTER");
 
        player_msg_send(api, pc, ret_buf, ret);
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc)) {
                player_unset_media_packet_video_frame_decoded_cb(player);
                if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
@@ -1505,7 +1503,7 @@ int player_unprepare(player_h player)
 
        if (!CALLBACK_INFO(pc))
                return PLAYER_ERROR_INVALID_STATE;
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                player_unset_media_packet_video_frame_decoded_cb(player);
                if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
@@ -1788,7 +1786,7 @@ int player_start(player_h player)
        char *ret_buf = NULL;
 
        LOGD("ENTER");
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_update_param(EVAS_HANDLE(pc));
                if (ret != PLAYER_ERROR_NONE)
@@ -1857,9 +1855,8 @@ int player_set_play_position(player_h player, int millisecond, bool accurate, pl
                return PLAYER_ERROR_SEEK_FAILED;
        } else {
                g_mutex_lock(&pc->cb_info->seek_cb_mutex);
-               if (pc->push_media_stream == TRUE) {
+               if (pc->push_media_stream == TRUE)
                        pc->cb_info->block_seek_cb = TRUE;
-               }
                LOGI("Event type : %d, pos : %d ", MUSE_PLAYER_EVENT_TYPE_SEEK, millisecond);
                pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = callback;
                pc->cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = user_data;
@@ -1874,9 +1871,8 @@ int player_set_play_position(player_h player, int millisecond, bool accurate, pl
                g_mutex_unlock(&pc->cb_info->seek_cb_mutex);
        }
 
-       if (pc->push_media_stream == TRUE) {
+       if (pc->push_media_stream == TRUE)
                _player_event_queue_remove(&pc->cb_info->event_queue, MUSE_PLAYER_EVENT_TYPE_SEEK);
-       }
 
        pc->cb_info->block_seek_cb = FALSE;
        g_free(ret_buf);
@@ -2043,9 +2039,8 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                                        LOGE("Fail to get window geometry");
                                        return ret;
                                }
-                               if (_wl_window_evas_object_cb_add(player, obj) != MM_ERROR_NONE) {
+                               if (_wl_window_evas_object_cb_add(player, obj) != MM_ERROR_NONE)
                                        LOGW("fail to set evas object callback");
-                               }
 
                                wl_window = elm_win_wl_window_get(obj);
                                return_val_if_fail(wl_window != NULL, PLAYER_ERROR_INVALID_OPERATION);
@@ -2077,7 +2072,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                                wl_win.wl_surface_id = wl_surface_id;
 
                        }
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
                        else if (type == PLAYER_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
                                /* evas object surface */
                                LOGI("evas surface type");
@@ -2091,12 +2086,11 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                                        if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
                                                LOGW("fail to unset evas client");
                                }
-                               if (mm_evas_renderer_create(&EVAS_HANDLE(pc), obj) != MM_ERROR_NONE) {
+                               if (mm_evas_renderer_create(&EVAS_HANDLE(pc), obj) != MM_ERROR_NONE)
                                        LOGW("fail to set evas client");
-                               }
-                               if (player_set_media_packet_video_frame_decoded_cb(player, mm_evas_renderer_write, (void *)EVAS_HANDLE(pc)) != PLAYER_ERROR_NONE) {
+
+                               if (player_set_media_packet_video_frame_decoded_cb(player, mm_evas_renderer_write, (void *)EVAS_HANDLE(pc)) != PLAYER_ERROR_NONE)
                                        LOGW("fail to set decoded callback");
-                               }
                        }
 #endif
                        else
@@ -2126,7 +2120,7 @@ int player_set_display_mode(player_h player, player_display_mode_e mode)
        char *ret_buf = NULL;
 
        LOGD("ENTER");
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_set_geometry(EVAS_HANDLE(pc), mode);
                return ret;
@@ -2148,7 +2142,7 @@ int player_get_display_mode(player_h player, player_display_mode_e * pmode)
        int mode = -1;
 
        LOGD("ENTER");
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_get_geometry(EVAS_HANDLE(pc), &mode);
                *pmode = (player_display_mode_e) mode;
@@ -2190,7 +2184,7 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat
        char *ret_buf = NULL;
 
        LOGD("ENTER");
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_set_rotation(EVAS_HANDLE(pc), rotation);
                return ret;
@@ -2212,7 +2206,7 @@ int player_get_display_rotation(player_h player, player_display_rotation_e * pro
        int rotation = -1;
 
        LOGD("ENTER");
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_get_rotation(EVAS_HANDLE(pc), &rotation);
                *protation = (player_display_rotation_e) rotation;
@@ -2238,7 +2232,7 @@ int player_set_display_visible(player_h player, bool visible)
        char *ret_buf = NULL;
 
        LOGD("ENTER");
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), visible);
                return ret;
@@ -2258,11 +2252,11 @@ int player_is_display_visible(player_h player, bool * pvisible)
        muse_player_api_e api = MUSE_PLAYER_API_IS_DISPLAY_VISIBLE;
        char *ret_buf = NULL;
        int value = -1;
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        bool visible = 0;
 #endif
        LOGD("ENTER");
-#ifdef EVAS_RENDERER_SUPPORT
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_get_visible(EVAS_HANDLE(pc), &visible);
                if (visible)