/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
ret = engine->pefuncs->initialize(result_cb, silence_cb);
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to initialize : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_deinitialize(int engine_id)
SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Fail to deinitialize : %s", __stt_get_engine_error_code(ret));
}
- return 0;
+ return ret;
}
static bool __supported_language_cb(const char* language, void* user_data)
ret = engine->pefuncs->foreach_langs(__supported_language_cb, (void*)lang_list);
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] get language list error : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_is_valid_language(int engine_id, const char* language, bool *is_valid)
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set private data(%d)", ret);
}
- return STTP_ERROR_NONE;
+ return ret;
}
int stt_engine_get_private_data(int engine_id, const char* key, char** data)
char* temp = NULL;
int ret = engine->pefuncs->get_private_data(key, &temp);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set private data(%d)", ret);
+ SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get private data(%d)", ret);
+ return ret;
}
- *data = strdup(temp);
+ if (NULL == temp)
+ *data = strdup("NULL");
+ else
+ *data = strdup(temp);
return STTP_ERROR_NONE;
}
ret = engine->pefuncs->get_audio_format(types, rate, channels);
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get audio format : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
/* Set option */
return STTP_ERROR_NOT_SUPPORTED_FEATURE;
} else if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set silence detection : %d", ret);
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_check_app_agreed(int engine_id, const char* appid, bool* value)
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get app agreement : %s", __stt_get_engine_error_code(ret));
*value = false;
- return ret;
}
- return 0;
+ return ret;
}
/* Recognition */
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start recognition : %s", __stt_get_engine_error_code(ret));
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start recognition : lang(%s), recognition_type(%s), credential(%s)", lang, recognition_type, credential);
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_set_recording_data(int engine_id, const void* data, unsigned int length)
int ret = engine->pefuncs->set_recording(data, length);
if (0 != ret) {
SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Fail to set recording : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_recognize_stop(int engine_id)
int ret = engine->pefuncs->stop();
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to stop : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_recognize_cancel(int engine_id)
int ret = engine->pefuncs->cancel();
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to cancel : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_foreach_result_time(int engine_id, void* time_info, sttpe_result_time_cb callback, void* user_data)
int ret = engine->pefuncs->foreach_result_time(time_info, callback, user_data);
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to foreach result time : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
-int stt_engine_recognize_start_file(int engine_id, const char* lang, const char* recognition_type,
+int stt_engine_recognize_start_file(int engine_id, const char* lang, const char* recognition_type,
const char* filepath, sttp_audio_type_e audio_type, int sample_rate, void* user_param)
{
if (NULL == filepath || NULL == lang || NULL == recognition_type) {
int ret = engine->pefuncs->start_file(lang, recognition_type, filepath, audio_type, sample_rate, user_param);
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}
int stt_engine_recognize_cancel_file(int engine_id)
int ret = engine->pefuncs->cancel_file();
if (0 != ret) {
SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret));
- return ret;
}
- return 0;
+ return ret;
}