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 "sipe-core-private.h"
36 #include "miranda-private.h"
38 struct sipe_backend_media
{
42 struct sipe_backend_stream
{
46 struct sipe_backend_media
*
47 sipe_backend_media_new(struct sipe_core_public
*sipe_public
,
48 struct sipe_media_call
*call
,
49 const gchar
*participant
,
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_candidates_prepared(struct sipe_backend_media
*media
)
144 sipe_backend_media_get_active_local_candidates(struct sipe_backend_media
*media
,
145 struct sipe_backend_stream
*stream
)
152 sipe_backend_media_get_active_remote_candidates(struct sipe_backend_media
*media
,
153 struct sipe_backend_stream
*stream
)
160 sipe_backend_stream_get_id(struct sipe_backend_stream
*stream
)
166 void sipe_backend_stream_hold(struct sipe_backend_media
*media
,
167 struct sipe_backend_stream
*stream
,
173 void sipe_backend_stream_unhold(struct sipe_backend_media
*media
,
174 struct sipe_backend_stream
*stream
,
180 gboolean
sipe_backend_stream_is_held(struct sipe_backend_stream
*stream
)
186 struct sipe_backend_codec
*
187 sipe_backend_codec_new(int id
, const char *name
, SipeMediaType type
, guint clock_rate
)
194 sipe_backend_codec_free(struct sipe_backend_codec
*codec
)
200 sipe_backend_codec_get_id(struct sipe_backend_codec
*codec
)
207 sipe_backend_codec_get_name(struct sipe_backend_codec
*codec
)
214 sipe_backend_codec_get_clock_rate(struct sipe_backend_codec
*codec
)
221 sipe_backend_codec_add_optional_parameter(struct sipe_backend_codec
*codec
,
222 const gchar
*name
, const gchar
*value
)
228 sipe_backend_codec_get_optional_parameters(struct sipe_backend_codec
*codec
)
235 sipe_backend_set_remote_codecs(struct sipe_backend_media
*media
,
236 struct sipe_backend_stream
*stream
,
244 sipe_backend_get_local_codecs(struct sipe_backend_media
*media
,
245 struct sipe_backend_stream
*stream
)
251 struct sipe_backend_candidate
*
252 sipe_backend_candidate_new(const gchar
*foundation
,
253 SipeComponentType component
,
254 SipeCandidateType type
, SipeNetworkProtocol proto
,
255 const gchar
*ip
, guint port
,
256 const gchar
*username
,
257 const gchar
*password
)
264 sipe_backend_candidate_free(struct sipe_backend_candidate
*candidate
)
270 sipe_backend_candidate_get_username(struct sipe_backend_candidate
*candidate
)
277 sipe_backend_candidate_get_password(struct sipe_backend_candidate
*candidate
)
284 sipe_backend_candidate_get_foundation(struct sipe_backend_candidate
*candidate
)
291 sipe_backend_candidate_get_ip(struct sipe_backend_candidate
*candidate
)
298 sipe_backend_candidate_get_port(struct sipe_backend_candidate
*candidate
)
305 sipe_backend_candidate_get_base_ip(struct sipe_backend_candidate
*candidate
)
312 sipe_backend_candidate_get_base_port(struct sipe_backend_candidate
*candidate
)
319 sipe_backend_candidate_get_priority(struct sipe_backend_candidate
*candidate
)
326 sipe_backend_candidate_set_priority(struct sipe_backend_candidate
*candidate
, guint32 priority
)
332 sipe_backend_candidate_get_component_type(struct sipe_backend_candidate
*candidate
)
335 return SIPE_COMPONENT_NONE
;
339 sipe_backend_candidate_get_type(struct sipe_backend_candidate
*candidate
)
342 return SIPE_CANDIDATE_TYPE_ANY
;
346 sipe_backend_candidate_get_protocol(struct sipe_backend_candidate
*candidate
)
349 return SIPE_NETWORK_PROTOCOL_TCP
;
353 sipe_backend_get_local_candidates(struct sipe_backend_media
*media
,
354 struct sipe_backend_stream
*stream
)
361 sipe_backend_media_accept(struct sipe_backend_media
*media
, gboolean local
)
367 sipe_backend_media_hangup(struct sipe_backend_media
*media
, gboolean local
)
373 sipe_backend_media_reject(struct sipe_backend_media
*media
, gboolean local
)