From d019cd3b58b30505dafe6edc9b2d5efa1da56d2d Mon Sep 17 00:00:00 2001 From: Hyunil Date: Thu, 28 Jan 2016 10:53:19 +0900 Subject: [PATCH] Apply Video interface for unique id for wl_window Change-Id: I6f8a5fdf5f5618b4c60a4219dc3f1c7c7bd3ae4d Signed-off-by: Hyunil --- CMakeLists.txt | 2 +- client/CMakeLists.txt | 2 +- client/src/player2.c | 149 +++++++++----------------------------- client/src/player2_internal.c | 76 ++++++++++++++++++++ client/src/player2_wayland.c | 150 +++++++++++++++++++++++++++++++++++++++ include/player2_private.h | 48 +++---------- include/player2_wayland.h | 47 ++++++++++++ include/player_msg_private.h | 2 +- packaging/capi-media-player.spec | 1 + src/player_msg_dispatcher.c | 41 ++++++----- 10 files changed, 341 insertions(+), 177 deletions(-) create mode 100644 client/src/player2_wayland.c create mode 100644 include/player2_wayland.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 04b628b..f3584c2 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 mused legacy-capi-media-player mm-common") +SET(dependents "dlog glib-2.0 libtbm mused legacy-capi-media-player mm-common tizen-extension-client evas") INCLUDE(FindPkgConfig) pkg_check_modules(${fw_name} REQUIRED ${dependents}) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index d619932..1804ee5 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(dependents "dlog elementary evas libtbm mm-common mm-playerclient capi-base-common capi-media-tool eom") +SET(dependents "dlog elementary evas libtbm mm-common mm-playerclient capi-base-common capi-media-tool eom tizen-extension-client") SET(pc_dependents "libtbm capi-media-tool capi-base-common capi-media-sound-manager legacy-capi-media-player") INCLUDE(FindPkgConfig) diff --git a/client/src/player2.c b/client/src/player2.c index 6532066..91b0b8e 100644 --- a/client/src/player2.c +++ b/client/src/player2.c @@ -337,13 +337,8 @@ static int __unset_callback(_player_event_e type, player_h player) static void __prepare_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) { - char caps[MUSE_MSG_MAX_LENGTH] = {0, }; _player_event_e ev = _PLAYER_EVENT_TYPE_PREPARE; - if (player_msg_get_string(caps, recvMsg)) - if (strlen(caps) > 0) - mm_player_mused_realize(cb_info->local_handle, caps); - ((player_prepared_cb)cb_info->user_cb[ev])(cb_info->user_data[ev]); set_null_user_cb(cb_info, ev); @@ -697,18 +692,6 @@ static void __video_stream_changed_cb_handler(callback_cb_info_s *cb_info, char } } -static void __video_bin_created_cb_handler(callback_cb_info_s *cb_info, char *recvMsg) -{ - char caps[MUSE_MSG_MAX_LENGTH] = {0, }; - if (player_msg_get_string(caps, recvMsg)) - if (strlen(caps) > 0) - mm_player_mused_realize(cb_info->local_handle, caps); -} - -static void dummy_user_callback() -{ -} - static void (*_user_callbacks[_PLAYER_EVENT_TYPE_NUM])(callback_cb_info_s *cb_info, char *recvMsg) = { __prepare_cb_handler, /*_PLAYER_EVENT_TYPE_PREPARE*/ __complete_cb_handler, /*_PLAYER_EVENT_TYPE_COMPLETE*/ @@ -737,7 +720,6 @@ static void (*_user_callbacks[_PLAYER_EVENT_TYPE_NUM])(callback_cb_info_s *cb_in __media_stream_audio_seek_cb_handler, /*_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK*/ NULL, /*_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED*/ __video_stream_changed_cb_handler, /*_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED*/ - __video_bin_created_cb_handler, /*_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED*/ }; static void _player_event_job_function(_player_cb_data *data) @@ -1128,27 +1110,12 @@ int player_create(player_h *player) ret = wait_for_cb_return(api, pc->cb_info, &ret_buf, CALLBACK_TIME_OUT); if (ret == PLAYER_ERROR_NONE) { intptr_t module_addr; - char stream_path[MUSE_MSG_MAX_LENGTH] = {0, }; *player = (player_h)pc; if (player_msg_get_type(module_addr, ret_buf, POINTER)) { pc->cb_info->data_fd = muse_core_client_new_data_ch(); muse_core_send_client_addr(module_addr, pc->cb_info->data_fd); LOGD("Data channel fd %d, muse module addr %p", pc->cb_info->data_fd, module_addr); } - - if (mm_player_mused_create(&INT_HANDLE(pc)) != MM_ERROR_NONE) { - LOGE("create failure"); - ret = PLAYER_ERROR_INVALID_OPERATION; - goto ErrorExit; - } - mm_player_get_state_timeout(INT_HANDLE(pc), &SERVER_TIMEOUT(pc), TRUE); - SERVER_TIMEOUT(pc) += CALLBACK_TIME_OUT; - if (player_msg_get_string(stream_path, ret_buf)) { - LOGD("shmsrc stream path : %s", stream_path); - if (mm_player_set_shm_stream_path(INT_HANDLE(pc), stream_path) - != MM_ERROR_NONE) - goto ErrorExit; - } } else goto ErrorExit; @@ -1183,13 +1150,10 @@ int player_destroy(player_h player) player_msg_send(api, pc, ret_buf, ret); - if(mm_player_mused_unset_evas_object_cb(INT_HANDLE(pc)) != MM_ERROR_NONE) + if(player_unset_evas_object_cb(player) != MM_ERROR_NONE) LOGW("fail to unset evas object callback"); if (CALLBACK_INFO(pc)) { - if (mm_player_mused_destroy(INT_HANDLE(pc)) != MM_ERROR_NONE) - ret = PLAYER_ERROR_INVALID_OPERATION; - _player_event_queue_destroy(CALLBACK_INFO(pc)); tbm_bufmgr_deinit(TBM_BUFMGR(pc)); @@ -1210,7 +1174,6 @@ int player_prepare_async(player_h player, player_prepared_cb callback, void *use muse_player_api_e api = MUSE_PLAYER_API_PREPARE_ASYNC; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; - int is_streaming = 0; LOGD("ENTER"); @@ -1223,12 +1186,6 @@ int player_prepare_async(player_h player, player_prepared_cb callback, void *use } player_msg_send(api, pc, ret_buf, ret); - if (ret == PLAYER_ERROR_NONE) { - player_msg_get(is_streaming, ret_buf); - IS_STREAMING_CONTENT(pc) = is_streaming; - mm_player_get_state_timeout(INT_HANDLE(pc), &SERVER_TIMEOUT(pc), is_streaming); - } - g_free(ret_buf); return ret; } @@ -1240,25 +1197,11 @@ int player_prepare(player_h player) muse_player_api_e api = MUSE_PLAYER_API_PREPARE; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; - char caps[MUSE_MSG_MAX_LENGTH] = {0, }; - int is_streaming = 0; LOGD("ENTER"); player_msg_send(api, pc, ret_buf, ret); - if (CALLBACK_INFO(pc)) - mm_player_set_attribute(INT_HANDLE(pc), NULL, "display_visible", 1, NULL); - - if (ret == PLAYER_ERROR_NONE) { - player_msg_get(is_streaming, ret_buf); - IS_STREAMING_CONTENT(pc) = is_streaming; - mm_player_get_state_timeout(INT_HANDLE(pc), &SERVER_TIMEOUT(pc), is_streaming); - player_msg_get_string(caps, ret_buf); - if (strlen(caps) > 0 && mm_player_mused_realize(INT_HANDLE(pc), caps) != MM_ERROR_NONE) - ret = PLAYER_ERROR_INVALID_OPERATION; - } - g_free(ret_buf); return ret; } @@ -1276,8 +1219,6 @@ int player_unprepare(player_h player) if (!CALLBACK_INFO(pc)) return PLAYER_ERROR_INVALID_STATE; - mm_player_mused_pre_unrealize(INT_HANDLE(pc)); - player_msg_send(api, pc, ret_buf, ret); if (ret == PLAYER_ERROR_NONE) { set_null_user_cb_lock(pc->cb_info, _PLAYER_EVENT_TYPE_SEEK); @@ -1286,9 +1227,6 @@ int player_unprepare(player_h player) _player_deinit_memory_buffer(pc); } - if (mm_player_mused_unrealize(INT_HANDLE(pc)) != MM_ERROR_NONE) - ret = PLAYER_ERROR_INVALID_OPERATION; - g_free(ret_buf); return ret; } @@ -1748,12 +1686,12 @@ int player_set_display(player_h player, player_display_type_e type, player_displ Evas_Object *obj = NULL; const char *object_type = NULL; #ifdef HAVE_WAYLAND - void *set_handle = NULL; - void *set_wl_display = NULL; - Ecore_Wl_Window *wl_window = NULL; wl_win_msg_type wl_win; char *wl_win_msg = (char *)&wl_win; - MMPlayerPipelineType mmPipelineType = MM_PLAYER_PIPELINE_CLIENT; + unsigned int parent_id; + struct wl_surface *wl_surface; + struct wl_display *wl_display; + Ecore_Wl_Window *wl_window = NULL; #else unsigned int xhandle = 0; #endif @@ -1774,21 +1712,35 @@ int player_set_display(player_h player, player_display_type_e type, player_displ wl_win.type = type; 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(mm_player_mused_set_evas_object_cb(INT_HANDLE(pc), obj) != MM_ERROR_NONE) + + if(player_set_evas_object_cb(player, obj) != MM_ERROR_NONE){ LOGW("fail to set evas object callback"); + } wl_window = elm_win_wl_window_get(obj); - set_handle = (void *)ecore_wl_window_surface_get(wl_window); + wl_surface = (struct wl_surface *) ecore_wl_window_surface_get(wl_window); /* get wl_display */ - set_wl_display = (void *)ecore_wl_display_get(); - - LOGI("xid %d, surface_id %d, surface %p(%d), win_id %d", - elm_win_xwindow_get(obj), - ecore_wl_window_surface_id_get(wl_window), - ecore_wl_window_surface_get(wl_window), - *(int *)ecore_wl_window_surface_get(wl_window), - ecore_wl_window_id_get(wl_window)); + wl_display = (struct wl_display *) ecore_wl_display_get(); + + if (!pc->wlclient) { + ret = _wlclient_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); + parent_id = _wlclient_get_wl_window_parent_id (pc->wlclient, wl_surface, wl_display); + LOGD ("parent_id = %d", parent_id); + wl_win.parent_id = parent_id; + LOGD ("wl_win.parent_id = %d", wl_win.parent_id); + } + if (pc->wlclient) { + g_free(pc->wlclient); + pc->wlclient = NULL; + } #else /* x window overlay surface */ LOGI("overlay surface type"); @@ -1803,7 +1755,6 @@ int player_set_display(player_h player, player_display_type_e type, player_displ 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); - set_handle = display; } #endif else @@ -1812,7 +1763,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ return PLAYER_ERROR_INVALID_PARAMETER; } #ifdef HAVE_WAYLAND - else { + else { /* PLAYER_DISPLAY_TYPE_NONE */ LOGI("Wayland surface type is NONE"); wl_win.type = type; wl_win.wl_window_x = 0; @@ -1821,28 +1772,6 @@ int player_set_display(player_h player, player_display_type_e type, player_displ wl_win.wl_window_height = 0; } player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char)); - - if (CALLBACK_INFO(pc)) { - ret = mm_player_set_attribute(INT_HANDLE(pc), NULL, - "display_surface_type", type, - "pipeline_type", mmPipelineType, - "wl_display", set_wl_display, - sizeof(void *), - "display_overlay", set_handle, - sizeof(display), (char *)NULL); - if (ret != MM_ERROR_NONE) - LOGE("Failed to display surface change :%d", ret); - - ret = mm_player_set_attribute(INT_HANDLE(pc), NULL, - "wl_window_render_x", wl_win.wl_window_x, - "wl_window_render_y", wl_win.wl_window_y, - "wl_window_render_width", wl_win.wl_window_width, - "wl_window_render_height", wl_win.wl_window_height, - (char *)NULL); - - if (ret != MM_ERROR_NONE) - LOGE("Failed to set wl_window render rectangle :%d", ret); - } #else player_msg_send2(api, pc, ret_buf, ret, INT, type, INT, xhandle); #endif @@ -1860,11 +1789,6 @@ int player_set_display_mode(player_h player, player_display_mode_e mode) char *ret_buf = NULL; LOGD("ENTER"); - - ret = mm_player_set_attribute(INT_HANDLE(pc), NULL, "display_method", mode, NULL); - if (ret != MM_ERROR_NONE) - return __player_convert_error_code(ret, (char *)__FUNCTION__); - player_msg_send1(api, pc, ret_buf, ret, INT, mode); g_free(ret_buf); return ret; @@ -1913,11 +1837,6 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat char *ret_buf = NULL; LOGD("ENTER"); - - ret = mm_player_set_attribute(INT_HANDLE(pc), NULL, "display_rotation", rotation, NULL); - if (ret != MM_ERROR_NONE) - return __player_convert_error_code(ret, (char *)__FUNCTION__); - player_msg_send1(api, pc, ret_buf, ret, INT, rotation); g_free(ret_buf); return ret; @@ -1946,16 +1865,17 @@ int player_set_display_visible(player_h player, bool visible) { PLAYER_INSTANCE_CHECK(player); int ret = PLAYER_ERROR_NONE; +#if 0 player_cli_s *pc = (player_cli_s *)player; int value = 0; LOGD("ENTER"); - if (visible == TRUE) value = 1; ret = mm_player_set_attribute(INT_HANDLE(pc), NULL, "display_visible", value, NULL); if (ret != MM_ERROR_NONE) return __player_convert_error_code(ret, (char *)__FUNCTION__); +#endif return ret; } @@ -2353,15 +2273,10 @@ int player_set_progressive_download_path(player_h player, const char *path) muse_player_api_e api = MUSE_PLAYER_API_SET_PROGRESSIVE_DOWNLOAD_PATH; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; - int type = _PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED; LOGD("ENTER"); player_msg_send1(api, pc, ret_buf, ret, STRING, path); - if (ret == PLAYER_ERROR_NONE) { - pc->cb_info->user_cb[type] = dummy_user_callback; - pc->cb_info->user_data[type] = NULL; - } g_free(ret_buf); return ret; } diff --git a/client/src/player2_internal.c b/client/src/player2_internal.c index e7329b5..30c67f8 100644 --- a/client/src/player2_internal.c +++ b/client/src/player2_internal.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "player2_private.h" #include "player_msg_private.h" #include "player_internal.h" @@ -165,3 +166,78 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream g_free(ret_buf); return ret; } + +static void __evas_resize_cb (void *data, Evas *e, Evas_Object *eo, void *event_info) +{ + + player_cli_s *pc = (player_cli_s *)data; + wl_win_msg_type wl_win; + char *wl_win_msg = (char *)&wl_win; + char *ret_buf = NULL; + muse_player_api_e api = MUSE_PLAYER_API_RESIZE_VIDEO_RENDER_RECT; + int ret = PLAYER_ERROR_NONE; + LOGD("ret =%d",ret); + + evas_object_geometry_get(eo, &wl_win.wl_window_x, &wl_win.wl_window_y, &wl_win.wl_window_width, &wl_win.wl_window_height); + LOGD("get window rectangle: x(%d) y(%d) width(%d) height(%d)", + wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height); + + wl_win.type = 0; /*init but not use */ + wl_win.parent_id = 0; /*init but not use */ + + player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char)); + + g_free(ret_buf); + return; + +} + +static void __evas_del_cb (void *data, Evas *e, Evas_Object *eo, void *event_info) +{ + + player_cli_s *pc = (player_cli_s *)data; + + evas_object_event_callback_del (eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); + evas_object_event_callback_del (eo, EVAS_CALLBACK_DEL, __evas_del_cb); + + LOGD("evas callback del %p", eo); + pc->have_evas_callback = FALSE; + + return; +} + +int player_set_evas_object_cb(player_h player, Evas_Object * eo) +{ + + PLAYER_INSTANCE_CHECK(player); + return_val_if_fail(eo != NULL, MM_ERROR_INVALID_ARGUMENT); + + player_cli_s *pc = (player_cli_s *)player; + + if(pc->have_evas_callback && pc->eo == eo) { + LOGW("evas object had callback already %p", pc->eo); + return MM_ERROR_UNKNOWN; + } + pc->eo = eo; + evas_object_event_callback_add (eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb, player); + evas_object_event_callback_add (eo, EVAS_CALLBACK_DEL, __evas_del_cb, player); + LOGD("evas callback add %p", pc->eo); + pc->have_evas_callback = TRUE; + + return MM_ERROR_NONE; +} + +int player_unset_evas_object_cb(player_h player) +{ + PLAYER_INSTANCE_CHECK(player); + player_cli_s *pc = (player_cli_s *)player; + return_val_if_fail(pc->eo != NULL, MM_ERROR_INVALID_ARGUMENT); + + evas_object_event_callback_del (pc->eo, EVAS_CALLBACK_RESIZE, __evas_resize_cb); + evas_object_event_callback_del (pc->eo, EVAS_CALLBACK_DEL, __evas_del_cb); + LOGD("evas callback del %p", pc->eo); + pc->eo = NULL; + pc->have_evas_callback = FALSE; + + return MM_ERROR_NONE; +} diff --git a/client/src/player2_wayland.c b/client/src/player2_wayland.c new file mode 100644 index 0000000..8bed108 --- /dev/null +++ b/client/src/player2_wayland.c @@ -0,0 +1,150 @@ +/* +* 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 "player2_wayland.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 *parent_id = data; + + *parent_id = id; + + LOGD("[CLIENT] got parent_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 _wlclient_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 _wlclient_get_wl_window_parent_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 parent_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 parent_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, &parent_id); + wl_display_roundtrip(wlclient->display); + goto_if_fail (parent_id > 0, failed); + + _wlclient_finalize(wlclient); + + return parent_id; + +failed: + LOGE ("Failed to get parent_id"); + + return 0; +} + +void _wlclient_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/include/player2_private.h b/include/player2_private.h index 1843c9c..d8a68b5 100644 --- a/include/player2_private.h +++ b/include/player2_private.h @@ -17,11 +17,12 @@ #ifndef __TIZEN_MEDIA_PLAYER_2_PRIVATE_H__ #define __TIZEN_MEDIA_PLAYER_2_PRIVATE_H__ #include +#include #include "player.h" #include "mm_types.h" #include "muse_core.h" #include "muse_core_ipc.h" - +#include "player2_wayland.h" #ifdef __cplusplus extern "C" { #endif @@ -84,6 +85,7 @@ typedef enum { MUSE_PLAYER_API_GET_DISPLAY_ROTATION, MUSE_PLAYER_API_SET_DISPLAY_VISIBLE, MUSE_PLAYER_API_IS_DISPLAY_VISIBLE, + MUSE_PLAYER_API_RESIZE_VIDEO_RENDER_RECT, MUSE_PLAYER_API_GET_CONTENT_INFO, MUSE_PLAYER_API_GET_CODEC_INFO, MUSE_PLAYER_API_GET_AUDIO_STREAM_INFO, @@ -256,6 +258,9 @@ 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; + gboolean have_evas_callback; } player_cli_s; /* Internal handle */ @@ -281,45 +286,8 @@ int _get_api_timeout(player_cli_s *pc, muse_player_api_e api); int wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out); int player_sound_register(player_h player, int pid); int player_is_streaming(player_h player, bool *is_streaming); - -/** - * @brief Called when the video sink bin is crated. - * @since_tizen 3.0 - * @param[out] caps video sink current caps - * @param[out ] user_data The user data passed from the callback registration function - * @see player_set_vidoe_bin_created_cb() - * @see player_unset_vidoe_bin_created_cb() - */ -typedef void (*player_video_bin_created_cb)(const char *caps, void *user_data); - -/** - * @brief Registers a callback function to be invoked when video sink bin is created. - * @since_tizen 3.0 - * @param[in] player The handle to the media player - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * @return @c 0 on success, - * otherwise a negative error value - * @retval #PLAYER_ERROR_NONE Successful - * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter - * @post player_video_bin_created_cb() will be invoked. - * @see player_unset_vidoe_bin_created_cb() - */ -int player_set_video_bin_created_cb(player_h player, player_video_bin_created_cb callback, void *user_data); - -/** - * @brief Unregisters a callback function to be invoked when video sink bin is created. - * @since_tizen 3.0 - * @param[in] player The handle to the media player - * @return @c 0 on success, - * otherwise a negative error value - * @retval #PLAYER_ERROR_NONE Successful - * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter - * @post player_video_bin_created_cb() will be invoked. - * @see player_unset_vidoe_bin_created_cb() - */ -int player_unset_video_bin_created_cb(player_h player); - +int player_set_evas_object_cb(player_h player, Evas_Object * eo); +int player_unset_evas_object_cb(player_h player); #ifdef __cplusplus } diff --git a/include/player2_wayland.h b/include/player2_wayland.h new file mode 100644 index 0000000..b7b40ae --- /dev/null +++ b/include/player2_wayland.h @@ -0,0 +1,47 @@ +/* +* 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_2_WLCLIENT_H__ +#define __TIZEN_MEDIA_PLAYER_2_WLCLIENT_H__ +#include +#include +#include +#include +#include "mm_types.h" +#include "mm_debug.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 _wlclient_create (wl_client ** wlclient); +int _wlclient_get_wl_window_parent_id (wl_client * wlclient, struct wl_surface *surface, struct wl_display *display); +void _wlclient_finalize (wl_client * wlclient); + +#ifdef __cplusplus +} +#endif + +#endif /* __TIZEN_MEDIA_PLAYER_2_WLCLIENT_H__ */ diff --git a/include/player_msg_private.h b/include/player_msg_private.h index 931ebb5..1246236 100644 --- a/include/player_msg_private.h +++ b/include/player_msg_private.h @@ -51,7 +51,7 @@ typedef struct _player_push_media_msg_type{ typedef struct { int type; - intptr_t surface; + unsigned int parent_id; int wl_window_x; int wl_window_y; int wl_window_width; diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 35e3bde..4591964 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -17,6 +17,7 @@ BuildRequires: pkgconfig(mm-player) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(legacy-capi-media-player) +BuildRequires: pkgconfig(tizen-extension-client) BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(ecore) diff --git a/src/player_msg_dispatcher.c b/src/player_msg_dispatcher.c index 3ff8612..149f058 100644 --- a/src/player_msg_dispatcher.c +++ b/src/player_msg_dispatcher.c @@ -71,7 +71,8 @@ typedef struct { * define for lagacy API for mused */ #ifdef HAVE_WAYLAND -extern int player_set_display_wl_for_mused(player_h player, player_display_type_e type, intptr_t surface, int x, int y, int w, int h); +extern int player_set_display_wl_for_mused(player_h player, player_display_type_e type, int parent_id, int x, int y, int w, int h); +extern int player_resize_video_render_rect(player_h player, int x, int y, int w, int h); #else extern int player_set_display_for_mused(player_h player, player_display_type_e type, unsigned int xhandle); #endif @@ -600,7 +601,6 @@ static void (*set_callback_func[_PLAYER_EVENT_TYPE_NUM])(player_h player, void * _set_media_stream_audio_seek_cb, /*_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK*/ NULL, /*_PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED*/ _set_video_stream_changed_cb, /*_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED*/ - NULL, /*_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED*/ }; static int player_disp_set_callback(muse_module_h module) @@ -1003,7 +1003,7 @@ static int player_disp_set_display(muse_module_h module) #ifdef HAVE_WAYLAND player_msg_get_array(wl_win_msg, muse_core_client_get_msg(module)); - ret = player_set_display_wl_for_mused((player_h)handle, wl_win.type, wl_win.surface, wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height); + ret = player_set_display_wl_for_mused((player_h)handle, wl_win.type, wl_win.parent_id, wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height); #else player_msg_get(type, muse_core_client_get_msg(module)); player_msg_get(xhandle, muse_core_client_get_msg(module)); @@ -1281,7 +1281,27 @@ static int player_disp_is_display_visible(muse_module_h module) return ret; } +#ifdef HAVE_WAYLAND +static int player_disp_resize_video_render_rect(muse_module_h module) +{ + int ret = -1; + intptr_t handle; + muse_player_api_e api = MUSE_PLAYER_API_RESIZE_VIDEO_RENDER_RECT; + + wl_win_msg_type wl_win; + char *wl_win_msg = (char *)&wl_win; + handle = muse_core_ipc_get_handle(module); + + player_msg_get_array(wl_win_msg, muse_core_client_get_msg(module)); + + ret = player_resize_video_render_rect((player_h)handle, wl_win.wl_window_x, wl_win.wl_window_y, wl_win.wl_window_width, wl_win.wl_window_height); + player_msg_return(api, ret, module); + + return ret; + +} +#endif static int player_disp_get_content_info(muse_module_h module) { int ret = -1; @@ -1589,17 +1609,6 @@ static int player_disp_set_subtitle_position_offset(muse_module_h module) return ret; } -static void _video_bin_created_cb(const char *caps, void *user_data) -{ - muse_module_h module = (muse_module_h)user_data; - muse_player_cb_e api = MUSE_PLAYER_CB_EVENT; - _player_event_e ev = _PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED; - - LOGD("Enter"); - - player_msg_event1(api, ev, module, STRING, caps); -} - static int player_disp_set_progressive_download_path(muse_module_h module) { int ret = -1; @@ -1611,9 +1620,6 @@ static int player_disp_set_progressive_download_path(muse_module_h module) player_msg_get_string(path, muse_core_client_get_msg(module)); ret = player_set_progressive_download_path((player_h)handle, path); - if (ret == PLAYER_ERROR_NONE) - player_set_video_bin_created_cb((player_h)handle, _video_bin_created_cb, module); - player_msg_return(api, ret, module); return ret; @@ -2262,6 +2268,7 @@ int (*dispatcher[MUSE_PLAYER_API_MAX])(muse_module_h module) = { player_disp_get_display_rotation, /* MUSE_PLAYER_API_GET_DISPLAY_ROTATION */ player_disp_set_display_visible, /* MUSE_PLAYER_API_SET_DISPLAY_VISIBLE */ player_disp_is_display_visible, /* MUSE_PLAYER_API_IS_DISPLAY_VISIBLE */ + player_disp_resize_video_render_rect, /* MUSE_PLAYER_API_RESIZE_VIDEO_RENDER_RECT */ player_disp_get_content_info, /* MUSE_PLAYER_API_GET_CONTENT_INFO */ player_disp_get_codec_info, /* MUSE_PLAYER_API_GET_CODEC_INFO */ player_disp_get_audio_stream_info, /* MUSE_PLAYER_API_GET_AUDIO_STREAM_INFO */ -- 2.7.4