Delete processing timer at main thread
[platform/core/uifw/stt.git] / include / stt_internal.h
index 5b0cc70..bee1d92 100644 (file)
@@ -32,6 +32,14 @@ extern "C"
 #define STT_SPEECH_STATUS_BEGINNING_POINT_DETECTED     0
 
 /**
+* @brief Enumerations of audio type.
+*/
+typedef enum {
+       STT_AUDIO_TYPE_RAW_S16 = 0,     /**< Signed 16-bit audio sample */
+       STT_AUDIO_TYPE_RAW_U8,          /**< Unsigned 8-bit audio sample */
+} stt_audio_type_e;
+
+/**
  * @brief Called when user speaking is detected.
  *
  * @param[in] stt The STT handle
@@ -124,12 +132,68 @@ int stt_unset_speech_status_cb(stt_h stt);
  */
 int stt_set_server_stt(stt_h stt, const char* key, char* user_data);
 
+/**
+ * @brief Starts file recognition asynchronously.
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks This function starts sending recorded data from file to engine.
+ * @param[in] stt The STT handle
+ * @param[in] language The language selected from stt_foreach_supported_languages()
+ * @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_FREE_PARTIAL)
+ * @param[in] filepath PCM filepath for recognition
+ * @param[in] audio_type audio type of file
+ * @param[in] sample_rate sample rate of file
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #STT_ERROR_NONE Successful
+ * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STT_ERROR_INVALID_STATE Invalid state
+ * @retval #STT_ERROR_OPERATION_FAILED Operation failure
+ * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
+ * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
+ * @pre The state should be #STT_STATE_READY.
+ * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb().
+ *       If this function succeeds, the STT state will be #STT_STATE_RECORDING.
+ *       If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_RECORDING.
+ * @see stt_cancel_file()
+ * @see stt_state_changed_cb()
+*/
+int stt_start_file(stt_h stt, const char* language, const char* type, const char* filepath, stt_audio_type_e audio_type, int sample_rate);
+
+/**
+ * @brief Cancels processing file recognition asynchronously.
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/recorder
+ * @remarks This function cancels recording and engine cancels recognition processing.
+ *         After successful cancel, stt_state_changed_cb() is called otherwise if error is occurred, stt_error_cb() is called.
+ * @param[in] stt The STT handle
+ * @return @c 0 on success,
+ *        otherwise a negative error value
+ * @retval #STT_ERROR_NONE Successful
+ * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STT_ERROR_INVALID_STATE Invalid state
+ * @retval #STT_ERROR_OPERATION_FAILED Operation failure
+ * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
+ * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #STT_ERROR_IN_PROGRESS_TO_READY Progress to ready is not finished
+ * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
+ * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing is not finished
+ * @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
+ * @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb().
+ *      If this function succeeds, the STT state will be #STT_STATE_READY.
+ *      If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_READY.
+ * @see stt_start_file()
+ * @see stt_state_changed_cb()
+*/
+int stt_cancel_file(stt_h stt);
+
 #ifdef __cplusplus
 }
 #endif
 
 /**
- * @}@}
+ * @}
  */
 
 #endif /* __STT_INTERNAL_H__ */