88609682a6f173e63ad8a18508e2182424903f7f
[platform/core/uifw/tts.git] / server / ttsd_data.h
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
15 #ifndef __TTSD_DATA_H_
16 #define __TTSD_DATA_H_
17
18 #include "ttse.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 typedef enum {
25         APP_STATE_CREATED = 0,
26         APP_STATE_READY,
27         APP_STATE_PLAYING,
28         APP_STATE_PAUSED
29 } app_state_e;
30
31 typedef struct {
32         int     utt_id; 
33         char*   text;
34         char*   lang;
35         int     vctype;
36         int     speed;
37 } speak_data_s;
38
39 typedef struct {
40         int             utt_id;
41         void*           data;
42         unsigned int    data_size;
43
44         ttse_result_event_e     event;
45         ttse_audio_type_e       audio_type;
46         int                     rate;
47         int                     channels;
48 } sound_data_s;
49
50 typedef void (* ttsd_used_voice_cb)(const char* lang, int type);
51
52 int ttsd_data_new_client(int pid, int uid);
53
54 int ttsd_data_delete_client(int uid);
55
56 int ttsd_data_is_client(int uid);
57
58 int ttsd_data_get_client_count();
59
60 int ttsd_data_get_pid(int uid);
61
62 /* speak data */
63 int ttsd_data_add_speak_data(int uid, speak_data_s* data);
64
65 int ttsd_data_get_speak_data(int uid, speak_data_s** data);
66
67 int ttsd_data_get_speak_data_size(int uid);
68
69 /* sound data */
70 int ttsd_data_add_sound_data(int uid, sound_data_s* data);
71
72 int ttsd_data_get_sound_data(int uid, sound_data_s** data);
73
74 int ttsd_data_get_sound_data_size(int uid);
75
76 int ttsd_data_clear_data(int uid);
77
78
79 int ttsd_data_set_used_voice(int uid, const char* lang, int type);
80
81 int ttsd_data_reset_used_voice(int uid, ttsd_used_voice_cb callback);
82
83 int ttsd_data_get_client_state(int pid, app_state_e* state);
84
85 int ttsd_data_set_client_state(int pid, app_state_e state);
86
87
88 int ttsd_data_get_current_playing();
89
90 typedef bool(*ttsd_data_get_client_cb)(int pid, int uid, app_state_e state, void* user_data);
91
92 int ttsd_data_foreach_clients(ttsd_data_get_client_cb callback, void* user_data);
93
94 bool ttsd_data_is_uttid_valid(int uid, int uttid);
95
96 int ttsd_data_get_same_pid_client_count(int pid);
97
98 /* For error handing */
99 int ttsd_data_save_error_log(int uid, FILE* fp);
100
101
102 #ifdef __cplusplus
103 }
104 #endif
105
106 #endif /* __TTSD_DATA_H_ */