typedef void* esplusplayer_handle;
/**
+ * @brief Enumerations for the Adaptive info type
+ */
+typedef enum {
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_NONE,
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES,
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_VIDEO_FRAMES_FOR_CATCHUP,
+ ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_AUDIO_FRAMES_FOR_CATCHUP,
+} esplusplayer_adaptive_info_type;
+
+/**
* @brief Enumerations for low latency mode
* @remark Public supports #ESPLUSPLAYER_LOW_LATENCY_MODE_DISABLE_PREROLL only.
*/
} esplusplayer_rsc_alloc_policy;
/**
+ * @brief Enumerations for the status of getting decoded video frame
+ * @version 4.0
+ */
+typedef enum {
+ /** @brief successfully decoded video frame acquired. */
+ ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS,
+ /** @brief it means app has to return the video before getting decoded
+ * video frame frame.
+ */
+ ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_REMAINING_BUFFER,
+ /**
+ * @brief there is no filled video frame yet.
+ */
+ ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_FILLED_BUFFER,
+ /**
+ * @brief internal error
+ */
+ ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_UNKNOWN
+} esplusplayer_get_decoded_video_frame_status_type;
+
+/**
* @brief Create a esplusplayer handle.
* @param None
* @return return esplusplayer handle pointer.
int esplusplayer_get_playing_time(esplusplayer_handle handle, uint64_t* ms);
/**
+ * @brief Get dropped frame counts in videosink.
+ * @param [in] handle : esplusplayer handle.
+ * @param [out] padaptive_info : dropped frame counts.
+ * @param [in] adaptive_type : type of adaptive info which APP want to get.
+ * @return @c ESPLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of esplusplayer_error_type
+ * values will be returned.
+ * @retval #ESPLUSPLAYER_ERROR_TYPE_NONE Successful
+ * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter
+ * @retval #ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed
+ * @code
+ * prepare esplayer done
+ * // ... your codes ...
+ * uint64_t count = 0;
+ * esplusplayer_get_adaptive_info(esplayer,
+ * static_cast<void*>(&count),ESPLUSPLAYER_ADAPT_INFO_TYPE_DROPPED_FRAMES);
+ * // ... your codes ...
+ * esplusplayer_stop(esplayer);
+ * @endcode
+ * @pre The player must be one of #ESPLUSPLAYER_STATE_READY,
+ * #ESPLUSPLAYER_STATE_PAUSE or #ESPLUSPLAYER_STATE_PLAYING.
+ * @post None
+ * @exception None
+ * @see esplusplayer_prepare_async()
+ */
+int esplusplayer_get_adaptive_info(
+ esplusplayer_handle handle, void* padaptive_info,
+ esplusplayer_adaptive_info_type adaptive_type);
+
+/**
* @brief Set volume to player
* @param [in] handle : esplusplayer handle.
* @param [in] volume : volume level(0 ~ 100).
esplusplayer_stream_type type,
int64_t* offset);
/**
+ * @brief Requests decoded video frame packet to acquire it. it works only
+ * with #ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY
+ * mode
+ * @param [in] handle : esplusplayer handle.
+ * @param [out] packet : the decoded buffer.
+ * @param [out] status : (nullable) the result of video frame requested
+ * @pre The player state must be one of #ESPLUSPLAYER_STATE_READY or
+ * #ESPLUSPLAYER_STATE_PAUSED or #ESPLUSPLAYER_STATE_PLAYING.
+ * @post None
+ * @return #ESPLUSPLAYER_ERROR_TYPE_NONE on success, otherwise one of
+ * esplusplayer_error_type values will be returned.
+ * @exception None
+ * @version 4.0
+ * @see esplusplayer_set_video_frame_buffer_type()
+ * @see esplusplayer_decoded_buffer_destroy()
+ * @see esplusplayer_decoded_video_frame_buffer_type
+ * @code
+ * ...
+ * esplusplayer_set_video_frame_buffer_type(handle,
+ * ESPLUSPLAYER_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY);
+ * ...
+ * esplusplayer_prepare_async(handle);
+ * ...
+ * // after prepared
+ * esplusplayer_decoded_video_packet packet;
+ * esplusplayer_get_decoded_video_frame_status_type state;
+ * int retval = esplusplayer_get_decoded_video_packet(handle, &packet, &state);
+ * if (state == ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_SUCCESS) {
+ * // successful case.
+ * // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
+ * // you have to call esplusplayer_decoded_buffer_destroy() after using the
+ * // packet
+ * ...
+ * esplusplayer_decoded_buffer_destroy(handle, &packet);
+ * } else if (state ==
+ * ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_REMAINING_BUFFER) {
+ * // app has to call esplusplayer_decoded_buffer_destroy() with previous
+ * // video packet.
+ * // it means player couldn't draw the video frame into a buffer due to no
+ * buffer.
+ * // in this case ,retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
+ * } else if (state ==
+ * ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_NO_FILLED_BUFFER) {
+ * // it means app should retry to get decoded video packet.
+ * // in most case, there were no buffers drawn in the timing you called this
+ * // api.
+ * // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_NONE
+ * } else if (state == ESPLUSPLAYER_GET_DECVIDEOFRAME_STATUS_UNKNOWN) {
+ * // internal error happened
+ * // in this case, retval will be ESPLUSPLAYER_ERROR_TYPE_INVALID_OPERATION
+ * }
+ * ...
+ * @endcode
+ */
+int esplusplayer_get_decoded_video_packet(
+ esplusplayer_handle handle, esplusplayer_decoded_video_packet* packet,
+ esplusplayer_get_decoded_video_frame_status_type* status);
+
+/**
* @brief Provided api for enabling video hole.
* @param [in] handle : esplusplayer handle.
* @param [in] value : the value of video hole.
} espp_display_mode_e;
/**
+ * @brief Enumerations for decoded video buffer type
+ */
+typedef enum {
+ ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_NONE, /**< None */
+ ESPP_DECODED_VIDEO_FRAME_BUFFER_TYPE_MANUAL_COPY = 4, /**< Manual copy */
+} espp_decoded_video_frame_buffer_type_e;
+
+/**
* @brief Enumerations for the buffer status
*/
typedef enum {
*/
int espp_client_set_low_latency_mode(espp_h espp, espp_low_latency_mode_e mode);
+/**
+ * @brief Sets the decoded video frame buffer type.
+ * @param[in] espp ESPP service client handle
+ * @param[in] type The video frame buffer type
+ * @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_client_open() must be called before calling this function.
+ * @see espp_client_open()
+ */
+int espp_client_set_decoded_video_frame_buffer_type(espp_h espp, espp_decoded_video_frame_buffer_type_e type);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
result->ret = 0;
}
+static void __handle_set_decoded_video_frame_buffer_type(handler_userdata_s *hdata, espp_service_data_from_client_s *data, espp_service_data_from_server_s *result)
+{
+ int ret;
+ esplusplayer_decoded_video_frame_buffer_type type;
+
+ result->ret = -1;
+
+ ret = espp_service_msg_parse_params(data->params, data->request, &type);
+ if (ret != 0)
+ return;
+
+ ret = esplusplayer_set_video_frame_buffer_type((esplusplayer_handle)hdata->espp, type);
+ RET_IF(ret != ESPLUSPLAYER_ERROR_TYPE_NONE, "failed to esplusplayer_set_video_frame_buffer_type(), ESPP[%p], type[%d]",
+ hdata->espp, type);
+
+ LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_set_video_frame_buffer_type() success, type[%d]",
+ hdata->fd, hdata->espp, 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_SUBMIT_EOS_PACKET] = __handle_submit_eos_packet,
[ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE] = __handle_set_buffer_size,
[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_SET_CALLBACK] = __handle_set_callback,
};