PLAYER_DISPLAY_MODE_FULL_SCREEN, /**< full-screen*/
PLAYER_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full-screen*/
PLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER, /**< Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size)*/
+ PLAYER_DISPLAY_MODE_ROI, /**< ROI mode*/
} player_display_mode_e;
int player_set_x11_display_pixmap_error_cb (player_h player, player_x11_pixmap_error_cb callback, void *user_data);
/**
+ * @brief Sets information of ROI
+ * @remarks If current display mode is not #PLAYER_DISPLAY_MODE_ROI, #PLAYER_ERROR_INVALID_OPERATION will be returned.
+ * @param[in] player The handle to media player
+ * @param[in] x The x coordinate of ROI
+ * @param[in] y The y coordinate of ROI
+ * @param[in] w The width of ROI
+ * @param[in] h The height of ROI
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_get_x11_display_roi()
+ */
+int player_set_x11_display_roi (player_h player, int x, int y, int w, int h);
+
+/**
+ * @brief Gets information of ROI
+ * @remarks If current display mode is not #PLAYER_DISPLAY_MODE_ROI, #PLAYER_ERROR_INVALID_OPERATION will be returned.
+ * @param[in] player The handle to media player
+ * @param[out] x The x coordinate of ROI
+ * @param[out] y The y coordinate of ROI
+ * @param[out] w The width of ROI
+ * @param[out] h The height of ROI
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_set_x11_display_roi()
+ */
+int player_get_x11_display_roi (player_h player, int *x, int *y, int *w, int *h);
+
+/**
* @}
*/
Name: capi-media-player
Summary: A Media Player library in Tizen Native API
-Version: 0.1.0
-Release: 60
+Version: 0.1.1
+Release: 0
Group: TO_BE/FILLED_IN
License: TO BE FILLED IN
Source0: %{name}-%{version}.tar.gz
}
}
+int player_set_x11_display_roi (player_h player, int x, int y, int w, int h)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(x >= 0 && y >= 0 && w >= 0 && h >= 0,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER" );
+
+ player_display_mode_e mode;
+ player_s * handle = (player_s *) player;
+
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_method", &mode, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ if (mode != PLAYER_DISPLAY_MODE_ROI)
+ {
+ ret = MM_ERROR_PLAYER_INTERNAL;
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+
+ ret = mm_player_set_attribute(handle->mm_handle, NULL,
+ "display_roi_x", x,
+ "display_roi_y", y,
+ "display_roi_width", w,
+ "display_roi_height", h,
+ (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ return PLAYER_ERROR_NONE;
+ }
+}
+
+int player_get_x11_display_roi (player_h player, int *x, int *y, int *w, int *h)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(x);
+ PLAYER_NULL_ARG_CHECK(y);
+ PLAYER_NULL_ARG_CHECK(w);
+ PLAYER_NULL_ARG_CHECK(h);
+
+ player_display_mode_e mode;
+ player_s * handle = (player_s *) player;
+ int _x = 0;
+ int _y = 0;
+ int _w = 0;
+ int _h = 0;
+
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_method", &mode, (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ if (mode != PLAYER_DISPLAY_MODE_ROI)
+ {
+ ret = MM_ERROR_PLAYER_INTERNAL;
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+
+ ret = mm_player_get_attribute(handle->mm_handle, NULL,
+ "display_roi_x", &_x,
+ "display_roi_y", &_y,
+ "display_roi_width", &_w,
+ "display_roi_height", &_h,
+ (char*)NULL);
+ if(ret != MM_ERROR_NONE)
+ {
+ *x = _x = 0;
+ *y = _y = 0;
+ *w = _w = 0;
+ *h = _h = 0;
+ return __convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ *x = _x;
+ *y = _y;
+ *w = _w;
+ *h = _h;
+ return PLAYER_ERROR_NONE;
+ }
+}
+
int player_enable_evas_display_scaling(player_h player, bool enable)
{
PLAYER_INSTANCE_CHECK(player);
CURRENT_STATUS_DISPLAY_MODE,
CURRENT_STATUS_DISPLAY_ROTATION,
CURRENT_STATUS_DISPLAY_VISIBLE,
+ CURRENT_STATUS_DISPLAY_ROI,
CURRENT_STATUS_SUBTITLE_FILENAME
};
g_print(" ==> [Player_Test] X11 Display Visible = %d\n", *visible);
}
+static void set_display_roi(int x, int y, int w, int h)
+{
+ if ( player_set_x11_display_roi(g_player, x, y, w, h) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to player_set_x11_display_roi\n");
+ } else {
+ g_print(" ==> [Player_Test] set X11 Display ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h);
+ }
+}
+
+static void get_display_roi()
+{
+ int x = 0;
+ int y = 0;
+ int w = 0;
+ int h = 0;
+ if ( player_get_x11_display_roi(g_player, &x, &y, &w, &h) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to player_get_x11_display_roi\n");
+ } else {
+ g_print(" ==> [Player_Test] got X11 Display ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h);
+ }
+}
+
static void input_subtitle_filename(char *subtitle_filename)
{
int len = strlen(subtitle_filename);
bool visible;
get_display_visible(&visible);
}
+ else if (strncmp(cmd, "x", 1) == 0 )
+ {
+ g_menu_state = CURRENT_STATUS_DISPLAY_ROI;
+ }
+ else if (strncmp(cmd, "y", 1) == 0 )
+ {
+ get_display_roi();
+ }
else if (strncmp(cmd, "A", 1) == 0 )
{
- g_menu_state=CURRENT_STATUS_SUBTITLE_FILENAME;
+ g_menu_state = CURRENT_STATUS_SUBTITLE_FILENAME;
}
else if (strncmp(cmd, "C", 1) == 0 )
{
g_print("t. Set display Rotation\t");
g_print("u. Get display Rotation\n");
g_print("[x display] v. Set display visible\t");
- g_print("w. Get display visible\n");
+ g_print("w. Get display visible\t");
+ g_print("x. Set ROI\t");
+ g_print("y. Get ROI\n");
g_print("[subtitle] A. Set subtitle path\n");
g_print("[Video Capture] C. Capture \n");
g_print("[Audio Frame Decode] D. Decoding Audio Frame E. Decoding Video Frame \n");
{
g_print("*** input display visible value.(0: HIDE, 1: SHOW) \n");
}
+ else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROI)
+ {
+ g_print("*** input display roi value sequencially.(x, y, w, h)\n");
+ }
else if (g_menu_state == CURRENT_STATUS_SUBTITLE_FILENAME)
{
g_print(" *** input subtitle file path.\n");
reset_menu_state();
}
break;
+ case CURRENT_STATUS_DISPLAY_ROI:
+ {
+ int value = atoi(cmd);
+ static int roi_x = 0;
+ static int roi_y = 0;
+ static int roi_w = 0;
+ static int roi_h = 0;
+ static int cnt = 0;
+ switch (cnt) {
+ case 0:
+ roi_x = value;
+ cnt++;
+ break;
+ case 1:
+ roi_y = value;
+ cnt++;
+ break;
+ case 2:
+ roi_w = value;
+ cnt++;
+ break;
+ case 3:
+ cnt = 0;
+ roi_h = value;
+ set_display_roi(roi_x, roi_y, roi_w, roi_h);
+ roi_x = roi_y = roi_w = roi_h = 0;
+ reset_menu_state();
+ break;
+ default:
+ break;
+ }
+ }
+ break;
case CURRENT_STATUS_SUBTITLE_FILENAME:
{
input_subtitle_filename(cmd);