Mercurial > pidgin.yaz
comparison libpurple/media.h @ 29712:d5fe33c3a765
propagate from branch 'im.pidgin.pidgin' (head 42a8485e73af5f2091d307b51c09dded94eceb24)
to branch 'im.pidgin.pidgin.next.minor' (head 4edcf8da14be654127117da5af0cbdd7a0616439)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Tue, 17 Nov 2009 07:33:47 +0000 |
parents | e18c1d347e37 |
children | dcd52d2b1b97 |
comparison
equal
deleted
inserted
replaced
28963:546e870dc506 | 29712:d5fe33c3a765 |
---|---|
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 "media/candidate.h" | |
31 #include "media/codec.h" | |
32 #include "media/enum-types.h" | |
33 | |
30 #include <glib.h> | 34 #include <glib.h> |
31 #include <glib-object.h> | 35 #include <glib-object.h> |
32 | 36 |
33 G_BEGIN_DECLS | 37 G_BEGIN_DECLS |
34 | 38 |
35 #define PURPLE_TYPE_MEDIA_CANDIDATE (purple_media_candidate_get_type()) | |
36 #define PURPLE_MEDIA_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate)) | |
37 #define PURPLE_MEDIA_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate)) | |
38 #define PURPLE_IS_MEDIA_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_CANDIDATE)) | |
39 #define PURPLE_IS_MEDIA_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_CANDIDATE)) | |
40 #define PURPLE_MEDIA_CANDIDATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate)) | |
41 | |
42 #define PURPLE_TYPE_MEDIA_CODEC (purple_media_codec_get_type()) | |
43 #define PURPLE_MEDIA_CODEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) | |
44 #define PURPLE_MEDIA_CODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) | |
45 #define PURPLE_IS_MEDIA_CODEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_CODEC)) | |
46 #define PURPLE_IS_MEDIA_CODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_CODEC)) | |
47 #define PURPLE_MEDIA_CODEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) | |
48 | |
49 #define PURPLE_TYPE_MEDIA_SESSION_TYPE (purple_media_session_type_get_type()) | |
50 #define PURPLE_TYPE_MEDIA (purple_media_get_type()) | 39 #define PURPLE_TYPE_MEDIA (purple_media_get_type()) |
51 #define PURPLE_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia)) | 40 #define PURPLE_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia)) |
52 #define PURPLE_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA, PurpleMediaClass)) | 41 #define PURPLE_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA, PurpleMediaClass)) |
53 #define PURPLE_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA)) | 42 #define PURPLE_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA)) |
54 #define PURPLE_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA)) | 43 #define PURPLE_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA)) |
55 #define PURPLE_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA, PurpleMediaClass)) | 44 #define PURPLE_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA, PurpleMediaClass)) |
56 | 45 |
57 #define PURPLE_TYPE_MEDIA_CANDIDATE_TYPE (purple_media_candidate_type_get_type()) | |
58 #define PURPLE_TYPE_MEDIA_NETWORK_PROTOCOL (purple_media_network_protocol_get_type()) | |
59 #define PURPLE_MEDIA_TYPE_STATE (purple_media_state_changed_get_type()) | |
60 #define PURPLE_MEDIA_TYPE_INFO_TYPE (purple_media_info_type_get_type()) | |
61 | |
62 /** An opaque structure representing a media call. */ | 46 /** An opaque structure representing a media call. */ |
63 typedef struct _PurpleMedia PurpleMedia; | 47 typedef struct _PurpleMedia PurpleMedia; |
64 /** An opaque structure representing a network candidate (IP Address and port pair). */ | |
65 typedef struct _PurpleMediaCandidate PurpleMediaCandidate; | |
66 /** An opaque structure representing an audio or video codec. */ | |
67 typedef struct _PurpleMediaCodec PurpleMediaCodec; | |
68 | |
69 /** Media caps */ | |
70 typedef enum { | |
71 PURPLE_MEDIA_CAPS_NONE = 0, | |
72 PURPLE_MEDIA_CAPS_AUDIO = 1, | |
73 PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION = 1 << 1, | |
74 PURPLE_MEDIA_CAPS_VIDEO = 1 << 2, | |
75 PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION = 1 << 3, | |
76 PURPLE_MEDIA_CAPS_AUDIO_VIDEO = 1 << 4, | |
77 PURPLE_MEDIA_CAPS_MODIFY_SESSION = 1 << 5, | |
78 PURPLE_MEDIA_CAPS_CHANGE_DIRECTION = 1 << 6, | |
79 } PurpleMediaCaps; | |
80 | |
81 /** Media session types */ | |
82 typedef enum { | |
83 PURPLE_MEDIA_NONE = 0, | |
84 PURPLE_MEDIA_RECV_AUDIO = 1 << 0, | |
85 PURPLE_MEDIA_SEND_AUDIO = 1 << 1, | |
86 PURPLE_MEDIA_RECV_VIDEO = 1 << 2, | |
87 PURPLE_MEDIA_SEND_VIDEO = 1 << 3, | |
88 PURPLE_MEDIA_AUDIO = PURPLE_MEDIA_RECV_AUDIO | PURPLE_MEDIA_SEND_AUDIO, | |
89 PURPLE_MEDIA_VIDEO = PURPLE_MEDIA_RECV_VIDEO | PURPLE_MEDIA_SEND_VIDEO | |
90 } PurpleMediaSessionType; | |
91 | |
92 /** Media state-changed types */ | |
93 typedef enum { | |
94 PURPLE_MEDIA_STATE_NEW = 0, | |
95 PURPLE_MEDIA_STATE_CONNECTED, | |
96 PURPLE_MEDIA_STATE_END, | |
97 } PurpleMediaState; | |
98 | |
99 /** Media info types */ | |
100 typedef enum { | |
101 PURPLE_MEDIA_INFO_HANGUP = 0, | |
102 PURPLE_MEDIA_INFO_ACCEPT, | |
103 PURPLE_MEDIA_INFO_REJECT, | |
104 PURPLE_MEDIA_INFO_MUTE, | |
105 PURPLE_MEDIA_INFO_UNMUTE, | |
106 PURPLE_MEDIA_INFO_PAUSE, | |
107 PURPLE_MEDIA_INFO_UNPAUSE, | |
108 PURPLE_MEDIA_INFO_HOLD, | |
109 PURPLE_MEDIA_INFO_UNHOLD, | |
110 } PurpleMediaInfoType; | |
111 | |
112 typedef enum { | |
113 PURPLE_MEDIA_CANDIDATE_TYPE_HOST, | |
114 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, | |
115 PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX, | |
116 PURPLE_MEDIA_CANDIDATE_TYPE_RELAY, | |
117 PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST, | |
118 } PurpleMediaCandidateType; | |
119 | |
120 typedef enum { | |
121 PURPLE_MEDIA_COMPONENT_NONE = 0, | |
122 PURPLE_MEDIA_COMPONENT_RTP = 1, | |
123 PURPLE_MEDIA_COMPONENT_RTCP = 2, | |
124 } PurpleMediaComponentType; | |
125 | |
126 typedef enum { | |
127 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, | |
128 PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, | |
129 } PurpleMediaNetworkProtocol; | |
130 | 48 |
131 #include "signals.h" | 49 #include "signals.h" |
132 #include "util.h" | 50 #include "util.h" |
133 | 51 |
134 #ifdef __cplusplus | 52 #ifdef __cplusplus |
135 extern "C" { | 53 extern "C" { |
136 #endif | 54 #endif |
137 | 55 |
138 /** | 56 /** |
139 * Gets the media session type's GType | |
140 * | |
141 * @return The media session type's GType. | |
142 * | |
143 * @since 2.6.0 | |
144 */ | |
145 GType purple_media_session_type_get_type(void); | |
146 | |
147 /** | |
148 * Gets the media candidate type's GType | |
149 * | |
150 * @return The media candidate type's GType. | |
151 * | |
152 * @since 2.6.0 | |
153 */ | |
154 GType purple_media_candidate_type_get_type(void); | |
155 | |
156 /** | |
157 * Gets the media network protocol's GType | |
158 * | |
159 * @return The media network protocol's GType. | |
160 * | |
161 * @since 2.6.0 | |
162 */ | |
163 GType purple_media_network_protocol_get_type(void); | |
164 | |
165 /** | |
166 * Gets the media class's GType | 57 * Gets the media class's GType |
167 * | 58 * |
168 * @return The media class's GType. | 59 * @return The media class's GType. |
169 * | 60 * |
170 * @since 2.6.0 | 61 * @since 2.6.0 |
171 */ | 62 */ |
172 GType purple_media_get_type(void); | 63 GType purple_media_get_type(void); |
173 | |
174 /** | |
175 * Gets the type of the state-changed enum | |
176 * | |
177 * @return The state-changed enum's GType | |
178 * | |
179 * @since 2.6.0 | |
180 */ | |
181 GType purple_media_state_changed_get_type(void); | |
182 | |
183 /** | |
184 * Gets the type of the info type enum | |
185 * | |
186 * @return The info type enum's GType | |
187 * | |
188 * @since 2.6.0 | |
189 */ | |
190 GType purple_media_info_type_get_type(void); | |
191 | |
192 /** | |
193 * Gets the type of the media candidate structure. | |
194 * | |
195 * @return The media canditate's GType | |
196 * | |
197 * @since 2.6.0 | |
198 */ | |
199 GType purple_media_candidate_get_type(void); | |
200 | |
201 /** | |
202 * Creates a PurpleMediaCandidate instance. | |
203 * | |
204 * @param foundation The foundation of the candidate. | |
205 * @param component_id The component this candidate is for. | |
206 * @param type The type of candidate. | |
207 * @param proto The protocol this component is for. | |
208 * @param ip The IP address of this component. | |
209 * @param port The network port. | |
210 * | |
211 * @return The newly created PurpleMediaCandidate instance. | |
212 * | |
213 * @since 2.6.0 | |
214 */ | |
215 PurpleMediaCandidate *purple_media_candidate_new( | |
216 const gchar *foundation, guint component_id, | |
217 PurpleMediaCandidateType type, | |
218 PurpleMediaNetworkProtocol proto, | |
219 const gchar *ip, guint port); | |
220 | |
221 /** | |
222 * Copies a GList of PurpleMediaCandidate and its contents. | |
223 * | |
224 * @param candidates The list of candidates to be copied. | |
225 * | |
226 * @return The copy of the GList. | |
227 * | |
228 * @since 2.6.0 | |
229 */ | |
230 GList *purple_media_candidate_list_copy(GList *candidates); | |
231 | |
232 /** | |
233 * Frees a GList of PurpleMediaCandidate and its contents. | |
234 * | |
235 * @param candidates The list of candidates to be freed. | |
236 * | |
237 * @since 2.6.0 | |
238 */ | |
239 void purple_media_candidate_list_free(GList *candidates); | |
240 | |
241 gchar *purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate); | |
242 guint purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate); | |
243 gchar *purple_media_candidate_get_ip(PurpleMediaCandidate *candidate); | |
244 guint16 purple_media_candidate_get_port(PurpleMediaCandidate *candidate); | |
245 gchar *purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate); | |
246 guint16 purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate); | |
247 PurpleMediaNetworkProtocol purple_media_candidate_get_protocol( | |
248 PurpleMediaCandidate *candidate); | |
249 guint32 purple_media_candidate_get_priority(PurpleMediaCandidate *candidate); | |
250 PurpleMediaCandidateType purple_media_candidate_get_candidate_type( | |
251 PurpleMediaCandidate *candidate); | |
252 gchar *purple_media_candidate_get_username(PurpleMediaCandidate *candidate); | |
253 gchar *purple_media_candidate_get_password(PurpleMediaCandidate *candidate); | |
254 guint purple_media_candidate_get_ttl(PurpleMediaCandidate *candidate); | |
255 | |
256 /** | |
257 * Gets the type of the media codec structure. | |
258 * | |
259 * @return The media codec's GType | |
260 * | |
261 * @since 2.6.0 | |
262 */ | |
263 GType purple_media_codec_get_type(void); | |
264 | |
265 /** | |
266 * Creates a new PurpleMediaCodec instance. | |
267 * | |
268 * @param id Codec identifier. | |
269 * @param encoding_name Name of the media type this encodes. | |
270 * @param media_type PurpleMediaSessionType of this codec. | |
271 * @param clock_rate The clock rate this codec encodes at, if applicable. | |
272 * | |
273 * @return The newly created PurpleMediaCodec. | |
274 * | |
275 * @since 2.6.0 | |
276 */ | |
277 PurpleMediaCodec *purple_media_codec_new(int id, const char *encoding_name, | |
278 PurpleMediaSessionType media_type, guint clock_rate); | |
279 | |
280 guint purple_media_codec_get_id(PurpleMediaCodec *codec); | |
281 gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec); | |
282 guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec); | |
283 guint purple_media_codec_get_channels(PurpleMediaCodec *codec); | |
284 GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec); | |
285 | |
286 /** | |
287 * Creates a string representation of the codec. | |
288 * | |
289 * @param codec The codec to create the string of. | |
290 * | |
291 * @return The new string representation. | |
292 * | |
293 * @since 2.6.0 | |
294 */ | |
295 gchar *purple_media_codec_to_string(const PurpleMediaCodec *codec); | |
296 | |
297 /** | |
298 * Adds an optional parameter to the codec. | |
299 * | |
300 * @param codec The codec to add the parameter to. | |
301 * @param name The name of the parameter to add. | |
302 * @param value The value of the parameter to add. | |
303 * | |
304 * @since 2.6.0 | |
305 */ | |
306 void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, | |
307 const gchar *name, const gchar *value); | |
308 | |
309 /** | |
310 * Removes an optional parameter from the codec. | |
311 * | |
312 * @param codec The codec to remove the parameter from. | |
313 * @param param A pointer to the parameter to remove. | |
314 * | |
315 * @since 2.6.0 | |
316 */ | |
317 void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, | |
318 PurpleKeyValuePair *param); | |
319 | |
320 /** | |
321 * Gets an optional parameter based on the values given. | |
322 * | |
323 * @param codec The codec to find the parameter in. | |
324 * @param name The name of the parameter to search for. | |
325 * @param value The value to search for or NULL. | |
326 * | |
327 * @return The value found or NULL. | |
328 * | |
329 * @since 2.6.0 | |
330 */ | |
331 PurpleKeyValuePair *purple_media_codec_get_optional_parameter( | |
332 PurpleMediaCodec *codec, const gchar *name, | |
333 const gchar *value); | |
334 | |
335 /** | |
336 * Copies a GList of PurpleMediaCodec and its contents. | |
337 * | |
338 * @param codecs The list of codecs to be copied. | |
339 * | |
340 * @return The copy of the GList. | |
341 * | |
342 * @since 2.6.0 | |
343 */ | |
344 GList *purple_media_codec_list_copy(GList *codecs); | |
345 | |
346 /** | |
347 * Frees a GList of PurpleMediaCodec and its contents. | |
348 * | |
349 * @param codecs The list of codecs to be freed. | |
350 * | |
351 * @since 2.6.0 | |
352 */ | |
353 void purple_media_codec_list_free(GList *codecs); | |
354 | 64 |
355 /** | 65 /** |
356 * Gets a list of session IDs. | 66 * Gets a list of session IDs. |
357 * | 67 * |
358 * @param media The media session from which to retrieve session IDs. | 68 * @param media The media session from which to retrieve session IDs. |