cpw.maiku.media_refactor: 602088ab: Move set_remote_codec functionality to t...
maiku at pidgin.im
maiku at pidgin.im
Mon Oct 26 22:45:53 EDT 2009
-----------------------------------------------------------------
Revision: 602088ab48304bdc10cd602297a92fc9fea2ed22
Ancestor: e5c8ea10ec8a48fd431e8c6959c8135a1aa3f9fc
Author: maiku at pidgin.im
Date: 2009-10-26T23:26:59
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/602088ab48304bdc10cd602297a92fc9fea2ed22
Modified files:
libpurple/media/backend-fs2.c libpurple/media/media.c
ChangeLog:
Move set_remote_codec functionality to the Fs2 media backend.
-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c 7b82b12d875817ed5b8a904c14484418e25111d4
+++ libpurple/media/backend-fs2.c 06a800e5fb13f41e6d315cfbb13f4982fe564a79
@@ -1462,6 +1462,27 @@ purple_media_backend_fs2_set_send_codec(
purple_media_backend_fs2_set_send_codec(PurpleMediaBackend *self,
const gchar *sess_id, PurpleMediaCodec *codec)
{
+ PurpleMediaBackendFs2Session *session;
+ FsCodec *fscodec;
+ GError *err = NULL;
+
+ g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
+
+ session = _get_session(PURPLE_MEDIA_BACKEND_FS2(self), sess_id);
+
+ if (session == NULL)
+ return FALSE;
+
+ fscodec = _codec_to_fs(codec);
+ fs_session_set_send_codec(session->session, fscodec, &err);
+ fs_codec_destroy(fscodec);
+
+ if (err) {
+ purple_debug_error("media", "Error setting send codec\n");
+ g_error_free(err);
+ return FALSE;
+ }
+
return TRUE;
}
============================================================
--- libpurple/media/media.c 508fe8bec94834129043754fda14bd7a827d0a71
+++ libpurple/media/media.c 8a87c9e7077146789fec87886bc41c25eda6dccd
@@ -620,44 +620,6 @@ purple_media_from_fs(FsMediaType type, F
return result;
}
-static FsCodec *
-purple_media_codec_to_fs(const PurpleMediaCodec *codec)
-{
- FsCodec *new_codec;
- gint id;
- char *encoding_name;
- PurpleMediaSessionType media_type;
- guint clock_rate;
- guint channels;
- GList *iter;
-
- if (codec == NULL)
- return NULL;
-
- g_object_get(G_OBJECT(codec),
- "id", &id,
- "encoding-name", &encoding_name,
- "media-type", &media_type,
- "clock-rate", &clock_rate,
- "channels", &channels,
- "optional-params", &iter,
- NULL);
-
- new_codec = fs_codec_new(id, encoding_name,
- purple_media_to_fs_media_type(media_type),
- clock_rate);
- new_codec->channels = channels;
-
- for (; iter; iter = g_list_next(iter)) {
- PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data;
- fs_codec_add_optional_parameter(new_codec,
- param->key, param->value);
- }
-
- g_free(encoding_name);
- return new_codec;
-}
-
static PurpleMediaSession*
purple_media_get_session(PurpleMedia *media, const gchar *sess_id)
{
@@ -1572,27 +1534,10 @@ purple_media_set_send_codec(PurpleMedia
purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec)
{
#ifdef USE_VV
- PurpleMediaSession *session;
- FsCodec *fscodec;
- GError *err = NULL;
-
g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
- session = purple_media_get_session(media, sess_id);
-
- if (session != NULL)
- return FALSE;
-
- fscodec = purple_media_codec_to_fs(codec);
- fs_session_set_send_codec(session->session, fscodec, &err);
- fs_codec_destroy(fscodec);
-
- if (err) {
- purple_debug_error("media", "Error setting send codec\n");
- g_error_free(err);
- return FALSE;
- }
- return TRUE;
+ return purple_media_backend_set_send_codec(
+ media->priv->backend, sess_id, codec);
#else
return FALSE;
#endif
More information about the Commits
mailing list