[VPR-306/ACR-1275] Add new API to set/get the video roi area 06/188006/5
authorHyunil <hyunil46.park@samsung.com>
Thu, 30 Aug 2018 08:19:19 +0000 (17:19 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Fri, 31 Aug 2018 01:09:45 +0000 (01:09 +0000)
Change-Id: I6df211d6ad036a8662627467cbac3b45a4544d2d
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
legacy/include/legacy_player.h
legacy/src/legacy_player.c
muse/api.list
muse/src/muse_player.c

index 9556da8..c1527a7 100644 (file)
@@ -1973,6 +1973,57 @@ int legacy_player_unset_retrieve_buffer_cb(player_h player);
 int legacy_player_manage_external_storage_state(player_h player, int id, int state);
 
 /**
+ * @brief Sets the ROI (Region Of Interest) area of the content video source.
+ * @details This function is to set the ROI area of video content to render it
+ *          on #PLAYER_DISPLAY_TYPE_OVERLAY display with current display mode.
+ *          It can be regarded as zooming operation because the selected video area will be rendered fit to the display.
+ * @since_tizen 5.0
+ * @remarks This function requires the ratio value of the each coordinate and size based on the video resolution size
+ *          to consider the dynamic resolution video content.
+ * @remarks The ROI area is valid only in #PLAYER_DISPLAY_TYPE_OVERLAY.
+ * @param[in] player        The handle to the media player
+ * @param[in] scale_x       X coordinate ratio value of the video source area based on the video width size \n
+ *                          Valid range is 0.0~1.0.
+ * @param[in] scale_y       Y coordinate ratio value of the video source area based on the video height size \n
+ *                          Valid range is 0.0~1.0.
+ * @param[in] scale_width   Width ratio value of the video source area based on the video width size \n
+ *                          Valid range is from greater than 0.0 to 1.0.
+ * @param[in] scale_height  Height ratio value of the video source area based on the video height size \n
+ *                          Valid range is from greater than 0.0 to 1.0.
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval  #PLAYER_ERROR_NONE Successful
+ * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see legacy_player_set_display()
+ * @see legacy_player_set_display_mode()
+ * @see legacy_player_get_video_size()
+ * @see legacy_player_get_video_roi_area()
+ */
+int legacy_player_set_video_roi_area(player_h player, double scale_x, double scale_y, double scale_width, double scale_height);
+
+/**
+ * @brief Gets the ROI (Region Of Interest) area of the content video source.
+ * @since_tizen 5.0
+ * @remarks This function gets the ratio value of the each coordinate and size based on the video resolution size.
+ * @remarks The ROI area is valid only in #PLAYER_DISPLAY_TYPE_OVERLAY.
+ * @param[in]  player        The handle to the media player
+ * @param[out] scale_x       The current X coordinate ratio value of the video source area based on the video width size
+ * @param[out] scale_y       The current Y coordinate ratio value of the video source area based on the video height size
+ * @param[out] scale_width   The current width ratio value of the video source area based on the video width size
+ * @param[out] scale_height  The current height ratio value of the video source area based on the video height size
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval  #PLAYER_ERROR_NONE Successful
+ * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see legacy_player_set_display()
+ * @see legacy_player_get_video_size()
+ * @see legacy_player_set_video_roi_area()
+ */
+int legacy_player_get_video_roi_area(player_h player, double *scale_x, double *scale_y, double *scale_width, double *scale_height);
+
+/**
  * @brief Sets the ROI(Region Of Interest) area of display.
  * @since_tizen 3.0
  * @remarks If no display is set, no operation is performed.
index e5a82f0..5a8c2c1 100644 (file)
@@ -2462,6 +2462,42 @@ int legacy_player_get_track_language_code(player_h player, player_stream_type_e
        }
 }
 
+int legacy_player_set_video_roi_area(player_h player, double scale_x,
+               double scale_y, double scale_width, double scale_heights)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s *handle = (player_s *)player;
+       int ret;
+
+       LOGD("<Enter>");
+
+       ret = mm_player_set_video_roi_area(handle->mm_handle, scale_x, scale_y, scale_width, scale_heights);
+       if (ret != PLAYER_ERROR_NONE)
+               return __player_convert_error_code(ret, (char *)__FUNCTION__);
+       else
+               return PLAYER_ERROR_NONE;
+}
+
+int legacy_player_get_video_roi_area(player_h player, double *scale_x,
+               double *scale_y, double *scale_width, double *scale_height)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(scale_x);
+       PLAYER_NULL_ARG_CHECK(scale_y);
+       PLAYER_NULL_ARG_CHECK(scale_width);
+       PLAYER_NULL_ARG_CHECK(scale_height);
+       player_s *handle = (player_s *)player;
+       int ret;
+
+       LOGD("<Enter>");
+
+       ret = mm_player_get_video_roi_area(handle->mm_handle, scale_x, scale_y, scale_width, scale_height);
+       if (ret != PLAYER_ERROR_NONE)
+               return __player_convert_error_code(ret, (char *)__FUNCTION__);
+       else
+               return PLAYER_ERROR_NONE;
+}
+
 int legacy_player_set_roi_area(player_h player, int x, int y, int w, int h)
 {
        PLAYER_INSTANCE_CHECK(player);
index b8ad747..9a7f85d 100644 (file)
@@ -25,6 +25,8 @@ get_duration
 set_display
 set_display_mode
 get_display_mode
+set_video_roi_area
+get_video_roi_area
 set_display_roi_area
 set_playback_rate
 set_display_rotation
index 07936cf..2148723 100644 (file)
@@ -1939,6 +1939,51 @@ int player_disp_get_display_mode(muse_module_h module)
        return ret;
 }
 
+int player_disp_set_video_roi_area(muse_module_h module)
+{
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_SET_VIDEO_ROI_AREA;
+       muse_player_handle_s *muse_player = NULL;
+       double x_scale = 0, y_scale = 0, w_scale = 0, h_scale = 0;
+       bool ret_val = TRUE;
+
+       ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
+                                       MUSE_TYPE_DOUBLE, "x_scale", (void *)&x_scale,
+                                       MUSE_TYPE_DOUBLE, "y_scale", (void *)&y_scale,
+                                       MUSE_TYPE_DOUBLE, "w_scale", (void *)&w_scale,
+                                       MUSE_TYPE_DOUBLE, "h_scale", (void *)&h_scale,
+                                       INVALID_MUSE_TYPE_VALUE);
+       if (ret_val) {
+               muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+               ret = legacy_player_set_video_roi_area(muse_player->player_handle, x_scale,
+                               y_scale, w_scale, h_scale);
+       }
+
+       PLAYER_RETURN_MSG(api, ret, module);
+
+       return ret;
+}
+
+int player_disp_get_video_roi_area(muse_module_h module)
+{
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_ROI_AREA;
+       muse_player_handle_s *muse_player = NULL;
+       double scale_x = 0, scale_y = 0, scale_w = 0, scale_h = 0;
+
+       muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+
+       ret = legacy_player_get_video_roi_area(muse_player->player_handle, &scale_x,
+                       &scale_y, &scale_w, &scale_h);
+
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "scale_x", scale_x,
+                       MUSE_TYPE_DOUBLE, "scale_y", scale_y,
+                       MUSE_TYPE_DOUBLE, "scale_w", scale_w,
+                       MUSE_TYPE_DOUBLE, "scale_h", scale_h);
+
+       return ret;
+}
+
 int player_disp_set_display_roi_area(muse_module_h module)
 {
        int ret = PLAYER_ERROR_NONE;
@@ -1948,8 +1993,12 @@ int player_disp_set_display_roi_area(muse_module_h module)
        char *wl_win_msg = (char *)&wl_win;
 
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+
        player_msg_get_array(wl_win_msg, muse_server_module_get_msg(module));
-       ret = legacy_player_set_roi_area(muse_player->player_handle, wl_win.win_roi_x, wl_win.win_roi_y, wl_win.win_roi_width, wl_win.win_roi_height);
+
+       ret = legacy_player_set_roi_area(muse_player->player_handle, wl_win.win_roi_x,
+                       wl_win.win_roi_y, wl_win.win_roi_width, wl_win.win_roi_height);
+
        PLAYER_RETURN_MSG(api, ret, module);
 
        return ret;