return ESPP_CLIENT_ERROR_NONE;
}
+int espp_client_resume(espp_h espp)
+{
+ 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_resume(_espp) != 0)
+ return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+ LOG_INFO("espp[%p] is resumed", espp);
+
+ return ESPP_CLIENT_ERROR_NONE;
+}
+
int espp_client_prepare_async(espp_h espp)
{
espp_s *_espp = (espp_s *)espp;
* @see espp_client_prepare_async()
* @see espp_client_stop()
* @see espp_client_pause()
+ * @see espp_client_resume()
*/
int espp_client_start(espp_h espp);
* @see espp_client_start()
* @see espp_client_close()
* @see espp_client_pause()
+ * @see espp_client_resume()
*/
int espp_client_stop(espp_h espp);
* @post The state will be #ESPP_STATE_PAUSED.
* @see espp_client_start()
* @see espp_client_stop()
- * @see espp_client_close()
+ * @see espp_client_resume()
*/
int espp_client_pause(espp_h espp);
+/**
+ * @brief Resumes the ESPP service client handle.
+ * @param[in] espp ESPP service client handle
+ * @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 #ESPP_STATE_PAUSED or #ESPP_STATE_PLAYING.
+ * @post The state will be #ESPP_STATE_PLAYING.
+ * @see espp_client_start()
+ * @see espp_client_stop()
+ * @see espp_client_pause()
+ */
+int espp_client_resume(espp_h espp);
+
/**
* @brief Prepares the ESPP service client handle asynchronously.
* @param[in] espp ESPP service client handle
int espp_service_client_socket_request_start(espp_s *espp);
int espp_service_client_socket_request_stop(espp_s *espp);
int espp_service_client_socket_request_pause(espp_s *espp);
+int espp_service_client_socket_request_resume(espp_s *espp);
int espp_service_client_socket_request_prepare_async(espp_s *espp);
int espp_service_client_socket_request_get_state(espp_s *espp, espp_state_e *state);
int espp_service_client_socket_request_set_audio_stream_info(espp_s *espp, espp_audio_stream_info_s *info);
return 0;
}
+int espp_service_client_socket_request_resume(espp_s *espp)
+{
+ 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_RESUME);
+ 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_prepare_async(espp_s *espp)
{
espp_service_data_from_client_s data;
[ESPP_SERVICE_REQUEST_START] = { "Start", NULL },
[ESPP_SERVICE_REQUEST_STOP] = { "Stop", NULL },
[ESPP_SERVICE_REQUEST_PAUSE] = { "Pause", NULL },
+ [ESPP_SERVICE_REQUEST_RESUME] = { "Resume", NULL },
[ESPP_SERVICE_REQUEST_PREPARE_ASYNC] = { "PrepareAsync", NULL },
[ESPP_SERVICE_REQUEST_GET_STATE] = { "GetState", NULL },
[ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = { "SetAudioStreamInfo", "suiuuu" },
ESPP_SERVICE_REQUEST_START,
ESPP_SERVICE_REQUEST_STOP,
ESPP_SERVICE_REQUEST_PAUSE,
+ ESPP_SERVICE_REQUEST_RESUME,
ESPP_SERVICE_REQUEST_PREPARE_ASYNC,
ESPP_SERVICE_REQUEST_GET_STATE,
ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO,
result->ret = 0;
}
+static void __handle_resume(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+ int ret;
+
+ 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 = esplusplayer_resume((esplusplayer_handle)hdata->espp);
+ RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_resume(), ESPP[%p]", hdata->espp);
+
+ LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_resume() success", hdata->fd, hdata->espp);
+
+ result->ret = 0;
+}
+
static void __handle_prepare_async(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
{
int ret;
[ESPP_SERVICE_REQUEST_START] = __handle_start,
[ESPP_SERVICE_REQUEST_STOP] = __handle_stop,
[ESPP_SERVICE_REQUEST_PAUSE] = __handle_pause,
+ [ESPP_SERVICE_REQUEST_RESUME] = __handle_resume,
[ESPP_SERVICE_REQUEST_PREPARE_ASYNC] = __handle_prepare_async,
[ESPP_SERVICE_REQUEST_GET_STATE] = __handle_get_state,
[ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = __handle_set_audio_stream_info,