2 * @file miranda-media.c
6 * Copyright (C) 2010-11 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "newpluginapi.h"
29 #include "m_protosvc.h"
30 #include "m_protoint.h"
32 #include "sipe-common.h"
33 #include "sipe-backend.h"
34 #include "sipe-core.h"
35 #include "miranda-private.h"
37 struct sipe_backend_media
{
41 struct sipe_backend_stream
{
45 struct sipe_backend_media
*
46 sipe_backend_media_new(struct sipe_core_public
*sipe_public
,
47 struct sipe_media_call
*call
,
48 const gchar
*participant
,
51 struct sipe_backend_media
*m
= g_new0(struct sipe_backend_media
,1);
57 sipe_backend_media_free(struct sipe_backend_media
*media
)
63 sipe_backend_media_set_cname(struct sipe_backend_media
*media
, gchar
*cname
)
68 struct sipe_backend_media_relays
*
69 sipe_backend_media_relays_convert(GSList
*media_relays
, gchar
*username
, gchar
*password
)
76 sipe_backend_media_relays_free(struct sipe_backend_media_relays
*media_relays
)
81 struct sipe_backend_stream
*
82 sipe_backend_media_add_stream(struct sipe_backend_media
*media
,
84 const gchar
*participant
,
86 SipeIceVersion ice_version
,
88 struct sipe_backend_media_relays
*media_relays
)
95 sipe_backend_media_remove_stream(struct sipe_backend_media
*media
,
96 struct sipe_backend_stream
*stream
)
101 GSList
*sipe_backend_media_get_streams(struct sipe_backend_media
*media
)
107 struct sipe_backend_stream
*
108 sipe_backend_media_get_stream_by_id(struct sipe_backend_media
*media
,
116 sipe_backend_media_add_remote_candidates(struct sipe_backend_media
*media
,
117 struct sipe_backend_stream
*stream
,
123 gboolean
sipe_backend_media_is_initiator(struct sipe_backend_media
*media
,
124 struct sipe_backend_stream
*stream
)
130 gboolean
sipe_backend_media_accepted(struct sipe_backend_media
*media
)
137 sipe_backend_stream_initialized(struct sipe_backend_media
*media
,
138 struct sipe_backend_stream
*stream
)
145 sipe_backend_media_get_active_local_candidates(struct sipe_backend_media
*media
,
146 struct sipe_backend_stream
*stream
)
153 sipe_backend_media_get_active_remote_candidates(struct sipe_backend_media
*media
,
154 struct sipe_backend_stream
*stream
)
161 sipe_backend_stream_get_id(struct sipe_backend_stream
*stream
)
167 void sipe_backend_stream_hold(struct sipe_backend_media
*media
,
168 struct sipe_backend_stream
*stream
,
174 void sipe_backend_stream_unhold(struct sipe_backend_media
*media
,
175 struct sipe_backend_stream
*stream
,
181 gboolean
sipe_backend_stream_is_held(struct sipe_backend_stream
*stream
)
187 struct sipe_backend_codec
*
188 sipe_backend_codec_new(int id
, const char *name
, SipeMediaType type
, guint clock_rate
)
195 sipe_backend_codec_free(struct sipe_backend_codec
*codec
)
201 sipe_backend_codec_get_id(struct sipe_backend_codec
*codec
)
208 sipe_backend_codec_get_name(struct sipe_backend_codec
*codec
)
215 sipe_backend_codec_get_clock_rate(struct sipe_backend_codec
*codec
)
222 sipe_backend_codec_add_optional_parameter(struct sipe_backend_codec
*codec
,
223 const gchar
*name
, const gchar
*value
)
229 sipe_backend_codec_get_optional_parameters(struct sipe_backend_codec
*codec
)
236 sipe_backend_set_remote_codecs(struct sipe_backend_media
*media
,
237 struct sipe_backend_stream
*stream
,
245 sipe_backend_get_local_codecs(struct sipe_backend_media
*media
,
246 struct sipe_backend_stream
*stream
)
252 struct sipe_backend_candidate
*
253 sipe_backend_candidate_new(const gchar
*foundation
,
254 SipeComponentType component
,
255 SipeCandidateType type
, SipeNetworkProtocol proto
,
256 const gchar
*ip
, guint port
,
257 const gchar
*username
,
258 const gchar
*password
)
265 sipe_backend_candidate_free(struct sipe_backend_candidate
*candidate
)
271 sipe_backend_candidate_get_username(struct sipe_backend_candidate
*candidate
)
278 sipe_backend_candidate_get_password(struct sipe_backend_candidate
*candidate
)
285 sipe_backend_candidate_get_foundation(struct sipe_backend_candidate
*candidate
)
292 sipe_backend_candidate_get_ip(struct sipe_backend_candidate
*candidate
)
299 sipe_backend_candidate_get_port(struct sipe_backend_candidate
*candidate
)
306 sipe_backend_candidate_get_base_ip(struct sipe_backend_candidate
*candidate
)
313 sipe_backend_candidate_get_base_port(struct sipe_backend_candidate
*candidate
)
320 sipe_backend_candidate_get_priority(struct sipe_backend_candidate
*candidate
)
327 sipe_backend_candidate_set_priority(struct sipe_backend_candidate
*candidate
, guint32 priority
)
333 sipe_backend_candidate_get_component_type(struct sipe_backend_candidate
*candidate
)
336 return SIPE_COMPONENT_NONE
;
340 sipe_backend_candidate_get_type(struct sipe_backend_candidate
*candidate
)
343 return SIPE_CANDIDATE_TYPE_ANY
;
347 sipe_backend_candidate_get_protocol(struct sipe_backend_candidate
*candidate
)
350 return SIPE_NETWORK_PROTOCOL_TCP_ACTIVE
;
354 sipe_backend_get_local_candidates(struct sipe_backend_media
*media
,
355 struct sipe_backend_stream
*stream
)
362 sipe_backend_media_accept(struct sipe_backend_media
*media
, gboolean local
)
368 sipe_backend_media_hangup(struct sipe_backend_media
*media
, gboolean local
)
374 sipe_backend_media_reject(struct sipe_backend_media
*media
, gboolean local
)