[0.3.76] Create display interface library for dlopen and packaging it 05/151605/6 submit/tizen_4.0/20170922.022806
authorHyunil <hyunil46.park@samsung.com>
Thu, 21 Sep 2017 08:41:30 +0000 (17:41 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Thu, 21 Sep 2017 11:41:27 +0000 (11:41 +0000)
Change-Id: I3cfff93572c384bec107309ae51d9ff687f3bfa7
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
13 files changed:
CMakeLists.txt
disp/CMakeLists.txt [new file with mode: 0644]
disp/player_display.c [new file with mode: 0644]
disp/player_display.h [new file with mode: 0644]
include/player_display.h [deleted file]
include/player_internal.h
include/player_private.h
packaging/capi-media-player.spec
src/player.c
src/player_display.c [deleted file]
src/player_internal.c
test/player_audio_test.c
test/player_test.c

index 31febd1..211090a 100644 (file)
@@ -10,12 +10,8 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 
 INCLUDE_DIRECTORIES(${INC_DIR})
-IF (TIZEN_FEATURE_EVAS_RENDERER)
-SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common muse-client mm-common tizen-extension-client evas ecore elementary mm-evas-renderer storage capi-system-info")
-ELSE (TIZEN_FEATURE_EVAS_RENDERER)
-SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common muse-client mm-common tizen-extension-client evas ecore elementary storage capi-system-info")
-ENDIF (TIZEN_FEATURE_EVAS_RENDERER)
-SET(pc_dependents "libtbm capi-media-tool capi-base-common capi-media-sound-manager ecore-wayland")
+SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common muse-client mm-common storage capi-system-info")
+SET(pc_dependents "libtbm capi-media-tool capi-base-common capi-media-sound-manager")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(${fw_name} REQUIRED ${dependents})
@@ -77,6 +73,7 @@ CONFIGURE_FILE(
 )
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
+ADD_SUBDIRECTORY(disp)
 ADD_SUBDIRECTORY(test)
 
 IF(UNIX)
diff --git a/disp/CMakeLists.txt b/disp/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3e1fbec
--- /dev/null
@@ -0,0 +1,48 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_disp "${fw_name}-display")
+SET(INC_DIR ./)
+INCLUDE_DIRECTORIES(INC_DIR)
+
+IF (TIZEN_FEATURE_EVAS_RENDERER)
+SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-base-common muse-client mm-common tizen-extension-client evas ecore elementary mm-evas-renderer storage capi-system-info")
+ELSE (TIZEN_FEATURE_EVAS_RENDERER)
+SET(dependents "dlog glib-2.0 libtbm capi-media-tool capi-base-common muse-client mm-common tizen-extension-client evas ecore elementary storage capi-system-info")
+ENDIF (TIZEN_FEATURE_EVAS_RENDERER)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_disp} REQUIRED ${dependents})
+FOREACH(flag ${${fw_disp}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "-I./${INC_DIR} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -Wno-deprecated -Wno-deprecated-declarations")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+IF (TIZEN_FEATURE_EVAS_RENDERER)
+ ADD_DEFINITIONS("-DTIZEN_FEATURE_EVAS_RENDERER")
+ENDIF(TIZEN_FEATURE_EVAS_RENDERER)
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+
+aux_source_directory(. sources)
+ADD_LIBRARY(${fw_disp} SHARED ${sources})
+
+TARGET_LINK_LIBRARIES(${fw_disp} ${${fw_disp}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_disp}
+     PROPERTIES
+     CLEAN_DIRECT_OUTPUT 1
+)
+INSTALL(TARGETS ${fw_disp} DESTINATION ${LIB_INSTALL_DIR})
+
+
+
+
+
diff --git a/disp/player_display.c b/disp/player_display.c
new file mode 100644 (file)
index 0000000..70ccbbb
--- /dev/null
@@ -0,0 +1,392 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <glib.h>
+#include <string.h>
+#include <dlog.h>
+#include <mm_error.h>
+#include <mm_types.h>
+#include <mm_debug.h>
+#include <media_packet.h>
+#include <Elementary.h>
+#include <Evas.h>
+#include <Ecore_Evas.h>
+#include <Ecore_Wayland.h>
+#include <tizen-extension-client-protocol.h>
+#include "player_display.h"
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+#include <mm_evas_renderer.h>
+#endif
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_PLAYER"
+
+typedef enum {
+       ELM_WAYLAND_WIN = 1,
+       ECORE_WAYLAND_WIN
+} wl_window_type;
+
+typedef enum {
+       DISP_EVAS_VISIBLE_NONE,                 /* if user dont set visibility, it will be changed to true */
+       DISP_EVAS_VISIBLE_TRUE,
+       DISP_EVAS_VISIBLE_FALSE
+} evas_visible_info_e;
+
+typedef struct {
+       struct wl_display *display;
+       struct wl_registry *registry;
+       struct tizen_surface *tz_surface;
+       struct tizen_resource *tz_resource;
+} wl_client;
+
+static int _wl_client_create(wl_client ** wlclient);
+static int _wl_client_get_wl_window_wl_surface_id(wl_client * wlclient, struct wl_surface *surface, struct wl_display *display);
+static void _wl_client_finalize(wl_client * wlclient);
+
+
+/*elm wayland window use display and ecore wayland window use ecore_win */
+unsigned int disp_set_wl_display(int wl_win_type, void *win)
+{
+       Evas_Object *obj = NULL;
+       const char *object_type = NULL;
+       struct wl_surface *wl_surface;
+       struct wl_display *wl_display;
+       Ecore_Wl_Window *wl_window = NULL;
+       unsigned int wl_surface_id = 0;
+       Evas *e;
+       wl_client *wlclient;
+       int ret = FALSE;
+
+       /* get wl_window */
+       if (wl_win_type == ELM_WAYLAND_WIN) {
+               /* elm win */
+               obj = (Evas_Object *) win;
+               object_type = evas_object_type_get(obj);
+               return_val_if_fail(object_type != NULL, FALSE);
+
+               if (!strcmp(object_type, "elm_win")) {
+                       e = evas_object_evas_get(obj);
+                       return_val_if_fail(e != NULL, FALSE);
+
+                       wl_window = elm_win_wl_window_get(obj);
+                       return_val_if_fail(wl_window != NULL, FALSE);
+                       LOGI("ELM Wayland overlay surface type");
+
+               } else return FALSE;
+       } else if (wl_win_type == ECORE_WAYLAND_WIN) {
+               /* ecore win */
+               wl_window = (Ecore_Wl_Window *) win;
+               LOGD("Ecore Wayland Window handle(%p)", wl_window);
+               LOGI("ECORE Wayland overlay surface type");
+       } else return FALSE;
+
+
+       /* Need to let wayland-server know that video is rendered in this wl_window
+        so that wayland-server sets alpha in this wl_window */
+       ecore_wl_window_video_has(wl_window, EINA_TRUE);
+
+       /* get wl_surface */
+       wl_surface = (struct wl_surface *)ecore_wl_window_surface_get(wl_window);
+       return_val_if_fail(wl_surface != NULL, FALSE);
+
+       /* get wl_display */
+       wl_display = (struct wl_display *)ecore_wl_display_get();
+       return_val_if_fail(wl_display != NULL, FALSE);
+       LOGD("surface = %p, wl_display = %p", wl_surface, wl_display);
+
+       ret = _wl_client_create(&wlclient);
+       if (ret != MM_ERROR_NONE) {
+               LOGE("Wayland client create failure");
+               return ret;
+       }
+
+       /* get wl_surface_id */
+       wl_surface_id = _wl_client_get_wl_window_wl_surface_id(wlclient, wl_surface, wl_display);
+       LOGD("wl_surface_id = %d", wl_surface_id);
+       /* need to free always */
+       if (wlclient) {
+               g_free(wlclient);
+               wlclient = NULL;
+       }
+       return_val_if_fail(wl_surface_id > 0, FALSE);
+
+       return wl_surface_id;
+}
+
+void disp_get_evas_display_geometry_info(void *display, int *x, int *y, int *width, int *height)
+{
+       Evas_Object *obj = NULL;
+       return_if_fail(display != NULL)
+       int e_x = 0, e_y = 0, e_w = 0, e_h = 0;
+       obj = (Evas_Object *) display;
+       evas_object_geometry_get(obj, &e_x, &e_y, &e_w, &e_h);
+       *x = e_x;
+       *y = e_y;
+       *width = e_w;
+       *height = e_h;
+}
+
+int disp_evas_display_retrieve_all_packets(MMHandleType evas_handle, bool keep_screen)
+{
+       int ret = MM_ERROR_NONE;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       ret = mm_evas_renderer_retrieve_all_packets(evas_handle, keep_screen);
+       return ret;
+}
+
+
+int disp_get_evas_display_rotation(MMHandleType evas_handle, int *p_rotate)
+{
+       int ret = MM_ERROR_NONE;
+       int rotate = -1;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       ret = mm_evas_renderer_get_rotation(evas_handle, &rotate);
+       *p_rotate = rotate;
+       return ret;
+}
+
+int disp_set_evas_display_rotation(MMHandleType evas_handle, int rotate)
+{
+       int ret = MM_ERROR_NONE;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       ret = mm_evas_renderer_set_rotation(evas_handle, rotate);
+       return ret;
+}
+
+int disp_get_evas_display_disp_mode(MMHandleType evas_handle, int *p_mode)
+{
+       int ret = MM_ERROR_NONE;
+       int mode = -1;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       ret = mm_evas_renderer_get_geometry(evas_handle, &mode);
+       *p_mode = mode;
+
+       return ret;
+}
+
+int disp_set_evas_display_disp_mode(MMHandleType evas_handle, int mode)
+{
+       int ret = MM_ERROR_NONE;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       ret = mm_evas_renderer_set_geometry(evas_handle, mode);
+       return ret;
+}
+
+int disp_get_evas_display_visible(MMHandleType evas_handle, bool *p_visible)
+{
+       int ret = MM_ERROR_NONE;
+       bool visible = -1;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       ret = mm_evas_renderer_get_visible(evas_handle, &visible);
+       *p_visible = visible;
+       return ret;
+
+}
+
+int disp_set_evas_display_visible(MMHandleType evas_handle, bool visible)
+{
+       int ret = MM_ERROR_NONE;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       ret = mm_evas_renderer_set_visible(evas_handle, visible);
+       return ret;
+}
+
+
+int disp_set_evas_display_roi_area(MMHandleType evas_handle, int x, int y, int width, int height)
+{
+       int ret = MM_ERROR_NONE;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       LOGW("set roi (%d, %d) %d*%d", x, y, width, height);
+       ret = mm_evas_renderer_set_roi_area(evas_handle, x, y, width, height);
+       return ret;
+}
+
+int disp_set_evas_display_old_info(void *display, void *evas_handle, int mode, int rotation, int visible)
+{
+       int ret = MM_ERROR_NONE;
+       return_val_if_fail(display != NULL, MM_ERROR_INVALID_ARGUMENT);
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       LOGW("set evas information mode %d, rotation %d, visible %d", mode, rotation, visible);
+
+       ret = mm_evas_renderer_set_geometry(evas_handle, mode);
+       ret |= mm_evas_renderer_set_rotation(evas_handle, mode);
+
+       /* if user didn't set visible, it will be set to true in player_start */
+       if (visible != DISP_EVAS_VISIBLE_NONE)
+               ret |= mm_evas_renderer_set_visible(evas_handle, (visible == DISP_EVAS_VISIBLE_TRUE) ? true : false);
+       return ret;
+}
+int disp_destroty_evas_display(MMHandleType *evas_handle)
+{
+       int ret = MM_ERROR_NONE;
+       return_val_if_fail(evas_handle != NULL, MM_ERROR_INVALID_HANDLE);
+
+       /* need to set display information again to new handle */
+       ret = mm_evas_renderer_destroy(evas_handle);
+       return ret;
+}
+int disp_create_evas_display(void *display, MMHandleType *evas_handle)
+{
+       int ret = MM_ERROR_NONE;
+       Evas_Object *obj = NULL;
+       const char *object_type = NULL;
+       return_val_if_fail(display != NULL, MM_ERROR_INVALID_ARGUMENT);
+
+       obj = (Evas_Object *) display;
+       return_val_if_fail(obj != NULL, MM_ERROR_INVALID_ARGUMENT);
+
+       object_type = evas_object_type_get(obj);
+       return_val_if_fail(object_type != NULL, MM_ERROR_INVALID_ARGUMENT);
+
+       if (!strcmp(object_type, "image")) {
+               LOGI("evas surface type");
+               ret = mm_evas_renderer_create(evas_handle, obj);
+       } else
+               return MM_ERROR_UNKNOWN;
+
+       return ret;
+}
+
+void disp_media_packet_video_decode_cb(media_packet_h packet, void *evas_handle)
+{
+       return_if_fail(packet != NULL);
+       return_if_fail(evas_handle != NULL);
+       mm_evas_renderer_write(packet, evas_handle);
+}
+
+#define goto_if_fail(expr, label)      \
+{      \
+       if (!(expr)) {  \
+               debug_error(" failed [%s]\n", #expr);   \
+               goto label;     \
+       }       \
+}
+
+static void handle_resource_id(void *data, struct tizen_resource *tizen_resource, uint32_t id)
+{
+       unsigned int *wl_surface_id = data;
+
+       *wl_surface_id = id;
+
+       LOGD("[CLIENT] got wl_surface_id(%d) from server\n", id);
+}
+
+static const struct tizen_resource_listener tz_resource_listener = {
+       handle_resource_id,
+};
+
+static void handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
+{
+       return_if_fail(data != NULL);
+       wl_client *wlclient = data;
+
+       if (strcmp(interface, "tizen_surface") == 0) {
+               LOGD("binding tizen_surface");
+               wlclient->tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
+               return_if_fail(wlclient->tz_surface != NULL);
+       }
+}
+
+static const struct wl_registry_listener registry_listener = {
+       handle_global,
+};
+
+static int _wl_client_create(wl_client ** wlclient)
+{
+       wl_client *ptr = NULL;
+
+       ptr = g_malloc0(sizeof(wl_client));
+       if (!ptr) {
+               LOGE("Cannot allocate memory for wlclient\n");
+               goto ERROR;
+       } else {
+               *wlclient = ptr;
+               LOGD("Success create wlclient(%p)", *wlclient);
+       }
+       return MM_ERROR_NONE;
+
+ ERROR:
+       *wlclient = NULL;
+       return MM_ERROR_PLAYER_NO_FREE_SPACE;
+}
+
+static int _wl_client_get_wl_window_wl_surface_id(wl_client * wlclient, struct wl_surface *surface, struct wl_display *display)
+{
+       goto_if_fail(wlclient != NULL, failed);
+       goto_if_fail(surface != NULL, failed);
+       goto_if_fail(display != NULL, failed);
+
+       unsigned int wl_surface_id = 0;
+
+       wlclient->display = display;
+       goto_if_fail(wlclient->display != NULL, failed);
+
+       wlclient->registry = wl_display_get_registry(wlclient->display);
+       goto_if_fail(wlclient->registry != NULL, failed);
+
+       wl_registry_add_listener(wlclient->registry, &registry_listener, wlclient);
+       wl_display_dispatch(wlclient->display);
+       wl_display_roundtrip(wlclient->display);
+
+       /* check global objects */
+       goto_if_fail(wlclient->tz_surface != NULL, failed);
+
+       /* Get wl_surface_id which is unique in a entire systemw. */
+       wlclient->tz_resource = tizen_surface_get_tizen_resource(wlclient->tz_surface, surface);
+       goto_if_fail(wlclient->tz_resource != NULL, failed);
+
+       tizen_resource_add_listener(wlclient->tz_resource, &tz_resource_listener, &wl_surface_id);
+       wl_display_roundtrip(wlclient->display);
+       goto_if_fail(wl_surface_id > 0, failed);
+
+       _wl_client_finalize(wlclient);
+
+       return wl_surface_id;
+
+ failed:
+       LOGE("Failed to get wl_surface_id");
+
+       return 0;
+}
+
+static void _wl_client_finalize(wl_client * wlclient)
+{
+       LOGD("start finalize wlclient");
+       return_if_fail(wlclient != NULL)
+
+       if (wlclient->tz_surface)
+               tizen_surface_destroy(wlclient->tz_surface);
+
+       if (wlclient->tz_resource)
+               tizen_resource_destroy(wlclient->tz_resource);
+
+       /* destroy registry */
+       if (wlclient->registry)
+               wl_registry_destroy(wlclient->registry);
+
+       return;
+}
diff --git a/disp/player_display.h b/disp/player_display.h
new file mode 100644 (file)
index 0000000..574399c
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TIZEN_MEDIA_PLAYER_WLCLIENT_H__
+#define __TIZEN_MEDIA_PLAYER_WLCLIENT_H__
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+unsigned int disp_set_wl_display(int wl_win_type, void *win);
+void disp_get_evas_display_geometry_info(void *display, int *x, int *y, int *width, int *height);
+int disp_evas_display_retrieve_all_packets(MMHandleType evas_handle, bool keep_screen);
+int disp_get_evas_display_rotation(MMHandleType evas_handle, int *p_rotate);
+int disp_set_evas_display_rotation(MMHandleType evas_handle, int rotate);
+int disp_get_evas_display_disp_mode(MMHandleType evas_handle, int *p_mode);
+int disp_set_evas_display_disp_mode(MMHandleType evas_handle, int mode);
+int disp_get_evas_display_visible(MMHandleType evas_handle, bool *p_visible);
+int disp_set_evas_display_visible(MMHandleType evas_handle, bool visible);
+int disp_set_evas_display_roi_area(MMHandleType evas_handle, int x, int y, int width, int height);
+int disp_set_evas_display_old_info(void *display, void *evas_handle, int mode, int rotation, int visible);
+int disp_destroty_evas_display(MMHandleType *evas_handle);
+int disp_create_evas_display(void *display, MMHandleType *evas_handle);
+void disp_media_packet_video_decode_cb(media_packet_h packet, void *evas_handle);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __TIZEN_MEDIA_PLAYER_WLCLIENT_H__ */
diff --git a/include/player_display.h b/include/player_display.h
deleted file mode 100644 (file)
index 8cc546c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef __TIZEN_MEDIA_PLAYER_WLCLIENT_H__
-#define __TIZEN_MEDIA_PLAYER_WLCLIENT_H__
-#include <stdio.h>
-#include <tbm_bufmgr.h>
-#include <tizen-extension-client-protocol.h>
-#include <wayland-client.h>
-#include <mm_types.h>
-#include <mm_debug.h>
-#include "player.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
-       struct wl_display *display;
-       struct wl_registry *registry;
-       struct tizen_surface *tz_surface;
-       struct tizen_resource *tz_resource;
-} wl_client;
-
-int _wl_client_create(wl_client ** wlclient);
-int _wl_client_get_wl_window_wl_surface_id(wl_client * wlclient, struct wl_surface *surface, struct wl_display *display);
-void _wl_client_finalize(wl_client * wlclient);
-#ifdef __cplusplus
-}
-#endif
-#endif /* __TIZEN_MEDIA_PLAYER_WLCLIENT_H__ */
index 975989d..51a6d93 100644 (file)
@@ -18,7 +18,6 @@
 #define        __TIZEN_MEDIA_PLAYER_INTERNAL_H__
 #include <player.h>
 #include <glib.h>
-#include <Ecore_Wayland.h>
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -32,6 +31,11 @@ extern "C" {
  * @{
  */
 
+typedef enum {
+       ELM_WAYLAND_WIN = 1,
+       ECORE_WAYLAND_WIN
+} wl_window_type;
+
 /**
  * @brief This file contains the media player API for custom features.
  * @since_tizen 2.4
@@ -232,16 +236,12 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream
 int player_set_media_stream_dynamic_resolution(player_h player, bool drc);
 
 /**
- * @brief Sets the ecore wayland video display.
+ * @brief Sets the ecore wayland window video display.
  * @since_tizen 3.0
  * @remarks This API support PLAYER_DISPLAY_TYPE_OVERLAY type only.
  * @param[in]   player The handle to the media player
  * @param[in]   type The display type
  * @param[in]   ecore_wl_window The ecore wayland window handle
- * @param[in]   x the x coordinate of window
- * @param[in]   y the y coordinate of window
- * @param[in]   width the width of window
- * @param[in]   height the height of window
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
@@ -251,7 +251,7 @@ int player_set_media_stream_dynamic_resolution(player_h player, bool drc);
  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
  * @see player_set_display_rotation
  */
-int player_set_ecore_wl_display(player_h player, player_display_type_e type, Ecore_Wl_Window *ecore_wl_window, int x, int y, int  width, int height);
+int player_set_ecore_wl_win_display(player_h player, player_display_type_e type, void *ecore_wl_window);
 
 /**
  * @brief Called when no free space in buffer.
index 2486c80..9e55a8c 100644 (file)
 #ifndef __TIZEN_MEDIA_PLAYER_PRIVATE_H__
 #define        __TIZEN_MEDIA_PLAYER_PRIVATE_H__
 #include <tbm_bufmgr.h>
-#include <Evas.h>
 #include <media_format.h>
 #include <muse_player.h>
+#include <dlfcn.h>
 #include "player.h"
-#include "player_display.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -47,10 +46,12 @@ do {        \
 #define PLAYER_NULL_ARG_CHECK(arg)      \
                PLAYER_CHECK_CONDITION((arg), PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
 
-#define PLAYER_VIDEO_SUPPORTABLE_CHECK(p) \
-do { \
-       if (p && !p->support_video) \
-               return PLAYER_ERROR_INVALID_OPERATION; \
+#define PLAYER_VIDEO_SUPPORTABLE_CHECK(p)      \
+do {   \
+       if (p && !p->support_video) {   \
+               LOGW("video display interface is not supported");       \
+               return PLAYER_ERROR_INVALID_OPERATION;  \
+       }       \
 } while (0)
 
 #define CONNECTION_RETRY 51
@@ -111,6 +112,7 @@ typedef struct {
        tbm_surface_h tsurf;
 } player_tsurf_info_t;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
+
 typedef enum {
        EVAS_VISIBLE_NONE,                      /* if user dont set visibility, it will be changed to true */
        EVAS_VISIBLE_TRUE,
@@ -165,8 +167,7 @@ typedef struct _player_cli_s {
        callback_cb_info_s *cb_info;
        player_data_s *head;
        server_info_s server;
-       wl_client *wlclient;
-       Evas_Object *eo;
+       void *dl_handle;        /* dlopen handle for display interface */
        gboolean have_evas_callback;
        gboolean push_media_stream;
        gboolean support_video;
@@ -191,6 +192,38 @@ typedef struct _player_cli_s {
 /* server state change timeout (sec) */
 #define SERVER_TIMEOUT(h)              ((h)->server.timeout)
 
+
+#define PATH_DISP_LIB PATH_LIBDIR"/libcapi-media-player-display.so"
+
+#define PLAYER_DISP_DLOPEN(pc) \
+do {   \
+       pc->dl_handle = dlopen(PATH_DISP_LIB, RTLD_LAZY);       \
+       if (pc->dl_handle == NULL) {    \
+               LOGW("not support video rendering"); \
+       } else {        \
+               pc->support_video = TRUE;       \
+               EVAS_INFO(pc)->support_video = TRUE;    \
+       }       \
+} while (0)
+
+#define PLAYER_DISP_DLSYM(handle, sym, function_name)  \
+do {   \
+       char *error;    \
+       sym = dlsym(handle, function_name);     \
+       if ((error = dlerror()) != NULL) {      \
+               dlclose(handle);        \
+               LOGE("dlsym error %s", error);  \
+       }       \
+} while (0)
+
+#define PLAYER_DISP_DLCLOSE(handle)    \
+do {   \
+       if (handle) {   \
+               dlclose(handle); \
+       } \
+} while (0)
+
+
 int client_get_api_timeout(player_cli_s * pc, muse_player_api_e api);
 int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s * cb_info, char **ret_buf, int time_out);
 int _player_convert_display_type(player_display_type_e type, player_private_display_type_e *out_type);
index 44c4dde..17ecb05 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.74
+Version:    0.3.75
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -43,6 +43,14 @@ Requires: %{name} = %{version}-%{release}
 %description devel
 %devel_desc
 
+%package display
+Summary:  A display interface library for Media Player libray
+Group:    Display/Multimedia
+Requires: %{name} = %{version}-%{release}
+
+%description display
+A display interface library for Media Player libray
+
 %package utils
 Summary: A test app for Media Player API
 Group:   Utils/Multimedia
@@ -100,6 +108,11 @@ cp test/player_audio_test %{buildroot}/usr/bin
 %{_libdir}/pkgconfig/*.pc
 %{_libdir}/libcapi-media-player.so
 
+%files display
+%manifest %{name}.manifest
+%license LICENSE.APLv2
+%{_libdir}/libcapi-media-player-display.so
+
 %files utils
 %manifest %{name}.manifest
 %license LICENSE.APLv2
index f81ed07..59667e6 100644 (file)
 #include <tbm_bufmgr.h>
 #include <tbm_surface.h>
 #include <tbm_surface_internal.h>
-#include <Evas.h>
-#include <Elementary.h>
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
 #include <dlog.h>
 #include <mm_error.h>
 #include <muse_core.h>
 #include <system_info.h>
 #include "player_internal.h"
 #include "player_private.h"
-#include "player_display.h"
 #include "player_msg.h"
-#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 PATH_EVAS_RENDERER_LIB PATH_LIBDIR"/libmmfevasrenderer.so.0"
-
-#define PLAYER_VIDEO_SUPPORT_CHECK(h)  \
-do {   \
-       void *_handle;  \
-       _handle = dlopen(PATH_EVAS_RENDERER_LIB, RTLD_LAZY);    \
-       if (_handle) {  \
-               h->support_video = TRUE; \
-               EVAS_INFO(h)->support_video = TRUE; \
-               dlclose(_handle);       \
-       } else { \
-               LOGW("not support video rendering"); \
-       } \
-} while (0)
-
 typedef enum {
        TIZEN_PROFILE_UNKNOWN = 0,
        TIZEN_PROFILE_MOBILE = 0x1,
@@ -583,13 +559,21 @@ EXIT:
 static void __seek_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *recv_data)
 {
        muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_SEEK;
-
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       void *dl_handle;
+       int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
+#endif
        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->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);
+                               dl_handle = dlopen(PATH_DISP_LIB, RTLD_LAZY);
+                               if (dl_handle == NULL)
+                                       LOGW("not support video rendering");
+                               PLAYER_DISP_DLSYM(dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
+                               int ret = p_disp_set_evas_display_visible(cb_info->evas_info->handle, true);
+                               dlclose(dl_handle);
                                if (ret != MM_ERROR_NONE)
                                        LOGW("failed to set visible at evas 0x%x", ret);
                                else
@@ -1800,7 +1784,7 @@ int player_create(player_h * player)
                EVAS_INFO(pc)->support_video = FALSE;
                pc->is_audio_only = FALSE;
 
-               PLAYER_VIDEO_SUPPORT_CHECK(pc); /* update supported_video */
+               PLAYER_DISP_DLOPEN(pc); /* update supported_video */
 
                g_free(ret_buf);
                return ret;
@@ -1831,7 +1815,9 @@ int player_destroy(player_h player)
        muse_player_api_e api = MUSE_PLAYER_API_DESTROY;
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
-
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_destroty_evas_display)(void **) = NULL;
+#endif
        LOGD("ENTER");
 
        /* clear cb and release mem */
@@ -1843,7 +1829,8 @@ int player_destroy(player_h player)
        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)
+                       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_destroty_evas_display, "disp_destroty_evas_display");
+                       if (p_disp_destroty_evas_display(&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);
@@ -1861,6 +1848,9 @@ int player_destroy(player_h player)
                callback_destroy(CALLBACK_INFO(pc));
        }
 
+       if (pc->dl_handle)
+               PLAYER_DISP_DLCLOSE(pc->dl_handle); /* update supported_video */
+
        g_free(pc);
        pc = NULL;
 
@@ -1896,9 +1886,8 @@ int player_prepare_async(player_h player, player_prepared_cb callback, void *use
                SERVER_TIMEOUT(pc) = timeout * G_TIME_SPAN_MILLISECOND;
        } else {
                LOGW("failed to realize, so prepare cb will be released soon");
-               if (pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
+               if (pc->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE])
                        set_null_user_cb(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-               }
        }
 
        g_free(ret_buf);
@@ -2277,10 +2266,13 @@ int player_start(player_h player)
 
        LOGD("ENTER");
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
+
        if (CALLBACK_INFO(pc) && EVAS_INFO(pc)->support_video) {
                if (EVAS_HANDLE(pc) && (EVAS_INFO(pc)->visible == EVAS_VISIBLE_NONE
                        || EVAS_INFO(pc)->visible == EVAS_VISIBLE_TRUE)) {
-                       ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), true);
+                       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
+                       ret = p_disp_set_evas_display_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;
@@ -2305,7 +2297,9 @@ int player_stop(player_h player)
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
        player_state_e state = PLAYER_STATE_NONE;
-
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
+#endif
        LOGD("ENTER");
 
        player_msg_send(MUSE_PLAYER_API_GET_STATE, pc, ret_buf, ret);
@@ -2330,7 +2324,8 @@ int player_stop(player_h player)
        if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc) &&
                EVAS_INFO(pc)->support_video && (EVAS_INFO(pc)->visible == EVAS_VISIBLE_NONE
                || EVAS_INFO(pc)->visible == EVAS_VISIBLE_TRUE)) {
-               ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), false);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
+               ret = p_disp_set_evas_display_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;
@@ -2581,20 +2576,23 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
        muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY;
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
-
-       PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
-
-       Evas_Object *obj = NULL;
-       const char *object_type = NULL;
        wl_win_msg_type wl_win;
        char *wl_win_msg = (char *)&wl_win;
        unsigned int wl_surface_id;
-       struct wl_surface *wl_surface;
-       struct wl_display *wl_display;
-       Ecore_Wl_Window *wl_window = NULL;
-       Evas *e;
        player_private_display_type_e conv_type;
        player_state_e state = PLAYER_STATE_NONE;
+       unsigned int (*p_disp_set_wl_display)(int, void *) = NULL;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_destroty_evas_display)(void **) = NULL;
+       int (*p_disp_create_evas_display)(void *, void **) = NULL;
+       int (*p_disp_set_evas_display_old_info)(void *, void *, int, int, int) = NULL;
+       int (*p_disp_set_evas_display_roi_area)(void *, int, int, int, int) = NULL;
+       void (*p_disp_get_evas_display_geometry_info)(void *, int *, int *, int *, int *) = NULL;
+       void (*p_disp_media_packet_video_decode_cb)(media_packet_h, void *) = NULL;
+#endif
+
+       LOGD("ENTER");
+       PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
        /* init */
        wl_win.wl_window_x = 0;
@@ -2631,128 +2629,71 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                return ret;
 
        if (conv_type != PLAYER_PRIVATE_DISPLAY_TYPE_NONE) {
-               obj = (Evas_Object *) display;
-               if (!obj)
+               if (!display)
                        return PLAYER_ERROR_INVALID_PARAMETER;
 
-               object_type = evas_object_type_get(obj);
-               if (object_type) {
-                       if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
-                               /* wayland overlay surface */
-                               LOGI("Wayland overlay surface type");
-                               wl_win.type = conv_type;
-
-                               e = evas_object_evas_get(obj);
-                               return_val_if_fail(e != NULL, PLAYER_ERROR_INVALID_OPERATION);
-
-                               wl_window = elm_win_wl_window_get(obj);
-                               return_val_if_fail(wl_window != NULL, PLAYER_ERROR_INVALID_OPERATION);
-
-                               /* Need to let wayland-server know that video is rendered in this wl_window
-                                so that wayland-server sets alpha in this wl_window */
-                               ecore_wl_window_video_has(wl_window, EINA_TRUE);
-
-                               wl_surface = (struct wl_surface *)ecore_wl_window_surface_get(wl_window);
-                               return_val_if_fail(wl_surface != NULL, PLAYER_ERROR_INVALID_OPERATION);
-
-                               /* get wl_display */
-                               wl_display = (struct wl_display *)ecore_wl_display_get();
-                               return_val_if_fail(wl_display != NULL, PLAYER_ERROR_INVALID_OPERATION);
-
-                               LOGD("surface = %p, wl_display = %p", wl_surface, wl_display);
-
-                               ret = _wl_client_create(&pc->wlclient);
-                               if (ret != MM_ERROR_NONE) {
-                                       LOGE("Wayland client create failure");
-                                       return ret;
-                               }
-
-                               wl_surface_id = _wl_client_get_wl_window_wl_surface_id(pc->wlclient, wl_surface, wl_display);
-                               LOGD("wl_surface_id = %d", wl_surface_id);
-
-                               /* need to free always */
-                               if (pc->wlclient) {
-                                       g_free(pc->wlclient);
-                                       pc->wlclient = NULL;
-                               }
-                               return_val_if_fail(wl_surface_id > 0, PLAYER_ERROR_INVALID_OPERATION);
+               /* set evas_render or wayland */
+               if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY) {
+                       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_wl_display, "disp_set_wl_display");
+                       wl_surface_id = p_disp_set_wl_display(ELM_WAYLAND_WIN, display);
+                       if (wl_surface_id > 0) {
                                wl_win.wl_surface_id = wl_surface_id;
-
-                       }
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-                       else if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
-                               if (!CALLBACK_INFO(pc)) {
-                                       LOGE("there is no cb info in player handle");
-                                       return PLAYER_ERROR_INVALID_OPERATION;
-                               }
-
-                               /* evas object surface */
-                               LOGI("evas surface type");
                                wl_win.type = conv_type;
+                       } else return PLAYER_ERROR_INVALID_OPERATION;
+               }
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+               else if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_EVAS) {
+                       if (!CALLBACK_INFO(pc)) {
+                               LOGE("there is no cb info in player handle");
+                               return PLAYER_ERROR_INVALID_OPERATION;
+                       }
 
-                               evas_object_geometry_get(obj, &wl_win.wl_window_x, &wl_win.wl_window_y,
-                                       &wl_win.wl_window_width, &wl_win.wl_window_height);
-
-                               if (EVAS_HANDLE(pc)) {
-                                       LOGW("evas client already exists");
-                                       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);
-
-                                       /* need to set display information again to new handle */
-                                       EVAS_INFO(pc)->update_needed = TRUE;
-                               }
-
-                               if (mm_evas_renderer_create(&EVAS_HANDLE(pc), obj) != MM_ERROR_NONE) {
-                                       LOGW("fail to set evas client");
-                                       return PLAYER_ERROR_INVALID_OPERATION;
-                               }
-
-                               /* before evas handle is created, user could set display information */
-                               if (EVAS_INFO(pc)->update_needed) {
-                                       LOGW("set evas information mode %d, rotation %d, visible %d", EVAS_INFO(pc)->mode,
-                                               EVAS_INFO(pc)->rotation, EVAS_INFO(pc)->visible);
-                                       ret = mm_evas_renderer_set_geometry(EVAS_HANDLE(pc), EVAS_INFO(pc)->mode);
-                                       ret |= mm_evas_renderer_set_rotation(EVAS_HANDLE(pc), EVAS_INFO(pc)->rotation);
-                                       /* if user didn't set visible, it will be set to true in player_start */
-                                       if (EVAS_INFO(pc)->visible != EVAS_VISIBLE_NONE)
-                                               ret |= mm_evas_renderer_set_visible(EVAS_HANDLE(pc), (EVAS_INFO(pc)->visible == EVAS_VISIBLE_TRUE) ? true : false);
-                                       if (ret != MM_ERROR_NONE) {
-                                               LOGW("fail to set evas information");
-                                               return PLAYER_ERROR_INVALID_OPERATION;
-                                       }
+                       if (EVAS_HANDLE(pc)) {
+                               LOGW("evas client already exists");
+                               player_unset_media_packet_video_frame_decoded_cb(player);
+                               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_destroty_evas_display, "disp_destroty_evas_display");
+                               if (p_disp_destroty_evas_display(&EVAS_HANDLE(pc)) != MM_ERROR_NONE)
+                                       LOGW("fail to unset evas client");
+                               __player_unset_retrieve_buffer_cb(player);
 
-                                       if (EVAS_INFO(pc)->mode == PLAYER_DISPLAY_MODE_DST_ROI) {
-                                               LOGW("set roi (%d, %d) %d*%d", EVAS_INFO(pc)->roi_x, EVAS_INFO(pc)->roi_y,
-                                               EVAS_INFO(pc)->roi_w, EVAS_INFO(pc)->roi_h);
-                                               ret = mm_evas_renderer_set_roi_area(EVAS_HANDLE(pc), EVAS_INFO(pc)->roi_x, EVAS_INFO(pc)->roi_y,
-                                               EVAS_INFO(pc)->roi_w, EVAS_INFO(pc)->roi_h);
-                                               if (ret != MM_ERROR_NONE)
-                                                       return PLAYER_ERROR_INVALID_OPERATION;
-                                       }
-                                       EVAS_INFO(pc)->update_needed = FALSE;
+                               /* need to set display information again to new handle */
+                               EVAS_INFO(pc)->update_needed = TRUE;
+                       }
+                       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_create_evas_display, "disp_create_evas_display");
+                       ret = p_disp_create_evas_display(display, &EVAS_HANDLE(pc));
+                       if (ret != MM_ERROR_NONE) return PLAYER_ERROR_INVALID_OPERATION;
+
+                       /* before evas handle is created, user could set display information */
+                       if (EVAS_INFO(pc)->update_needed) {
+                               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_old_info, "disp_set_evas_display_old_info");
+                               ret = p_disp_set_evas_display_old_info(display, CALLBACK_INFO(pc), EVAS_INFO(pc)->mode, EVAS_INFO(pc)->rotation, EVAS_INFO(pc)->visible);
+                               if (ret != MM_ERROR_NONE) return PLAYER_ERROR_INVALID_OPERATION;
+                               if (EVAS_INFO(pc)->mode == PLAYER_DISPLAY_MODE_DST_ROI) {
+                                       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_roi_area, "disp_set_evas_display_roi_area");
+                                       ret = p_disp_set_evas_display_roi_area(EVAS_HANDLE(pc), EVAS_INFO(pc)->roi_x, EVAS_INFO(pc)->roi_y, EVAS_INFO(pc)->roi_w, EVAS_INFO(pc)->roi_h);
+                                       if (ret != MM_ERROR_NONE) return PLAYER_ERROR_INVALID_OPERATION;
                                }
-
-                               ret = player_set_media_packet_video_frame_decoded_cb(player, mm_evas_renderer_write, (void *)EVAS_HANDLE(pc));
-                               if (ret != PLAYER_ERROR_NONE)
-                                       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)->update_needed = FALSE;
                        }
-#endif
-                       else
-                               return PLAYER_ERROR_INVALID_PARAMETER;
-               } else {
-                       return PLAYER_ERROR_INVALID_PARAMETER;
+                       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_geometry_info, "disp_get_evas_display_geometry_info");
+                       p_disp_get_evas_display_geometry_info(display, &wl_win.wl_window_x, &wl_win.wl_window_y, &wl_win.wl_window_width, &wl_win.wl_window_height);
+                       wl_win.type = conv_type;
+
+                       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_media_packet_video_decode_cb, "disp_media_packet_video_decode_cb");
+                       ret = player_set_media_packet_video_frame_decoded_cb(player, p_disp_media_packet_video_decode_cb, (void *)EVAS_HANDLE(pc));
+                       if (ret != PLAYER_ERROR_NONE)
+                               LOGW("fail to set decoded callback");
+                       if (__player_set_retrieve_buffer_cb(player, __retrieve_buffer_cb, pc))
+                               LOGW("fail to set __retrieve_buffer_cb");
                }
+#endif
        } else {        /* PLAYER_DISPLAY_TYPE_NONE */
                LOGI("Wayland surface type is NONE");
                wl_win.type = conv_type;
        }
        player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char));
        g_free(ret_buf);
+
        return ret;
 }
 
@@ -2764,13 +2705,16 @@ int player_set_display_mode(player_h player, player_display_mode_e mode)
        muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_MODE;
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
-
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_set_evas_display_disp_mode)(void *, int) = NULL;
+#endif
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
-               ret = mm_evas_renderer_set_geometry(EVAS_HANDLE(pc), mode);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_disp_mode, "disp_set_evas_display_disp_mode");
+               ret = p_disp_set_evas_display_disp_mode(EVAS_HANDLE(pc), mode);
                if (ret != MM_ERROR_NONE)
                        return PLAYER_ERROR_INVALID_OPERATION;
                else
@@ -2794,13 +2738,17 @@ 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;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_get_evas_display_disp_mode)(void *, int *) = NULL;
+#endif
 
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
-               ret = mm_evas_renderer_get_geometry(EVAS_HANDLE(pc), &mode);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_disp_mode, "disp_get_evas_display_disp_mode");
+               ret = p_disp_get_evas_display_disp_mode(EVAS_HANDLE(pc), &mode);
                *pmode = (player_display_mode_e) mode;
                if (ret != MM_ERROR_NONE)
                        return PLAYER_ERROR_INVALID_OPERATION;
@@ -2830,13 +2778,17 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he
        char *ret_buf = NULL;
        wl_win_msg_type wl_win;
        char *wl_win_msg = (char *)&wl_win;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_set_evas_display_roi_area)(void *, int, int, int, int) = NULL;
+#endif
 
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
-               ret = mm_evas_renderer_set_roi_area(EVAS_HANDLE(pc), x, y, width, height);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_roi_area, "disp_set_evas_display_roi_area");
+               ret = p_disp_set_evas_display_roi_area(EVAS_HANDLE(pc), x, y, width, height);
                if (ret == MM_ERROR_EVASRENDER_INVALID_ARGUMENT)
                        return PLAYER_ERROR_INVALID_PARAMETER;
                else if (ret != MM_ERROR_NONE)
@@ -2884,13 +2836,17 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat
        muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_ROTATION;
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_set_evas_display_rotation)(void *, int) = NULL;
+#endif
 
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
-               ret = mm_evas_renderer_set_rotation(EVAS_HANDLE(pc), rotation);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_rotation, "disp_set_evas_display_rotation");
+               ret = p_disp_set_evas_display_rotation(EVAS_HANDLE(pc), rotation);
                if (ret != MM_ERROR_NONE)
                        return PLAYER_ERROR_INVALID_OPERATION;
                else
@@ -2914,13 +2870,17 @@ int player_get_display_rotation(player_h player, player_display_rotation_e * pro
        muse_player_api_e api = MUSE_PLAYER_API_GET_DISPLAY_ROTATION;
        char *ret_buf = NULL;
        int rotation = -1;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_get_evas_display_rotation)(void *, int *) = NULL;
+#endif
 
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
-               ret = mm_evas_renderer_get_rotation(EVAS_HANDLE(pc), &rotation);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_rotation, "disp_get_evas_display_rotation");
+               ret = p_disp_get_evas_display_rotation(EVAS_HANDLE(pc), &rotation);
                *protation = (player_display_rotation_e) rotation;
                if (ret != MM_ERROR_NONE)
                        return PLAYER_ERROR_INVALID_OPERATION;
@@ -2945,13 +2905,17 @@ int player_set_display_visible(player_h player, bool visible)
        player_cli_s *pc = (player_cli_s *) player;
        muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_VISIBLE;
        char *ret_buf = NULL;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
+#endif
 
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
-               ret = mm_evas_renderer_set_visible(EVAS_HANDLE(pc), visible);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible");
+               ret = p_disp_set_evas_display_visible(EVAS_HANDLE(pc), visible);
                if (ret != MM_ERROR_NONE)
                        return PLAYER_ERROR_INVALID_OPERATION;
 
@@ -2979,13 +2943,16 @@ int player_is_display_visible(player_h player, bool * pvisible)
        int value = -1;
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        bool visible = 0;
+       int (*p_disp_get_evas_display_visible)(void *, bool *) = NULL;
 #endif
+
        LOGD("ENTER");
        PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
 
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (EVAS_HANDLE(pc)) {
-               ret = mm_evas_renderer_get_visible(EVAS_HANDLE(pc), &visible);
+               PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_visible, "disp_get_evas_display_visible");
+               ret = p_disp_get_evas_display_visible(EVAS_HANDLE(pc), &visible);
                if (visible)
                        *pvisible = TRUE;
                else
@@ -3612,6 +3579,7 @@ static void __retrieve_buffer_cb(void *user_data)
        player_cli_s *player = (player_cli_s *)user_data;
        int ret = PLAYER_ERROR_NONE;
        bool gapless = false;
+       int (*p_disp_evas_display_retrieve_all_packets)(void *, bool) = NULL;
 
        ret = player_is_gapless((player_h)user_data, &gapless);
        if (ret != PLAYER_ERROR_NONE) {
@@ -3619,7 +3587,8 @@ static void __retrieve_buffer_cb(void *user_data)
                return;
        }
 
-       ret = mm_evas_renderer_retrieve_all_packets(EVAS_HANDLE(player), gapless);
+       PLAYER_DISP_DLSYM(player->dl_handle, p_disp_evas_display_retrieve_all_packets, "disp_evas_display_retrieve_all_packets");
+       ret = p_disp_evas_display_retrieve_all_packets(EVAS_HANDLE(player), gapless);
        if (ret != PLAYER_ERROR_NONE)
                LOGI("mm_evas_renderer_retrieve_all_packets returned error");
 }
diff --git a/src/player_display.c b/src/player_display.c
deleted file mode 100644 (file)
index 02f3f84..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <glib.h>
-#include <string.h>
-#include <dlog.h>
-#include <mm_error.h>
-#include <wayland-client.h>
-#include <tizen-extension-client-protocol.h>
-#include <Evas.h>
-#include <Ecore_Evas.h>
-#include "player_msg.h"
-#include "player_display.h"
-#include "player_private.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "TIZEN_N_PLAYER"
-
-#define goto_if_fail(expr, label)      \
-{      \
-       if (!(expr)) {  \
-               debug_error(" failed [%s]\n", #expr);   \
-               goto label;     \
-       }       \
-}
-
-void handle_resource_id(void *data, struct tizen_resource *tizen_resource, uint32_t id)
-{
-       unsigned int *wl_surface_id = data;
-
-       *wl_surface_id = id;
-
-       LOGD("[CLIENT] got wl_surface_id(%d) from server\n", id);
-}
-
-static const struct tizen_resource_listener tz_resource_listener = {
-       handle_resource_id,
-};
-
-static void handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
-{
-       return_if_fail(data != NULL);
-       wl_client *wlclient = data;
-
-       if (strcmp(interface, "tizen_surface") == 0) {
-               LOGD("binding tizen_surface");
-               wlclient->tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
-               return_if_fail(wlclient->tz_surface != NULL);
-       }
-}
-
-static const struct wl_registry_listener registry_listener = {
-       handle_global,
-};
-
-int _wl_client_create(wl_client ** wlclient)
-{
-       wl_client *ptr = NULL;
-
-       ptr = g_malloc0(sizeof(wl_client));
-       if (!ptr) {
-               LOGE("Cannot allocate memory for wlclient\n");
-               goto ERROR;
-       } else {
-               *wlclient = ptr;
-               LOGD("Success create wlclient(%p)", *wlclient);
-       }
-       return MM_ERROR_NONE;
-
- ERROR:
-       *wlclient = NULL;
-       return MM_ERROR_PLAYER_NO_FREE_SPACE;
-}
-
-int _wl_client_get_wl_window_wl_surface_id(wl_client * wlclient, struct wl_surface *surface, struct wl_display *display)
-{
-       goto_if_fail(wlclient != NULL, failed);
-       goto_if_fail(surface != NULL, failed);
-       goto_if_fail(display != NULL, failed);
-
-       unsigned int wl_surface_id = 0;
-
-       wlclient->display = display;
-       goto_if_fail(wlclient->display != NULL, failed);
-
-       wlclient->registry = wl_display_get_registry(wlclient->display);
-       goto_if_fail(wlclient->registry != NULL, failed);
-
-       wl_registry_add_listener(wlclient->registry, &registry_listener, wlclient);
-       wl_display_dispatch(wlclient->display);
-       wl_display_roundtrip(wlclient->display);
-
-       /* check global objects */
-       goto_if_fail(wlclient->tz_surface != NULL, failed);
-
-       /* Get wl_surface_id which is unique in a entire systemw. */
-       wlclient->tz_resource = tizen_surface_get_tizen_resource(wlclient->tz_surface, surface);
-       goto_if_fail(wlclient->tz_resource != NULL, failed);
-
-       tizen_resource_add_listener(wlclient->tz_resource, &tz_resource_listener, &wl_surface_id);
-       wl_display_roundtrip(wlclient->display);
-       goto_if_fail(wl_surface_id > 0, failed);
-
-       _wl_client_finalize(wlclient);
-
-       return wl_surface_id;
-
- failed:
-       LOGE("Failed to get wl_surface_id");
-
-       return 0;
-}
-
-void _wl_client_finalize(wl_client * wlclient)
-{
-       LOGD("start finalize wlclient");
-       return_if_fail(wlclient != NULL)
-
-       if (wlclient->tz_surface)
-               tizen_surface_destroy(wlclient->tz_surface);
-
-       if (wlclient->tz_resource)
-               tizen_resource_destroy(wlclient->tz_resource);
-
-       /* destroy registry */
-       if (wlclient->registry)
-               wl_registry_destroy(wlclient->registry);
-
-       return;
-}
index 4ea9fad..18408e3 100644 (file)
 #include <string.h>
 #include <mm_error.h>
 #include <dlog.h>
-#include <Evas.h>
-#include <Ecore_Evas.h>
-#include <Ecore_Wayland.h>
 #include <muse_player.h>
 #include <muse_player_msg.h>
 #include <storage-internal.h>
 #include "player_private.h"
 #include "player_msg.h"
 #include "player_internal.h"
-#include "player_display.h"
 
 int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data)
 {
@@ -184,7 +180,7 @@ int player_set_media_stream_dynamic_resolution(player_h player, bool drc)
        return ret;
 }
 
-int player_set_ecore_wl_display(player_h player, player_display_type_e type, Ecore_Wl_Window *ecore_wl_window, int x, int y, int  width, int height)
+int player_set_ecore_wl_win_display(player_h player, player_display_type_e type, void *ecore_wl_window)
 {
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
@@ -194,12 +190,12 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, Eco
        wl_win_msg_type wl_win;
        char *wl_win_msg = (char *)&wl_win;
        unsigned int wl_surface_id;
-       struct wl_surface *wl_surface;
-       struct wl_display *wl_display;
-       Ecore_Wl_Window *wl_window = NULL;
        player_private_display_type_e conv_type;
+       unsigned int (*p_disp_set_wl_display)(int, void *) = NULL;
 
        LOGD("ENTER");
+       PLAYER_VIDEO_SUPPORTABLE_CHECK(pc);
+
        ret = _player_convert_display_type(type, &conv_type);
        if (ret != PLAYER_ERROR_NONE)
                return ret;
@@ -211,56 +207,19 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, Eco
        if (!ecore_wl_window)
                return PLAYER_ERROR_INVALID_PARAMETER;
 
-       LOGI("Wayland overlay surface type");
-       LOGD("Ecore Wayland Window handle(%p), size (%d, %d, %d, %d)", ecore_wl_window, x, y, width, height);
-       wl_window = ecore_wl_window;
-
-       /* set wl_win */
-       wl_win.type = conv_type;
-       wl_win.wl_window_x = x;
-       wl_win.wl_window_y = y;
-       wl_win.wl_window_width = width;
-       wl_win.wl_window_height = height;
-
-       /* Need to let wayland-server know that video is rendered in this wl_window
-        so that wayland-server sets alpha in this wl_window */
-       ecore_wl_window_video_has(wl_window, EINA_TRUE);
-
-       wl_surface = (struct wl_surface *)ecore_wl_window_surface_get(wl_window);
-       /* get wl_display */
-       wl_display = (struct wl_display *)ecore_wl_display_get();
-
-       if (!pc->wlclient) {
-               ret = _wl_client_create(&pc->wlclient);
-               if (ret != MM_ERROR_NONE) {
-                       LOGE("Wayland client create failure");
-                       return ret;
-               }
-       }
-
-       if (wl_surface && wl_display) {
-               LOGD("surface = %p, wl_display = %p", wl_surface, wl_display);
-               wl_surface_id = _wl_client_get_wl_window_wl_surface_id(pc->wlclient, wl_surface, wl_display);
-               LOGD("wl_surface_id = %d", wl_surface_id);
+       PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_wl_display, "disp_set_wl_display");
+       wl_surface_id = p_disp_set_wl_display(ECORE_WAYLAND_WIN, ecore_wl_window);
+       if (wl_surface_id > 0) {
                wl_win.wl_surface_id = wl_surface_id;
-               LOGD("wl_win.wl_surface_id = %d", wl_win.wl_surface_id);
-       } else {
-               LOGE("Fail to get wl_surface or wl_display");
-               return PLAYER_ERROR_INVALID_OPERATION;
-       }
-
-       if (pc->wlclient) {
-               g_free(pc->wlclient);
-               pc->wlclient = NULL;
-       }
+               wl_win.type = conv_type;
+       } else return PLAYER_ERROR_INVALID_OPERATION;
 
        player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char));
-
        g_free(ret_buf);
 
        return ret;
-}
 
+}
 int player_set_next_uri(player_h player, const char *uri)
 {
        PLAYER_INSTANCE_CHECK(player);
index 5436d8d..6ab60ea 100644 (file)
 
 #include <glib.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include <pthread.h>
 #include <system_info.h>
 #include <sound_manager.h>
+#include <unistd.h>
 #include "player.h"
 #include "player_internal.h"
 
@@ -402,17 +405,15 @@ static void set_content_info(bool is_push_mode)
 #endif
 
 #ifdef _ES_PULL_
-       if (!is_push_mode) {
+       if (!is_push_mode)
                player_set_buffer_need_audio_data_cb(g_player[0], buffer_need_audio_data_cb, (void *)g_player[0]);
-       }
 #endif
 }
 
 static void feed_audio_data_thread_func(void *data)
 {
-       while (!g_thread_end) {
+       while (!g_thread_end)
                buffer_need_audio_data_cb(1048576, NULL);
-       }
 }
 
 static void _player_prepare(bool async)
@@ -1361,12 +1362,13 @@ static void interpret(char *cmd)
 gboolean input(GIOChannel * channel)
 {
        gchar buf[MAX_STRING_LEN];
-       gsize read;
-       GError *error = NULL;
+       ssize_t cnt;
+
+       memset(buf, 0, MAX_STRING_LEN);
+       cnt = read(0, (void*)buf, MAX_STRING_LEN);
+       if (cnt == 0) return TRUE;
+       buf[cnt-1] = 0;
 
-       g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
-       buf[read] = '\0';
-       g_strstrip(buf);
        interpret(buf);
 
        return TRUE;
index 6b1ab00..a7e9e06 100644 (file)
@@ -23,6 +23,8 @@
 #include <Elementary.h>
 #include <Ecore.h>
 #include <Ecore_Wayland.h>
+#include <stdio.h>
+#include <string.h>
 #ifdef _ACTIVATE_EOM_
 #include <eom.h>
 #endif
@@ -689,7 +691,7 @@ static void input_filename(char *filename)
                        g_print("player create is failed\n");
        }
 
-       strncpy(g_uri, filename, len);
+       strncpy(g_uri, filename, len+1);
        g_uri[len] = '\0';
 
 #if 0