Mercurial > pidgin.yaz
annotate libpurple/media/backend-iface.h @ 30675:a87764155fa5
Fix a crash in Finch < 2.7.0 with purple >= 2.7.0.
The crash would happen if purple_sound_play_event is called for
GOT_ATTENTION event. Finch itself doesn't do it, but a plugin might.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 05 Jul 2010 15:49:57 +0000 |
parents | 510f4c50b3d7 |
children | 44f53d3fc54f |
rev | line source |
---|---|
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
1 /** |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
2 * @file backend-iface.h Interface for media backends |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
3 * @ingroup core |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
4 */ |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
5 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
6 /* purple |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
7 * |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
8 * Purple is the legal property of its developers, whose names are too numerous |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
10 * source distribution. |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
11 * |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
15 * (at your option) any later version. |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
16 * |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
21 * |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
25 */ |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
26 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
27 #ifndef _MEDIA_BACKEND_IFACE_H_ |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
28 #define _MEDIA_BACKEND_IFACE_H_ |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
29 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
30 #include "codec.h" |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
31 #include "enum-types.h" |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
32 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
33 #include <glib-object.h> |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
34 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
35 G_BEGIN_DECLS |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
36 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
37 #define PURPLE_TYPE_MEDIA_BACKEND (purple_media_backend_get_type()) |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
38 #define PURPLE_IS_MEDIA_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_BACKEND)) |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
39 #define PURPLE_MEDIA_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_BACKEND, PurpleMediaBackend)) |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
40 #define PURPLE_MEDIA_BACKEND_GET_INTERFACE(inst)(G_TYPE_INSTANCE_GET_INTERFACE((inst), PURPLE_TYPE_MEDIA_BACKEND, PurpleMediaBackendIface)) |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
41 |
29637 | 42 /** A placeholder to represent any media backend */ |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
43 typedef struct _PurpleMediaBackend PurpleMediaBackend; |
29637 | 44 /** A structure to derive media backends from. */ |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
45 typedef struct _PurpleMediaBackendIface PurpleMediaBackendIface; |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
46 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
47 struct _PurpleMediaBackendIface |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
48 { |
29637 | 49 GTypeInterface parent_iface; /**< The parent iface class */ |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
50 |
29637 | 51 /** Implementable functions called with purple_media_backend_* */ |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
52 gboolean (*add_stream) (PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
53 const gchar *sess_id, const gchar *who, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
54 PurpleMediaSessionType type, gboolean initiator, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
55 const gchar *transmitter, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
56 guint num_params, GParameter *params); |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
57 void (*add_remote_candidates) (PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
58 const gchar *sess_id, const gchar *participant, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
59 GList *remote_candidates); |
29581
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29574
diff
changeset
|
60 gboolean (*codecs_ready) (PurpleMediaBackend *self, |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29574
diff
changeset
|
61 const gchar *sess_id); |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
62 GList *(*get_codecs) (PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
63 const gchar *sess_id); |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
64 GList *(*get_local_candidates) (PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
65 const gchar *sess_id, const gchar *participant); |
29572
a7cad99144f0
Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents:
29541
diff
changeset
|
66 gboolean (*set_remote_codecs) (PurpleMediaBackend *self, |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
67 const gchar *sess_id, const gchar *participant, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
68 GList *codecs); |
29574
90c48f1e479a
Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents:
29572
diff
changeset
|
69 gboolean (*set_send_codec) (PurpleMediaBackend *self, |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
70 const gchar *sess_id, PurpleMediaCodec *codec); |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
71 }; |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
72 |
29637 | 73 /** |
74 * Gets the media backend's GType. | |
75 * | |
76 * @return The media backend's GType. | |
77 * | |
78 * @since 2.7.0 | |
79 */ | |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
80 GType purple_media_backend_get_type(void); |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
81 |
29637 | 82 /** |
83 * Creates and adds a stream to the media backend. | |
84 * | |
85 * @param self The backend to add the stream to. | |
86 * @param sess_id The session id of the stream to add. | |
87 * @param who The remote participant of the stream to add. | |
88 * @param type The media type and direction of the stream to add. | |
89 * @param initiator True if the local user initiated the stream. | |
90 * @param transmitter The string id of the tranmsitter to use. | |
91 * @param num_params The number of parameters in the param parameter. | |
92 * @param params The additional parameters to pass when creating the stream. | |
93 * | |
94 * @return True if the stream was successfully created, othewise False. | |
95 * | |
96 * @since 2.7.0 | |
97 */ | |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
98 gboolean purple_media_backend_add_stream(PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
99 const gchar *sess_id, const gchar *who, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
100 PurpleMediaSessionType type, gboolean initiator, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
101 const gchar *transmitter, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
102 guint num_params, GParameter *params); |
29637 | 103 |
104 /** | |
105 * Add remote candidates to a stream. | |
106 * | |
107 * @param self The backend the stream is in. | |
108 * @param sess_id The session id associated with the stream. | |
109 * @param participant The participant associated with the stream. | |
110 * @param remote_candidates The list of remote candidates to add. | |
111 * | |
112 * @since 2.7.0 | |
113 */ | |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
114 void purple_media_backend_add_remote_candidates(PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
115 const gchar *sess_id, const gchar *participant, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
116 GList *remote_candidates); |
29637 | 117 |
118 /** | |
119 * Get whether or not a session's codecs are ready. | |
120 * | |
121 * A codec is ready if all of the attributes and additional | |
122 * parameters have been collected. | |
123 * | |
124 * @param self The media backend the session is in. | |
125 * @param sess_id The session id of the session to check. | |
126 * | |
127 * @return True if the codecs are ready, otherwise False. | |
128 * | |
129 * @since 2.7.0 | |
130 */ | |
29581
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29574
diff
changeset
|
131 gboolean purple_media_backend_codecs_ready(PurpleMediaBackend *self, |
f351e87b7af0
Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents:
29574
diff
changeset
|
132 const gchar *sess_id); |
29637 | 133 |
134 /** | |
135 * Gets the codec intersection list for a session. | |
136 * | |
137 * The intersection list consists of all codecs that are compatible | |
138 * between the local and remote software. | |
139 * | |
140 * @param self The media backend the session is in. | |
141 * @param sess_id The session id of the session to use. | |
142 * | |
143 * @return The codec intersection list. | |
144 * | |
145 * @since 2.7.0 | |
146 */ | |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
147 GList *purple_media_backend_get_codecs(PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
148 const gchar *sess_id); |
29637 | 149 |
150 /** | |
151 * Gets the list of local candidates for a stream. | |
152 * | |
153 * @param self The media backend the stream is in. | |
154 * @param sess_id The session id associated with the stream. | |
155 * @param particilant The participant associated with the stream. | |
156 * | |
157 * @return The list of local candidates. | |
158 * | |
159 * @since 2.7.0 | |
160 */ | |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
161 GList *purple_media_backend_get_local_candidates(PurpleMediaBackend *self, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
162 const gchar *sess_id, const gchar *participant); |
29637 | 163 |
164 /** | |
165 * Sets the remote codecs on a stream. | |
166 * | |
167 * @param self The media backend the stream is in. | |
168 * @param sess_id The session id the stream is associated with. | |
169 * @param participant The participant the stream is associated with. | |
170 * @param codecs The list of remote codecs to set. | |
171 * | |
172 * @return True if the remote codecs were set successfully, otherwise False. | |
173 * | |
174 * @since 2.7.0 | |
175 */ | |
29572
a7cad99144f0
Make the backend interface's set_remote_codecs function return gboolean.
maiku@pidgin.im
parents:
29541
diff
changeset
|
176 gboolean purple_media_backend_set_remote_codecs(PurpleMediaBackend *self, |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
177 const gchar *sess_id, const gchar *participant, |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
178 GList *codecs); |
29637 | 179 |
180 /** | |
181 * Sets which codec format to send media content in for a session. | |
182 * | |
183 * @param self The media backend the session is in. | |
184 * @param sess_id The session id of the session to set the codec for. | |
185 * @param codec The codec to set. | |
186 * | |
187 * @return True if set successfully, otherwise False. | |
188 * | |
189 * @since 2.7.0 | |
190 */ | |
29574
90c48f1e479a
Change the media backend interface's set_send_codec to return gboolean to
maiku@pidgin.im
parents:
29572
diff
changeset
|
191 gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self, |
29539
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
192 const gchar *sess_id, PurpleMediaCodec *codec); |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
193 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
194 G_END_DECLS |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
195 |
0ae9306de1f6
Add a media backend interface to handle different backends in addition to
maiku@pidgin.im
parents:
diff
changeset
|
196 #endif /* _MEDIA_BACKEND_IFACE_H_ */ |