12024
|
1 /**
|
|
2 * @file media.h Voice and Video API
|
|
3 * @ingroup core
|
|
4 *
|
|
5 * gaim
|
|
6 *
|
|
7 * Gaim is the legal property of its developers, whose names are too numerous
|
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this
|
|
9 * source distribution.
|
|
10 *
|
|
11 * This program is free software; you can redistribute it and/or modify
|
|
12 * it under the terms of the GNU General Public License as published by
|
|
13 * the Free Software Foundation; either version 2 of the License, or
|
|
14 * (at your option) any later version.
|
|
15 *
|
|
16 * This program is distributed in the hope that it will be useful,
|
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 * GNU General Public License for more details.
|
|
20 *
|
|
21 * You should have received a copy of the GNU General Public License
|
|
22 * along with this program; if not, write to the Free Software
|
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
24 */
|
|
25 #ifndef _GAIM_MEDIA_H_
|
|
26 #define _GAIM_MEDIA_H_
|
|
27
|
|
28 typedef struct _GaimVoiceChat GaimVoiceChat;
|
|
29 typedef struct _GaimMediaPrplOps GaimMediaPrplOps;
|
|
30
|
|
31 #include "connection.h"
|
|
32
|
12050
|
33 /* Forward declarations so I needn't #include mediastreamer headers in
|
12024
|
34 * nearly every single file */
|
|
35 struct _MSFilter;
|
|
36 struct _MSSync;
|
|
37
|
|
38 /**
|
|
39 * The state of a VoiceChat that should be reflected in the UI
|
|
40 */
|
|
41 typedef enum {
|
|
42 GAIM_MEDIA_STATE_CALLING, /**< An outgoing call is waiting to be answered */
|
|
43 GAIM_MEDIA_STATE_RECEIVING, /**< An incoming call is waiting to be answered */
|
|
44 GAIM_MEDIA_STATE_IN_PROGRESS, /**< The call is connected */
|
|
45 GAIM_MEDIA_STATE_ERROR, /**< Some error occured */
|
|
46 } GaimMediaState;
|
|
47
|
|
48 /**
|
|
49 * UI Operations
|
|
50 */
|
|
51 typedef struct {
|
|
52 void (*new_voice_chat)(GaimVoiceChat *vc); /**< A new voice chat is created */
|
|
53 void (*destroy)(GaimVoiceChat *vc); /**< The voice chat has been destroyed */
|
|
54 void (*state_change)(GaimVoiceChat *vc, GaimMediaState state); /**< The state of the voice chat has changed */
|
|
55 } GaimMediaUiOps;
|
|
56
|
|
57 /**
|
|
58 * PRPL Operations
|
|
59 */
|
|
60 struct _GaimMediaPrplOps {
|
|
61 void (*call)(GaimConnection *gc, const char *who); /**< Request an outgoing call to 'who' */
|
|
62 void (*init_filters)(GaimVoiceChat *); /**< Create the media stream for the call */
|
|
63 void (*accept)(GaimVoiceChat *); /**< Accept an incoming call */
|
|
64 void (*reject)(GaimVoiceChat *); /**< Reject an incoming call */
|
|
65 void (*terminate)(GaimVoiceChat *); /**< Terminate an in-progress call */
|
|
66 };
|
|
67
|
|
68 #ifdef HAVE_VV
|
|
69
|
|
70 /**
|
|
71 * Initializes mediastreamer and ortp
|
|
72 */
|
|
73 void gaim_media_init(void);
|
|
74
|
|
75 /**************************************************************************/
|
|
76 /** @name Voice Chat API **************************************************/
|
|
77 /**************************************************************************/
|
|
78 /*@{*/
|
|
79
|
|
80 /**
|
|
81 * Creates a new voice chat
|
|
82 * This function creates a new voice chat object, and tells the UI about it. The UI
|
|
83 * probably won't want to do anything, until the state is changed to Incoming or Outgoing,
|
|
84 * but the UI should initialize any data structures it needs on this call
|
|
85 *
|
|
86 * @param gc The connection this chat is happening on
|
|
87 * @param name The person on the other end of the call
|
|
88 * @return The new voice chat
|
|
89 */
|
|
90 GaimVoiceChat *gaim_voice_chat_new(GaimConnection *gc, const char *name);
|
|
91
|
|
92 /**
|
|
93 * Destroys a voice chat
|
|
94 *
|
|
95 * @param vc The voice chat to destroy
|
|
96 */
|
|
97 void gaim_voice_chat_destroy(GaimVoiceChat *vc);
|
|
98
|
|
99 /**
|
|
100 * Acessor function of the name of the other user on the voice chat
|
|
101 *
|
|
102 * @param vc The voice chat
|
|
103 * @return The name
|
|
104 */
|
|
105 const char *gaim_voice_chat_get_name(GaimVoiceChat *vc);
|
|
106
|
|
107 /**
|
|
108 * Accessor for the GaimConnection of the voice chat
|
|
109 *
|
|
110 * @param vc The voice chat
|
|
111 * @return The GaimConnection
|
|
112 */
|
|
113 GaimConnection *gaim_voice_chat_get_connection(GaimVoiceChat *vc);
|
|
114
|
|
115 /**
|
|
116 * Accessor for the UI data
|
|
117 *
|
|
118 * @param vc The voice chat
|
|
119 * @return The UI data
|
|
120 */
|
|
121 void *gaim_voice_chat_get_ui_data(GaimVoiceChat *vc);
|
|
122
|
|
123 /**
|
|
124 * Mutator for the UI Data
|
|
125 *
|
|
126 * @param vc The voice chat
|
|
127 * @param data The data
|
|
128 */
|
|
129 void gaim_voice_chat_set_ui_data(GaimVoiceChat *vc, void *data);
|
|
130
|
|
131 /**
|
|
132 * Accessor for the protocol data
|
|
133 *
|
|
134 * @param vc The voice chat
|
|
135 * @return The protocol data
|
|
136 */
|
|
137 void *gaim_voice_chat_get_proto_data(GaimVoiceChat *vc);
|
|
138
|
|
139 /**
|
|
140 * Mutator for the protocol data
|
|
141 *
|
|
142 * @param vc The voice chat
|
|
143 * @param data The protocol data
|
|
144 */
|
|
145 void gaim_voice_chat_set_proto_data(GaimVoiceChat *vc, void *data);
|
|
146
|
|
147 /**
|
|
148 * Accessor for the state
|
|
149 *
|
|
150 * @param vc The voice chat
|
|
151 * @return The state
|
|
152 */
|
|
153 GaimMediaState gaim_voice_chat_get_state(GaimVoiceChat *vc);
|
|
154
|
|
155 /**
|
|
156 * Mutator for the state
|
|
157 *
|
|
158 * @param vc The voice chat
|
12050
|
159 * @param state The state
|
12024
|
160 */
|
|
161 void gaim_voice_chat_set_state(GaimVoiceChat *vc, GaimMediaState state);
|
|
162
|
|
163 /**
|
|
164 * Accepts an incoming voice chat
|
|
165 *
|
|
166 * @param vc The voice chat
|
|
167 */
|
|
168 void gaim_voice_chat_accept(GaimVoiceChat *vc);
|
|
169
|
|
170 /**
|
|
171 * Rejects an incoming voice chat
|
|
172 *
|
|
173 * @param vc The voice chat
|
|
174 */
|
|
175 void gaim_voice_chat_reject(GaimVoiceChat *vc);
|
|
176
|
|
177 /**
|
|
178 * Terminates an in-progress voice chat
|
|
179 *
|
|
180 * @param vc The voice chat
|
|
181 */
|
|
182 void gaim_voice_chat_terminate(GaimVoiceChat *vc);
|
|
183
|
|
184 /**
|
|
185 * Accessor for the microphone and speaker MSFilter objects
|
|
186 *
|
|
187 * @param vc The voice chat
|
|
188 * @param microphone A pointer to return the microphone filter in, or NULL.
|
|
189 * @param speaker A poitner to reutrn the speaker filter in, or NULL.
|
|
190 */
|
|
191 void gaim_voice_chat_get_filters(GaimVoiceChat *vc, struct _MSFilter **microphone, struct _MSFilter **speaker);
|
|
192
|
|
193 /**
|
|
194 * Accessor for the Mediastreamer timer
|
|
195 *
|
|
196 * @param vc The voice chat
|
|
197 * @return The timer
|
|
198 */
|
|
199 struct _MSSync *gaim_voice_chat_get_timer(GaimVoiceChat *vc);
|
|
200
|
|
201 /*@}*/
|
|
202
|
|
203 /**************************************************************************/
|
|
204 /** @name UI Registration Functions */
|
|
205 /**************************************************************************/
|
|
206 /*@{*/
|
|
207
|
|
208 /**
|
|
209 * Sets the UI operations structure to be used for the buddy list.
|
|
210 *
|
|
211 * @param ops The ops struct.
|
|
212 */
|
|
213 void gaim_media_set_ui_ops(GaimMediaUiOps *ops);
|
|
214
|
|
215 /**
|
|
216 * Returns the UI operations structure to be used for the buddy list.
|
|
217 *
|
|
218 * @return The UI operations structure.
|
|
219 */
|
|
220 GaimMediaUiOps *gaim_media_get_ui_ops(void);
|
|
221
|
|
222 /*@}*/
|
|
223
|
|
224 #endif /* HAVE_VV */
|
|
225
|
|
226 #endif /* _GAIM_MEDIA_H_ */
|