Mercurial > pidgin
changeset 24975:d03cfec8bf7f
merge of '2a69c36548c533b1a96f40e1ee6af57c06ab1bad'
and '6a12860d1ff4413ceb4ee4796d32912e52573269'
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sat, 13 Dec 2008 08:49:16 +0000 |
parents | 25e2ab1fff1d (current diff) 93cc8982d4e5 (diff) |
children | 01df0829f054 |
files | pidgin/pixmaps/protocols/16/facebook.png pidgin/pixmaps/protocols/22/facebook.png pidgin/pixmaps/protocols/48/facebook.png pidgin/pixmaps/status/48/rtl/login.png pidgin/pixmaps/status/48/rtl/logout.png |
diffstat | 3 files changed, 84 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/media.c Sat Dec 06 02:23:20 2008 +0000 +++ b/libpurple/media.c Sat Dec 13 08:49:16 2008 +0000 @@ -451,6 +451,25 @@ return NULL; } +static GList * +purple_media_get_streams(PurpleMedia *media, const gchar *session, + const gchar *participant) +{ + GList *streams = media->priv->streams; + GList *ret = NULL; + + for (; streams; streams = g_list_next(streams)) { + PurpleMediaStream *stream = streams->data; + if ((session == NULL || + !strcmp(stream->session->id, session)) && + (participant == NULL || + !strcmp(stream->participant, participant))) + ret = g_list_append(ret, stream); + } + + return ret; +} + static void purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session) { @@ -1175,7 +1194,7 @@ gchar *stun_ip = NULL; FsStream *fsstream = NULL; - if (stun_ip = purple_media_get_stun_pref_ip()) { + if ((stun_ip = purple_media_get_stun_pref_ip())) { GParameter *param = g_new0(GParameter, num_params+1); memcpy(param, params, sizeof(GParameter) * num_params); @@ -1378,4 +1397,46 @@ } } +void purple_media_set_input_volume(PurpleMedia *media, + const gchar *session_id, double level) +{ + GList *sessions; + + if (session_id == NULL) + sessions = g_hash_table_get_values(media->priv->sessions); + else + sessions = g_list_append(NULL, + purple_media_get_session(media, session_id)); + + for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { + PurpleMediaSession *session = sessions->data; + + if (session->type & PURPLE_MEDIA_SEND_AUDIO) { + GstElement *volume = gst_bin_get_by_name( + GST_BIN(session->src), + "purpleaudioinputvolume"); + g_object_set(volume, "volume", level, NULL); + } + } +} + +void purple_media_set_output_volume(PurpleMedia *media, + const gchar *session_id, const gchar *participant, + double level) +{ + GList *streams = purple_media_get_streams(media, + session_id, participant); + + for (; streams; streams = g_list_delete_link(streams, streams)) { + PurpleMediaStream *stream = streams->data; + + if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO) { + GstElement *volume = gst_bin_get_by_name( + GST_BIN(stream->session->sink), + "purpleaudiooutputvolume"); + g_object_set(volume, "volume", level, NULL); + } + } +} + #endif /* USE_VV */
--- a/libpurple/media.h Sat Dec 06 02:23:20 2008 +0000 +++ b/libpurple/media.h Sat Dec 13 08:49:16 2008 +0000 @@ -479,6 +479,26 @@ */ void purple_media_mute(PurpleMedia *media, gboolean active); +/** + * Sets the input volume of all the selected sessions. + * + * @param media The media object the sessions are in. + * @param session_id The session to select (if any). + * @param level The level to set the volume to. + */ +void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, double level); + +/** + * Sets the output volume of all the selected streams. + * + * @param media The media object the streams are in. + * @param session_id The session to limit the streams to (if any). + * @param participant The participant to limit the streams to (if any). + * @param level The level to set the volume to. + */ +void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, + const gchar *participant, double level); + #ifdef __cplusplus } #endif
--- a/pidgin/gtkprefs.c Sat Dec 06 02:23:20 2008 +0000 +++ b/pidgin/gtkprefs.c Sat Dec 13 08:49:16 2008 +0000 @@ -2197,17 +2197,7 @@ val /= 10.0; for (; medias; medias = g_list_next(medias)) { PurpleMedia *media = PURPLE_MEDIA(medias->data); - GList *sessions = purple_media_get_session_names(media); - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - const gchar *session = sessions->data; - if (purple_media_get_session_type(media, session) - & PURPLE_MEDIA_SEND_AUDIO) { - GstElement *volume = gst_bin_get_by_name( - GST_BIN(purple_media_get_src(media, session)), - "purpleaudioinputvolume"); - g_object_set(volume, "volume", val, NULL); - } - } + purple_media_set_input_volume(media, NULL, val); } } @@ -2221,17 +2211,7 @@ val /= 10.0; for (; medias; medias = g_list_next(medias)) { PurpleMedia *media = PURPLE_MEDIA(medias->data); - GList *sessions = purple_media_get_session_names(media); - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - const gchar *session = sessions->data; - if (purple_media_get_session_type(media, session) - & PURPLE_MEDIA_RECV_AUDIO) { - GstElement *volume = gst_bin_get_by_name( - GST_BIN(purple_media_get_sink(media, session)), - "purpleaudiooutputvolume"); - g_object_set(volume, "volume", val, NULL); - } - } + purple_media_set_output_volume(media, NULL, NULL, val); } }