Add ttse_terminate() and tts_prepare_sync() into public API 69/271169/4
authorSuyeon Hwang <stom.hwang@samsung.com>
Wed, 16 Feb 2022 07:00:23 +0000 (16:00 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 24 Feb 2022 00:16:38 +0000 (09:16 +0900)
Change-Id: I7c724fff803f9d2aa85ef7f24638685683430075
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts.c
include/CMakeLists.txt
include/tts.h
include/tts_internal.h
include/ttse.h
include/ttse_internal.h [deleted file]
packaging/tts.spec
server/ttse.c

index bd641f044130cc5155ae494de9f7fdb7b3de7dc5..82fa959675dadb24651dd4d4fbe994e0cd117f6b 100644 (file)
@@ -593,7 +593,6 @@ int tts_prepare(tts_h tts)
        return TTS_ERROR_NONE;
 }
 
-//LCOV_EXCL_START
 int tts_prepare_sync(tts_h tts)
 {
        if (0 != __tts_get_feature_enabled()) {
@@ -622,7 +621,6 @@ int tts_prepare_sync(tts_h tts)
        SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
        return TTS_ERROR_NONE;
 }
-//LCOV_EXCL_STOP
 
 int tts_unprepare(tts_h tts)
 {
index 5d42c92a301da9e64c506e4603cc647f1dc276e9..8437a1801107c3d05e3448c8c924db49c250a675 100644 (file)
@@ -11,4 +11,3 @@ INSTALL(FILES "${CMAKE_BINARY_DIR}/include/tts.h" DESTINATION ${INCLUDEDIR})
 INSTALL(FILES "${CMAKE_BINARY_DIR}/include/tts_internal.h" DESTINATION ${INCLUDEDIR})
 INSTALL(FILES "${CMAKE_BINARY_DIR}/include/tts_setting.h" DESTINATION ${INCLUDEDIR})
 INSTALL(FILES "${CMAKE_BINARY_DIR}/include/ttse.h" DESTINATION ${INCLUDEDIR})
-INSTALL(FILES "${CMAKE_BINARY_DIR}/include/ttse_internal.h" DESTINATION ${INCLUDEDIR})
index 5121f7997c1b0a47cc46e192a5c463766312b260..c421661e564c7bdc605bbfacaec98c404e640a4c 100644 (file)
@@ -369,6 +369,24 @@ int tts_prepare(tts_h tts);
 int tts_unprepare(tts_h tts);
 
 
+/**
+ * @brief Connects the daemon synchronously.
+ * @since_tizen 7.0
+ * @param[in] tts The TTS handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_INVALID_STATE Invalid state
+ * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
+ * @pre The state should be #TTS_STATE_CREATED.
+ * @post If this function is successful, the TTS state will be #TTS_STATE_READY.
+ * @see tts_unprepare()
+*/
+int tts_prepare_sync(tts_h tts);
+
+
 /**
  * @brief Retrieves all supported voices of the current engine using callback function.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
index 2060b4a4e7f14c6bcdebe415af56cf7eb84e3fb7..ab07e2452c2545adc535055f0d3a1c4ad8dc033d 100644 (file)
@@ -63,12 +63,12 @@ int tts_set_server_tts(tts_h tts, const char* credential);
  * @since_tizen 4.0
  *
  * @param[in] tts The TTS handle
- * @param[in] event An event about pcm buffer (-1: error, 1: start, 2: continue, 3: finish) 
+ * @param[in] event An event about pcm buffer (-1: error, 1: start, 2: continue, 3: finish)
  * @param[in] data The pcm data buffer
  * @param[in] data_size The data size of pcm data buffer
  * @param[in] audio_type The audio type of pcm (0: signed 16-bit, 1: unsigned 8-bit)
  * @param[in] rate The sampling rate of pcm
- * @return @c 0 on success, 
+ * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
@@ -87,7 +87,7 @@ int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size,
  * @since_tizen 4.0
  *
  * @param[in] tts The TTS handle
- * @return @c 0 on success, 
+ * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
@@ -106,7 +106,7 @@ int tts_play_pcm(tts_h tts);
  * @since_tizen 4.0
  *
  * @param[in] tts The TTS handle
- * @return @c 0 on success, 
+ * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
@@ -121,23 +121,6 @@ int tts_play_pcm(tts_h tts);
 int tts_stop_pcm(tts_h tts);
 
 
-/**
- * @brief Connects the daemon asynchronously.
- * @since_tizen 5.0
- * @param[in] tts The TTS handle
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #TTS_ERROR_NONE Successful
- * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
- * @pre The state should be #TTS_STATE_CREATED.
- * @post If this function is successful, the TTS state will be #TTS_STATE_READY.
- *       If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
- * @see tts_unprepare()
-*/
-int tts_prepare_sync(tts_h tts);
-
 
 #ifdef __cplusplus
 }
index a9e5e7b9bc27b6017db587bda8adf33fd5a719ac..0c73115ec49429833769cad0d587813bf1196489 100755 (executable)
@@ -103,7 +103,7 @@ typedef enum {
 *                     For example, "ko_KR" for Korean, "en_US" for American English
 * @param[in] type The voice type
 * @param[in] user_data The user data passed from ttse_foreach_supported_voices_cb()
-* @return @c true to continue with the next iteration of the loop 
+* @return @c true to continue with the next iteration of the loop
 *         @c false to break out of the loop
 * @pre ttse_foreach_supported_voices_cb() will invoke this callback function.
 * @see ttse_foreach_supported_voices_cb()
@@ -115,7 +115,7 @@ typedef bool (*ttse_supported_voice_cb)(const char* language, int type, void* us
 * @brief Called when the engine service user initializes TTS engine.
 * @since_tizen 3.0
 * @remarks This callback function is mandatory and must be registered using ttse_main().
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -133,7 +133,7 @@ typedef int (*ttse_initialize_cb)(void);
 * @remarks This callback function is mandatory and must be registered using ttse_main().
 *          NOTE that the engine may be terminated automatically.
 *          When this callback function is invoked, the release of resources is necessary.
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
@@ -150,7 +150,7 @@ typedef int (*ttse_deinitialize_cb)(void);
 *          If 'ttse_supported_voice_cb()' returns @c false, it should be stopped to call 'ttse_supported_voice_cb()'.
 * @param[in] callback The callback function
 * @param[in] user_data The user data which must be passed to ttse_supported_voice_cb()
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -169,10 +169,10 @@ typedef int (*ttse_foreach_supported_voices_cb)(ttse_supported_voice_cb callback
 *                     followed by ISO 639-1 for the two-letter language code.
 *                     For example, "ko_KR" for Korean, "en_US" for American English
 * @param[in] type The voice type
-* @param[out] is_valid A variable for checking whether the corresponding voice is valid or not. 
+* @param[out] is_valid A variable for checking whether the corresponding voice is valid or not.
 *                      @c true to be valid,
 *                      @c false to be invalid
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -186,7 +186,7 @@ typedef int (*ttse_is_valid_voice_cb)(const char* language, int type, bool* is_v
 * @since_tizen 3.0
 * @remarks This callback function is mandatory and must be registered using ttse_main().
 * @param[in] pitch The default pitch
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -204,7 +204,7 @@ typedef int (*ttse_set_pitch_cb)(int pitch);
 *                     followed by ISO 639-1 for the two-letter language code.
 *                     For example, "ko_KR" for Korean, "en_US" for American English
 * @param[in] type The voice type
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -225,7 +225,7 @@ typedef int (*ttse_load_voice_cb)(const char* language, int type);
 *                     followed by ISO 639-1 for the two-letter language code.
 *                     For example, "ko_KR" for Korean, "en_US" for American English
 * @param[in] type The voice type
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -249,7 +249,7 @@ typedef int (*ttse_unload_voice_cb)(const char* language, int type);
 * @param[out] is_agreed A variable for checking whether the application agreed to use TTS engine or not.
 *                       @c true to agree,
 *                       @c false to disagree
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_STATE Not initialized
@@ -284,7 +284,7 @@ typedef bool (*ttse_need_app_credential_cb)(void);
 * @param[in] appid The Application ID
 * @param[in] credential The credential granted to the application
 * @param[in] user_data The user data which must be passed to ttse_send_result()
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -305,7 +305,7 @@ typedef int (*ttse_start_synthesis_cb)(const char* language, int type, const cha
 * @brief Called when the engine service user cancels to synthesize a voice.
 * @since_tizen 3.0
 * @remarks This callback function is mandatory and must be registered using ttse_main().
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_STATE Not initialized or not started synthesis
@@ -326,7 +326,7 @@ typedef int (*ttse_cancel_synthesis_cb)(void);
 * @param[out] engine_name Name of engine
 * @param[out] engine_setting The engine setting application(ui app)'s app ID
 * @param[out] use_network The status for using network
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error code on failure
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -342,7 +342,7 @@ typedef int (*ttse_get_info_cb)(char** engine_uuid, char** engine_name, char** e
 * @remarks This callback function is optional and is registered using ttse_set_private_data_set_cb().
 * @param[in] key The key field of private data
 * @param[in] data The data field of private data
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -361,7 +361,7 @@ typedef int (*ttse_private_data_set_cb)(const char* key, const char* data);
 * @remarks This callback function is optional and is registered using ttse_set_private_data_requested_cb().
 * @param[out] key The key field of private data
 * @param[out] data The data field of private data
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -409,7 +409,7 @@ typedef struct {
 * @param[in] argc The argument count(original)
 * @param[in] argv The argument(original)
 * @param[in] callback The structure of engine request callback function
-* @return This function returns zero on success, 
+* @return This function returns zero on success,
 *         or negative with error code on failure
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -487,6 +487,19 @@ int main(int argc, char* argv[])
 int ttse_main(int argc, char** argv, ttse_request_callback_s *callback);
 
 
+/**
+* @brief Terminates the main function of TTS engine.
+* @since_tizen 7.0
+* @remarks This function invokes ttse_deinitialize_cb() in #ttse_request_callback_s which is registered by ttse_main().
+*          And this function should be called before terminating the engine to ensure safe termination.
+* @return @c 0 on success,
+*         otherwise a negative error value
+* @retval #TTSE_ERROR_NONE Successful
+* @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
+*/
+int ttse_terminate(void);
+
+
 /**
 * @brief Gets the speed range from Tizen platform.
 * @since_tizen 3.0
@@ -494,7 +507,7 @@ int ttse_main(int argc, char** argv, ttse_request_callback_s *callback);
 * @param[out] min The minimum speed value
 * @param[out] normal The normal speed value
 * @param[out] max The maximum speed value
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -511,7 +524,7 @@ int ttse_get_speed_range(int* min, int* normal, int* max);
 * @param[out] min The minimum pitch value
 * @param[out] normal The normal pitch value
 * @param[out] max The maximum pitch value
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -532,7 +545,7 @@ int ttse_get_pitch_range(int* min, int* normal, int* max);
 * @param[in] audio_type The audio type
 * @param[in] rate The sample rate
 * @param[in] user_data The user data passed from ttse_start_synthesis_cb()
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -563,7 +576,7 @@ int ttse_send_result(ttse_result_event_e event, const void* data, unsigned int d
 * @since_tizen 3.0
 * @param[in] error The error reason
 * @param[in] msg The error message
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -579,7 +592,7 @@ int ttse_send_error(ttse_error_e error, const char* msg);
 * @since_tizen 3.0
 * @remarks The ttse_private_data_set_cb() function is called when the engine service user sends the private data.
 * @param[in] callback_func ttse_private_data_set event callback function
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
@@ -596,7 +609,7 @@ int ttse_set_private_data_set_cb(ttse_private_data_set_cb callback_func);
 * @since_tizen 3.0
 * @remarks The ttse_private_data_requested_cb() function is called when the engine service user gets the private data from TTS engine.
 * @param[in] callback_func ttse_private_data_requested event callback function
-* @return @c 0 on success, 
+* @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
 * @retval #TTSE_ERROR_INVALID_PARAMETER Invalid parameter
diff --git a/include/ttse_internal.h b/include/ttse_internal.h
deleted file mode 100644 (file)
index 02054b5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __TTSE_INTERNAL_H__
-#define __TTSE_INTERNAL_H__
-
-#include <tizen.h>
-#include "ttse.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int ttse_terminate();
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TTSE_INTERNAL_H__ */
-
index 1845ae942c07d7273739570749a064d8237201cd..3086f9fb8857e30391c69e41b6c4a35e3156df44 100644 (file)
@@ -200,7 +200,6 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice/test
 %defattr(-,root,root,-)
 %{_libdir}/pkgconfig/tts-engine.pc
 %{_includedir}/ttse.h
-%{_includedir}/ttse_internal.h
 
 %if 0%{?gcov:1}
 %files gcov
index b0b73e15b897a8b6446902725909fa3d2d6b370a..f280d5411261e4fca2084f7af2f009c2b0561569 100755 (executable)
@@ -27,7 +27,6 @@
 #include <app_manager.h>
 
 #include "ttse.h"
-#include "ttse_internal.h"
 
 static ttsd_mode_e g_tts_mode = TTSD_MODE_DEFAULT;
 static bool g_is_terminated = false;
@@ -228,7 +227,7 @@ int ttse_main(int argc, char** argv, ttse_request_callback_s *callback)
        return TTSE_ERROR_NONE;
 }
 
-int ttse_terminate()
+int ttse_terminate(void)
 {
        if (true == g_is_terminated) {
                SLOG(LOG_INFO, tts_tag(), "[INFO] ttse_terminate() is already invoked.");