C-API/ml_pipeline_src_input_data new enum for events suggstion.
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 22 Jul 2020 02:20:36 +0000 (11:20 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 3 Aug 2020 11:09:17 +0000 (20:09 +0900)
In order to give events to appsrc via ml_pipeline_src_input_data,
I'd like to suggest to use "policy" argument to keep "data"
uncomplicated.

We can simply add non-policy enum values to have general
event support; if you need some value for an event, you can
keep using "data".

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
api/capi/include/nnstreamer.h

index a49362a..721b8de 100644 (file)
@@ -190,6 +190,7 @@ typedef enum {
   ML_PIPELINE_BUF_POLICY_AUTO_FREE      = 0, /**< Default. Application should not deallocate this buffer. NNStreamer will deallocate when the buffer is no more needed. */
   ML_PIPELINE_BUF_POLICY_DO_NOT_FREE    = 1, /**< This buffer is not to be freed by NNStreamer (i.e., it's a static object). However, be careful: NNStreamer might be accessing this object after the return of the API call. */
   ML_PIPELINE_BUF_POLICY_MAX,   /**< Max size of #ml_pipeline_buf_policy_e structure. */
+  ML_PIPELINE_BUF_SRC_EVENT_EOS         = 0x10000, /**< Trigger End-Of-Stream event for the corresponding appsrc and ignore the given input value. The correspnding appsrc will no longer accept new data after this. */
 } ml_pipeline_buf_policy_e;
 
 /**
@@ -417,7 +418,7 @@ int ml_pipeline_src_release_handle (ml_pipeline_src_h src_handle);
  * @param[in] src_handle The source handle returned by ml_pipeline_src_get_handle().
  * @param[in] data The handle of input tensors, in the format of tensors info given by ml_pipeline_src_get_tensors_info().
  *                 This function takes ownership of the data if @a policy is #ML_PIPELINE_BUF_POLICY_AUTO_FREE.
- * @param[in] policy The policy of buffer deallocation.
+ * @param[in] policy The policy of buffer deallocation. The policy value may include buffer deallocation mechanisms or event triggers for appsrc elements. If event triggers are provided, these functions will not give input data to the appsrc element, but will trigger the given event only.
  * @return 0 on success. Otherwise a negative error value.
  * @retval #ML_ERROR_NONE Successful.
  * @retval #ML_ERROR_NOT_SUPPORTED Not supported.