These changes are reuired to make the Windows installer build.
[pidgin-git.git] / libpurple / media / backend-iface.c
blob9c06934ab77610d8f7f07abfaa0e6d9146b92d71
1 /**
2 * @file backend-iface.c Interface for media backend
3 * @ingroup core
4 */
6 /* purple
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #include "backend-iface.h"
29 #include "marshallers.h"
31 enum {
32 S_ERROR,
33 CANDIDATES_PREPARED,
34 CODECS_CHANGED,
35 NEW_CANDIDATE,
36 ACTIVE_CANDIDATE_PAIR,
37 LAST_SIGNAL
40 static guint purple_media_backend_signals[LAST_SIGNAL] = {0};
42 static void
43 purple_media_backend_base_init(gpointer iface)
45 static gboolean is_initialized = FALSE;
47 if (is_initialized)
48 return;
50 g_object_interface_install_property(iface,
51 g_param_spec_string("conference-type",
52 "Conference Type",
53 "The type of conference that this backend "
54 "has been created to provide.",
55 NULL,
56 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
57 g_object_interface_install_property(iface,
58 g_param_spec_object("media",
59 "Purple Media",
60 "The media object that this backend is bound to.",
61 PURPLE_TYPE_MEDIA,
62 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
64 purple_media_backend_signals[S_ERROR] =
65 g_signal_new("error", G_TYPE_FROM_CLASS(iface),
66 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
67 g_cclosure_marshal_VOID__STRING,
68 G_TYPE_NONE, 1, G_TYPE_STRING);
69 purple_media_backend_signals[CANDIDATES_PREPARED] =
70 g_signal_new("candidates-prepared",
71 G_TYPE_FROM_CLASS(iface),
72 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
73 purple_smarshal_VOID__STRING_STRING,
74 G_TYPE_NONE, 2, G_TYPE_STRING,
75 G_TYPE_STRING);
76 purple_media_backend_signals[CODECS_CHANGED] =
77 g_signal_new("codecs-changed",
78 G_TYPE_FROM_CLASS(iface),
79 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
80 g_cclosure_marshal_VOID__STRING,
81 G_TYPE_NONE, 1, G_TYPE_STRING);
82 purple_media_backend_signals[NEW_CANDIDATE] =
83 g_signal_new("new-candidate",
84 G_TYPE_FROM_CLASS(iface),
85 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
86 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
87 G_TYPE_NONE, 3, G_TYPE_POINTER,
88 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE);
89 purple_media_backend_signals[ACTIVE_CANDIDATE_PAIR] =
90 g_signal_new("active-candidate-pair",
91 G_TYPE_FROM_CLASS(iface),
92 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
93 purple_smarshal_VOID__STRING_STRING_OBJECT_OBJECT,
94 G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING,
95 PURPLE_TYPE_MEDIA_CANDIDATE,
96 PURPLE_TYPE_MEDIA_CANDIDATE);
98 is_initialized = TRUE;
101 GType
102 purple_media_backend_get_type(void)
104 static GType iface_type = 0;
105 if (iface_type == 0) {
106 static const GTypeInfo info = {
107 sizeof(PurpleMediaBackendIface),
108 purple_media_backend_base_init,
109 NULL,
110 NULL,
111 NULL,
112 NULL,
115 NULL,
116 NULL
119 iface_type = g_type_register_static (G_TYPE_INTERFACE,
120 "PurpleMediaBackend", &info, 0);
123 return iface_type;
126 gboolean
127 purple_media_backend_add_stream(PurpleMediaBackend *self,
128 const gchar *sess_id, const gchar *who,
129 PurpleMediaSessionType type, gboolean initiator,
130 const gchar *transmitter,
131 guint num_params, GParameter *params)
133 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
134 return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->add_stream(self,
135 sess_id, who, type, initiator, transmitter,
136 num_params, params);
139 void
140 purple_media_backend_add_remote_candidates(PurpleMediaBackend *self,
141 const gchar *sess_id, const gchar *participant,
142 GList *remote_candidates)
144 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND(self));
145 PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->add_remote_candidates(self,
146 sess_id, participant, remote_candidates);
149 gboolean
150 purple_media_backend_codecs_ready(PurpleMediaBackend *self,
151 const gchar *sess_id)
153 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
154 return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->codecs_ready(self,
155 sess_id);
158 GList *
159 purple_media_backend_get_codecs(PurpleMediaBackend *self,
160 const gchar *sess_id)
162 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), NULL);
163 return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->get_codecs(self,
164 sess_id);
167 GList *
168 purple_media_backend_get_local_candidates(PurpleMediaBackend *self,
169 const gchar *sess_id, const gchar *participant)
171 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), NULL);
172 return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->
173 get_local_candidates(self,
174 sess_id, participant);
177 gboolean
178 purple_media_backend_set_remote_codecs(PurpleMediaBackend *self,
179 const gchar *sess_id, const gchar *participant,
180 GList *codecs)
182 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
183 return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->set_remote_codecs(
184 self, sess_id, participant, codecs);
187 gboolean
188 purple_media_backend_set_send_codec(PurpleMediaBackend *self,
189 const gchar *sess_id, PurpleMediaCodec *codec)
191 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
192 return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->set_send_codec(self,
193 sess_id, codec);