Add API - espp_client_set_display_rotation() 29/315529/2 accepted/tizen_unified_dev accepted/tizen/9.0/unified/20241031.000234 accepted/tizen/unified/20240805.114528 accepted/tizen/unified/dev/20240807.092855 tizen_9.0_m2_release
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 2 Aug 2024 05:53:15 +0000 (14:53 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 2 Aug 2024 05:58:44 +0000 (14:58 +0900)
[Version] 0.3.19

Change-Id: Ic06d3b2d82fe110cb2b0b229b1c9a0d0758ca063
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/espp-service.spec
project_def.prop
src/client/espp_service_client.c
src/client/espp_service_client.h
src/client/espp_service_client_priv.h
src/client/espp_service_client_socket.c
src/common/espp_service_ipc.c
src/common/espp_service_ipc.h
src/daemon/espp_service_handler.c
tizen-manifest.xml

index 4c91ab6d0c1e1e15b20db0400349d435410c5539..b709043bc001ffd5d17abacbc060f47deb7eca21 100644 (file)
@@ -1,6 +1,6 @@
 Name:       espp-service
 Summary:    ESPP service package which contains client lib. and daemon binary
-Version:    0.3.18
+Version:    0.3.19
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 7a978859c592c4db14b0244ca70add12903b8f05..87c19d00ba0aecd3e3365680e71b41dc3fb09d68 100644 (file)
@@ -11,7 +11,7 @@ profile = mobile-7.0
 USER_SRCS = ./src/daemon/*.c ./src/common/*.c
 
 # User Defines
-USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.18"
+USER_DEFS = USE_DLOG USE_SERVICE_APP ESPP_SERVICE_VERSION="0.3.19"
 
 # User Includes
 USER_INC_DIRS = ./src/daemon ./src/common ./inc ./inc/esplusplayer_capi
index de836256bb65abbb51582a84c45aa9f565119fff..1890c1b7f0b1ce865351984967369836e50ab7b3 100644 (file)
@@ -588,6 +588,23 @@ int espp_client_set_display_visible(espp_h espp, bool visible)
        return ESPP_CLIENT_ERROR_NONE;
 }
 
+int espp_client_set_display_rotation(espp_h espp, espp_display_rotation_angle_e angle)
+{
+       espp_s *_espp = (espp_s *)espp;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(!espp, ESPP_CLIENT_ERROR_INVALID_PARAMETER, "espp is NULL");
+
+       locker = g_mutex_locker_new(&_espp->mutex);
+
+       if (espp_service_client_socket_request_set_display_rotation(_espp, angle) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] angle[%d]", espp, angle);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
+
 int espp_client_set_audio_mute(espp_h espp, bool mute)
 {
        espp_s *_espp = (espp_s *)espp;
index c13fbc47b4b6eafde6d5c595616cc4c9af3641c8..29ff8e102c927d885e523e35cbf835abc3f2f880 100644 (file)
@@ -125,6 +125,16 @@ typedef enum {
        ESPP_DISPLAY_MODE_DST_ROI,          /**< Destination RoI */
 } espp_display_mode_e;
 
+/**
+ * @brief  Enumerations for the display rotation angle
+ */
+typedef enum {
+       ESPP_DISPLAY_ROTATION_ANGLE_0,      /**< Rotation angle 0 */
+       ESPP_DISPLAY_ROTATION_ANGLE_90,     /**< Rotation angle 90 */
+       ESPP_DISPLAY_ROTATION_ANGLE_180,    /**< Rotation angle 180 */
+       ESPP_DISPLAY_ROTATION_ANGLE_270,    /**< Rotation angle 270 */
+} espp_display_rotation_angle_e;
+
 /**
  * @brief Enumerations for decoded video buffer type
  */
@@ -678,6 +688,7 @@ int espp_client_set_playback_rate(espp_h espp, double rate, bool mute_audio);
  * @see espp_client_set_display_mode()
  * @see espp_client_set_display_roi()
  * @see espp_client_set_display_visible()
+ * @see espp_client_set_display_rotation()
  */
 int espp_client_set_display_surface_id(espp_h espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h);
 
@@ -694,6 +705,7 @@ int espp_client_set_display_surface_id(espp_h espp, espp_display_type_e type, un
  * @see espp_client_open()
  * @see espp_client_set_display_surface_id()
  * @see espp_client_set_display_roi()
+ * @see espp_client_set_display_rotation()
  */
 int espp_client_set_display_mode(espp_h espp, espp_display_mode_e mode);
 
@@ -712,6 +724,7 @@ int espp_client_set_display_mode(espp_h espp, espp_display_mode_e mode);
  * @pre #ESPP_DISPLAY_MODE_DST_ROI must be set by espp_client_set_display_mode() before calling this function.
  * @see espp_client_set_display_surface_id()
  * @see espp_client_set_display_mode()
+ * @see espp_client_set_display_rotation()
  */
 int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h);
 
@@ -728,6 +741,21 @@ int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h);
  */
 int espp_client_set_display_visible(espp_h espp, bool visible);
 
+/**
+ * @brief Set the rotate angle of the video display.
+ * @param[in] espp       ESPP service client handle
+ * @param[in] angle      The rotation angle of the display
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #ESPP_CLIENT_ERROR_NONE Successful
+ * @retval #ESPP_CLIENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
+ * @see espp_client_set_display_surface_id()
+ * @see espp_client_set_display_mode()
+ * @see espp_client_set_display_roi()
+ */
+int espp_client_set_display_rotation(espp_h espp, espp_display_rotation_angle_e angle);
+
 /**
  * @brief Sets mute of the audio stream.
  * @param[in] espp    ESPP service client handle
index 7678808d48da3e756af20b193f2a4395ca9208d4..b14244b07e121fa4fde2a76baa07f429d9974bf3 100644 (file)
@@ -92,6 +92,7 @@ int espp_service_client_socket_request_set_display_surface_id(espp_s *espp, espp
 int espp_service_client_socket_request_set_display_mode(espp_s *espp, espp_display_mode_e mode);
 int espp_service_client_socket_request_set_display_roi(espp_s *espp, int x, int y, int w, int h);
 int espp_service_client_socket_request_set_display_visible(espp_s *espp, bool visible);
+int espp_service_client_socket_request_set_display_rotation(espp_s *espp, espp_display_rotation_angle_e angle);
 int espp_service_client_socket_request_set_audio_mute(espp_s *espp, bool mute);
 int espp_service_client_socket_request_set_audio_volume(espp_s *espp, int volume);
 int espp_service_client_socket_request_get_audio_volume(espp_s *espp, int *volume);
index ae2ee049b9f73f72789b697f798ea6ff21747ce1..4f50c49a5f39d3ec5afb2704784d26a9d7e450de 100644 (file)
@@ -683,6 +683,26 @@ int espp_service_client_socket_request_set_display_visible(espp_s *espp, bool vi
        return 0;
 }
 
+int espp_service_client_socket_request_set_display_rotation(espp_s *espp, espp_display_rotation_angle_e angle)
+{
+       espp_service_data_from_client_s data;
+       espp_service_data_from_server_s result;
+
+       ASSERT(espp);
+       RET_VAL_IF(espp->fd == -1, -1, "fd is -1");
+
+       FILL_SOCKET_MSG_REQUEST(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION, "angle", angle);
+       if (send_data(espp->fd, &data, &result) != 0)
+               return -1;
+
+       RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+       LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+       return 0;
+}
+
 int espp_service_client_socket_request_set_audio_mute(espp_s *espp, bool mute)
 {
        espp_service_data_from_client_s data;
index 77cfcfaf920cfa11f168f6bdc1bd8dd5f419524a..3645e4070e6bea22a5aefef86e7cfbe556d45aa8 100644 (file)
@@ -46,6 +46,7 @@ espp_service_ipc_data_s requests[] = {
        [ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = { "SetDisplayMode", "i" },
        [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = { "SetDisplayRoi", "iiii" },
        [ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE] = { "SetDisplayVisible", "b" },
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION] = { "SetDisplayRotation", "i" },
        [ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = { "SetAudioMute", "b" },
        [ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME] = { "SetAudioVolume", "i" },
        [ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME] = { "GetAudioVolume", NULL },
index 96f5268953f691ec73f2f59c64e2b034065214b4..bc41abba0eac17f38352ab61921e1eb2acc1fd54 100644 (file)
@@ -47,6 +47,7 @@ typedef enum {
        ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE,
        ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
        ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE,
+       ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION,
        ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE,
        ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME,
        ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME,
index 7c3358de00c292c87d49324b2b10b26a8dcbf0a8..e551fc6c671c4d8069de2419631aed7fd25ec4ad 100644 (file)
@@ -552,6 +552,29 @@ static void __handle_set_display_visible(handler_userdata_s *hdata, espp_service
        result->ret = 0;
 }
 
+static void __handle_set_display_rotation(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+       int ret;
+       esplusplayer_display_rotation_type type;
+
+       result->ret = -1;
+
+       RET_IF(!g_hash_table_lookup(hdata->svc->fd_table, hdata->key), "failed to g_hash_table_lookup(), key[%s]", hdata->key);
+
+       ret = espp_service_msg_parse_params(data->params, data->request, &type);
+       if (ret != 0)
+               return;
+
+       ret = esplusplayer_set_display_rotation((esplusplayer_handle)hdata->espp, type);
+       RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_rotation(), ESPP[%p], type[%d]",
+               hdata->espp, type);
+
+       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_rotation() success, type[%d]",
+               hdata->fd, hdata->espp, type);
+
+       result->ret = 0;
+}
+
 static void __handle_set_audio_mute(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
 {
        int ret;
@@ -1289,6 +1312,7 @@ static func_handler handlers[] = {
        [ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = __handle_set_display_mode,
        [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = __handle_set_display_roi,
        [ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE] = __handle_set_display_visible,
+       [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROTATION] = __handle_set_display_rotation,
        [ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = __handle_set_audio_mute,
        [ESPP_SERVICE_REQUEST_SET_AUDIO_VOLUME] = __handle_set_audio_volume,
        [ESPP_SERVICE_REQUEST_GET_AUDIO_VOLUME] = __handle_get_audio_volume,
index f4f41a672358988c0f8612e42fb1496172dab633..4ed53131e4c870458698a67e29aaa74ed587d464 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="7.0" package="com.samsung.tizen.espp-service" version="0.3.18">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="7.0" package="com.samsung.tizen.espp-service" version="0.3.19">
     <profile name="mobile"/>
     <description>espp-service</description>
     <service-application appid="com.samsung.tizen.espp-service" auto-restart="false" exec="espp-service" multiple="false" nodisplay="false" on-boot="false" taskmanage="false" type="capp">