pidgin: 6cdccf57: media: Allow setting SDES properties of ...
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Sun May 1 23:31:39 EDT 2011
----------------------------------------------------------------------
Revision: 6cdccf57eb89059350d3853289540768abb6434c
Parent: fe1e545296641502337c940e326cd8a5ae62a57d
Author: jakub.adam at ktknet.cz
Date: 05/01/11 23:23:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6cdccf57eb89059350d3853289540768abb6434c
Changelog:
media: Allow setting SDES properties of RTP conferences. Fixes #12981.
Changes against parent fe1e545296641502337c940e326cd8a5ae62a57d
patched libpurple/media/backend-fs2.c
patched libpurple/media/backend-iface.c
patched libpurple/media/backend-iface.h
patched libpurple/media.c
patched libpurple/media.h
-------------- next part --------------
============================================================
--- libpurple/media.c 62b6a8345a91d625f397efa479b77a96f0d88406
+++ libpurple/media.c b6d7130f18c1bd96f12516b0eb35344457c5b447
@@ -916,7 +916,48 @@ purple_media_stream_info(PurpleMedia *me
#endif
}
+void
+purple_media_set_params(PurpleMedia *media,
+ guint num_params, GParameter *params)
+{
#ifdef USE_VV
+ g_return_if_fail(PURPLE_IS_MEDIA(media));
+
+ purple_media_backend_set_params(media->priv->backend, num_params, params);
+#endif
+}
+
+const gchar **
+purple_media_get_available_params(PurpleMedia *media)
+{
+ static const gchar *NULL_ARRAY[] = { NULL };
+#ifdef USE_VV
+ g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL_ARRAY);
+
+ return purple_media_backend_get_available_params(media->priv->backend);
+#else
+ return NULL_ARRAY;
+#endif
+}
+
+gboolean
+purple_media_param_is_supported(PurpleMedia *media, const gchar *param)
+{
+#ifdef USE_VV
+ const gchar **params;
+
+ g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
+ g_return_val_if_fail(param != NULL, FALSE);
+
+ params = purple_media_backend_get_available_params(media->priv->backend);
+ for (; *params != NULL; ++params)
+ if (!strcmp(*params, param))
+ return TRUE;
+#endif
+ return FALSE;
+}
+
+#ifdef USE_VV
static void
purple_media_new_local_candidate_cb(PurpleMediaBackend *backend,
const gchar *sess_id, const gchar *participant,
============================================================
--- libpurple/media.h 7708bb2947aaf73f120743f188942a02e9c96023
+++ libpurple/media.h 446b57c35eaabf153e8b0ac42e01a3fbe83b0c45
@@ -144,6 +144,52 @@ void purple_media_stream_info(PurpleMedi
gboolean local);
/**
+ * Sets various optional parameters of the media call.
+ *
+ * Currently supported are:
+ * - "sdes-cname" : The CNAME for the RTP sessions
+ * - "sdes-name" : Real name used to describe the source in SDES messages
+ * - "sdes-tool" : The TOOL to put in SDES messages
+ * - "sdes-email" : Email address to put in SDES messages
+ * - "sdes-location" : The LOCATION to put in SDES messages
+ * - "sdes-note" : The NOTE to put in SDES messages
+ * - "sdes-phone" : The PHONE to put in SDES messages
+ *
+ * @param media The media object to set the parameters on.
+ * @param num_params The number of parameters to pass
+ * @param params Array of @c GParameter to pass
+ *
+ * @since 2.8.0
+ */
+void purple_media_set_params(PurpleMedia *media,
+ guint num_params, GParameter *params);
+
+/**
+ * Gets the list of optional parameters supported by the media backend.
+ *
+ * The list is owned by the @c PurpleMedia internals and should NOT be freed.
+ *
+ * @param media The media object
+ *
+ * @return NULL-terminated array of names of supported parameters.
+ *
+ * @since 2.8.0
+ */
+const gchar **purple_media_get_available_params(PurpleMedia *media);
+
+/**
+ * Checks if given optional parameter is supported by the media backend.
+ *
+ * @param media The media object
+ * @param param name of parameter
+ *
+ * @return @c TRUE if backend recognizes the parameter, @c FALSE otherwise.
+ *
+ * @since 2.8.0
+ */
+gboolean purple_media_param_is_supported(PurpleMedia *media, const gchar *param);
+
+/**
* Adds a stream to a session.
*
* It only adds a stream to one audio session or video session as
============================================================
--- libpurple/media/backend-iface.c 897573dc4fe4b9a2fcb5629f471c6723563ed128
+++ libpurple/media/backend-iface.c 8052e6892d00d3739f239bda083a61ed09ba3fb9
@@ -192,3 +192,20 @@ purple_media_backend_set_send_codec(Purp
return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->set_send_codec(self,
sess_id, codec);
}
+
+void
+purple_media_backend_set_params(PurpleMediaBackend *self,
+ guint num_params, GParameter *params)
+{
+ g_return_if_fail(PURPLE_IS_MEDIA_BACKEND(self));
+ PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->set_params(self, num_params, params);
+}
+
+const gchar **
+purple_media_backend_get_available_params(PurpleMediaBackend *self)
+{
+ static const gchar *NULL_ARRAY[] = { NULL };
+
+ g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), NULL_ARRAY);
+ return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->get_available_params();
+}
============================================================
--- libpurple/media/backend-iface.h 8d7440897c122db1045174cefe0a9e3a780a9f08
+++ libpurple/media/backend-iface.h 320648565c761b97a84fb95fec1c0d8bd97a59a1
@@ -68,6 +68,9 @@ struct _PurpleMediaBackendIface
GList *codecs);
gboolean (*set_send_codec) (PurpleMediaBackend *self,
const gchar *sess_id, PurpleMediaCodec *codec);
+ void (*set_params) (PurpleMediaBackend *self,
+ guint num_params, GParameter *params);
+ const gchar **(*get_available_params) (void);
};
/**
@@ -191,6 +194,31 @@ gboolean purple_media_backend_set_send_c
gboolean purple_media_backend_set_send_codec(PurpleMediaBackend *self,
const gchar *sess_id, PurpleMediaCodec *codec);
+/**
+ * Sets various optional parameters of the media backend.
+ *
+ * @param self The media backend to set the parameters on.
+ * @param num_params The number of parameters to pass to backend
+ * @param params Array of @c GParameter to pass to backend
+ *
+ * @since 2.8.0
+ */
+void purple_media_backend_set_params(PurpleMediaBackend *self,
+ guint num_params, GParameter *params);
+
+/**
+ * Gets the list of optional parameters supported by the media backend.
+ *
+ * The list should NOT be freed.
+ *
+ * @param self The media backend
+ *
+ * @return NULL-terminated array of names of supported parameters.
+ *
+ * @since 2.8.0
+ */
+const gchar **purple_media_backend_get_available_params(PurpleMediaBackend *self);
+
G_END_DECLS
#endif /* _MEDIA_BACKEND_IFACE_H_ */
============================================================
--- libpurple/media/backend-fs2.c 9035de5df989f8cf4851bbf1680a753991621408
+++ libpurple/media/backend-fs2.c d35ff3fcd4005cef61707bbd247426e17dfcec25
@@ -85,6 +85,9 @@ static gboolean purple_media_backend_fs2
static gboolean purple_media_backend_fs2_set_send_codec(
PurpleMediaBackend *self, const gchar *sess_id,
PurpleMediaCodec *codec);
+static void purple_media_backend_fs2_set_params(PurpleMediaBackend *self,
+ guint num_params, GParameter *params);
+static const gchar **purple_media_backend_fs2_get_available_params(void);
static void free_stream(PurpleMediaBackendFs2Stream *stream);
static void free_session(PurpleMediaBackendFs2Session *session);
@@ -413,6 +416,8 @@ purple_media_backend_iface_init(PurpleMe
purple_media_backend_fs2_get_local_candidates;
iface->set_remote_codecs = purple_media_backend_fs2_set_remote_codecs;
iface->set_send_codec = purple_media_backend_fs2_set_send_codec;
+ iface->set_params = purple_media_backend_fs2_set_params;
+ iface->get_available_params = purple_media_backend_fs2_get_available_params;
}
static FsMediaType
@@ -2126,6 +2131,49 @@ purple_media_backend_fs2_set_send_codec(
return TRUE;
}
+
+static void
+purple_media_backend_fs2_set_params(PurpleMediaBackend *self,
+ guint num_params, GParameter *params)
+{
+ PurpleMediaBackendFs2Private *priv;
+ const gchar **supported = purple_media_backend_fs2_get_available_params();
+ const gchar **p;
+ guint i;
+
+ g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self));
+
+ priv = PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
+
+ if (priv->conference == NULL &&
+ !init_conference(PURPLE_MEDIA_BACKEND_FS2(self))) {
+ purple_debug_error("backend-fs2",
+ "Error initializing the conference.\n");
+ return;
+ }
+
+ for (i = 0; i != num_params; ++i) {
+ for (p = supported; *p != NULL; ++p) {
+ if (!strcmp(params[i].name, *p)) {
+ g_object_set(priv->conference,
+ params[i].name, g_value_get_string(¶ms[i].value),
+ NULL);
+ break;
+ }
+ }
+ }
+}
+
+static const gchar **
+purple_media_backend_fs2_get_available_params(void)
+{
+ static const gchar *supported_params[] = {
+ "sdes-cname", "sdes-email", "sdes-location", "sdes-name", "sdes-note",
+ "sdes-phone", "sdes-tool", NULL
+ };
+
+ return supported_params;
+}
#else
GType
purple_media_backend_fs2_get_type(void)
More information about the Commits
mailing list