b5231441c5d6e37434d2d890195b0b0def723971
[platform/core/uifw/tts.git] / server / ttsd_data.cpp
1 /*
2 *  Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved 
3 *  Licensed under the Apache License, Version 2.0 (the "License");
4 *  you may not use this file except in compliance with the License.
5 *  You may obtain a copy of the License at
6 *  http://www.apache.org/licenses/LICENSE-2.0
7 *  Unless required by applicable law or agreed to in writing, software
8 *  distributed under the License is distributed on an "AS IS" BASIS,
9 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 *  See the License for the specific language governing permissions and
11 *  limitations under the License.
12 */
13
14 #include <list>
15 #include <pthread.h>
16 #include <vector>
17
18 #include "ttsd_main.h"
19 #include "ttsd_data.h"
20
21 using namespace std;
22
23 typedef struct
24 {
25         char*   lang;
26         int     vctype;
27 }used_voice_s;
28
29 typedef struct
30 {
31         int             pid;
32         int             uid;
33         int             utt_id_stopped;
34         app_state_e     state;
35
36         std::list<speak_data_s*> m_speak_data;
37         std::list<sound_data_s*> m_wav_data;
38
39         std::list<used_voice_s> m_used_voice;
40 }app_data_s;
41
42 static vector<app_data_s> g_app_list;
43
44 static pthread_mutex_t g_speak_data_mutex = PTHREAD_MUTEX_INITIALIZER;
45 static pthread_mutex_t g_sound_data_mutex = PTHREAD_MUTEX_INITIALIZER;
46
47 /*
48 * functions for debug
49 */
50 int __data_show_list()
51 {
52         int vsize = g_app_list.size();
53
54         SLOG(LOG_DEBUG, tts_tag(), "----- client list -----");
55
56         for (int i=0; i < vsize; i++) {
57                 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[%dth] pid(%d), uid(%d), state(%d)", i, g_app_list[i].pid, g_app_list[i].uid, g_app_list[i].state);
58         }
59
60         if (0 == vsize) {
61                 SLOG(LOG_DEBUG, tts_tag(), "No Client");
62         }
63
64         SLOG(LOG_DEBUG, tts_tag(), "-----------------------");
65
66         return TTSD_ERROR_NONE;
67 }
68
69 int __data_show_sound_list(int index)
70 {
71         SLOG(LOG_DEBUG, tts_tag(), "----- Sound list -----");
72
73         unsigned int i = 0;
74         std::list<sound_data_s*>::iterator iter;
75         for (iter = g_app_list[index].m_wav_data.begin(); iter != g_app_list[index].m_wav_data.end(); iter++) {
76                 SLOG(LOG_DEBUG, tts_tag(), "[%dth][%p] data(%p) data size(%ld), uttid(%d), type(%d)", 
77                         i, *iter, (*iter)->data, (*iter)->data_size, (*iter)->utt_id, (*iter)->audio_type);
78                 i++;
79         }
80
81         if (i == 0) {
82                 SLOG(LOG_DEBUG, tts_tag(), "No Sound Data");
83         }
84
85         SLOG(LOG_DEBUG, tts_tag(), "----------------------");
86         return TTSD_ERROR_NONE;
87 }
88
89 int __data_show_text_list(int index)
90 {
91         SLOG(LOG_DEBUG, tts_tag(), "----- Text list -----");
92
93         unsigned int i = 0;
94         std::list<speak_data_s*>::iterator iter;
95         for (iter = g_app_list[index].m_speak_data.begin(); iter != g_app_list[index].m_speak_data.end(); iter++) {
96                 SLOG(LOG_DEBUG, tts_tag(), "[%dth][%p] lang(%s), vctype(%d), speed(%d), uttid(%d), text(%s)", 
97                         i + 1, *iter, (*iter)->lang, (*iter)->vctype, (*iter)->speed, (*iter)->utt_id, (*iter)->text);
98                 i++;
99         }
100
101         if (0 == i) {
102                 SLOG(LOG_DEBUG, tts_tag(), "No Text Data");
103         }
104
105         SLOG(LOG_DEBUG, tts_tag(), "---------------------");
106         return TTSD_ERROR_NONE;
107 }
108
109 int __data_show_used_voice_list(int index)
110 {
111         SLOG(LOG_DEBUG, tts_tag(), "----- Used voice list -----");
112
113         unsigned int i = 0;
114         std::list<used_voice_s>::iterator iter;
115         for (iter = g_app_list[index].m_used_voice.begin(); iter != g_app_list[index].m_used_voice.end(); iter++) {
116                 SLOG(LOG_DEBUG, tts_tag(), "[%dth] lang(%s), vctype(%d)", i + 1, iter->lang, iter->vctype);
117                 i++;
118         }
119
120         if (0 == i) {
121                 SLOG(LOG_DEBUG, tts_tag(), "No Voice Data");
122         }
123
124         SLOG(LOG_DEBUG, tts_tag(), "---------------------------");
125         return TTSD_ERROR_NONE;
126 }
127
128 /*
129 * ttsd data functions
130 */
131
132 int ttsd_data_new_client(int pid, int uid)
133 {
134         if( -1 != ttsd_data_is_client(uid) ) {
135                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
136                 return TTSD_ERROR_INVALID_PARAMETER;
137         }
138
139         app_data_s app;
140         app.pid = pid;
141         app.uid = uid;
142         app.utt_id_stopped = 0;
143         app.state = APP_STATE_READY;
144
145         g_app_list.insert(g_app_list.end(), app);
146
147 #ifdef DATA_DEBUG
148         __data_show_list();
149 #endif
150         return TTSD_ERROR_NONE;
151 }
152
153 int ttsd_data_delete_client(int uid)
154 {
155         int index = 0;
156
157         index = ttsd_data_is_client(uid);
158
159         if (index < 0) {
160                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
161                 return -1;
162         }
163
164         if (0 != ttsd_data_clear_data(uid)) {
165                 SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] Fail to clear data");
166                 return -1;
167         }
168
169         g_app_list.erase(g_app_list.begin()+index);
170
171 #ifdef DATA_DEBUG
172         __data_show_list();
173 #endif
174         return TTSD_ERROR_NONE;
175 }
176
177 int ttsd_data_is_client(int uid)
178 {
179         int vsize = g_app_list.size();
180
181         for (int i = 0; i < vsize; i++) {
182                 if(g_app_list[i].uid == uid) {
183                         return i;
184                 }
185         }
186
187         return -1;
188 }
189
190 int ttsd_data_get_client_count()
191 {
192         return g_app_list.size();
193 }
194
195 int ttsd_data_get_pid(int uid)
196 {
197         int index;
198
199         index = ttsd_data_is_client(uid);
200
201         if (index < 0)  {
202                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
203                 return TTSD_ERROR_INVALID_PARAMETER;
204         }
205
206         return g_app_list[index].pid;
207 }
208
209 int ttsd_data_get_speak_data_size(int uid)
210 {
211         int index = 0;
212         index = ttsd_data_is_client(uid);
213
214         if (index < 0) {
215                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
216                 return TTSD_ERROR_INVALID_PARAMETER;
217         }
218
219         /* mutex is locked */
220         pthread_mutex_lock(&g_speak_data_mutex);
221         int size = g_app_list[index].m_speak_data.size();
222
223         /* mutex is unlocked */
224         pthread_mutex_unlock(&g_speak_data_mutex);
225
226         return size;
227 }
228
229 int ttsd_data_set_used_voice(int uid, const char* lang, int type)
230 {
231         int index = 0;
232         index = ttsd_data_is_client(uid);
233
234         if (index < 0) {
235                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
236                 return TTSD_ERROR_INVALID_PARAMETER;
237         }
238
239         /* Find voice */
240         std::list<used_voice_s>::iterator iter;
241
242         for (iter = g_app_list[index].m_used_voice.begin();iter != g_app_list[index].m_used_voice.end();iter++) {
243                 if (0 == strcmp(lang, iter->lang) && type == iter->vctype) {
244                         SLOG(LOG_DEBUG, tts_tag(), "[DATA] The voice is already registered (%s)(%d)", lang, type);
245                         return 0;
246                 }
247         }
248
249         /* Add voice */
250         used_voice_s used_voice;
251         used_voice.lang = strdup(lang);
252         used_voice.vctype = type;
253
254         g_app_list[index].m_used_voice.insert(g_app_list[index].m_used_voice.end(), used_voice);
255
256 #ifdef DATA_DEBUG
257         __data_show_used_voice_list(index);
258 #endif
259
260         return -1;      /* Need to load voice*/
261 }
262
263 int ttsd_data_reset_used_voice(int uid, ttsd_used_voice_cb callback)
264 {
265         int index = 0;
266         index = ttsd_data_is_client(uid);
267
268         if (index < 0) {
269                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
270                 return TTSD_ERROR_INVALID_PARAMETER;
271         }
272
273         if (NULL == callback) {
274                 SLOG(LOG_WARN, tts_tag(), "[DATA WARNING] Used voice callback is NULL");
275         }
276
277         /* Find voice */
278         std::list<used_voice_s>::iterator iter;
279
280         for (iter = g_app_list[index].m_used_voice.begin(); iter != g_app_list[index].m_used_voice.end(); iter++) {
281                 if (NULL != callback) {
282                         callback(iter->lang, iter->vctype);
283                 }
284
285                 if (NULL != iter->lang) {
286                         free(iter->lang);
287                         iter->lang = NULL;
288                 }
289         }
290
291         g_app_list[index].m_used_voice.clear();
292
293 #ifdef DATA_DEBUG
294         __data_show_used_voice_list(index);
295 #endif
296
297         return TTSD_ERROR_NONE;
298 }
299
300 int ttsd_data_add_speak_data(int uid, speak_data_s* data)
301 {
302         int index = 0;
303         index = ttsd_data_is_client(uid);
304
305         if (index < 0) {
306                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
307                 return TTSD_ERROR_INVALID_PARAMETER;
308         }
309
310         /* mutex is locked */
311         pthread_mutex_lock(&g_speak_data_mutex);
312
313         g_app_list[index].m_speak_data.insert(g_app_list[index].m_speak_data.end(), data);
314
315         if (1 == data->utt_id)
316                 g_app_list[index].utt_id_stopped = 0;
317
318 #ifdef DATA_DEBUG
319         __data_show_text_list(index);
320 #endif
321         pthread_mutex_unlock(&g_speak_data_mutex);
322
323         return TTSD_ERROR_NONE;
324 }
325
326 int ttsd_data_get_speak_data(int uid, speak_data_s** data)
327 {
328         int index = 0;
329         index = ttsd_data_is_client(uid);
330
331         if (index < 0) {
332                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid(%d)", uid);
333                 return TTSD_ERROR_INVALID_PARAMETER;
334         }
335
336         /* mutex is locked */
337         pthread_mutex_lock(&g_speak_data_mutex);
338
339         if (0 == g_app_list[index].m_speak_data.size()) {
340 #ifdef DATA_DEBUG
341                 SLOG(LOG_WARN, tts_tag(), "[DATA WARNING] There is no speak data");
342 #endif
343                 pthread_mutex_unlock(&g_speak_data_mutex);
344                 return -1;
345         }
346
347         std::list<speak_data_s*>::iterator iter = g_app_list[index].m_speak_data.begin();
348         *data = *iter;
349         if (!g_app_list[index].m_speak_data.empty())
350                 g_app_list[index].m_speak_data.pop_front();
351
352 #ifdef DATA_DEBUG
353         __data_show_text_list(index);
354 #endif
355         pthread_mutex_unlock(&g_speak_data_mutex);
356
357         return TTSD_ERROR_NONE;
358 }
359
360 int ttsd_data_add_sound_data(int uid, sound_data_s* data)
361 {
362         int index = 0;
363         index = ttsd_data_is_client(uid);
364
365         if(index < 0) {
366                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
367                 return TTSD_ERROR_INVALID_PARAMETER;
368         }
369
370         if (NULL == data) {
371                 SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] sound data is NULL");
372                 return TTSD_ERROR_INVALID_PARAMETER;
373         }
374         /* mutex is locked */
375         pthread_mutex_lock(&g_sound_data_mutex);
376
377         g_app_list[index].m_wav_data.insert(g_app_list[index].m_wav_data.end(), data);
378
379 #ifdef DATA_DEBUG
380         __data_show_sound_list(index);
381 #endif
382
383         /* mutex is unlocked */
384         pthread_mutex_unlock(&g_sound_data_mutex);
385
386         return TTSD_ERROR_NONE;
387 }
388
389 int ttsd_data_get_sound_data(int uid, sound_data_s** data)
390 {
391         int index = 0;
392         index = ttsd_data_is_client(uid);
393
394         if (index < 0)  {
395                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
396                 return TTSD_ERROR_INVALID_PARAMETER;
397         }
398
399         /* mutex is locked */
400         pthread_mutex_lock(&g_sound_data_mutex);
401
402         if (0 == g_app_list[index].m_wav_data.size()) {
403 #ifdef DATA_DEBUG
404                 SLOG(LOG_DEBUG, tts_tag(), "[DATA] There is no wav data");
405 #endif
406                 /* mutex is unlocked */
407                 pthread_mutex_unlock(&g_sound_data_mutex);
408                 return -1;
409         }
410
411         std::list<sound_data_s*>::iterator iter = g_app_list[index].m_wav_data.begin();
412         *data = *iter;
413         if (!g_app_list[index].m_wav_data.empty())
414                 g_app_list[index].m_wav_data.pop_front();
415
416 #ifdef DATA_DEBUG
417         __data_show_sound_list(index);
418 #endif
419
420         /* mutex is unlocked */
421         pthread_mutex_unlock(&g_sound_data_mutex);
422
423         return TTSD_ERROR_NONE;
424 }
425
426 int ttsd_data_get_sound_data_size(int uid)
427 {
428         int index = 0;
429         int data_size = 0;
430         index = ttsd_data_is_client(uid);
431
432         if (index < 0)  {
433                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
434                 return TTSD_ERROR_INVALID_PARAMETER;
435         }
436
437         /* mutex is locked */
438         pthread_mutex_lock(&g_sound_data_mutex);
439         data_size = g_app_list[index].m_wav_data.size();
440
441         /* mutex is unlocked */
442         pthread_mutex_unlock(&g_sound_data_mutex);
443
444         return data_size;
445 }
446
447 int ttsd_data_clear_data(int uid)
448 {
449         int index = 0;
450
451         index = ttsd_data_is_client(uid);
452         if (index < 0) {
453                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
454                 return TTSD_ERROR_INVALID_PARAMETER;
455         }
456
457         int removed_last_uttid = -1;
458         speak_data_s* temp_speak = NULL;
459         sound_data_s* temp_sound = NULL;
460
461         /* free allocated data */
462         while(1) {
463                 if (0 != ttsd_data_get_speak_data(uid, &temp_speak)) {
464                         break;
465                 }
466
467                 if (NULL != temp_speak) {
468                         SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] utt(%d), text(%s), lang(%s), vctype(%d) speed(%d)", 
469                                         temp_speak->utt_id, temp_speak->text, temp_speak->lang, temp_speak->vctype, temp_speak->speed);
470
471                         if (NULL != temp_speak->text) {
472                                 free(temp_speak->text);
473                                 temp_speak->text = NULL;
474                         }
475                         if (NULL != temp_speak->lang) {
476                                 free(temp_speak->lang);
477                                 temp_speak->lang = NULL;
478                         }
479                         removed_last_uttid = temp_speak->utt_id;
480
481                         free(temp_speak);
482                         temp_speak = NULL;
483                 }
484         }
485
486         if (-1 != removed_last_uttid) {
487                 g_app_list[index].utt_id_stopped = removed_last_uttid;
488         }
489
490         while(1) {
491                 if (0 != ttsd_data_get_sound_data(uid, &temp_sound)) {
492                         break;
493                 }
494
495                 if (NULL != temp_sound) {
496                         SLOG(LOG_ERROR, tts_tag(), "[DEBUG][%p] uid(%d), event(%d) data(%p) size(%d) rate(%d) utt(%d)", 
497                                 temp_sound, uid, temp_sound->event, temp_sound->data, temp_sound->data_size, temp_sound->rate, temp_sound->utt_id);
498
499                         if (NULL != temp_sound->data) {
500                                 free(temp_sound->data);
501                                 temp_sound->data = NULL;
502                         }
503
504                         free(temp_sound);
505                         temp_sound = NULL;
506                 }
507         }
508
509         pthread_mutex_lock(&g_speak_data_mutex);
510         g_app_list[index].m_speak_data.clear();
511         pthread_mutex_unlock(&g_speak_data_mutex);
512
513         pthread_mutex_lock(&g_sound_data_mutex);
514         g_app_list[index].m_wav_data.clear();
515         pthread_mutex_unlock(&g_sound_data_mutex);
516
517         return TTSD_ERROR_NONE;
518 }
519
520 int ttsd_data_get_client_state(int uid, app_state_e* state)
521 {
522         int index = 0;
523
524         index = ttsd_data_is_client(uid);
525         if (index < 0)  {
526                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
527                 return TTSD_ERROR_INVALID_PARAMETER;
528         }
529
530         *state = g_app_list[index].state;
531
532         return TTSD_ERROR_NONE;
533 }
534
535 int ttsd_data_set_client_state(int uid, app_state_e state)
536 {
537         int index = 0;
538
539         index = ttsd_data_is_client(uid);
540         if (index < 0)  {
541                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
542                 return TTSD_ERROR_INVALID_PARAMETER;
543         }
544
545         /* The client of playing state of all clients is only one. need to check state. */
546         if (APP_STATE_PLAYING == state) {
547                 int vsize = g_app_list.size();
548                 for (int i = 0; i < vsize; i++) {
549                         if(g_app_list[i].state == APP_STATE_PLAYING) {
550                                 SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] A playing client has already existed.");
551                                 return -1;
552                         }
553                 }
554         }
555
556         g_app_list[index].state = state;
557
558         return TTSD_ERROR_NONE;
559 }
560
561 int ttsd_data_get_current_playing()
562 {
563         int vsize = g_app_list.size();
564
565         for (int i = 0; i < vsize; i++) {
566                 if (APP_STATE_PLAYING == g_app_list[i].state) {
567                         SLOG(LOG_DEBUG, tts_tag(), "[DATA] uid(%d) is playing", g_app_list[i].uid);
568                         return g_app_list[i].uid;
569                 }
570         }
571
572         return -1;
573 }
574
575 int ttsd_data_foreach_clients(ttsd_data_get_client_cb callback, void* user_data)
576 {
577         if (NULL == callback) {
578                 SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] input data is NULL!!");
579                 return -1;
580         }
581
582 #ifdef DATA_DEBUG
583         __data_show_list();
584 #endif
585
586         /* Copy app info */
587         vector<app_data_s> temp_app_list;
588         int vsize = g_app_list.size();
589
590         int i = 0;
591         for (i = 0;i < vsize;i++) {
592                 app_data_s app;
593                 app.pid = g_app_list[i].pid;
594                 app.uid = g_app_list[i].uid;
595                 app.utt_id_stopped = 0;
596                 app.state = g_app_list[i].state;
597
598                 temp_app_list.insert(temp_app_list.end(), app);
599         }
600
601         for (i = 0;i < vsize;i++) {
602                 SECURE_SLOG(LOG_DEBUG, tts_tag(), "[%dth] pid(%d), uid(%d), state(%d)", i, temp_app_list[i].pid, temp_app_list[i].uid, temp_app_list[i].state);
603                 if (false == callback(temp_app_list[i].pid, temp_app_list[i].uid, temp_app_list[i].state, user_data)) {
604                         break;
605                 }
606         }
607
608         for (i = 0;i < vsize;i++) {
609                 temp_app_list.erase(temp_app_list.begin());
610         }
611
612         return 0;
613 }
614
615 bool ttsd_data_is_uttid_valid(int uid, int uttid)
616 {
617         int index = 0;
618
619         index = ttsd_data_is_client(uid);
620         if (index < 0)  {
621                 SECURE_SLOG(LOG_ERROR, tts_tag(), "[DATA ERROR] uid is not valid (%d)", uid);
622                 return TTSD_ERROR_INVALID_PARAMETER;
623         }
624
625         if (uttid < g_app_list[index].utt_id_stopped)
626                 return false;
627
628         return true;
629 }
630
631 int ttsd_data_is_current_playing()
632 {
633         int vsize = g_app_list.size();
634
635         for (int i = 0; i < vsize; i++) {
636                 if(g_app_list[i].state == APP_STATE_PLAYING) {
637                         return g_app_list[i].uid;
638                 }
639         }
640
641         return -1;
642 }
643
644 int ttsd_data_get_same_pid_client_count(int pid)
645 {
646         int vsize = g_app_list.size();
647         int number = 0;
648
649         for (int i = 0;i < vsize;i++) {
650                 if(g_app_list[i].pid == pid) {
651                         number++;
652                 }
653         }
654
655         return number;
656 }
657
658 int ttsd_data_save_error_log(int uid, FILE* fp)
659 {
660         int ret;
661         int pid;
662         /* pid */
663         pid = ttsd_data_get_pid(uid);
664         if (0 > pid) {
665                 SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get pid");
666         } else {
667                 fprintf(fp, "pid - %d", pid);
668         }
669         /* app state */
670         app_state_e state;
671         ret = ttsd_data_get_client_state(uid, &state);
672         if (0 != ret) {
673                 SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get app state");
674         } else {
675                 fprintf(fp, "app state - %d", state);
676         }
677
678         int index = 0;
679         unsigned int i;
680
681         index = ttsd_data_is_client(uid);
682         if (0 > index) {
683                 SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid client");
684                 return -1;
685         }
686
687         /* get sound data */
688         fprintf(fp, "----- Sound list -----");
689
690         i = 0;
691         std::list<sound_data_s*>::iterator iter;
692         for (iter = g_app_list[index].m_wav_data.begin(); iter != g_app_list[index].m_wav_data.end(); iter++) {
693                 SLOG(LOG_DEBUG, tts_tag(), "[%dth][%p] data(%p) data size(%ld), uttid(%d), type(%d)",
694                         i, *iter, (*iter)->data, (*iter)->data_size, (*iter)->utt_id, (*iter)->audio_type);
695                 i++;
696         }
697
698         fprintf(fp, "----------------------");
699
700         /* get speck data */
701         fprintf(fp, "----- Text list -----");
702
703         i = 0;
704         std::list<speak_data_s*>::iterator iter_speak;
705         for (iter_speak = g_app_list[index].m_speak_data.begin(); iter_speak != g_app_list[index].m_speak_data.end(); iter_speak++) {
706                 SLOG(LOG_DEBUG, tts_tag(), "[%dth][%p] lang(%s), vctype(%d), speed(%d), uttid(%d), text(%s)",
707                         i, *iter_speak, (*iter_speak)->lang, (*iter_speak)->vctype, (*iter_speak)->speed, (*iter_speak)->utt_id, (*iter_speak)->text);
708                 i++;
709         }
710         fprintf(fp, "---------------------");
711
712         return 0;
713 }