return ESPP_CLIENT_ERROR_NONE;
}
+int espp_client_submit_eos_packet(espp_h espp, espp_stream_type_e stream_type, espp_submit_error_e *error)
+{
+ 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_submit_eos_packet(_espp, stream_type, error) != 0)
+ return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+ LOG_INFO("espp[%p] stream_type[%d]", espp, stream_type);
+
+ return ESPP_CLIENT_ERROR_NONE;
+}
+
*/
int espp_client_submit_packet(espp_h espp, espp_packet_s *packet, espp_submit_error_e *error);
+/**
+ * @brief Generates EoS(End of Stream) packet and submits it.
+ * @param[in] espp ESPP service client handle
+ * @param[in] stream_type The stream type that reaches EoS.
+ * @param[out] error ESPP packet submit error (optional, this can be NULL)
+ * @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_ready_to_prepare_cb()
+ * @see espp_seek_done_cb()
+ * @see espp_buffer_status_cb()
+ */
+int espp_client_submit_eos_packet(espp_h espp, espp_stream_type_e stream_type, espp_submit_error_e *error);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
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);
+int espp_service_client_socket_request_submit_eos_packet(espp_s *espp, espp_stream_type_e stream_type, espp_submit_error_e *error);
/* event handler */
gpointer espp_service_client_event_handler_thread_func(gpointer user_data);
return 0;
}
+
+int espp_service_client_socket_request_submit_eos_packet(espp_s *espp, espp_stream_type_e stream_type, espp_submit_error_e *error)
+{
+ 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_SUBMIT_EOS_PACKET);
+ FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET, "stream_type", stream_type);
+ if (send_data(espp->fd, &data, &result) != 0)
+ return -1;
+
+ if (result.ret != 0 && error)
+ *error = result.ret;
+
+ RET_VAL_IF_SERVER_RESULT_ERROR(result, -1);
+
+ LOG_DEBUG("espp[%p], fd[%d]", espp, espp->fd);
+
+ return 0;
+}
[ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE] = { "SetDisplayVisible", "b" },
[ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = { "SetAudioMute", "b" },
[ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = { "SubmitPacket", "iukku" },
+ [ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET] = { "SubmitEosPacket", "i" },
[ESPP_SERVICE_REQUEST_SET_CALLBACK] = { "SetCallback", "i" },
};
ESPP_SERVICE_REQUEST_SET_DISPLAY_VISIBLE,
ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE,
ESPP_SERVICE_REQUEST_SUBMIT_PACKET,
+ ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET,
ESPP_SERVICE_REQUEST_SET_CALLBACK,
} espp_service_request_e;
status = esplusplayer_submit_packet((esplusplayer_handle)hdata->espp, &es_packet);
if (status != ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS) {
result->ret = status;
- LOG_ERROR("failed to esplusplayer_submit_packet(), status:%d", status);
+ LOG_ERROR("failed to esplusplayer_submit_packet(), status[%d]", status);
return;
}
result->ret = 0;
}
+static void __handle_submit_eos_packet(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+ int ret;
+ esplusplayer_submit_status status;
+ esplusplayer_stream_type stream_type;
+
+ ret = espp_service_msg_parse_params(data->params, data->request, &stream_type);
+ if (ret != 0)
+ return;
+
+ status = esplusplayer_submit_eos_packet((esplusplayer_handle)hdata->espp, stream_type);
+ if (status != ESPLUSPLAYER_SUBMIT_STATUS_SUCCESS) {
+ result->ret = status;
+ LOG_ERROR("failed to esplusplayer_submit_eos_packet(), stream_type[%d], status[%d]", stream_type, status);
+ return;
+ }
+
+ LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_submit_eos_packet() success, stream_type[%d]", hdata->fd, hdata->espp, stream_type);
+
+ 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_DISPLAY_VISIBLE] = __handle_set_display_visible,
[ESPP_SERVICE_REQUEST_SET_AUDIO_MUTE] = __handle_set_audio_mute,
[ESPP_SERVICE_REQUEST_SUBMIT_PACKET] = __handle_submit_packet,
+ [ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET] = __handle_submit_eos_packet,
[ESPP_SERVICE_REQUEST_SET_CALLBACK] = __handle_set_callback,
};