comparison libpurple/media.h @ 32819:2c6510167895 default tip

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24) to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:49 +0000
parents 98520ee78f12
children
comparison
equal deleted inserted replaced
32818:01ff09d4a463 32819:2c6510167895
25 */ 25 */
26 26
27 #ifndef _PURPLE_MEDIA_H_ 27 #ifndef _PURPLE_MEDIA_H_
28 #define _PURPLE_MEDIA_H_ 28 #define _PURPLE_MEDIA_H_
29 29
30 #include <glib.h>
31 #include <glib-object.h>
32
30 #include "media/candidate.h" 33 #include "media/candidate.h"
31 #include "media/codec.h" 34 #include "media/codec.h"
32 #include "media/enum-types.h" 35 #include "media/enum-types.h"
33
34 #include <glib.h>
35 #include <glib-object.h>
36
37 G_BEGIN_DECLS
38 36
39 #define PURPLE_TYPE_MEDIA (purple_media_get_type()) 37 #define PURPLE_TYPE_MEDIA (purple_media_get_type())
40 #define PURPLE_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia)) 38 #define PURPLE_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia))
41 #define PURPLE_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA, PurpleMediaClass)) 39 #define PURPLE_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA, PurpleMediaClass))
42 #define PURPLE_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA)) 40 #define PURPLE_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA))
47 typedef struct _PurpleMedia PurpleMedia; 45 typedef struct _PurpleMedia PurpleMedia;
48 46
49 #include "signals.h" 47 #include "signals.h"
50 #include "util.h" 48 #include "util.h"
51 49
52 #ifdef __cplusplus 50 G_BEGIN_DECLS
53 extern "C" {
54 #endif
55 51
56 /** 52 /**
57 * Gets the media class's GType 53 * Gets the media class's GType
58 * 54 *
59 * @return The media class's GType. 55 * @return The media class's GType.
60 *
61 * @since 2.6.0
62 */ 56 */
63 GType purple_media_get_type(void); 57 GType purple_media_get_type(void);
64 58
65 /** 59 /**
66 * Gets a list of session IDs. 60 * Gets a list of session IDs.
67 * 61 *
68 * @param media The media session from which to retrieve session IDs. 62 * @param media The media session from which to retrieve session IDs.
69 * 63 *
70 * @return GList of session IDs. The caller must free the list. 64 * @return GList of session IDs. The caller must free the list.
71 *
72 * @since 2.6.0
73 */ 65 */
74 GList *purple_media_get_session_ids(PurpleMedia *media); 66 GList *purple_media_get_session_ids(PurpleMedia *media);
75 67
76 /** 68 /**
77 * Gets the PurpleAccount this media session is on. 69 * Gets the PurpleAccount this media session is on.
78 * 70 *
79 * @param media The media session to retrieve the account from. 71 * @param media The media session to retrieve the account from.
80 * 72 *
81 * @return The account retrieved. 73 * @return The account retrieved.
82 *
83 * @since 2.6.0
84 */ 74 */
85 PurpleAccount *purple_media_get_account(PurpleMedia *media); 75 PurpleAccount *purple_media_get_account(PurpleMedia *media);
86 76
87 /** 77 /**
88 * Gets the prpl data from the media session. 78 * Gets the prpl data from the media session.
89 * 79 *
90 * @param media The media session to retrieve the prpl data from. 80 * @param media The media session to retrieve the prpl data from.
91 * 81 *
92 * @return The prpl data retrieved. 82 * @return The prpl data retrieved.
93 *
94 * @since 2.6.0
95 */ 83 */
96 gpointer purple_media_get_prpl_data(PurpleMedia *media); 84 gpointer purple_media_get_prpl_data(PurpleMedia *media);
97 85
98 /** 86 /**
99 * Sets the prpl data on the media session. 87 * Sets the prpl data on the media session.
100 * 88 *
101 * @param media The media session to set the prpl data on. 89 * @param media The media session to set the prpl data on.
102 * @param prpl_data The data to set on the media session. 90 * @param prpl_data The data to set on the media session.
103 *
104 * @since 2.6.0
105 */ 91 */
106 void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data); 92 void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data);
107 93
108 /** 94 /**
109 * Signals an error in the media session. 95 * Signals an error in the media session.
110 * 96 *
111 * @param media The media object to set the state on. 97 * @param media The media object to set the state on.
112 * @param error The format of the error message to send in the signal. 98 * @param error The format of the error message to send in the signal.
113 * @param ... The arguments to plug into the format. 99 * @param ... The arguments to plug into the format.
114 *
115 * @since 2.6.0
116 */ 100 */
117 void purple_media_error(PurpleMedia *media, const gchar *error, ...); 101 void purple_media_error(PurpleMedia *media, const gchar *error, ...);
118 102
119 /** 103 /**
120 * Ends all streams that match the given parameters 104 * Ends all streams that match the given parameters
121 * 105 *
122 * @param media The media object with which to end streams. 106 * @param media The media object with which to end streams.
123 * @param session_id The session to end streams on. 107 * @param session_id The session to end streams on.
124 * @param participant The participant to end streams with. 108 * @param participant The participant to end streams with.
125 *
126 * @since 2.6.0
127 */ 109 */
128 void purple_media_end(PurpleMedia *media, const gchar *session_id, 110 void purple_media_end(PurpleMedia *media, const gchar *session_id,
129 const gchar *participant); 111 const gchar *participant);
130 112
131 /** 113 /**
134 * @param media The media instance to containing the stream to signal. 116 * @param media The media instance to containing the stream to signal.
135 * @param type The type of info being signaled. 117 * @param type The type of info being signaled.
136 * @param session_id The id of the session of the stream being signaled. 118 * @param session_id The id of the session of the stream being signaled.
137 * @param participant The participant of the stream being signaled. 119 * @param participant The participant of the stream being signaled.
138 * @param local TRUE if the info originated locally, FALSE if on the remote end. 120 * @param local TRUE if the info originated locally, FALSE if on the remote end.
139 *
140 * @since 2.6.0
141 */ 121 */
142 void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, 122 void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type,
143 const gchar *session_id, const gchar *participant, 123 const gchar *session_id, const gchar *participant,
144 gboolean local); 124 gboolean local);
145 125
156 * - "sdes-phone" : The PHONE to put in SDES messages 136 * - "sdes-phone" : The PHONE to put in SDES messages
157 * 137 *
158 * @param media The media object to set the parameters on. 138 * @param media The media object to set the parameters on.
159 * @param num_params The number of parameters to pass 139 * @param num_params The number of parameters to pass
160 * @param params Array of @c GParameter to pass 140 * @param params Array of @c GParameter to pass
161 *
162 * @since 2.8.0
163 */ 141 */
164 void purple_media_set_params(PurpleMedia *media, 142 void purple_media_set_params(PurpleMedia *media,
165 guint num_params, GParameter *params); 143 guint num_params, GParameter *params);
166 144
167 /** 145 /**
170 * The list is owned by the @c PurpleMedia internals and should NOT be freed. 148 * The list is owned by the @c PurpleMedia internals and should NOT be freed.
171 * 149 *
172 * @param media The media object 150 * @param media The media object
173 * 151 *
174 * @return NULL-terminated array of names of supported parameters. 152 * @return NULL-terminated array of names of supported parameters.
175 *
176 * @since 2.8.0
177 */ 153 */
178 const gchar **purple_media_get_available_params(PurpleMedia *media); 154 const gchar **purple_media_get_available_params(PurpleMedia *media);
179 155
180 /** 156 /**
181 * Checks if given optional parameter is supported by the media backend. 157 * Checks if given optional parameter is supported by the media backend.
182 * 158 *
183 * @param media The media object 159 * @param media The media object
184 * @param param name of parameter 160 * @param param name of parameter
185 * 161 *
186 * @return @c TRUE if backend recognizes the parameter, @c FALSE otherwise. 162 * @return @c TRUE if backend recognizes the parameter, @c FALSE otherwise.
187 *
188 * @since 2.8.0
189 */ 163 */
190 gboolean purple_media_param_is_supported(PurpleMedia *media, const gchar *param); 164 gboolean purple_media_param_is_supported(PurpleMedia *media, const gchar *param);
191 165
192 /** 166 /**
193 * Adds a stream to a session. 167 * Adds a stream to a session.
203 * @param transmitter The transmitter to use for the stream. 177 * @param transmitter The transmitter to use for the stream.
204 * @param num_params The number of parameters to pass to Farsight. 178 * @param num_params The number of parameters to pass to Farsight.
205 * @param params The parameters to pass to Farsight. 179 * @param params The parameters to pass to Farsight.
206 * 180 *
207 * @return @c TRUE The stream was added successfully, @c FALSE otherwise. 181 * @return @c TRUE The stream was added successfully, @c FALSE otherwise.
208 *
209 * @since 2.6.0
210 */ 182 */
211 gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, 183 gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id,
212 const gchar *who, PurpleMediaSessionType type, 184 const gchar *who, PurpleMediaSessionType type,
213 gboolean initiator, const gchar *transmitter, 185 gboolean initiator, const gchar *transmitter,
214 guint num_params, GParameter *params); 186 guint num_params, GParameter *params);
218 * 190 *
219 * @param media The media object to find the session in. 191 * @param media The media object to find the session in.
220 * @param sess_id The session id of the session to get the type from. 192 * @param sess_id The session id of the session to get the type from.
221 * 193 *
222 * @return The retreived session type. 194 * @return The retreived session type.
223 *
224 * @since 2.6.0
225 */ 195 */
226 PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id); 196 PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id);
227 197
228 /** 198 /**
229 * Gets the PurpleMediaManager this media session is a part of. 199 * Gets the PurpleMediaManager this media session is a part of.
230 * 200 *
231 * @param media The media object to get the manager instance from. 201 * @param media The media object to get the manager instance from.
232 * 202 *
233 * @return The PurpleMediaManager instance retrieved. 203 * @return The PurpleMediaManager instance retrieved.
234 *
235 * @since 2.6.0
236 */ 204 */
237 struct _PurpleMediaManager *purple_media_get_manager(PurpleMedia *media); 205 struct _PurpleMediaManager *purple_media_get_manager(PurpleMedia *media);
238 206
239 /** 207 /**
240 * Gets the codecs from a session. 208 * Gets the codecs from a session.
241 * 209 *
242 * @param media The media object to find the session in. 210 * @param media The media object to find the session in.
243 * @param sess_id The session id of the session to get the codecs from. 211 * @param sess_id The session id of the session to get the codecs from.
244 * 212 *
245 * @return The retreieved codecs. 213 * @return The retreieved codecs.
246 *
247 * @since 2.6.0
248 */ 214 */
249 GList *purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id); 215 GList *purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id);
250 216
251 /** 217 /**
252 * Adds remote candidates to the stream. 218 * Adds remote candidates to the stream.
253 * 219 *
254 * @param media The media object to find the session in. 220 * @param media The media object to find the session in.
255 * @param sess_id The session id of the session find the stream in. 221 * @param sess_id The session id of the session find the stream in.
256 * @param participant The name of the remote user to add the candidates for. 222 * @param participant The name of the remote user to add the candidates for.
257 * @param remote_candidates The remote candidates to add. 223 * @param remote_candidates The remote candidates to add.
258 *
259 * @since 2.6.0
260 */ 224 */
261 void purple_media_add_remote_candidates(PurpleMedia *media, 225 void purple_media_add_remote_candidates(PurpleMedia *media,
262 const gchar *sess_id, 226 const gchar *sess_id,
263 const gchar *participant, 227 const gchar *participant,
264 GList *remote_candidates); 228 GList *remote_candidates);
267 * Gets the local candidates from a stream. 231 * Gets the local candidates from a stream.
268 * 232 *
269 * @param media The media object to find the session in. 233 * @param media The media object to find the session in.
270 * @param sess_id The session id of the session to find the stream in. 234 * @param sess_id The session id of the session to find the stream in.
271 * @param participant The name of the remote user to get the candidates from. 235 * @param participant The name of the remote user to get the candidates from.
272 *
273 * @since 2.6.0
274 */ 236 */
275 GList *purple_media_get_local_candidates(PurpleMedia *media, 237 GList *purple_media_get_local_candidates(PurpleMedia *media,
276 const gchar *sess_id, 238 const gchar *sess_id,
277 const gchar *participant); 239 const gchar *participant);
278 240
283 * @param sess_id The session id of the session to find the stream in. 245 * @param sess_id The session id of the session to find the stream in.
284 * @param participant The name of the remote user to get the active candidate 246 * @param participant The name of the remote user to get the active candidate
285 * from. 247 * from.
286 * 248 *
287 * @return The active candidates retrieved. 249 * @return The active candidates retrieved.
288 *
289 * @since 2.8.0
290 */ 250 */
291 GList *purple_media_get_active_local_candidates(PurpleMedia *media, 251 GList *purple_media_get_active_local_candidates(PurpleMedia *media,
292 const gchar *sess_id, const gchar *participant); 252 const gchar *sess_id, const gchar *participant);
293 253
294 /** 254 /**
298 * @param sess_id The session id of the session to find the stream in. 258 * @param sess_id The session id of the session to find the stream in.
299 * @param participant The name of the remote user to get the remote candidate 259 * @param participant The name of the remote user to get the remote candidate
300 * from. 260 * from.
301 * 261 *
302 * @return The remote candidates retrieved. 262 * @return The remote candidates retrieved.
303 *
304 * @since 2.8.0
305 */ 263 */
306 GList *purple_media_get_active_remote_candidates(PurpleMedia *media, 264 GList *purple_media_get_active_remote_candidates(PurpleMedia *media,
307 const gchar *sess_id, const gchar *participant); 265 const gchar *sess_id, const gchar *participant);
308 266
309 /** 267 /**
313 * @param sess_id The session id of the session find the stream in. 271 * @param sess_id The session id of the session find the stream in.
314 * @param participant The name of the remote user to set the candidates from. 272 * @param participant The name of the remote user to set the candidates from.
315 * @param codecs The list of remote codecs to set. 273 * @param codecs The list of remote codecs to set.
316 * 274 *
317 * @return @c TRUE The codecs were set successfully, or @c FALSE otherwise. 275 * @return @c TRUE The codecs were set successfully, or @c FALSE otherwise.
318 *
319 * @since 2.6.0
320 */ 276 */
321 gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, 277 gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id,
322 const gchar *participant, GList *codecs); 278 const gchar *participant, GList *codecs);
323 279
324 /** 280 /**
327 * @param media The media object to find the remote user in. 283 * @param media The media object to find the remote user in.
328 * @param session_id The session id of the session to check. 284 * @param session_id The session id of the session to check.
329 * @param participant The remote user to check for. 285 * @param participant The remote user to check for.
330 * 286 *
331 * @return @c TRUE All streams for the given session_id/participant combination have candidates prepared, @c FALSE otherwise. 287 * @return @c TRUE All streams for the given session_id/participant combination have candidates prepared, @c FALSE otherwise.
332 *
333 * @since 2.6.0
334 */ 288 */
335 gboolean purple_media_candidates_prepared(PurpleMedia *media, 289 gboolean purple_media_candidates_prepared(PurpleMedia *media,
336 const gchar *session_id, const gchar *participant); 290 const gchar *session_id, const gchar *participant);
337 291
338 /** 292 /**
341 * @param media The media object to find the session in. 295 * @param media The media object to find the session in.
342 * @param sess_id The session id of the session to set the codec for. 296 * @param sess_id The session id of the session to set the codec for.
343 * @param codec The codec to set the session to stream. 297 * @param codec The codec to set the session to stream.
344 * 298 *
345 * @return @c TRUE The codec was successfully changed, or @c FALSE otherwise. 299 * @return @c TRUE The codec was successfully changed, or @c FALSE otherwise.
346 *
347 * @since 2.6.0
348 */ 300 */
349 gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec); 301 gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec);
350 302
351 /** 303 /**
352 * Gets whether a session's codecs are ready to be used. 304 * Gets whether a session's codecs are ready to be used.
353 * 305 *
354 * @param media The media object to find the session in. 306 * @param media The media object to find the session in.
355 * @param sess_id The session id of the session to check. 307 * @param sess_id The session id of the session to check.
356 * 308 *
357 * @return @c TRUE The codecs are ready, or @c FALSE otherwise. 309 * @return @c TRUE The codecs are ready, or @c FALSE otherwise.
358 *
359 * @since 2.6.0
360 */ 310 */
361 gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id); 311 gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id);
362 312
363 /** 313 /**
364 * Gets whether the local user is the conference/session/stream's initiator. 314 * Gets whether the local user is the conference/session/stream's initiator.
366 * @param media The media instance to find the session in. 316 * @param media The media instance to find the session in.
367 * @param sess_id The session id of the session to check. 317 * @param sess_id The session id of the session to check.
368 * @param participant The participant of the stream to check. 318 * @param participant The participant of the stream to check.
369 * 319 *
370 * @return TRUE if the local user is the stream's initator, else FALSE. 320 * @return TRUE if the local user is the stream's initator, else FALSE.
371 *
372 * @since 2.6.0
373 */ 321 */
374 gboolean purple_media_is_initiator(PurpleMedia *media, 322 gboolean purple_media_is_initiator(PurpleMedia *media,
375 const gchar *sess_id, const gchar *participant); 323 const gchar *sess_id, const gchar *participant);
376 324
377 /** 325 /**
380 * @param media The media object to find the session in. 328 * @param media The media object to find the session in.
381 * @param sess_id The session id of the session to check. 329 * @param sess_id The session id of the session to check.
382 * @param participant The participant to check. 330 * @param participant The participant to check.
383 * 331 *
384 * @return @c TRUE The selected streams have been accepted, or @c FALSE otherwise. 332 * @return @c TRUE The selected streams have been accepted, or @c FALSE otherwise.
385 *
386 * @since 2.6.0
387 */ 333 */
388 gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id, 334 gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id,
389 const gchar *participant); 335 const gchar *participant);
390 336
391 /** 337 /**
392 * Sets the input volume of all the selected sessions. 338 * Sets the input volume of all the selected sessions.
393 * 339 *
394 * @param media The media object the sessions are in. 340 * @param media The media object the sessions are in.
395 * @param session_id The session to select (if any). 341 * @param session_id The session to select (if any).
396 * @param level The level to set the volume to. 342 * @param level The level to set the volume to.
397 *
398 * @since 2.6.0
399 */ 343 */
400 void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, double level); 344 void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, double level);
401 345
402 /** 346 /**
403 * Sets the output volume of all the selected streams. 347 * Sets the output volume of all the selected streams.
404 * 348 *
405 * @param media The media object the streams are in. 349 * @param media The media object the streams are in.
406 * @param session_id The session to limit the streams to (if any). 350 * @param session_id The session to limit the streams to (if any).
407 * @param participant The participant to limit the streams to (if any). 351 * @param participant The participant to limit the streams to (if any).
408 * @param level The level to set the volume to. 352 * @param level The level to set the volume to.
409 *
410 * @since 2.6.0
411 */ 353 */
412 void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, 354 void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id,
413 const gchar *participant, double level); 355 const gchar *participant, double level);
414 356
415 /** 357 /**
419 * @param session_id The session to set the output window on. 361 * @param session_id The session to set the output window on.
420 * @param participant Optionally, the participant to set the output window on. 362 * @param participant Optionally, the participant to set the output window on.
421 * @param window_id The window id use for embedding the video in. 363 * @param window_id The window id use for embedding the video in.
422 * 364 *
423 * @return An id to reference the output window. 365 * @return An id to reference the output window.
424 *
425 * @since 2.6.0
426 */ 366 */
427 gulong purple_media_set_output_window(PurpleMedia *media, 367 gulong purple_media_set_output_window(PurpleMedia *media,
428 const gchar *session_id, const gchar *participant, 368 const gchar *session_id, const gchar *participant,
429 gulong window_id); 369 gulong window_id);
430 370
431 /** 371 /**
432 * Removes all output windows from a given media session. 372 * Removes all output windows from a given media session.
433 * 373 *
434 * @param media The instance to remove all output windows from. 374 * @param media The instance to remove all output windows from.
435 *
436 * @since 2.6.0
437 */ 375 */
438 void purple_media_remove_output_windows(PurpleMedia *media); 376 void purple_media_remove_output_windows(PurpleMedia *media);
439 377
440 #ifdef __cplusplus
441 }
442 #endif
443
444 G_END_DECLS 378 G_END_DECLS
445 379
446 #endif /* _PURPLE_MEDIA_H_ */ 380 #endif /* _PURPLE_MEDIA_H_ */