return ESPP_CLIENT_ERROR_NONE;
}
+int espp_client_set_playback_rate(espp_h espp, double rate, bool mute_audio)
+{
+ 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_playback_rate(_espp, rate, mute_audio) != 0)
+ return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+ LOG_INFO("espp[%p] rate[%f] mute_audio[%d]", espp, rate, mute_audio);
+
+ return ESPP_CLIENT_ERROR_NONE;
+}
+
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)
{
espp_s *_espp = (espp_s *)espp;
*/
int espp_client_set_video_stream_info(espp_h espp, espp_video_stream_info_s *info);
+/**
+ * @brief Sets the playback rate.
+ * @remarks User has to push the data as fast as playback rate.
+ * @param[in] espp ESPP service client handle
+ * @param[in] rate The playback rate from 0.0 to 2.0
+ * @param[in] mute_audio Mute audio or not (@c true = mute, @c false = not mute)
+ * @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.
+ * @see espp_client_prepare_async()
+ */
+int espp_client_set_playback_rate(espp_h espp, double rate, bool mute_audio);
+
/**
* @brief Sets the video display surface id.
* @param[in] espp ESPP service client handle
int espp_service_client_socket_request_get_playing_time(espp_s *espp, uint64_t *time_ms);
int espp_service_client_socket_request_set_audio_stream_info(espp_s *espp, espp_audio_stream_info_s *info);
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_playback_rate(espp_s *espp, double rate, bool mute_audio);
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);
return 0;
}
+
+int espp_service_client_socket_request_set_playback_rate(espp_s *espp, double rate, bool mute_audio)
+{
+ 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_PLAYBACK_RATE);
+ FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE,
+ "rate", rate, "mute_audio", mute_audio);
+ 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_display_surface_id(espp_s *espp, espp_display_type_e type, unsigned int surface_id, int x, int y, int w, int h)
{
espp_service_data_from_client_s data;
[ESPP_SERVICE_REQUEST_GET_PLAYING_TIME] = { "GetPlayingTime", NULL },
[ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = { "SetAudioStreamInfo", "suiuuu" },
[ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = { "SetVideoStreamInfo", "suiuuuuuu" },
+ [ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE] = { "SetPlaybackRate", "db" },
[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_GET_PLAYING_TIME,
ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO,
ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO,
+ ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE,
ESPP_SERVICE_REQUEST_SET_DISPLAY_SURFACE_ID,
ESPP_SERVICE_REQUEST_SET_DISPLAY_MODE,
ESPP_SERVICE_REQUEST_SET_DISPLAY_ROI,
result->ret = 0;
}
+static void __handle_set_playback_rate(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+ int ret;
+ double rate;
+ bool mute_audio;
+
+ 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,
+ &rate, &mute_audio);
+ if (ret != 0)
+ return;
+
+ ret = esplusplayer_set_playback_rate((esplusplayer_handle)hdata->espp, rate, mute_audio);
+ RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_playback_rate(), ESPP[%p], rate[%f], mute_audio[%d]",
+ hdata->espp, rate, mute_audio);
+
+ LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_playback_rate() success, rate[%f], mute_audio[%d]",
+ hdata->fd, hdata->espp, rate, mute_audio);
+
+ result->ret = 0;
+}
+
static void __handle_set_display_surface_id(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
{
int ret;
[ESPP_SERVICE_REQUEST_GET_PLAYING_TIME] = __handle_get_playing_time,
[ESPP_SERVICE_REQUEST_SET_AUDIO_STREAM_INFO] = __handle_set_audio_stream_info,
[ESPP_SERVICE_REQUEST_SET_VIDEO_STREAM_INFO] = __handle_set_video_stream_info,
+ [ESPP_SERVICE_REQUEST_SET_PLAYBACK_RATE] = __handle_set_playback_rate,
[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,