return ESPP_CLIENT_ERROR_NONE;
}
+int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h)
+{
+ 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_roi(_espp, x, y, w, h) != 0)
+ return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+ LOG_INFO("espp[%p] x[%d] y[%d] w[%d] h[%d]", espp, x, y, w, h);
+
+ return ESPP_CLIENT_ERROR_NONE;
+}
+
int espp_client_set_audio_mute(espp_h espp, bool mute)
{
espp_s *_espp = (espp_s *)espp;
* @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_mode()
+ * @see espp_client_set_display_roi()
*/
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);
* @retval #ESPP_CLIENT_ERROR_INVALID_OPERATION Invalid operation
* @pre espp_client_open() must be called before calling this function.
* @see espp_client_open()
+ * @see espp_client_set_display_surface_id()
+ * @see espp_client_set_display_roi()
*/
int espp_client_set_display_mode(espp_h espp, espp_display_mode_e mode);
+/**
+ * @brief Sets the video display RoI(Region of Interest).
+ * @param[in] espp ESPP service client handle
+ * @param[in] x The x coordinate of window
+ * @param[in] y The y coordinate of window
+ * @param[in] w The width of window
+ * @param[in] h The height of window
+ * @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
+ * @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()
+ */
+int espp_client_set_display_roi(espp_h espp, int x, int y, int w, int h);
+
/**
* @brief Sets mute of the audio stream.
* @param[in] espp ESPP service client handle
int espp_service_client_socket_request_set_video_stream_info(espp_s *espp, espp_video_stream_info_s *info);
int espp_service_client_socket_request_set_display_surface_id(espp_s *espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h);
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_audio_mute(espp_s *espp, bool mute);
int espp_service_client_socket_request_set_callback(espp_s *espp, espp_service_event_e type, void *callback, void *user_data);
int espp_service_client_socket_request_submit_packet(espp_s *espp, espp_packet_s *packet, espp_submit_error_e *error);
return 0;
}
+int espp_service_client_socket_request_set_display_roi(espp_s *espp, int x, int y, int w, int h)
+{
+ 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_ROI);
+ FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
+ "x", x, "y", y, "w", w, "h", h);
+ 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;
[ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = { "SetVideoStreamInfo", "suiuuuuuu" },
[ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID] = { "SetDisplaySurfaceId", "iuiiii" },
[ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = { "SetDisplayMode", "i" },
+ [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = { "SetDisplayRoi", "iiii" },
[ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = { "SetAudioMute", "b" },
[ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = { "SubmitPacket", "iukku" },
[ESPP_SERVICE_REQUEST_SET_CALLBACK] = { "SetCallback", "i" },
ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO,
ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID,
ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE,
+ ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE,
ESPP_SERVICE_REQUEST_SUBMIT_PACKET,
ESPP_SERVICE_REQUEST_SET_CALLBACK,
result->ret = 0;
}
+static void __handle_set_display_roi(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+ int ret;
+ int x, y, w, h;
+
+ ASSERT(hdata);
+ ASSERT(data);
+ ASSERT(result);
+ ASSERT(hdata->svc);
+ ASSERT(hdata->fd >= 0);
+
+ 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,
+ &x, &y, &w, &h);
+ if (ret != 0)
+ return;
+
+ ret = esplusplayer_set_display_roi((esplusplayer_handle)hdata->espp, x, y, w, h);
+ RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_display_roi(), ESPP[%p], x[%d], y[%d], w[%d], h[%d]",
+ hdata->espp, x, y, w, h);
+
+ LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_display_roi() success, x[%d], y[%d], w[%d], h[%d]",
+ hdata->fd, hdata->espp, x, y, w, h);
+
+ 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;
[ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = __handle_set_video_stream_info,
[ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID] = __handle_set_display_surface_id,
[ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE] = __handle_set_display_mode,
+ [ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI] = __handle_set_display_roi,
[ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = __handle_set_audio_mute,
[ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = __handle_submit_packet,
[ESPP_SERVICE_REQUEST_SET_CALLBACK] = __handle_set_callback,