Confiburable : blocking UI function code for Headless by dlopen 77/140177/7
authorHyunil <hyunil46.park@samsung.com>
Mon, 24 Jul 2017 05:38:36 +0000 (14:38 +0900)
committereunhae choi <eunhae1.choi@samsung.com>
Tue, 1 Aug 2017 09:43:26 +0000 (09:43 +0000)
Change-Id: Ie6934612ae4caa887032aa8286d8324ff3195e49
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
include/player_private.h
src/player.c

index 04602f6..971b337 100644 (file)
@@ -121,6 +121,7 @@ typedef struct {
        int roi_y;
        int roi_w;
        int roi_h;
+       gboolean support_video;
 } player_evas_info_s;
 #endif
 typedef struct _callback_cb_info {
@@ -162,6 +163,7 @@ typedef struct _player_cli_s {
        Evas_Object *eo;
        gboolean have_evas_callback;
        gboolean push_media_stream;
+       gboolean support_video;
 } player_cli_s;
 
 /* player callback information */
index f236c02..dc4a851 100644 (file)
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
 #include <mm_evas_renderer.h>
 #endif
+#include <dlfcn.h>
 
 #define INVALID_DEFAULT_VALUE -1
 #define MAX_S_PATH_LEN 32
 
+#define PLAYER_VIDEO_SUPPORT_CHECK()   \
+do {   \
+       void *handle;   \
+       handle = dlopen("libmmfevasrenderer.so.01", RTLD_LAZY); \
+       if (!handle)    \
+               return PLAYER_ERROR_INVALID_OPERATION;  \
+       else    \
+               dlclose(handle);        \
+} while (0)
+
 typedef enum {
        TIZEN_PROFILE_UNKNOWN = 0,
        TIZEN_PROFILE_MOBILE = 0x1,
@@ -573,12 +584,15 @@ static void __seek_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *r
        g_mutex_lock(&cb_info->seek_cb_mutex);
        if (cb_info->user_cb[ev] && cb_info->seek_cb_state == PLAYER_SEEK_CB_STATE_NONE) {
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
-               if (cb_info->evas_info && cb_info->evas_info->handle && cb_info->evas_info->visible != EVAS_VISIBLE_FALSE) {
-                       int ret = mm_evas_renderer_set_visible(cb_info->evas_info->handle, true);
-                       if (ret != MM_ERROR_NONE)
-                               LOGW("failed to set visible at evas 0x%x", ret);
-                       else
-                               cb_info->evas_info->visible = EVAS_VISIBLE_TRUE;
+
+               if (cb_info->evas_info && cb_info->evas_info->support_video) {
+                       if (cb_info->evas_info->handle && cb_info->evas_info->visible != EVAS_VISIBLE_FALSE) {
+                               int ret = mm_evas_renderer_set_visible(cb_info->evas_info->handle, true);
+                               if (ret != MM_ERROR_NONE)
+                                       LOGW("failed to set visible at evas 0x%x", ret);
+                               else
+                                       cb_info->evas_info->visible = EVAS_VISIBLE_TRUE;
+                       }
                }
 #endif
                LOGD("call seek cb");
@@ -1780,6 +1794,8 @@ int player_create(player_h * player)
 #endif
                pc->cb_info->bufmgr = tbm_bufmgr_init(-1);
                pc->push_media_stream = FALSE;
+               pc->support_video = FALSE;
+               EVAS_INFO(pc)->support_video = FALSE;
 
                g_free(ret_buf);
                return ret;
@@ -1820,12 +1836,14 @@ int player_destroy(player_h player)
 
        player_msg_send(api, pc, ret_buf, ret);
 #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)
-                       LOGW("fail to unset evas client");
-               __player_unset_retrieve_buffer_cb(player);
-               g_free(pc->cb_info->evas_info);
+       if (CALLBACK_INFO(pc) && EVAS_INFO(pc)->support_video) {
+               if (EVAS_HANDLE(pc)) {
+                       player_unset_media_packet_video_frame_decoded_cb(player);
+                       if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
+                               LOGW("fail to unset evas client");
+                       __player_unset_retrieve_buffer_cb(player);
+                       g_free(pc->cb_info->evas_info);
+               }
        }
 #endif
 
@@ -2251,14 +2269,16 @@ int player_start(player_h player)
 
        LOGD("ENTER");
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
-       if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc) && EVAS_INFO(pc)->visible == EVAS_VISIBLE_NONE) {
-               ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), true);
-               if (ret != MM_ERROR_NONE) {
-                       LOGE("mm_evas_renderer_set_visible err 0x%x", ret);
-                       return PLAYER_ERROR_INVALID_OPERATION;
+       if (CALLBACK_INFO(pc) && EVAS_INFO(pc)->support_video) {
+               if (EVAS_HANDLE(pc) && EVAS_INFO(pc)->visible == EVAS_VISIBLE_NONE) {
+                       ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), true);
+                       if (ret != MM_ERROR_NONE) {
+                               LOGE("mm_evas_renderer_set_visible err 0x%x", ret);
+                               return PLAYER_ERROR_INVALID_OPERATION;
+                       }
+                       /* avoid setting true at all times, when player is resumed */
+                       EVAS_INFO(pc)->visible = EVAS_VISIBLE_TRUE;
                }
-               /* avoid setting true at all times, when player is resumed */
-               EVAS_INFO(pc)->visible = EVAS_VISIBLE_TRUE;
        }
 #endif
 
@@ -2284,13 +2304,15 @@ int player_stop(player_h player)
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (ret != PLAYER_ERROR_INVALID_STATE) {
-               if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc) && (EVAS_INFO(pc)->visible == EVAS_VISIBLE_TRUE)) {
-                       ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), false);
-                       if (ret != MM_ERROR_NONE) {
-                               LOGE("mm_evas_renderer_set_visible err 0x%x", ret);
-                               return PLAYER_ERROR_INVALID_OPERATION;
+               if (CALLBACK_INFO(pc) && EVAS_INFO(pc)->support_video) {
+                       if (EVAS_HANDLE(pc) && (EVAS_INFO(pc)->visible == EVAS_VISIBLE_TRUE)) {
+                               ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), false);
+                               if (ret != MM_ERROR_NONE) {
+                                       LOGE("mm_evas_renderer_set_visible err 0x%x", ret);
+                                       return PLAYER_ERROR_INVALID_OPERATION;
+                               }
+                               /* do not update EVAS_INFO(pc)->visible to set visible true if start again */
                        }
-                       /* do not update EVAS_INFO(pc)->visible to set visible true if start again */
                }
        }
 #endif
@@ -2529,6 +2551,7 @@ int _player_convert_display_type(player_display_type_e type, player_private_disp
 int player_set_display(player_h player, player_display_type_e type, player_display_h display)
 {
        PLAYER_INSTANCE_CHECK(player);
+       PLAYER_VIDEO_SUPPORT_CHECK();
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY;
        player_cli_s *pc = (player_cli_s *) player;
@@ -2544,6 +2567,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
        Evas *e;
        player_private_display_type_e conv_type;
        player_state_e state = PLAYER_STATE_NONE;
+       pc->support_video = TRUE;
 
        /* init */
        wl_win.wl_window_x = 0;
@@ -2685,6 +2709,8 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                                        LOGW("fail to set decoded callback");
                                if (__player_set_retrieve_buffer_cb(player, __retrieve_buffer_cb, pc))
                                        LOGW("fail to set __retrieve_buffer_cb");
+
+                               EVAS_INFO(pc)->support_video = TRUE;
                        }
 #endif
                        else
@@ -2711,6 +2737,7 @@ int player_set_display_mode(player_h player, player_display_mode_e mode)
        char *ret_buf = NULL;
 
        LOGD("ENTER");
+       if (!pc->support_video) return PLAYER_ERROR_INVALID_OPERATION;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_set_geometry(EVAS_HANDLE(pc), mode);
@@ -2739,6 +2766,7 @@ int player_get_display_mode(player_h player, player_display_mode_e * pmode)
        int mode = -1;
 
        LOGD("ENTER");
+       if (!pc->support_video) return PLAYER_ERROR_INVALID_OPERATION;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_get_geometry(EVAS_HANDLE(pc), &mode);
@@ -2773,7 +2801,7 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he
        char *wl_win_msg = (char *)&wl_win;
 
        LOGD("ENTER");
-
+       if (!pc->support_video) return PLAYER_ERROR_INVALID_OPERATION;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_set_roi_area(EVAS_HANDLE(pc), x, y, width, height);
@@ -2826,6 +2854,7 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat
        char *ret_buf = NULL;
 
        LOGD("ENTER");
+       if (!pc->support_video) return PLAYER_ERROR_INVALID_OPERATION;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_set_rotation(EVAS_HANDLE(pc), rotation);
@@ -2854,6 +2883,7 @@ int player_get_display_rotation(player_h player, player_display_rotation_e * pro
        int rotation = -1;
 
        LOGD("ENTER");
+       if (!pc->support_video) return PLAYER_ERROR_INVALID_OPERATION;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_get_rotation(EVAS_HANDLE(pc), &rotation);
@@ -2883,6 +2913,7 @@ int player_set_display_visible(player_h player, bool visible)
        char *ret_buf = NULL;
 
        LOGD("ENTER");
+       if (!pc->support_video) return PLAYER_ERROR_INVALID_OPERATION;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), visible);
@@ -2915,6 +2946,7 @@ int player_is_display_visible(player_h player, bool * pvisible)
        bool visible = 0;
 #endif
        LOGD("ENTER");
+       if (!pc->support_video) return PLAYER_ERROR_INVALID_OPERATION;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
                ret = mm_evas_renderer_get_visible(EVAS_HANDLE(pc), &visible);