[ACR-844] Add Interrupt cb API 08/99808/2 accepted/tizen/3.0/common/20161130.064735 accepted/tizen/3.0/ivi/20161130.011802 accepted/tizen/3.0/mobile/20161130.011505 accepted/tizen/3.0/tv/20161130.011637 accepted/tizen/3.0/wearable/20161130.011719 submit/tizen_3.0/20161129.051721
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 24 Nov 2016 07:16:45 +0000 (16:16 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 24 Nov 2016 07:46:24 +0000 (16:46 +0900)
Change-Id: I21ff9004aafbd53a8f3222d9f98411e8ca8967d6

include/media_streamer.h

index f011fe4..ca518ee 100644 (file)
@@ -166,6 +166,16 @@ typedef enum {
 } media_streamer_custom_buffer_status_e;
 
 /**
+ * @brief Enumeration for media streamer's interruption type.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       MEDIA_STREAMER_INTERRUPTED_BY_RESOURCE_CONFLICT,    /**< Interrupted by a resource conflict */
+       MEDIA_STREAMER_INTERRUPTED_BY_SECURITY,             /**< Interrupted by a security policy */
+} media_streamer_interrupted_code_e;
+
+/**
  * @brief Definition for "camera-id" parameter of source node.
  * @details Index number of camera to activate.
  *          Data type is integer and default value is 0.
@@ -472,6 +482,16 @@ typedef void (*media_streamer_sink_eos_cb)(media_streamer_node_h node, void *use
 typedef void (*media_streamer_position_changed_cb)(void *user_data);
 
 /**
+ * @brief Called when the media streamer is interrupted.
+ * @since_tizen 3.0
+ * @param[in]  error_code      The interrupted error code
+ * @param[in]  user_data       The user data passed from the callback registration function
+ * @see media_streamer_set_interrupted_cb()
+ * @see media_streamer_unset_interrupted_cb()
+ */
+typedef void (*media_streamer_interrupted_cb)(media_streamer_interrupted_code_e code, void *user_data);
+
+/**
  * @brief Registers a error callback function to be invoked when an error occurs.
  * @details Following error codes can be delivered by error callback.
  *          #MEDIA_STREAMER_ERROR_INVALID_OPERATION,
@@ -544,6 +564,36 @@ int media_streamer_set_state_change_cb(media_streamer_h streamer, media_streamer
 int media_streamer_unset_state_change_cb(media_streamer_h streamer);
 
 /**
+ * @brief Registers a callback function to be invoked when the media streamer is interrupted.
+ * @since_tizen 3.0
+ * @param[in] streamer Media streamer handle
+ * @param[in] callback The 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
+ * @post media_streamer_interrupted_cb() will be invoked.
+ * @see media_streamer_unset_interrupted_cb()
+ * @see #media_streamer_interrupted_code_e
+ */
+int media_streamer_set_interrupted_cb(media_streamer_h streamer, media_streamer_interrupted_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen 3.0
+ * @param[in] streamer Media streamer 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
+ * @retval #MEDIA_STREAMER_ERROR_INVALID_OPERATION Invalid operation
+ * @see media_streamer_set_interrupted_cb()
+ */
+int media_streamer_unset_interrupted_cb(media_streamer_h streamer);
+
+/**
  * @brief Registers a callback function to be invoked when buffer underrun or overflow is occurred.
  * @details This function can be called only for MEDIA_STREAMER_NODE_SRC_TYPE_CUSTOM source type
  * @since_tizen 3.0