Add new APIs to set/unset decoded ready callback of the node
[platform/core/api/mediastreamer.git] / include / media_streamer.h
index 3f11575..4385790 100644 (file)
@@ -530,6 +530,19 @@ typedef void (*media_streamer_position_changed_cb)(void *user_data);
 typedef void (*media_streamer_interrupted_cb)(media_streamer_interrupted_code_e code, void *user_data);
 
 /**
+ * @brief Called when the media streamer node is ready for decoded data.
+ * @since_tizen 6.0
+ * @param[in] webrtc        Media streamer node handle
+ * @param[in] src_pad_name  The source pad name that can give decoded data to another one
+ * @param[in] media_type    The media type of the data from the given source pad such as 'video/x-raw', 'audio/x-raw', and so on
+ * @param[in] user_data     The user data passed from the callback registration function
+ * @see media_streamer_node_set_decoded_ready_cb()
+ * @see media_streamer_node_link()
+ * @see media_streamer_node_unset_decoded_ready_cb()
+ */
+typedef void (*media_streamer_node_decoded_ready_cb)(media_streamer_node_h node, const char *src_pad_name, const char *media_type, void *user_data);
+
+/**
  * @brief Called when the media streamer WebRTC node needs to send the message to the remote peer of WebRTC connection.
  * @since_tizen 6.0
  * @remarks Two types will be delivered with @ message which is JSON string.
@@ -1301,6 +1314,37 @@ int media_streamer_node_get_param(media_streamer_node_h node,
                                        const char *param_name, char **param_value);
 
 /**
+ * @brief Sets a callback function to be invoked when a source pad of @ node is ready to give decoded data.
+ * @remarks The available type of @a node for this function is #MEDIA_STREAMER_NODE_TYPE_WEBRTC.
+ * @since_tizen 6.0
+ * @param[in] node      Media streamer node handle
+ * @param[in] callback  The decoded ready callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #MEDIA_STREAMER_ERROR_NONE Successful
+ * @retval #MEDIA_STREAMER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_STREAMER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre Create a media streamer node handle by calling media_streamer_node_create().
+ * @post media_streamer_node_decoded_ready_cb() will be invoked.
+ * @see media_streamer_node_unset_decoded_ready_cb()
+ * @see media_streamer_node_decoded_ready_cb()
+ */
+int media_streamer_node_set_decoded_ready_cb(media_streamer_node_h node, media_streamer_node_decoded_ready_cb callback, void *user_data);
+
+/**
+ * @brief Unsets the decoded ready callback function.
+ * @since_tizen 6.0
+ * @param[in] node    Media streamer node handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #MEDIA_STREAMER_ERROR_NONE Successful
+ * @retval #MEDIA_STREAMER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see media_streamer_node_set_decoded_ready_cb()
+ */
+int media_streamer_node_unset_decoded_ready_cb(media_streamer_node_h node);
+
+/**
  * @brief Sets a callback function to be invoked when WebRTC node needs to send the message to the remote peer of WebRTC connection.
  * @details This function can be called only for #MEDIA_STREAMER_NODE_TYPE_WEBRTC type.
  * @since_tizen 6.0