Update esplusplayer_capi.h for CLI build and add API - espp_client_set_video_frame_bu... 91/301091/1
authorEunhye Choi <eunhae1.choi@samsung.com>
Wed, 30 Aug 2023 06:54:51 +0000 (15:54 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 8 Nov 2023 08:16:20 +0000 (08:16 +0000)
./inc/esplusplayer_capi/esplusplayer_capi.h header is synchronized with
version 0.0.14 of Tizen 7.0.

Change-Id: Ifb246536a44dfbbca46415f5e31b104bd53d5ade
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
(cherry picked from commit c775b7307c26f159cdd0d11e9fdc0f2dc0fb23f6)

inc/esplusplayer_capi/esplusplayer_capi.h
libs/libesplusplayer.so [deleted file]
src/client/espp_service_client.c
src/client/espp_service_client.h
src/client/espp_service_client_priv.h
src/client/espp_service_client_socket.c
src/common/espp_service_ipc.c
src/common/espp_service_ipc.h
src/daemon/espp_service_handler.c

index 0440098..9c17146 100644 (file)
@@ -73,6 +73,16 @@ typedef void (*esplusplayer_event_cb)(const esplusplayer_event_type,
 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.
  */
@@ -279,6 +289,27 @@ typedef enum {
 } 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.
@@ -1165,6 +1196,35 @@ int esplusplayer_set_video_stream_info(esplusplayer_handle handle,
 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).
@@ -1897,6 +1957,65 @@ int esplusplayer_get_render_time_offset(esplusplayer_handle handle,
                                         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.
diff --git a/libs/libesplusplayer.so b/libs/libesplusplayer.so
deleted file mode 100755 (executable)
index 6cb238d..0000000
Binary files a/libs/libesplusplayer.so and /dev/null differ
index 0b308cd..9e6075e 100644 (file)
@@ -690,3 +690,20 @@ int espp_client_set_low_latency_mode(espp_h espp, espp_low_latency_mode_e mode)
 
        return ESPP_CLIENT_ERROR_NONE;
 }
+
+int espp_client_set_decoded_video_frame_buffer_type(espp_h espp, espp_decoded_video_frame_buffer_type_e type)
+{
+       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_decoded_video_frame_buffer_type(_espp, type) != 0)
+               return ESPP_CLIENT_ERROR_INVALID_OPERATION;
+
+       LOG_INFO("espp[%p] type[%d]", espp, type);
+
+       return ESPP_CLIENT_ERROR_NONE;
+}
index 66488de..3716697 100644 (file)
@@ -126,6 +126,14 @@ typedef enum {
 } 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 {
@@ -811,6 +819,20 @@ int espp_client_set_buffer_size(espp_h espp, espp_buffer_size_type_e size_type,
  */
 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 */
index b4314f3..002cfc6 100644 (file)
@@ -98,6 +98,7 @@ int espp_service_client_socket_request_submit_packet(espp_s *espp, espp_packet_s
 int espp_service_client_socket_request_submit_eos_packet(espp_s *espp, espp_stream_type_e stream_type, espp_submit_error_e *error);
 int espp_service_client_socket_request_set_buffer_size(espp_s *espp, espp_buffer_size_type_e size_type, uint64_t size);
 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);
 
 /* event handler */
 gpointer espp_service_client_event_handler_thread_func(gpointer user_data);
index e70c10d..9b64062 100644 (file)
@@ -859,3 +859,23 @@ int espp_service_client_socket_request_set_low_latency_mode(espp_s *espp, espp_l
 
        return 0;
 }
+
+int espp_service_client_socket_request_set_decoded_video_frame_buffer_type(espp_s *espp, espp_decoded_video_frame_buffer_type_e type)
+{
+       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_DECODED_VIDEO_FRAME_BUFFER_TYPE);
+       FILL_SOCKET_MSG_PARAMS(data, ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE, "type", type);
+       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;
+}
index aef7122..11188f2 100644 (file)
@@ -53,6 +53,7 @@ espp_service_ipc_data_s requests[] = {
        [ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET] = { "SubmitEosPacket", "i" },
        [ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE] = { "SetBufferSize", "ik" },
        [ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE] = { "SetLowLatencyMode", "i" },
+       [ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE] = { "SetDecodedVideoFrameBufferType", "i" },
        [ESPP_SERVICE_REQUEST_SET_CALLBACK] = { "SetCallback", "i" },
 };
 
index d27cbd5..6028232 100644 (file)
@@ -54,6 +54,7 @@ typedef enum {
        ESPP_SERVICE_REQUEST_SUBMIT_EOS_PACKET,
        ESPP_SERVICE_REQUEST_SET_BUFFER_SIZE,
        ESPP_SERVICE_REQUEST_SET_LOW_LATENCY_MODE,
+       ESPP_SERVICE_REQUEST_SET_DECODED_VIDEO_FRAME_BUFFER_TYPE,
        ESPP_SERVICE_REQUEST_SET_CALLBACK,
        ESPP_SERVICE_REQUEST_NUM,
 } espp_service_request_e;
index b0bc5a9..7420033 100644 (file)
@@ -763,6 +763,27 @@ static void __handle_set_low_latency_mode(handler_userdata_s *hdata, espp_servic
        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;
@@ -1002,6 +1023,7 @@ static func_handler handlers[] = {
        [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,
 };