Name: espp-service
Summary: ESPP service package which contains client lib. and daemon binary
-Version: 0.3.12
+Version: 0.3.13
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
return ESPP_CLIENT_ERROR_NONE;
}
+
+int espp_client_set_render_time_offset(espp_h espp, espp_stream_type_e stream_type, int64_t time_offset_ms)
+{
+ 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_render_time_offset(_espp, stream_type, time_offset_ms) != 0)
+ return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+ LOG_INFO("espp[%p] stream_type[%d] time_offset_ms[%" PRId64 "]", espp, stream_type, time_offset_ms);
+
+ return ESPP_CLIENT_ERROR_NONE;
+}
*/
int espp_client_take_snapshot(espp_h espp, espp_snapshot_cb callback, void *user_data);
+/**
+ * @brief Sets the render time offset of the stream type.
+ * @remarks The default value of @a time_offset_ms is 0 and the valid range is between INT64_MIN/1000000 and INT64_MAX/1000000.
+ * @param[in] espp ESPP service client handle
+ * @param[in] stream_type The stream type to set render time offset
+ * @param[in] time_offset_ms Render time offset in milliseconds
+ * @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 The state must be one of #ESPP_STATE_READY or #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @pre Low latency mode has to be set except for #ESPP_LOW_LATENCY_MODE_NONE and #ESPP_LOW_LATENCY_MODE_DISABLE_SYNC.
+ * @see espp_client_prepare_async()
+ * @see espp_client_set_low_latency_mode()
+ */
+int espp_client_set_render_time_offset(espp_h espp, espp_stream_type_e stream_type, int64_t time_offset_ms);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
int espp_service_client_socket_request_set_low_latency_mode(espp_s *espp, espp_low_latency_mode_e mode);
int espp_service_client_socket_request_set_decoded_video_frame_buffer_type(espp_s *espp, espp_decoded_video_frame_buffer_type_e type);
int espp_service_client_socket_request_take_snapshot(espp_s *espp, int id);
+int espp_service_client_socket_request_set_render_time_offset(espp_s *espp, espp_stream_type_e stream_type, int64_t time_offset_ms);
/* event handler */
gpointer espp_service_client_event_handler_thread_func(gpointer user_data);
return 0;
}
+
+int espp_service_client_socket_request_set_render_time_offset(espp_s *espp, espp_stream_type_e stream_type, int64_t time_offset_ms)
+{
+ 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_RENDER_TIME_OFFSET);
+ FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET,
+ "stream_type", stream_type, "time_offset_ms", time_offset_ms);
+
+ 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;
+}
[ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE] = { "SetLowLatencyMode", "i" },
[ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE] = { "SetDecodedVideoFrameBufferType", "i" },
[ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT] = { "TakeSnapshot", "i" },
+ [ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET] = { "SetRenderTimeOffset", "il" },
[ESPP_SERVICE_REQUEST_SET_CALLBACK] = { "SetCallback", "i" },
};
ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE,
ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE,
ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT,
+ ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET,
ESPP_SERVICE_REQUEST_SET_CALLBACK,
ESPP_SERVICE_REQUEST_NUM,
} espp_service_request_e;
result->ret = 0;
}
+static void __handle_set_render_time_offset(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+ int ret;
+ esplusplayer_stream_type stream_type;
+ int64_t time_offset_ms;
+
+ 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, &stream_type, &time_offset_ms);
+ if (ret != 0)
+ return;
+
+ ret = esplusplayer_set_render_time_offset((esplusplayer_handle)hdata->espp, stream_type, time_offset_ms);
+ RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE,
+ "failed to esplusplayer_set_render_time_offset(), ESPP[%p], stream_type[%d], time_offset_ms[%" PRId64 "]",
+ hdata->espp, stream_type, time_offset_ms);
+
+ LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_render_time_offset() success, stream_type[%d], time_offset_ms[%" PRId64 "]",
+ hdata->fd, hdata->espp, stream_type, time_offset_ms);
+
+ result->ret = 0;
+}
+
static void __ready_to_prepare_cb(const int type, void *user_data)
{
handler_userdata_s *hdata = (handler_userdata_s *)user_data;
[ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE] = __handle_set_low_latency_mode,
[ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE] = __handle_set_decoded_video_frame_buffer_type,
[ESPP_SERVICE_REQUEST_TAKE_SNAPSHOT] = __handle_take_snapshot,
+ [ESPP_SERVICE_REQUEST_SET_RENDER_TIME_OFFSET] = __handle_set_render_time_offset,
[ESPP_SERVICE_REQUEST_SET_CALLBACK] = __handle_set_callback,
};