From 8b8010bf6774a704cb7241ae58013fed7936f283 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 1 Jul 2020 16:50:33 +0900 Subject: [PATCH] [0.3.132] Replace player-display by libmm-display - Remove TIZEN_FEATURE_EVAS_RENDERER feature - Remove libmm-evas-renderer dependency Change-Id: Id4eec7c37735449319f2e909ac645153540b334b Signed-off-by: Jeongmo Yang --- CMakeLists.txt | 7 +- disp/CMakeLists.txt | 48 ---- disp/player_display.c | 403 --------------------------- disp/player_display.h | 43 --- include/player_private.h | 85 ++---- packaging/capi-media-player.spec | 28 +- src/player.c | 576 +++++++++++++++++---------------------- src/player_internal.c | 23 +- test/player_test.c | 2 - 9 files changed, 278 insertions(+), 937 deletions(-) delete mode 100644 disp/CMakeLists.txt delete mode 100644 disp/player_display.c delete mode 100644 disp/player_display.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 211090a..f84a25f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -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(dependents "dlog glib-2.0 libtbm capi-media-tool capi-media-sound-manager capi-base-common muse-client mm-common storage capi-system-info mm-display-interface") SET(pc_dependents "libtbm capi-media-tool capi-base-common capi-media-sound-manager") INCLUDE(FindPkgConfig) @@ -31,10 +31,6 @@ 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") @@ -73,7 +69,6 @@ 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 deleted file mode 100644 index cd39166..0000000 --- a/disp/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -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-wl2 ecore-evas 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-wl2 ecore-evas 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 deleted file mode 100644 index f864354..0000000 --- a/disp/player_display.c +++ /dev/null @@ -1,403 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "player_display.h" -#ifdef TIZEN_FEATURE_EVAS_RENDERER -#include -#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 */ -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_Wl2_Window *wl_window = NULL; - Ecore_Evas *ee = NULL; - Ecore_Wl2_Display *e_wl2_display = NULL; - int wl_surface_id = 0; - Evas *e; - wl_client *wlclient; - int ret = 0; - - /* 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); - - ee = ecore_evas_ecore_evas_get(e); - return_val_if_fail(ee != NULL, FALSE); - - wl_window = ecore_evas_wayland2_window_get(ee); - return_val_if_fail(wl_window != NULL, FALSE); - LOGI("ELM Wayland overlay surface type"); - - } else { - return 0; - } - } else if (wl_win_type == ECORE_WAYLAND_WIN) { - /* ecore win */ - wl_window = (Ecore_Wl2_Window *)win; - LOGD("Ecore Wayland Window handle(%p)", wl_window); - LOGI("ECORE Wayland overlay surface type"); - } else { - return 0; - } - - - /* 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_wl2_window_video_has(wl_window, EINA_TRUE); - - /* get wl_surface */ - wl_surface = (struct wl_surface *)ecore_wl2_window_surface_get(wl_window); - return_val_if_fail(wl_surface != NULL, FALSE); - - /* get wl_display */ - e_wl2_display = ecore_wl2_connected_display_get(NULL); - return_val_if_fail(e_wl2_display != NULL, FALSE); - wl_display = (struct wl_display *)ecore_wl2_display_get(e_wl2_display); - 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 */ - g_free(wlclient); - - 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, MMHandleType 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, rotation); - /* 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_destroy_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) -{ - *((int *)data) = (int)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 void handle_global_remove(void *data, struct wl_registry *registry, uint32_t name) -{ - LOGD("Removed global object: name(%d)", name); -} - - -static const struct wl_registry_listener registry_listener = { - handle_global, - handle_global_remove -}; - -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); - - 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, ®istry_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 deleted file mode 100644 index 68cf600..0000000 --- a/disp/player_display.h +++ /dev/null @@ -1,43 +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 - -#ifdef __cplusplus -extern "C" { -#endif - -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, MMHandleType evas_handle, int mode, int rotation, int visible); -int disp_destroy_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_private.h b/include/player_private.h index e57cae2..8cfb668 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -20,6 +20,7 @@ #include #include #include +#include #include "player.h" #ifdef __cplusplus @@ -59,10 +60,10 @@ do { \ PLAYER_CHECK_CONDITION(arg <= max, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); \ } while (0) -#define PLAYER_VIDEO_SUPPORTABLE_CHECK(p) \ +#define PLAYER_GET_DISPLAY_TYPE(p, type) \ do { \ - if (p && !p->support_video) { \ - LOGW("video display interface is not supported"); \ + if (mm_display_interface_get_type(DP_INTERFACE(p), &type) != MM_ERROR_NONE) { \ + LOGE("get display type failed"); \ return PLAYER_ERROR_INVALID_OPERATION; \ } \ } while (0) @@ -98,15 +99,6 @@ do { \ #define MAX_URL_LEN 2048 /**< Maximum length of the maximum URL */ #define MAX_SUPPORTED_MEDIA_FORMAT 10 -/** - * @brief Enumeration for private display type - */ -typedef enum { - PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */ - PLAYER_PRIVATE_DISPLAY_TYPE_EVAS, /**< Evas image object surface display */ - PLAYER_PRIVATE_DISPLAY_TYPE_NONE, /**< This disposes off buffers */ -} player_private_display_type_e; - typedef enum { PLAYER_SEEK_CB_STATE_NONE, PLAYER_SEEK_CB_STATE_DROP, @@ -147,28 +139,23 @@ typedef struct { typedef struct { int key[4]; tbm_surface_h tsurf; -} player_tsurf_info_t; -#ifdef TIZEN_FEATURE_EVAS_RENDERER +} player_tsurf_info_s; typedef enum { - EVAS_VISIBLE_NONE, /* if user dont set visibility, it will be changed to true */ - EVAS_VISIBLE_TRUE, - EVAS_VISIBLE_FALSE -} visible_info_e; + PLAYER_VISIBLE_INFO_NONE = 0, /* if user dont set visibility, it will be changed to true */ + PLAYER_VISIBLE_INFO_TRUE, + PLAYER_VISIBLE_INFO_FALSE +} player_visible_info_e; typedef struct { - void *handle; - visible_info_e visible; - player_display_rotation_e rotation; - player_display_mode_e mode; - gboolean update_needed; + mm_display_interface_h interface; int roi_x; int roi_y; int roi_w; int roi_h; - gboolean support_video; -} player_evas_info_s; -#endif + player_visible_info_e visible; +} player_display_info_s; + typedef struct _callback_cb_info { GThread *thread; gint running; @@ -187,14 +174,12 @@ typedef struct _callback_cb_info { msg_buff_s buff; player_event_queue event_queue; media_format_h pkt_fmt; -#ifdef TIZEN_FEATURE_EVAS_RENDERER - player_evas_info_s *evas_info; -#endif tbm_bufmgr bufmgr; tbm_fd tfd; /* for player_get_album_art*/ GList *tsurf_list; /* player_tsurf_info_t */ int video_frame_pool_size; bool use_tsurf_pool; + player_display_info_s dp_info; } callback_cb_info_s; typedef struct { @@ -206,10 +191,8 @@ typedef struct _player_cli_s { callback_cb_info_s *cb_info; player_data_s *head; server_info_s server; - void *dl_handle; /* dlopen handle for display interface */ gboolean have_evas_callback; gboolean push_media_stream; - gboolean support_video; gboolean is_audio_only; } player_cli_s; @@ -230,50 +213,18 @@ typedef struct { #define DATA_FD(h) (CALLBACK_INFO(h)->data_fd) /* TBM buffer manager */ #define TBM_BUFMGR(h) (CALLBACK_INFO(h)->bufmgr) -#ifdef TIZEN_FEATURE_EVAS_RENDERER -/* evas display handle */ -#define EVAS_INFO(h) ((h)->cb_info->evas_info) -#define EVAS_HANDLE(h) (EVAS_INFO(h)->handle) -#endif +/* MM Display interface */ +#define DP_INTERFACE(h) (CALLBACK_INFO(h)->dp_info.interface) + /* server tbm bo */ #define SERVER_TBM_BO(h) ((h)->server.bo) /* 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 { \ - sym = dlsym(handle, function_name); \ - if (!sym) { \ - LOGE("dlsym error %s", dlerror()); \ - dlclose(handle); \ - } \ -} 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); +int _player_convert_display_type(player_display_type_e type, mm_display_type_e *out_type); int _player_get_valid_path(const char *uri, char *origin); #ifdef __cplusplus diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 83fc643..7006d01 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.131 +Version: 0.3.132 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -11,6 +11,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(muse-client) BuildRequires: pkgconfig(mm-common) +BuildRequires: pkgconfig(mm-display-interface) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(tizen-extension-client) @@ -18,8 +19,6 @@ BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(evas) -BuildRequires: pkgconfig(ecore-evas) -BuildRequires: pkgconfig(ecore-wl2) BuildRequires: pkgconfig(capi-media-tool) BuildRequires: pkgconfig(mmsvc-player) BuildRequires: pkgconfig(libtbm) @@ -27,9 +26,6 @@ BuildRequires: pkgconfig(eom) BuildRequires: pkgconfig(storage) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(libinput) -%if "%{tizen_profile_name}" != "tv" -BuildRequires: pkgconfig(mm-evas-renderer) -%endif Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -45,14 +41,6 @@ Requires: %{name} = %{version}-%{release} %description devel %devel_desc -%package display -Summary: A display interface library for Media Player library -Group: Display/Multimedia -Requires: %{name} = %{version}-%{release} - -%description display -A display interface library for Media Player library - %package utils Summary: A test app for Media Player API Group: Utils/Multimedia @@ -90,12 +78,7 @@ export LDFLAGS+=" -lgcov" %endif MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ -%if "%{tizen_profile_name}" == "tv" - -DTIZEN_FEATURE_EVAS_RENDERER=Off -%else - -DTIZEN_FEATURE_EVAS_RENDERER=On -%endif +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} make %{?jobs:-j%jobs} @@ -136,11 +119,6 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_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 diff --git a/src/player.c b/src/player.c index 691d7a1..e5d7f99 100644 --- a/src/player.c +++ b/src/player.c @@ -81,12 +81,11 @@ static int _player_deinit_memory_buffer(player_cli_s *pc); static void _player_event_queue_add(player_event_queue *ev, _player_cb_data *data); static bool _player_need_sync_context(int event_id); static void _player_remove_idle_event(callback_cb_info_s *cb_info, muse_player_event_e event_type, bool remove_all); -#ifdef TIZEN_FEATURE_EVAS_RENDERER typedef void (*player_retrieve_buffer_cb)(void *user_data); static void __retrieve_buffer_cb(void *user_data); +static void __player_media_packet_video_decoded_cb(media_packet_h packet, void *user_data); static int __player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data); static int __player_unset_retrieve_buffer_cb(player_h player); -#endif static void _player_release_internal_memory(player_cli_s *pc, bool deinit_server_mem); /* @@ -588,14 +587,24 @@ static void __complete_cb_handler(callback_cb_info_s *cb_info, _player_recv_data ((player_completed_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]); } -#ifdef TIZEN_FEATURE_EVAS_RENDERER +static void __player_media_packet_video_decoded_cb(media_packet_h packet, void *user_data) +{ + if (!packet || !user_data) { + LOGE("invalid param [packet:%p, user_data:%p]", packet, user_data); + return; + } + + LOGD("render packet %p", packet); + + mm_display_interface_evas_render(DP_INTERFACE((player_cli_s *)user_data), packet); +} + static void __retrieve_buffer_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data) { muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER; ((player_retrieve_buffer_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]); } -#endif static void __interrupt_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data) { @@ -722,11 +731,10 @@ EXIT: static void __seek_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data) { + int ret = MM_ERROR_NONE; muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_SEEK; -#ifdef TIZEN_FEATURE_EVAS_RENDERER - void *dl_handle = NULL; - int (*p_disp_set_evas_display_visible)(void *, bool) = NULL; -#endif + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; + g_mutex_lock(&cb_info->seek_cb_mutex); switch (cb_info->seek_cb_state) { @@ -737,25 +745,16 @@ static void __seek_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *re break; } -#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) { - dl_handle = dlopen(PATH_DISP_LIB, RTLD_LAZY); - if (dl_handle) { - PLAYER_DISP_DLSYM(dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible"); - if (p_disp_set_evas_display_visible) { - if (p_disp_set_evas_display_visible(cb_info->evas_info->handle, true) != MM_ERROR_NONE) - LOGW("failed to set visible"); - else - cb_info->evas_info->visible = EVAS_VISIBLE_TRUE; - dlclose(dl_handle); - } - } else { - LOGW("not support video rendering"); - } - } + ret = mm_display_interface_get_type(cb_info->dp_info.interface, &display_type); + if (ret == MM_ERROR_NONE && display_type == MM_DISPLAY_TYPE_EVAS && + cb_info->dp_info.visible != PLAYER_VISIBLE_INFO_FALSE) { + LOGW("set display visible true for EVAS"); + if (mm_display_interface_evas_set_visible(cb_info->dp_info.interface, true) != MM_ERROR_NONE) + LOGE("mm_display_interface_evas_set_visible failed"); + } else { + LOGW("get display type ret 0x%x, type %d", ret, display_type); } -#endif + LOGD("call seek cb"); ((player_seek_completed_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]); set_null_user_cb(cb_info, ev); @@ -783,7 +782,7 @@ static void __player_remove_tsurf_list(player_cli_s *pc) LOGD("total num of tsurf list = %d", g_list_length(pc->cb_info->tsurf_list)); for (l = g_list_first(pc->cb_info->tsurf_list); l; l = g_list_next(l)) { - player_tsurf_info_t *tmp = (player_tsurf_info_t *)l->data; + player_tsurf_info_s *tmp = (player_tsurf_info_s *)l->data; LOGD("%p will be removed", tmp); if (tmp) { @@ -801,13 +800,13 @@ static void __player_remove_tsurf_list(player_cli_s *pc) return; } -static player_tsurf_info_t *__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, int *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_t *tmp = (player_tsurf_info_t *)l->data; + 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]); @@ -863,7 +862,7 @@ static void __media_packet_video_frame_cb_handler(callback_cb_info_s *cb_info, _ char *surface_info = (char *)&sinfo; media_packet_h pkt = NULL; tbm_surface_h tsurf = NULL; - player_tsurf_info_t *tsurf_data = NULL; + player_tsurf_info_s *tsurf_data = NULL; int bo_num = 0; media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12; bool make_pkt_fmt = false; @@ -921,7 +920,7 @@ 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_t, 1); + tsurf_data = g_new(player_tsurf_info_s, 1); if (!tsurf_data) { LOGE("failed to alloc tsurf info"); goto ERROR; @@ -1311,9 +1310,7 @@ static void (*_user_callbacks[MUSE_PLAYER_EVENT_TYPE_NUM])(callback_cb_info_s *c __media_stream_audio_seek_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK */ NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED */ __video_stream_changed_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED */ -#ifdef TIZEN_FEATURE_EVAS_RENDERER __retrieve_buffer_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */ -#endif __disconnected_error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED */ }; @@ -1904,6 +1901,7 @@ static void callback_destroy(callback_cb_info_s *cb_info) g_free(cb_info->buff.recvMsg); _remove_all_ret_msg(cb_info); g_free(cb_info->buff.part_of_msg); + g_free(cb_info); } @@ -2097,21 +2095,13 @@ int player_create(player_h *player) } else { goto ERROR; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER - pc->cb_info->evas_info = g_new0(player_evas_info_s, 1); - if (pc->cb_info->evas_info == NULL) { - ret = PLAYER_ERROR_OUT_OF_MEMORY; - goto ERROR; - } - EVAS_INFO(pc)->visible = EVAS_VISIBLE_NONE; -#endif + pc->cb_info->bufmgr = tbm_bufmgr_init(-1); pc->push_media_stream = FALSE; - pc->support_video = FALSE; - EVAS_INFO(pc)->support_video = FALSE; - pc->is_audio_only = FALSE; - PLAYER_DISP_DLOPEN(pc); /* update supported_video */ + /* get display interface handle */ + if (mm_display_interface_init(&DP_INTERFACE(pc)) != MM_ERROR_NONE) + LOGW("display interface init failed"); g_free(ret_buf); @@ -2148,10 +2138,7 @@ 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_destroy_evas_display)(void **) = NULL; -#endif + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); @@ -2162,21 +2149,17 @@ int player_destroy(player_h player) set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE); _player_release_internal_memory(pc, true); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (CALLBACK_INFO(pc) && EVAS_INFO(pc)) { - if (EVAS_INFO(pc)->support_video && EVAS_HANDLE(pc)) { + if (DP_INTERFACE(pc)) { + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + if (display_type == MM_DISPLAY_TYPE_EVAS) { player_unset_media_packet_video_frame_decoded_cb(player); - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_destroy_evas_display, "disp_destroy_evas_display"); - if (!p_disp_destroy_evas_display || - p_disp_destroy_evas_display(&EVAS_HANDLE(pc)) != MM_ERROR_NONE) { - LOGW("fail to unset evas client"); - return PLAYER_ERROR_INVALID_OPERATION; - } __player_unset_retrieve_buffer_cb(player); } - g_free(EVAS_INFO(pc)); + + mm_display_interface_deinit(DP_INTERFACE(pc)); + DP_INTERFACE(pc) = NULL; } -#endif PLAYER_SEND_MSG(api, pc, ret_buf, ret); @@ -2189,9 +2172,6 @@ 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; @@ -2265,14 +2245,12 @@ int player_prepare(player_h player) int player_unprepare(player_h player) { int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_UNPREPARE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; -#ifdef TIZEN_FEATURE_EVAS_RENDERER - int (*p_disp_evas_display_retrieve_all_packets)(void *, bool) = NULL; - int (*p_disp_set_evas_display_visible)(void *, bool) = NULL; -#endif player_state_e state = PLAYER_STATE_NONE; + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); @@ -2295,25 +2273,30 @@ int player_unprepare(player_h player) set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK); set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_INFO(pc)->support_video && EVAS_HANDLE(pc)) { - if (EVAS_INFO(pc)->visible != EVAS_VISIBLE_FALSE) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible"); - if (!p_disp_set_evas_display_visible || - p_disp_set_evas_display_visible(EVAS_HANDLE(pc), false) != MM_ERROR_NONE) { - LOGE("mm_evas_renderer_set_visible err"); - return PLAYER_ERROR_INVALID_OPERATION; - } - } - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_evas_display_retrieve_all_packets, "disp_evas_display_retrieve_all_packets"); - if (!p_disp_evas_display_retrieve_all_packets || - p_disp_evas_display_retrieve_all_packets(EVAS_HANDLE(pc), false) != PLAYER_ERROR_NONE) { - LOGE("mm_evas_renderer_retrieve_all_packets returned error"); + if (!DP_INTERFACE(pc)) + goto _PLAYER_UNPREPARE; + + + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + if (display_type != MM_DISPLAY_TYPE_EVAS) + goto _PLAYER_UNPREPARE; + + if (CALLBACK_INFO(pc)->dp_info.visible != PLAYER_VISIBLE_INFO_FALSE) { + mm_ret = mm_display_interface_evas_set_visible(DP_INTERFACE(pc), false); + if (mm_ret != MM_ERROR_NONE) { + LOGE("mm_display_interface_evas_set_visible failed 0x%x", mm_ret); return PLAYER_ERROR_INVALID_OPERATION; } } -#endif + mm_ret = mm_display_interface_evas_flush(DP_INTERFACE(pc), false); + if (mm_ret != MM_ERROR_NONE) { + LOGE("mm_display_interface_evas_flush failed 0x%x", mm_ret); + return PLAYER_ERROR_INVALID_OPERATION; + } + +_PLAYER_UNPREPARE: PLAYER_SEND_MSG(api, pc, ret_buf, ret); _player_release_internal_memory(pc, false); @@ -2661,26 +2644,31 @@ int player_start(player_h player) muse_player_api_e api = MUSE_PLAYER_API_START; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); LOGD("ENTER %p", pc); -#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_FALSE) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible"); - if (!p_disp_set_evas_display_visible || - p_disp_set_evas_display_visible(EVAS_HANDLE(pc), true) != MM_ERROR_NONE) { - LOGE("mm_evas_renderer_set_visible err"); - return PLAYER_ERROR_INVALID_OPERATION; - } - /* avoid setting true at all times, when player is resumed */ - EVAS_INFO(pc)->visible = EVAS_VISIBLE_TRUE; - } + + if (!DP_INTERFACE(pc)) + goto _PLAYER_START; + + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + if (display_type != MM_DISPLAY_TYPE_EVAS || + CALLBACK_INFO(pc)->dp_info.visible == PLAYER_VISIBLE_INFO_FALSE) + goto _PLAYER_START; + + /* set proper visible to evas renderer */ + if (mm_display_interface_evas_set_visible(DP_INTERFACE(pc), true) != MM_ERROR_NONE) { + LOGE("mm_display_interface_evas_set_visible failed"); + return PLAYER_ERROR_INVALID_OPERATION; } -#endif + + /* avoid setting true at all times, when player is resumed */ + CALLBACK_INFO(pc)->dp_info.visible = PLAYER_VISIBLE_INFO_TRUE; + +_PLAYER_START: g_mutex_lock(&pc->cb_info->buffering_cb_mutex); pc->cb_info->drop_buffering_message = TRUE; g_mutex_unlock(&pc->cb_info->buffering_cb_mutex); @@ -2702,13 +2690,12 @@ int player_start(player_h player) int player_stop(player_h player) { int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_STOP; 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 + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); @@ -2725,19 +2712,22 @@ int player_stop(player_h player) return PLAYER_ERROR_INVALID_STATE; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc) && - EVAS_INFO(pc)->support_video && EVAS_INFO(pc)->visible != EVAS_VISIBLE_FALSE) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible"); - if (!p_disp_set_evas_display_visible || - p_disp_set_evas_display_visible(EVAS_HANDLE(pc), false) != MM_ERROR_NONE) { - LOGE("mm_evas_renderer_set_visible err"); - return PLAYER_ERROR_INVALID_OPERATION; - } - /* do not update EVAS_INFO(pc)->visible to set visible true if start again */ + if (!DP_INTERFACE(pc)) + goto _PLAYER_STOP; + + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + if (display_type != MM_DISPLAY_TYPE_EVAS || + CALLBACK_INFO(pc)->dp_info.visible == PLAYER_VISIBLE_INFO_FALSE) + goto _PLAYER_STOP; + + mm_ret = mm_display_interface_evas_set_visible(DP_INTERFACE(pc), false); + if (mm_ret != MM_ERROR_NONE) { + LOGE("mm_display_interface_evas_set_visible failed 0x%x", mm_ret); + return PLAYER_ERROR_INVALID_OPERATION; } -#endif +_PLAYER_STOP: PLAYER_SEND_MSG(api, pc, ret_buf, ret); if (ret == PLAYER_ERROR_NONE) set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK); @@ -3060,7 +3050,7 @@ int player_get_duration_nsec(player_h player, int64_t *nanoseconds) } /* The player_display_type_e is different at wearable profile */ -int _player_convert_display_type(player_display_type_e type, player_private_display_type_e *out_type) +int _player_convert_display_type(player_display_type_e type, mm_display_type_e *out_type) { int ret = PLAYER_ERROR_NONE; @@ -3068,13 +3058,13 @@ int _player_convert_display_type(player_display_type_e type, player_private_disp switch (type) { case PLAYER_DISPLAY_TYPE_OVERLAY: - *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY; + *out_type = MM_DISPLAY_TYPE_OVERLAY; break; case PLAYER_DISPLAY_TYPE_EVAS: - *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS; + *out_type = MM_DISPLAY_TYPE_EVAS; break; case PLAYER_DISPLAY_TYPE_NONE: - *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_NONE; + *out_type = MM_DISPLAY_TYPE_NONE; break; default: ret = PLAYER_ERROR_INVALID_PARAMETER; @@ -3082,35 +3072,26 @@ int _player_convert_display_type(player_display_type_e type, player_private_disp } LOGD("display type(%d) -> (%d)", type, *out_type); + return ret; } int player_set_display(player_h player, player_display_type_e type, player_display_h display) { int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; wl_win_msg_type wl_win; char *wl_win_msg = (char *)&wl_win; - int wl_surface_id; - player_private_display_type_e conv_type = PLAYER_DISPLAY_TYPE_NONE; - unsigned int (*p_disp_set_wl_display)(int, void *) = NULL; + mm_display_type_e conv_type = MM_DISPLAY_TYPE_NONE; int arr_msg_len = 0; -#ifdef TIZEN_FEATURE_EVAS_RENDERER - int (*p_disp_destroy_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_media_packet_video_decode_cb)(media_packet_h, void *) = NULL; -#endif pid_t pid = getpid(); pid_t tid = syscall(SYS_gettid); PLAYER_INSTANCE_CHECK(player); - LOGD("ENTER"); - if (type != PLAYER_DISPLAY_TYPE_NONE) { LOGD("Check if API is called in main thread. pid [%d], tid [%d]", pid, tid); if (pid != tid) { @@ -3119,7 +3100,11 @@ int player_set_display(player_h player, player_display_type_e type, player_displ } } - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); + /* check display interface handle */ + if (!DP_INTERFACE(pc)) { + LOGE("display interface not supported"); + return PLAYER_ERROR_INVALID_OPERATION; + } LOGD("ENTER type: %d", type); @@ -3130,89 +3115,71 @@ int player_set_display(player_h player, player_display_type_e type, player_displ if (ret != PLAYER_ERROR_NONE) return ret; - if (conv_type != PLAYER_PRIVATE_DISPLAY_TYPE_NONE) { - if (!display) + if (conv_type != MM_DISPLAY_TYPE_NONE) { + if (!display) { + LOGE("type[%d] NULL handle for display", type); return PLAYER_ERROR_INVALID_PARAMETER; - -#ifdef TIZEN_FEATURE_EVAS_RENDERER - /** - * To support repeating play and stop, Evas_handle should not be destroyed in player_unprepare. - * When the display type changes, Player need to destroy Evas_handle to set values of video output, - * Otherwise, the values is not set because of checking Evas_handle. - */ - if (CALLBACK_INFO(pc) && 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_destroy_evas_display, "disp_destroy_evas_display"); - if (!p_disp_destroy_evas_display || - p_disp_destroy_evas_display(&EVAS_HANDLE(pc)) != MM_ERROR_NONE) { - LOGW("fail to unset evas client"); - return PLAYER_ERROR_INVALID_OPERATION; - } - __player_unset_retrieve_buffer_cb(player); - /* need to set display information again to new handle */ - EVAS_INFO(pc)->update_needed = TRUE; } -#endif - /* 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"); - if (!p_disp_set_wl_display) - return PLAYER_ERROR_INVALID_OPERATION; - wl_surface_id = p_disp_set_wl_display(ELM_WAYLAND_WIN, display); - if (wl_surface_id > 0) { - wl_win.surface_id = wl_surface_id; - wl_win.type = conv_type; - } else - return PLAYER_ERROR_INVALID_OPERATION; + + mm_ret = mm_display_interface_set_display(DP_INTERFACE(pc), conv_type, display, &wl_win.surface_id); + if (mm_ret != MM_ERROR_NONE) { + LOGE("[INVALID_OPERATION] set display failed[0x%x]", mm_ret); + 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"); + + 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; + bool visible = false; + + ret = player_get_display_mode(player, &mode); + ret |= player_get_display_rotation(player, &rotation); + ret |= player_is_display_visible(player, &visible); + + if (ret != PLAYER_ERROR_NONE) { + LOGE("get current display settings"); return PLAYER_ERROR_INVALID_OPERATION; } - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_create_evas_display, "disp_create_evas_display"); - if (!p_disp_create_evas_display || - p_disp_create_evas_display(display, &EVAS_HANDLE(pc)) != MM_ERROR_NONE) - return PLAYER_ERROR_INVALID_OPERATION; + LOGD("current setting : mode %d, rotation %d, visible %d, roi %d,%d,%dx%d", + mode, rotation, visible, + CALLBACK_INFO(pc)->dp_info.roi_x, + CALLBACK_INFO(pc)->dp_info.roi_y, + CALLBACK_INFO(pc)->dp_info.roi_w, + CALLBACK_INFO(pc)->dp_info.roi_h); + + mm_ret = mm_display_interface_evas_set_mode(DP_INTERFACE(pc), mode); + mm_ret |= mm_display_interface_evas_set_rotation(DP_INTERFACE(pc), rotation); + mm_ret |= mm_display_interface_evas_set_visible(DP_INTERFACE(pc), visible); + if (mode == PLAYER_DISPLAY_MODE_DST_ROI) { + mm_ret |= mm_display_interface_evas_set_roi_area(DP_INTERFACE(pc), + CALLBACK_INFO(pc)->dp_info.roi_x, CALLBACK_INFO(pc)->dp_info.roi_y, + CALLBACK_INFO(pc)->dp_info.roi_w, CALLBACK_INFO(pc)->dp_info.roi_h); + } - /* 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"); - if (!p_disp_set_evas_display_old_info || - p_disp_set_evas_display_old_info(display, EVAS_HANDLE(pc), EVAS_INFO(pc)->mode, EVAS_INFO(pc)->rotation, EVAS_INFO(pc)->visible) != 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"); - if (!p_disp_set_evas_display_roi_area || - 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) != MM_ERROR_NONE) - return PLAYER_ERROR_INVALID_OPERATION; - } - EVAS_INFO(pc)->update_needed = FALSE; + if (mm_ret != MM_ERROR_NONE) { + LOGE("set mm_display_interface failed"); + return PLAYER_ERROR_INVALID_OPERATION; } - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_media_packet_video_decode_cb, "disp_media_packet_video_decode_cb"); - if (!p_disp_media_packet_video_decode_cb || - player_set_media_packet_video_frame_decoded_cb(player, p_disp_media_packet_video_decode_cb, (void *)EVAS_HANDLE(pc)) != MM_ERROR_NONE) { + if (player_set_media_packet_video_frame_decoded_cb(player, + __player_media_packet_video_decoded_cb, player) != MM_ERROR_NONE) { LOGE("fail to set decoded callback"); return PLAYER_ERROR_INVALID_OPERATION; } + if (__player_set_retrieve_buffer_cb(player, __retrieve_buffer_cb, pc)) LOGW("fail to set __retrieve_buffer_cb"); - - wl_win.type = conv_type; } -#endif - } else { /* PLAYER_DISPLAY_TYPE_NONE */ - LOGI("Wayland surface type is NONE"); - wl_win.type = conv_type; } + wl_win.type = conv_type; + arr_msg_len = (sizeof(wl_win_msg_type) / sizeof(int) + (sizeof(wl_win_msg_type) % sizeof(int) ? 1 : 0)); PLAYER_SEND_MSG(api, pc, ret_buf, ret, - MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg); + MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg); + g_free(ret_buf); return ret; @@ -3221,34 +3188,31 @@ int player_set_display(player_h player, player_display_type_e type, player_displ int player_set_display_mode(player_h player, player_display_mode_e mode) { int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; 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 + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); PLAYER_RANGE_ARG_CHECK(mode, PLAYER_DISPLAY_MODE_LETTER_BOX, PLAYER_DISPLAY_MODE_DST_ROI); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); LOGD("ENTER"); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_disp_mode, "disp_set_evas_display_disp_mode"); - if (!p_disp_set_evas_display_disp_mode || - p_disp_set_evas_display_disp_mode(EVAS_HANDLE(pc), mode) != MM_ERROR_NONE) + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + 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) { + LOGE("mm_display_interface_evas_set_mode failed 0x%x", mm_ret); return PLAYER_ERROR_INVALID_OPERATION; - else - return PLAYER_ERROR_NONE; - } else { - EVAS_INFO(pc)->mode = mode; - EVAS_INFO(pc)->update_needed = TRUE; + } } -#endif + PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "mode", (int)mode); + g_free(ret_buf); + return ret; } @@ -3259,36 +3223,21 @@ 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 PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(pmode); LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); - -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_disp_mode, "disp_get_evas_display_disp_mode"); - if (!p_disp_get_evas_display_disp_mode || - p_disp_get_evas_display_disp_mode(EVAS_HANDLE(pc), &mode) != MM_ERROR_NONE) - return PLAYER_ERROR_INVALID_OPERATION; - - *pmode = (player_display_mode_e) mode; - - return PLAYER_ERROR_NONE; - } -#endif PLAYER_SEND_MSG(api, pc, ret_buf, ret); + if (ret == PLAYER_ERROR_NONE) { player_msg_get_type(mode, ret_buf, INT); *pmode = mode; } g_free(ret_buf); + return ret; } @@ -3299,14 +3248,18 @@ int player_set_video_roi_area(player_h player, double x_scale, double y_scale, muse_player_api_e api = MUSE_PLAYER_API_SET_VIDEO_ROI_AREA; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); - PLAYER_CHECK_CONDITION(CALLBACK_INFO(pc) != NULL && EVAS_HANDLE(pc) == NULL, - PLAYER_ERROR_INVALID_OPERATION, "Display type is EVAS, video display interface is not supported"); + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + if (display_type == MM_DISPLAY_TYPE_EVAS) { + LOGE("Display type is EVAS, video display interface is not supported"); + return PLAYER_ERROR_INVALID_OPERATION; + } if (!_player_video_roi_area_is_valid(x_scale, y_scale, w_scale, h_scale)) return PLAYER_ERROR_INVALID_PARAMETER; @@ -3365,42 +3318,30 @@ int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale, int player_set_display_roi_area(player_h player, int x, int y, int width, int height) { int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY_ROI_AREA; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; wl_win_msg_type wl_win; char *wl_win_msg = (char *)&wl_win; int arr_msg_len = 0; -#ifdef TIZEN_FEATURE_EVAS_RENDERER - int (*p_disp_set_evas_display_roi_area)(void *, int, int, int, int) = NULL; -#endif + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); PLAYER_CHECK_CONDITION(width > 0 && height > 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_roi_area, "disp_set_evas_display_roi_area"); - if (!p_disp_set_evas_display_roi_area) - return PLAYER_ERROR_INVALID_OPERATION; - ret = p_disp_set_evas_display_roi_area(EVAS_HANDLE(pc), x, y, width, height); - if (ret == MM_ERROR_EVASRENDER_INVALID_ARGUMENT) + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + if (display_type == MM_DISPLAY_TYPE_EVAS) { + mm_ret = mm_display_interface_evas_set_roi_area(DP_INTERFACE(pc), x, y, width, height); + if (mm_ret == MM_ERROR_EVASRENDER_INVALID_ARGUMENT) return PLAYER_ERROR_INVALID_PARAMETER; - else if (ret != MM_ERROR_NONE) + else if (mm_ret != MM_ERROR_NONE) return PLAYER_ERROR_INVALID_OPERATION; - else - return PLAYER_ERROR_NONE; - } else { - EVAS_INFO(pc)->roi_x = x; - EVAS_INFO(pc)->roi_y = y; - EVAS_INFO(pc)->roi_w = width; - EVAS_INFO(pc)->roi_h = height; - EVAS_INFO(pc)->update_needed = TRUE; } -#endif + wl_win.win_roi_x = x; wl_win.win_roi_y = y; wl_win.win_roi_width = width; @@ -3408,9 +3349,17 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he arr_msg_len = (sizeof(wl_win_msg_type) / sizeof(int) + (sizeof(wl_win_msg_type) % sizeof(int) ? 1 : 0)); PLAYER_SEND_MSG(api, pc, ret_buf, ret, - MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg); + MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg); + + if (ret == PLAYER_ERROR_NONE) { + CALLBACK_INFO(pc)->dp_info.roi_x = x; + CALLBACK_INFO(pc)->dp_info.roi_y = y; + CALLBACK_INFO(pc)->dp_info.roi_w = width; + CALLBACK_INFO(pc)->dp_info.roi_h = height; + } g_free(ret_buf); + return ret; } @@ -3436,34 +3385,31 @@ int player_set_playback_rate(player_h player, float rate) int player_set_display_rotation(player_h player, player_display_rotation_e rotation) { int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; 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 + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); PLAYER_RANGE_ARG_CHECK(rotation, PLAYER_DISPLAY_ROTATION_NONE, PLAYER_DISPLAY_ROTATION_270); LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_rotation, "disp_set_evas_display_rotation"); - if (!p_disp_set_evas_display_rotation || - p_disp_set_evas_display_rotation(EVAS_HANDLE(pc), rotation) != MM_ERROR_NONE) + PLAYER_GET_DISPLAY_TYPE(pc, display_type); + + 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) { + LOGE("mm_display_interface_evas_set_rotation failed 0x%x", mm_ret); return PLAYER_ERROR_INVALID_OPERATION; - else - return PLAYER_ERROR_NONE; - } else { - EVAS_INFO(pc)->rotation = rotation; - EVAS_INFO(pc)->update_needed = TRUE; + } } -#endif + PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "rotation", (int)rotation); + g_free(ret_buf); + return ret; } @@ -3474,70 +3420,54 @@ 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; -#ifdef TIZEN_FEATURE_EVAS_RENDERER - int (*p_disp_get_evas_display_rotation)(void *, int *) = NULL; -#endif PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(protation); LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); - -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_rotation, "disp_get_evas_display_rotation"); - if (!p_disp_get_evas_display_rotation || - p_disp_get_evas_display_rotation(EVAS_HANDLE(pc), &rotation) != MM_ERROR_NONE) - return PLAYER_ERROR_INVALID_OPERATION; - *protation = (player_display_rotation_e) rotation; - - return PLAYER_ERROR_NONE; - } -#endif PLAYER_SEND_MSG(api, pc, ret_buf, ret); + if (ret == PLAYER_ERROR_NONE) { player_msg_get_type(rotation, ret_buf, INT); *protation = rotation; } g_free(ret_buf); + return ret; } int player_set_display_visible(player_h player, bool visible) { int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; 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 + mm_display_type_e display_type = MM_DISPLAY_TYPE_NONE; PLAYER_INSTANCE_CHECK(player); LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_evas_display_visible, "disp_set_evas_display_visible"); - if (!p_disp_set_evas_display_visible || - p_disp_set_evas_display_visible(EVAS_HANDLE(pc), visible) != MM_ERROR_NONE) - return PLAYER_ERROR_INVALID_OPERATION; + PLAYER_GET_DISPLAY_TYPE(pc, display_type); - EVAS_INFO(pc)->visible = visible ? EVAS_VISIBLE_TRUE : EVAS_VISIBLE_FALSE; - return PLAYER_ERROR_NONE; - } else { - EVAS_INFO(pc)->visible = visible ? EVAS_VISIBLE_TRUE : EVAS_VISIBLE_FALSE; - EVAS_INFO(pc)->update_needed = TRUE; + if (display_type == MM_DISPLAY_TYPE_EVAS) { + mm_ret = mm_display_interface_evas_set_visible(DP_INTERFACE(pc), visible); + if (mm_ret != MM_ERROR_NONE) { + LOGE("mm_display_interface_evas_set_visible failed 0x%x", mm_ret); + return PLAYER_ERROR_INVALID_OPERATION; + } } -#endif PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "visible", (int)visible); + g_free(ret_buf); + + if (ret == PLAYER_ERROR_NONE) + CALLBACK_INFO(pc)->dp_info.visible = visible ? PLAYER_VISIBLE_INFO_TRUE : PLAYER_VISIBLE_INFO_FALSE; + return ret; } @@ -3548,32 +3478,14 @@ 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 TIZEN_FEATURE_EVAS_RENDERER - bool visible = 0; - int (*p_disp_get_evas_display_visible)(void *, bool *) = NULL; -#endif PLAYER_INSTANCE_CHECK(player); PLAYER_NULL_ARG_CHECK(pvisible); LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); - -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_get_evas_display_visible, "disp_get_evas_display_visible"); - if (!p_disp_get_evas_display_visible || - p_disp_get_evas_display_visible(EVAS_HANDLE(pc), &visible) != MM_ERROR_NONE) - return PLAYER_ERROR_INVALID_OPERATION; - if (visible) - *pvisible = TRUE; - else - *pvisible = FALSE; - return PLAYER_ERROR_NONE; - } -#endif PLAYER_SEND_MSG(api, pc, ret_buf, ret); + if (ret == PLAYER_ERROR_NONE) { player_msg_get_type(value, ret_buf, INT); @@ -3584,6 +3496,7 @@ int player_is_display_visible(player_h player, bool *pvisible) } g_free(ret_buf); + return ret; } @@ -4181,23 +4094,21 @@ int player_set_completed_cb(player_h player, player_completed_cb callback, void return __set_callback(MUSE_PLAYER_EVENT_TYPE_COMPLETE, player, callback, user_data); } -#ifdef TIZEN_FEATURE_EVAS_RENDERER 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); + ret = player_is_gapless((player_h)player, &gapless); if (ret != PLAYER_ERROR_NONE) { LOGW("player_is_gapless is failed"); return; } - PLAYER_DISP_DLSYM(player->dl_handle, p_disp_evas_display_retrieve_all_packets, "disp_evas_display_retrieve_all_packets"); - if (!p_disp_evas_display_retrieve_all_packets || - p_disp_evas_display_retrieve_all_packets(EVAS_HANDLE(player), gapless) != PLAYER_ERROR_NONE) - LOGE("mm_evas_renderer_retrieve_all_packets returned error"); + + ret = mm_display_interface_evas_flush(DP_INTERFACE(player), gapless); + + LOGW("flush all packet : 0x%x [gapless %d]", ret, gapless); } static int __player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data) @@ -4209,7 +4120,6 @@ static int __player_unset_retrieve_buffer_cb(player_h player) { return __unset_callback(MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER, player); } -#endif int player_unset_completed_cb(player_h player) { @@ -4944,6 +4854,7 @@ 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); @@ -4960,18 +4871,19 @@ int player_set_audio_only(player_h player, bool audio_only) return PLAYER_ERROR_INVALID_STATE; } -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { + 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; } -#endif + PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "audio_only", (int)audio_only); + g_free(ret_buf); LOGD("LEAVE 0x%X", ret); - return ret; + return ret; } int player_is_audio_only(player_h player, bool *paudio_only) @@ -4981,26 +4893,30 @@ 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"); -#ifdef TIZEN_FEATURE_EVAS_RENDERER - if (EVAS_HANDLE(pc)) { + + 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; } -#endif PLAYER_SEND_MSG(api, pc, ret_buf, ret); + if (ret == PLAYER_ERROR_NONE) { player_msg_get(audio_only, ret_buf); *paudio_only = (bool)audio_only; } + g_free(ret_buf); LOGD("LEAVE 0x%X", ret); + return ret; } diff --git a/src/player_internal.c b/src/player_internal.c index 8817722..2126187 100644 --- a/src/player_internal.c +++ b/src/player_internal.c @@ -144,41 +144,38 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, voi { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; wl_win_msg_type wl_win; char *wl_win_msg = (char *)&wl_win; - int wl_surface_id; - player_private_display_type_e conv_type; - int (*p_disp_set_wl_display)(int, void *) = NULL; + mm_display_type_e conv_type; int arr_msg_len = 0; LOGD("ENTER"); - PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); ret = _player_convert_display_type(type, &conv_type); if (ret != PLAYER_ERROR_NONE) return ret; - if (conv_type != PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY) { + if (conv_type != MM_DISPLAY_TYPE_OVERLAY) { LOGE("Display type(%d) is not overlay", conv_type); return PLAYER_ERROR_INVALID_PARAMETER; } if (!ecore_wl2_window) return PLAYER_ERROR_INVALID_PARAMETER; - PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_wl_display, "disp_set_wl_display"); - if (!p_disp_set_wl_display) - return PLAYER_ERROR_INVALID_OPERATION; - wl_surface_id = p_disp_set_wl_display(ECORE_WAYLAND_WIN, ecore_wl2_window); - if (wl_surface_id > 0) { - wl_win.surface_id = wl_surface_id; - wl_win.type = conv_type; - } else { + mm_ret = mm_display_interface_set_display(DP_INTERFACE(pc), + MM_DISPLAY_TYPE_OVERLAY_EXT, ecore_wl2_window, &wl_win.surface_id); + + if (mm_ret != MM_ERROR_NONE) { + LOGE("mm_display_interface_set_display failed 0x%x", mm_ret); return PLAYER_ERROR_INVALID_OPERATION; } + wl_win.type = conv_type; + arr_msg_len = (sizeof(wl_win_msg_type) / sizeof(int) + (sizeof(wl_win_msg_type) % sizeof(int) ? 1 : 0)); PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg); diff --git a/test/player_test.c b/test/player_test.c index 04afca7..cc6d5a6 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -1786,13 +1786,11 @@ static void change_surface(int option) surface_type = PLAYER_DISPLAY_TYPE_OVERLAY; g_print("change surface type to X\n"); break; -#ifdef TIZEN_FEATURE_EVAS_RENDERER case 1: /* EVAS surface */ surface_type = PLAYER_DISPLAY_TYPE_EVAS; g_print("change surface type to EVAS\n"); break; -#endif case 2: g_print("change surface type to NONE\n"); surface_type = g_current_surface_type = PLAYER_DISPLAY_TYPE_NONE; -- 2.7.4