From 3987160bb5798be176197ac0d66bf275f01fee5b Mon Sep 17 00:00:00 2001 From: Hyunil Date: Tue, 30 Aug 2016 13:54:25 +0900 Subject: [PATCH] Add player_set_display_roi_area API Change-Id: I69a93857610609118425b0fec7c606728e9eaee3 Signed-off-by: Hyunil --- packaging/capi-media-player.spec | 2 +- src/player.c | 28 +++++++++++++++++++++++ test/player_test.c | 48 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index faea983..14a5229 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.17 +Version: 0.3.18 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index 6d75185..44c1695 100644 --- a/src/player.c +++ b/src/player.c @@ -2219,6 +2219,34 @@ int player_get_display_mode(player_h player, player_display_mode_e * pmode) return ret; } + +int player_set_display_roi_area(player_h player, int x, int y, int width, int height) +{ + PLAYER_INSTANCE_CHECK(player); + int ret = PLAYER_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; + + LOGD("ENTER"); +#ifdef TIZEN_FEATURE_EVAS_RENDERER + if (EVAS_HANDLE(pc)) { + ret = mm_evas_renderer_set_roi_area(EVAS_HANDLE(pc), x, y, width, height); + return ret; + } +#endif + wl_win.wl_window_x = x; + wl_win.wl_window_y = y; + wl_win.wl_window_width = width; + wl_win.wl_window_height = height; + + player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char)); + g_free(ret_buf); + return ret; +} + int player_set_playback_rate(player_h player, float rate) { PLAYER_INSTANCE_CHECK(player); diff --git a/test/player_test.c b/test/player_test.c index 557617e..1636059 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -75,6 +75,7 @@ enum { CURRENT_STATUS_LOOPING, CURRENT_STATUS_DISPLAY_SURFACE_CHANGE, CURRENT_STATUS_DISPLAY_MODE, + CURRENT_STATUS_DISPLAY_DST_ROI, CURRENT_STATUS_DISPLAY_ROTATION, CURRENT_STATUS_DISPLAY_VISIBLE, CURRENT_STATUS_SUBTITLE_FILENAME, @@ -1559,6 +1560,12 @@ static void get_display_mode() g_print(" ==> [Player_Test] Display mode: [%d ] \n", mode); } +static void set_display_roi_area(int x, int y, int width, int height) +{ + //player_set_display_roi_area(g_player[0], x, y, width, height); + g_print(" ==> [Player_Test] Display roi area: [x(%d) y(%d) width(%d) height(%d)] \n", x, y, width, height); +} + static void set_display_rotation(int rotation) { if (player_set_display_rotation(g_player[0], rotation) != PLAYER_ERROR_NONE) @@ -1797,6 +1804,9 @@ void _interpret_main_menu(char *cmd) g_print("memory playback = %d\n", g_memory_playback); } else if (strncmp(cmd, "ds", 2) == 0) { g_menu_state = CURRENT_STATUS_DISPLAY_SURFACE_CHANGE; + } else if (strncmp(cmd, "dr", 2) == 0) { + g_print("now, PLAYER_DISPLAY_MODE_DST_ROI(display mode) is set\n"); + g_menu_state = CURRENT_STATUS_DISPLAY_DST_ROI; } else if (strncmp(cmd, "nb", 2) == 0) { g_menu_state = CURRENT_STATUS_HANDLE_NUM; } else if (strncmp(cmd, "tr", 2) == 0) { @@ -1860,6 +1870,7 @@ void display_sub_basic() g_print("[display] v. Set display visible\t"); g_print("w. Get display visible\n"); g_print("[display] ds. Change display surface type\n"); + g_print("[display] dr. set display roi area\n"); g_print("[overlay display] r. Set display mode\t"); g_print("s. Get display mode\n"); g_print("[overlay display] t. Set display Rotation\n"); @@ -1904,6 +1915,8 @@ static void displaymenu() g_print("*** input display surface type.(0: X surface, 1: EVAS surface) \n"); } else if (g_menu_state == CURRENT_STATUS_DISPLAY_MODE) { g_print("*** input display mode value.(0: LETTER BOX, 1: ORIGIN SIZE, 2: FULL_SCREEN, 3: CROPPED_FULL, 4: ORIGIN_OR_LETTER) \n"); + } else if (g_menu_state == CURRENT_STATUS_DISPLAY_DST_ROI) { + g_print("*** input display roi value sequentially.(x, y, w, h)\n"); } else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROTATION) { g_print("*** input display rotation value.(0: NONE, 1: 90, 2: 180, 3: 270, 4:F LIP_HORZ, 5: FLIP_VERT ) \n"); } else if (g_menu_state == CURRENT_STATUS_DISPLAY_VISIBLE) { @@ -2044,6 +2057,41 @@ static void interpret(char *cmd) reset_menu_state(); } break; + case CURRENT_STATUS_DISPLAY_DST_ROI: + { + int value = atoi(cmd); + static int x = 0; + static int y = 0; + static int w = 0; + static int h = 0; + static int cnt = 0; + + set_display_mode(PLAYER_DISPLAY_MODE_DST_ROI); + switch (cnt) { + case 0: + x = value; + cnt++; + break; + case 1: + y = value; + cnt++; + break; + case 2: + w = value; + cnt++; + break; + case 3: + cnt = 0; + h = value; + set_display_roi_area(x, y, w, h); + x = y = w = h = 0; + reset_menu_state(); + break; + default: + break; + } + } + break; case CURRENT_STATUS_DISPLAY_ROTATION: { int rotation = atoi(cmd); -- 2.7.4