Fix to get the maximum text size from the engine meta data
[platform/core/uifw/tts.git] / common / tts_config_parser.c
index b984103..135b392 100644 (file)
@@ -29,6 +29,7 @@
 #define TTS_TAG_ENGINE_VOICE           "voice"
 #define TTS_TAG_ENGINE_VOICE_TYPE      "type"
 #define TTS_TAG_ENGINE_PITCH_SUPPORT   "pitch-support"
+#define TTS_TAG_ENGINE_TEXT_SIZE       "text-size"
 
 #define TTS_TAG_CONFIG_BASE_TAG                "tts-config"
 #define TTS_TAG_CONFIG_ENGINE_ID       "engine"
@@ -106,6 +107,7 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info
        temp->voices = NULL;
        temp->setting = NULL;
        temp->pitch_support = false;
+       temp->text_size = 0;
 
        while (cur != NULL) {
                if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_NAME)) {
@@ -210,6 +212,15 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info
                        } else {
                                SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_PITCH_SUPPORT);
                        }
+               } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_TEXT_SIZE)) {
+                       key = xmlNodeGetContent(cur);
+                       if (NULL != key) {
+                               temp->text_size = atoi((char*)key);
+                               xmlFree(key);
+                       } else {
+                               SLOG(LOG_INFO, tts_tag(), "[INFO] text size is unlimited.");
+                               temp->text_size = 0;
+                       }
                }
                cur = cur->next;
        }