From 19b8b190515ef65d5afff23149bbb98ca823c314 Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Wed, 28 Sep 2016 19:47:52 +0900 Subject: [PATCH] [v0.3.26] keep display value until evas handle is created Change-Id: If6e17798c26edb2ea71b61e36cda3887bf025a7a --- include/player_private.h | 17 ++++++++++-- packaging/capi-media-player.spec | 2 +- src/player.c | 56 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/include/player_private.h b/include/player_private.h index 7aebbe8..442fab3 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -88,6 +88,18 @@ typedef struct { tbm_surface_h tsurf; } player_tsurf_info_t; +typedef struct { + void *handle; + gboolean visible; + player_display_rotation_e rotation; + player_display_mode_e mode; + gboolean update_needed; + int roi_x; + int roi_y; + int roi_w; + int roi_h; +} player_evas_info_s; + typedef struct _callback_cb_info { GThread *thread; gint running; @@ -104,7 +116,7 @@ typedef struct _callback_cb_info { msg_buff_s buff; player_event_queue event_queue; media_format_h pkt_fmt; - void *evas_info; + player_evas_info_s *evas_info; tbm_bufmgr bufmgr; tbm_fd tfd; /* for player_get_album_art*/ GList *tsurf_list; /* player_tsurf_info_t */ @@ -136,7 +148,8 @@ typedef struct _player_cli_s { /* TBM buffer manager */ #define TBM_BUFMGR(h) (CALLBACK_INFO(h)->bufmgr) /* evas display handle */ -#define EVAS_HANDLE(h) ((h)->cb_info->evas_info) +#define EVAS_INFO(h) ((h)->cb_info->evas_info) +#define EVAS_HANDLE(h) (EVAS_INFO(h)->handle) /* server tbm bo */ #define SERVER_TBM_BO(h) ((h)->server.bo) diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index b7be8df..aed429a 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.25 +Version: 0.3.26 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index 1938623..fea97d7 100644 --- a/src/player.c +++ b/src/player.c @@ -1631,6 +1631,13 @@ int player_create(player_h * player) } else goto ERROR; + 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 = -1; + pc->cb_info->bufmgr = tbm_bufmgr_init(-1); pc->push_media_stream = FALSE; @@ -1675,6 +1682,9 @@ int player_destroy(player_h player) } #endif + if (EVAS_INFO(pc)) + g_free(pc->cb_info->evas_info); + if (CALLBACK_INFO(pc)) { __player_remove_tsurf_list(pc); _player_remove_idle_event_all(CALLBACK_INFO(pc)); @@ -2071,6 +2081,7 @@ int player_start(player_h player) } } #endif + player_msg_send(api, pc, ret_buf, ret); g_free(ret_buf); @@ -2364,13 +2375,41 @@ int player_set_display(player_h player, player_display_type_e type, player_displ LOGW("evas client already exists"); if (mm_evas_renderer_destroy(&EVAS_HANDLE(pc)) != MM_ERROR_NONE) LOGW("fail to unset evas client"); + /* need to set display information again to new handle */ + EVAS_INFO(pc)->update_needed = TRUE; } if (mm_evas_renderer_create(&EVAS_HANDLE(pc), obj) != MM_ERROR_NONE) { LOGW("fail to set evas client"); return PLAYER_ERROR_INVALID_OPERATION; } - if (player_set_media_packet_video_frame_decoded_cb(player, mm_evas_renderer_write, (void *)EVAS_HANDLE(pc)) != PLAYER_ERROR_NONE) + /* before evas handle is created, user could set display information */ + if (EVAS_INFO(pc)->update_needed) { + LOGW("set evas information mode %d, rotation %d, visible %d", EVAS_INFO(pc)->mode, + EVAS_INFO(pc)->rotation, EVAS_INFO(pc)->visible); + ret = mm_evas_renderer_set_geometry(EVAS_HANDLE(pc), EVAS_INFO(pc)->mode); + ret |= mm_evas_renderer_set_rotation(EVAS_HANDLE(pc), EVAS_INFO(pc)->rotation); + /* if user didn't set visible, it will be set to true in player_start */ + if (EVAS_INFO(pc)->visible != -1) + ret |= mm_evas_renderer_set_visible(EVAS_HANDLE(pc), (EVAS_INFO(pc)->visible == 1) ? true : false); + if (ret != MM_ERROR_NONE) { + LOGW("fail to set evas information"); + return PLAYER_ERROR_INVALID_OPERATION; + } + + if (EVAS_INFO(pc)->mode == PLAYER_DISPLAY_MODE_DST_ROI) { + LOGW("set roi (%d, %d) %d*%d", EVAS_INFO(pc)->roi_x, EVAS_INFO(pc)->roi_y, + EVAS_INFO(pc)->roi_w, EVAS_INFO(pc)->roi_h); + ret = mm_evas_renderer_set_roi_area(EVAS_HANDLE(pc), EVAS_INFO(pc)->roi_x, EVAS_INFO(pc)->roi_y, + EVAS_INFO(pc)->roi_w, EVAS_INFO(pc)->roi_h); + if (ret != MM_ERROR_NONE) + return PLAYER_ERROR_INVALID_OPERATION; + } + EVAS_INFO(pc)->update_needed = FALSE; + } + + ret = player_set_media_packet_video_frame_decoded_cb(player, mm_evas_renderer_write, (void *)EVAS_HANDLE(pc)); + if (ret != PLAYER_ERROR_NONE) LOGW("fail to set decoded callback"); } #endif @@ -2404,6 +2443,9 @@ int player_set_display_mode(player_h player, player_display_mode_e mode) return PLAYER_ERROR_INVALID_OPERATION; else return PLAYER_ERROR_NONE; + } else { + EVAS_INFO(pc)->mode = mode; + EVAS_INFO(pc)->update_needed = TRUE; } #endif player_msg_send1(api, pc, ret_buf, ret, INT, mode); @@ -2466,6 +2508,12 @@ int player_set_display_roi_area(player_h player, int x, int y, int width, int he 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.wl_window_x = x; @@ -2510,6 +2558,9 @@ int player_set_display_rotation(player_h player, player_display_rotation_e rotat return PLAYER_ERROR_INVALID_OPERATION; else return PLAYER_ERROR_NONE; + } else { + EVAS_INFO(pc)->rotation = rotation; + EVAS_INFO(pc)->update_needed = TRUE; } #endif player_msg_send1(api, pc, ret_buf, ret, INT, rotation); @@ -2564,6 +2615,9 @@ int player_set_display_visible(player_h player, bool visible) return PLAYER_ERROR_INVALID_OPERATION; else return PLAYER_ERROR_NONE; + } else { + EVAS_INFO(pc)->visible = visible ? 1 : 0; + EVAS_INFO(pc)->update_needed = TRUE; } #endif -- 2.7.4