diff options
-rw-r--r-- | libempathy/Makefile.am | 4 | ||||
-rw-r--r-- | libempathy/empathy-call-factory.c | 12 | ||||
-rw-r--r-- | libempathy/empathy-call-factory.h | 2 | ||||
-rw-r--r-- | libempathy/empathy-call-handler.h | 106 | ||||
-rw-r--r-- | libempathy/empathy-streamed-media-handler.c (renamed from libempathy/empathy-call-handler.c) | 210 | ||||
-rw-r--r-- | libempathy/empathy-streamed-media-handler.h | 106 | ||||
-rw-r--r-- | src/empathy-av.c | 2 | ||||
-rw-r--r-- | src/empathy-call-window.c | 60 | ||||
-rw-r--r-- | src/empathy-call-window.h | 4 |
9 files changed, 253 insertions, 253 deletions
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 497d8d99b..025515604 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -29,7 +29,6 @@ libempathy_headers = \ empathy-account-settings.h \ empathy-auth-factory.h \ empathy-call-factory.h \ - empathy-call-handler.h \ empathy-chatroom-manager.h \ empathy-chatroom.h \ empathy-connection-managers.h \ @@ -54,6 +53,7 @@ libempathy_headers = \ empathy-server-sasl-handler.h \ empathy-server-tls-handler.h \ empathy-status-presets.h \ + empathy-streamed-media-handler.h \ empathy-time.h \ empathy-tls-certificate.h \ empathy-tls-verifier.h \ @@ -71,7 +71,6 @@ libempathy_la_SOURCES = \ empathy-account-settings.c \ empathy-auth-factory.c \ empathy-call-factory.c \ - empathy-call-handler.c \ empathy-chatroom-manager.c \ empathy-chatroom.c \ empathy-connection-managers.c \ @@ -94,6 +93,7 @@ libempathy_la_SOURCES = \ empathy-server-sasl-handler.c \ empathy-server-tls-handler.c \ empathy-status-presets.c \ + empathy-streamed-media-handler.c \ empathy-time.c \ empathy-tls-certificate.c \ empathy-tls-verifier.c \ diff --git a/libempathy/empathy-call-factory.c b/libempathy/empathy-call-factory.c index 6e523aada..4ec3e976b 100644 --- a/libempathy/empathy-call-factory.c +++ b/libempathy/empathy-call-factory.c @@ -49,7 +49,7 @@ static void handle_channels_cb (TpSimpleHandler *handler, /* signal enum */ enum { - NEW_CALL_HANDLER, + NEW_STREAMED_MEDIA_HANDLER, LAST_SIGNAL }; @@ -166,14 +166,14 @@ empathy_call_factory_class_init ( object_class->dispose = empathy_call_factory_dispose; object_class->finalize = empathy_call_factory_finalize; - signals[NEW_CALL_HANDLER] = + signals[NEW_STREAMED_MEDIA_HANDLER] = g_signal_new ("new-call-handler", G_TYPE_FROM_CLASS (empathy_call_factory_class), G_SIGNAL_RUN_LAST, 0, NULL, NULL, _empathy_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, - 2, EMPATHY_TYPE_CALL_HANDLER, G_TYPE_BOOLEAN); + 2, EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, G_TYPE_BOOLEAN); } EmpathyCallFactory * @@ -263,13 +263,13 @@ static void create_call_handler (EmpathyCallFactory *factory, EmpathyTpStreamedMedia *call) { - EmpathyCallHandler *handler; + EmpathyStreamedMediaHandler *handler; g_return_if_fail (factory != NULL); - handler = empathy_call_handler_new_for_channel (call); + handler = empathy_streamed_media_handler_new_for_channel (call); - g_signal_emit (factory, signals[NEW_CALL_HANDLER], 0, + g_signal_emit (factory, signals[NEW_STREAMED_MEDIA_HANDLER], 0, handler, FALSE); g_object_unref (handler); diff --git a/libempathy/empathy-call-factory.h b/libempathy/empathy-call-factory.h index 7b160dda4..36c08911b 100644 --- a/libempathy/empathy-call-factory.h +++ b/libempathy/empathy-call-factory.h @@ -23,7 +23,7 @@ #include <glib-object.h> -#include <libempathy/empathy-call-handler.h> +#include <libempathy/empathy-streamed-media-handler.h> #include <libempathy/empathy-dispatcher.h> G_BEGIN_DECLS diff --git a/libempathy/empathy-call-handler.h b/libempathy/empathy-call-handler.h deleted file mode 100644 index 1e0fd7165..000000000 --- a/libempathy/empathy-call-handler.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * empathy-call-handler.h - Header for EmpathyCallHandler - * Copyright (C) 2008-2009 Collabora Ltd. - * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __EMPATHY_CALL_HANDLER_H__ -#define __EMPATHY_CALL_HANDLER_H__ - -#include <glib-object.h> - -#include <gst/gst.h> -#include <gst/farsight/fs-conference-iface.h> - -#include <libempathy/empathy-tp-streamed-media.h> -#include <libempathy/empathy-contact.h> - -G_BEGIN_DECLS - -typedef struct _EmpathyCallHandler EmpathyCallHandler; -typedef struct _EmpathyCallHandlerClass EmpathyCallHandlerClass; - -struct _EmpathyCallHandlerClass { - GObjectClass parent_class; -}; - -struct _EmpathyCallHandler { - GObject parent; - gpointer priv; -}; - -GType empathy_call_handler_get_type (void); - -/* TYPE MACROS */ -#define EMPATHY_TYPE_CALL_HANDLER \ - (empathy_call_handler_get_type ()) -#define EMPATHY_CALL_HANDLER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_CALL_HANDLER, \ - EmpathyCallHandler)) -#define EMPATHY_CALL_HANDLER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_CALL_HANDLER, \ - EmpathyCallHandlerClass)) -#define EMPATHY_IS_CALL_HANDLER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_CALL_HANDLER)) -#define EMPATHY_IS_CALL_HANDLER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_CALL_HANDLER)) -#define EMPATHY_CALL_HANDLER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_CALL_HANDLER, \ - EmpathyCallHandlerClass)) - -EmpathyCallHandler * empathy_call_handler_new_for_contact ( - EmpathyContact *contact); - -EmpathyCallHandler * empathy_call_handler_new_for_channel ( - EmpathyTpStreamedMedia *call); - -void empathy_call_handler_start_call (EmpathyCallHandler *handler, - gint64 timestamp); -void empathy_call_handler_stop_call (EmpathyCallHandler *handler); - -gboolean empathy_call_handler_has_initial_video (EmpathyCallHandler *handler); - -void empathy_call_handler_bus_message (EmpathyCallHandler *handler, - GstBus *bus, GstMessage *message); - -FsCodec * empathy_call_handler_get_send_audio_codec ( - EmpathyCallHandler *self); - -FsCodec * empathy_call_handler_get_send_video_codec ( - EmpathyCallHandler *self); - -GList * empathy_call_handler_get_recv_audio_codecs ( - EmpathyCallHandler *self); - -GList * empathy_call_handler_get_recv_video_codecs ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_audio_remote_candidate ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_audio_local_candidate ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_video_remote_candidate ( - EmpathyCallHandler *self); - -FsCandidate * empathy_call_handler_get_video_local_candidate ( - EmpathyCallHandler *self); - -G_END_DECLS - -#endif /* #ifndef __EMPATHY_CALL_HANDLER_H__*/ diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-streamed-media-handler.c index c3ce5fed4..7fa49cde7 100644 --- a/libempathy/empathy-call-handler.c +++ b/libempathy/empathy-streamed-media-handler.c @@ -1,5 +1,5 @@ /* - * empathy-call-handler.c - Source for EmpathyCallHandler + * empathy-call-handler.c - Source for EmpathyStreamedMediaHandler * Copyright (C) 2008-2009 Collabora Ltd. * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> * @@ -29,7 +29,7 @@ #include <telepathy-farsight/channel.h> #include <telepathy-farsight/stream.h> -#include "empathy-call-handler.h" +#include "empathy-streamed-media-handler.h" #include "empathy-call-factory.h" #include "empathy-marshal.h" #include "empathy-utils.h" @@ -37,7 +37,7 @@ #define DEBUG_FLAG EMPATHY_DEBUG_VOIP #include <libempathy/empathy-debug.h> -G_DEFINE_TYPE(EmpathyCallHandler, empathy_call_handler, G_TYPE_OBJECT) +G_DEFINE_TYPE(EmpathyStreamedMediaHandler, empathy_streamed_media_handler, G_TYPE_OBJECT) /* signal enum */ enum { @@ -87,14 +87,14 @@ typedef struct { FsCandidate *video_remote_candidate; FsCandidate *audio_local_candidate; FsCandidate *video_local_candidate; -} EmpathyCallHandlerPriv; +} EmpathyStreamedMediaHandlerPriv; -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallHandler) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyStreamedMediaHandler) static void -empathy_call_handler_dispose (GObject *object) +empathy_streamed_media_handler_dispose (GObject *object) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); if (priv->dispose_has_run) return; @@ -120,14 +120,14 @@ empathy_call_handler_dispose (GObject *object) priv->call = NULL; /* release any references held by the object here */ - if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose) - G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose (object); + if (G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->dispose) + G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->dispose (object); } static void -empathy_call_handler_finalize (GObject *object) +empathy_streamed_media_handler_finalize (GObject *object) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); fs_codec_destroy (priv->send_audio_codec); fs_codec_destroy (priv->send_video_codec); @@ -138,23 +138,23 @@ empathy_call_handler_finalize (GObject *object) fs_candidate_destroy (priv->audio_local_candidate); fs_candidate_destroy (priv->video_local_candidate); - if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize) - G_OBJECT_CLASS (empathy_call_handler_parent_class)->finalize (object); + if (G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->finalize) + G_OBJECT_CLASS (empathy_streamed_media_handler_parent_class)->finalize (object); } static void -empathy_call_handler_init (EmpathyCallHandler *obj) +empathy_streamed_media_handler_init (EmpathyStreamedMediaHandler *obj) { - EmpathyCallHandlerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, - EMPATHY_TYPE_CALL_HANDLER, EmpathyCallHandlerPriv); + EmpathyStreamedMediaHandlerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, + EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, EmpathyStreamedMediaHandlerPriv); obj->priv = priv; } static void -empathy_call_handler_constructed (GObject *object) +empathy_streamed_media_handler_constructed (GObject *object) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); if (priv->contact == NULL) { @@ -163,10 +163,10 @@ empathy_call_handler_constructed (GObject *object) } static void -empathy_call_handler_set_property (GObject *object, +empathy_streamed_media_handler_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); switch (property_id) { @@ -188,10 +188,10 @@ empathy_call_handler_set_property (GObject *object, } static void -empathy_call_handler_get_property (GObject *object, +empathy_streamed_media_handler_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - EmpathyCallHandlerPriv *priv = GET_PRIV (object); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (object); switch (property_id) { @@ -238,18 +238,18 @@ empathy_call_handler_get_property (GObject *object, static void -empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) +empathy_streamed_media_handler_class_init (EmpathyStreamedMediaHandlerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *param_spec; - g_type_class_add_private (klass, sizeof (EmpathyCallHandlerPriv)); + g_type_class_add_private (klass, sizeof (EmpathyStreamedMediaHandlerPriv)); - object_class->constructed = empathy_call_handler_constructed; - object_class->set_property = empathy_call_handler_set_property; - object_class->get_property = empathy_call_handler_get_property; - object_class->dispose = empathy_call_handler_dispose; - object_class->finalize = empathy_call_handler_finalize; + object_class->constructed = empathy_streamed_media_handler_constructed; + object_class->set_property = empathy_streamed_media_handler_set_property; + object_class->get_property = empathy_streamed_media_handler_get_property; + object_class->dispose = empathy_streamed_media_handler_dispose; + object_class->finalize = empathy_streamed_media_handler_finalize; param_spec = g_param_spec_object ("contact", "contact", "The remote contact", @@ -386,35 +386,35 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) } /** - * empathy_call_handler_new_for_contact: + * empathy_streamed_media_handler_new_for_contact: * @contact: an #EmpathyContact * - * Creates a new #EmpathyCallHandler with contact @contact. + * Creates a new #EmpathyStreamedMediaHandler with contact @contact. * - * Return value: a new #EmpathyCallHandler + * Return value: a new #EmpathyStreamedMediaHandler */ -EmpathyCallHandler * -empathy_call_handler_new_for_contact (EmpathyContact *contact) +EmpathyStreamedMediaHandler * +empathy_streamed_media_handler_new_for_contact (EmpathyContact *contact) { - return EMPATHY_CALL_HANDLER (g_object_new (EMPATHY_TYPE_CALL_HANDLER, + return EMPATHY_STREAMED_MEDIA_HANDLER (g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, "contact", contact, NULL)); } -EmpathyCallHandler * -empathy_call_handler_new_for_channel (EmpathyTpStreamedMedia *call) +EmpathyStreamedMediaHandler * +empathy_streamed_media_handler_new_for_channel (EmpathyTpStreamedMedia *call) { - return EMPATHY_CALL_HANDLER (g_object_new (EMPATHY_TYPE_CALL_HANDLER, + return EMPATHY_STREAMED_MEDIA_HANDLER (g_object_new (EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, "tp-call", call, "initial-video", empathy_tp_streamed_media_is_receiving_video (call), NULL)); } static void -update_sending_codec (EmpathyCallHandler *self, +update_sending_codec (EmpathyStreamedMediaHandler *self, FsCodec *codec, FsSession *session) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); FsMediaType type; if (codec == NULL || session == NULL) @@ -435,11 +435,11 @@ update_sending_codec (EmpathyCallHandler *self, } static void -update_receiving_codec (EmpathyCallHandler *self, +update_receiving_codec (EmpathyStreamedMediaHandler *self, GList *codecs, FsStream *stream) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); FsSession *session; FsMediaType type; @@ -467,12 +467,12 @@ update_receiving_codec (EmpathyCallHandler *self, } static void -update_candidates (EmpathyCallHandler *self, +update_candidates (EmpathyStreamedMediaHandler *self, FsCandidate *remote_candidate, FsCandidate *local_candidate, FsStream *stream) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); FsSession *session; FsMediaType type; @@ -528,10 +528,10 @@ update_candidates (EmpathyCallHandler *self, } void -empathy_call_handler_bus_message (EmpathyCallHandler *handler, +empathy_streamed_media_handler_bus_message (EmpathyStreamedMediaHandler *handler, GstBus *bus, GstMessage *message) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); const GstStructure *s = gst_message_get_structure (message); if (priv->tfchannel == NULL) @@ -590,9 +590,9 @@ empathy_call_handler_bus_message (EmpathyCallHandler *handler, } static void -empathy_call_handler_tf_channel_session_created_cb (TfChannel *tfchannel, +empathy_streamed_media_handler_tf_channel_session_created_cb (TfChannel *tfchannel, FsConference *conference, FsParticipant *participant, - EmpathyCallHandler *self) + EmpathyStreamedMediaHandler *self) { g_signal_emit (G_OBJECT (self), signals[CONFERENCE_ADDED], 0, GST_ELEMENT (conference)); @@ -611,8 +611,8 @@ src_pad_added_error_idle (gpointer data) } static void -empathy_call_handler_tf_stream_src_pad_added_cb (TfStream *stream, - GstPad *pad, FsCodec *codec, EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_stream_src_pad_added_cb (TfStream *stream, + GstPad *pad, FsCodec *codec, EmpathyStreamedMediaHandler *handler) { guint media_type; gboolean retval; @@ -628,7 +628,7 @@ empathy_call_handler_tf_stream_src_pad_added_cb (TfStream *stream, static gboolean -empathy_call_handler_tf_stream_request_resource_cb (TfStream *stream, +empathy_streamed_media_handler_tf_stream_request_resource_cb (TfStream *stream, guint direction, EmpathyTpStreamedMedia *call) { gboolean ret; @@ -643,15 +643,15 @@ empathy_call_handler_tf_stream_request_resource_cb (TfStream *stream, } static void -empathy_call_handler_tf_stream_closed_cb (TfStream *stream, - EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_stream_closed_cb (TfStream *stream, + EmpathyStreamedMediaHandler *handler) { g_signal_emit (handler, signals[STREAM_CLOSED], 0, stream); } static void -empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, - TfStream *stream, EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, + TfStream *stream, EmpathyStreamedMediaHandler *handler) { guint media_type; GstPad *spad; @@ -662,12 +662,12 @@ empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, FsCodec *codec; g_signal_connect (stream, "src-pad-added", - G_CALLBACK (empathy_call_handler_tf_stream_src_pad_added_cb), handler); + G_CALLBACK (empathy_streamed_media_handler_tf_stream_src_pad_added_cb), handler); g_signal_connect (stream, "request-resource", - G_CALLBACK (empathy_call_handler_tf_stream_request_resource_cb), + G_CALLBACK (empathy_streamed_media_handler_tf_stream_request_resource_cb), handler); g_signal_connect (stream, "closed", - G_CALLBACK (empathy_call_handler_tf_stream_closed_cb), handler); + G_CALLBACK (empathy_streamed_media_handler_tf_stream_closed_cb), handler); g_object_get (stream, "media-type", &media_type, "sink-pad", &spad, NULL); @@ -701,14 +701,14 @@ empathy_call_handler_tf_channel_stream_created_cb (TfChannel *tfchannel, } static void -empathy_call_handler_tf_channel_closed_cb (TfChannel *tfchannel, - EmpathyCallHandler *handler) +empathy_streamed_media_handler_tf_channel_closed_cb (TfChannel *tfchannel, + EmpathyStreamedMediaHandler *handler) { g_signal_emit (G_OBJECT (handler), signals[CLOSED], 0); } static GList * -empathy_call_handler_tf_channel_codec_config_cb (TfChannel *channel, +empathy_streamed_media_handler_tf_channel_codec_config_cb (TfChannel *channel, guint stream_id, FsMediaType media_type, guint direction, gpointer user_data) { gchar *filename = empathy_file_lookup ("codec-preferences", "data"); @@ -729,9 +729,9 @@ empathy_call_handler_tf_channel_codec_config_cb (TfChannel *channel, } static void -empathy_call_handler_start_tpfs (EmpathyCallHandler *self) +empathy_streamed_media_handler_start_tpfs (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); TpChannel *channel; g_object_get (priv->call, "channel", &channel, NULL); @@ -742,24 +742,24 @@ empathy_call_handler_start_tpfs (EmpathyCallHandler *self) /* Set up the telepathy farsight channel */ g_signal_connect (priv->tfchannel, "session-created", - G_CALLBACK (empathy_call_handler_tf_channel_session_created_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_session_created_cb), self); g_signal_connect (priv->tfchannel, "stream-created", - G_CALLBACK (empathy_call_handler_tf_channel_stream_created_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_stream_created_cb), self); g_signal_connect (priv->tfchannel, "closed", - G_CALLBACK (empathy_call_handler_tf_channel_closed_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_closed_cb), self); g_signal_connect (priv->tfchannel, "stream-get-codec-config", - G_CALLBACK (empathy_call_handler_tf_channel_codec_config_cb), self); + G_CALLBACK (empathy_streamed_media_handler_tf_channel_codec_config_cb), self); g_object_unref (channel); } static void -empathy_call_handler_request_cb (GObject *source, +empathy_streamed_media_handler_request_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyCallHandler *self = EMPATHY_CALL_HANDLER (user_data); - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandler *self = EMPATHY_STREAMED_MEDIA_HANDLER (user_data); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); TpChannel *channel; GError *error = NULL; TpAccountChannelRequest *req = TP_ACCOUNT_CHANNEL_REQUEST (source); @@ -780,23 +780,23 @@ empathy_call_handler_request_cb (GObject *source, g_object_notify (G_OBJECT (self), "tp-call"); - empathy_call_handler_start_tpfs (self); + empathy_streamed_media_handler_start_tpfs (self); g_object_unref (channel); } void -empathy_call_handler_start_call (EmpathyCallHandler *handler, +empathy_streamed_media_handler_start_call (EmpathyStreamedMediaHandler *handler, gint64 timestamp) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); TpAccountChannelRequest *req; TpAccount *account; GHashTable *request; if (priv->call != NULL) { - empathy_call_handler_start_tpfs (handler); + empathy_streamed_media_handler_start_tpfs (handler); empathy_tp_streamed_media_accept_incoming_call (priv->call); return; } @@ -812,22 +812,22 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler, req = tp_account_channel_request_new (account, request, timestamp); tp_account_channel_request_create_and_handle_channel_async (req, NULL, - empathy_call_handler_request_cb, handler); + empathy_streamed_media_handler_request_cb, handler); g_object_unref (req); g_hash_table_unref (request); } /** - * empathy_call_handler_stop_call: - * @handler: an #EmpathyCallHandler + * empathy_streamed_media_handler_stop_call: + * @handler: an #EmpathyStreamedMediaHandler * - * Closes the #EmpathyCallHandler's call and frees its resources. + * Closes the #EmpathyStreamedMediaHandler's call and frees its resources. */ void -empathy_call_handler_stop_call (EmpathyCallHandler *handler) +empathy_streamed_media_handler_stop_call (EmpathyStreamedMediaHandler *handler) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); if (priv->call != NULL) { @@ -839,86 +839,86 @@ empathy_call_handler_stop_call (EmpathyCallHandler *handler) } /** - * empathy_call_handler_has_initial_video: - * @handler: an #EmpathyCallHandler + * empathy_streamed_media_handler_has_initial_video: + * @handler: an #EmpathyStreamedMediaHandler * - * Return %TRUE if the call managed by this #EmpathyCallHandler was + * Return %TRUE if the call managed by this #EmpathyStreamedMediaHandler was * created with video enabled * * Return value: %TRUE if the call was created as a video conversation. */ gboolean -empathy_call_handler_has_initial_video (EmpathyCallHandler *handler) +empathy_streamed_media_handler_has_initial_video (EmpathyStreamedMediaHandler *handler) { - EmpathyCallHandlerPriv *priv = GET_PRIV (handler); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (handler); return priv->initial_video; } FsCodec * -empathy_call_handler_get_send_audio_codec (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_send_audio_codec (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->send_audio_codec; } FsCodec * -empathy_call_handler_get_send_video_codec (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_send_video_codec (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->send_video_codec; } GList * -empathy_call_handler_get_recv_audio_codecs (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_recv_audio_codecs (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->recv_audio_codecs; } GList * -empathy_call_handler_get_recv_video_codecs (EmpathyCallHandler *self) +empathy_streamed_media_handler_get_recv_video_codecs (EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->recv_video_codecs; } FsCandidate * -empathy_call_handler_get_audio_remote_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_audio_remote_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->audio_remote_candidate; } FsCandidate * -empathy_call_handler_get_audio_local_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_audio_local_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->audio_local_candidate; } FsCandidate * -empathy_call_handler_get_video_remote_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_video_remote_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->video_remote_candidate; } FsCandidate * -empathy_call_handler_get_video_local_candidate ( - EmpathyCallHandler *self) +empathy_streamed_media_handler_get_video_local_candidate ( + EmpathyStreamedMediaHandler *self) { - EmpathyCallHandlerPriv *priv = GET_PRIV (self); + EmpathyStreamedMediaHandlerPriv *priv = GET_PRIV (self); return priv->video_local_candidate; } diff --git a/libempathy/empathy-streamed-media-handler.h b/libempathy/empathy-streamed-media-handler.h new file mode 100644 index 000000000..b6d7049c2 --- /dev/null +++ b/libempathy/empathy-streamed-media-handler.h @@ -0,0 +1,106 @@ +/* + * empathy-call-handler.h - Header for EmpathyStreamedMediaHandler + * Copyright (C) 2008-2009 Collabora Ltd. + * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __EMPATHY_STREAMED_MEDIA_HANDLER_H__ +#define __EMPATHY_STREAMED_MEDIA_HANDLER_H__ + +#include <glib-object.h> + +#include <gst/gst.h> +#include <gst/farsight/fs-conference-iface.h> + +#include <libempathy/empathy-tp-streamed-media.h> +#include <libempathy/empathy-contact.h> + +G_BEGIN_DECLS + +typedef struct _EmpathyStreamedMediaHandler EmpathyStreamedMediaHandler; +typedef struct _EmpathyStreamedMediaHandlerClass EmpathyStreamedMediaHandlerClass; + +struct _EmpathyStreamedMediaHandlerClass { + GObjectClass parent_class; +}; + +struct _EmpathyStreamedMediaHandler { + GObject parent; + gpointer priv; +}; + +GType empathy_streamed_media_handler_get_type (void); + +/* TYPE MACROS */ +#define EMPATHY_TYPE_STREAMED_MEDIA_HANDLER \ + (empathy_streamed_media_handler_get_type ()) +#define EMPATHY_STREAMED_MEDIA_HANDLER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, \ + EmpathyStreamedMediaHandler)) +#define EMPATHY_STREAMED_MEDIA_HANDLER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, \ + EmpathyStreamedMediaHandlerClass)) +#define EMPATHY_IS_STREAMED_MEDIA_HANDLER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER)) +#define EMPATHY_IS_STREAMED_MEDIA_HANDLER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER)) +#define EMPATHY_STREAMED_MEDIA_HANDLER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, \ + EmpathyStreamedMediaHandlerClass)) + +EmpathyStreamedMediaHandler * empathy_streamed_media_handler_new_for_contact ( + EmpathyContact *contact); + +EmpathyStreamedMediaHandler * empathy_streamed_media_handler_new_for_channel ( + EmpathyTpStreamedMedia *call); + +void empathy_streamed_media_handler_start_call (EmpathyStreamedMediaHandler *handler, + gint64 timestamp); +void empathy_streamed_media_handler_stop_call (EmpathyStreamedMediaHandler *handler); + +gboolean empathy_streamed_media_handler_has_initial_video (EmpathyStreamedMediaHandler *handler); + +void empathy_streamed_media_handler_bus_message (EmpathyStreamedMediaHandler *handler, + GstBus *bus, GstMessage *message); + +FsCodec * empathy_streamed_media_handler_get_send_audio_codec ( + EmpathyStreamedMediaHandler *self); + +FsCodec * empathy_streamed_media_handler_get_send_video_codec ( + EmpathyStreamedMediaHandler *self); + +GList * empathy_streamed_media_handler_get_recv_audio_codecs ( + EmpathyStreamedMediaHandler *self); + +GList * empathy_streamed_media_handler_get_recv_video_codecs ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_audio_remote_candidate ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_audio_local_candidate ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_video_remote_candidate ( + EmpathyStreamedMediaHandler *self); + +FsCandidate * empathy_streamed_media_handler_get_video_local_candidate ( + EmpathyStreamedMediaHandler *self); + +G_END_DECLS + +#endif /* #ifndef __EMPATHY_STREAMED_MEDIA_HANDLER_H__*/ diff --git a/src/empathy-av.c b/src/empathy-av.c index 2313b22fc..e93382d34 100644 --- a/src/empathy-av.c +++ b/src/empathy-av.c @@ -51,7 +51,7 @@ static EmpathyCallFactory *call_factory = NULL; static void new_call_handler_cb (EmpathyCallFactory *factory, - EmpathyCallHandler *handler, + EmpathyStreamedMediaHandler *handler, gboolean outgoing, gpointer user_data) { diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 2b9c48ce0..ddfebeafd 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -89,7 +89,7 @@ static guint signals[LAST_SIGNAL] = {0}; #endif enum { - PROP_CALL_HANDLER = 1, + PROP_STREAMED_MEDIA_HANDLER = 1, }; typedef enum { @@ -111,7 +111,7 @@ typedef struct _EmpathyCallWindowPriv EmpathyCallWindowPriv; struct _EmpathyCallWindowPriv { gboolean dispose_has_run; - EmpathyCallHandler *handler; + EmpathyStreamedMediaHandler *handler; EmpathyContact *contact; guint call_state; @@ -1315,7 +1315,7 @@ empathy_call_window_got_self_contact_cb (TpConnection *connection, static void empathy_call_window_setup_avatars (EmpathyCallWindow *self, - EmpathyCallHandler *handler) + EmpathyStreamedMediaHandler *handler) { EmpathyCallWindowPriv *priv = GET_PRIV (self); @@ -1375,12 +1375,12 @@ update_send_codec (EmpathyCallWindow *self, if (audio) { - codec = empathy_call_handler_get_send_audio_codec (priv->handler); + codec = empathy_streamed_media_handler_get_send_audio_codec (priv->handler); widget = priv->acodec_encoding_label; } else { - codec = empathy_call_handler_get_send_video_codec (priv->handler); + codec = empathy_streamed_media_handler_get_send_video_codec (priv->handler); widget = priv->vcodec_encoding_label; } @@ -1423,12 +1423,12 @@ update_recv_codec (EmpathyCallWindow *self, if (audio) { - codecs = empathy_call_handler_get_recv_audio_codecs (priv->handler); + codecs = empathy_streamed_media_handler_get_recv_audio_codecs (priv->handler); widget = priv->acodec_decoding_label; } else { - codecs = empathy_call_handler_get_recv_video_codecs (priv->handler); + codecs = empathy_streamed_media_handler_get_recv_video_codecs (priv->handler); widget = priv->vcodec_decoding_label; } @@ -1541,14 +1541,14 @@ candidates_changed_cb (GObject *object, if (type == FS_MEDIA_TYPE_VIDEO) { /* Update remote candidate */ - candidate = empathy_call_handler_get_video_remote_candidate ( + candidate = empathy_streamed_media_handler_get_video_remote_candidate ( priv->handler); update_candidat_widget (self, priv->video_remote_candidate_label, priv->video_remote_candidate_info_img, candidate); /* Update local candidate */ - candidate = empathy_call_handler_get_video_local_candidate ( + candidate = empathy_streamed_media_handler_get_video_local_candidate ( priv->handler); update_candidat_widget (self, priv->video_local_candidate_label, @@ -1557,14 +1557,14 @@ candidates_changed_cb (GObject *object, else { /* Update remote candidate */ - candidate = empathy_call_handler_get_audio_remote_candidate ( + candidate = empathy_streamed_media_handler_get_audio_remote_candidate ( priv->handler); update_candidat_widget (self, priv->audio_remote_candidate_label, priv->audio_remote_candidate_info_img, candidate); /* Update local candidate */ - candidate = empathy_call_handler_get_audio_local_candidate ( + candidate = empathy_streamed_media_handler_get_audio_local_candidate ( priv->handler); update_candidat_widget (self, priv->audio_local_candidate_label, @@ -1589,7 +1589,7 @@ empathy_call_window_constructed (GObject *object) empathy_call_window_setup_avatars (self, priv->handler); empathy_call_window_set_state_connecting (self); - if (!empathy_call_handler_has_initial_video (priv->handler)) + if (!empathy_streamed_media_handler_has_initial_video (priv->handler)) { gtk_toggle_tool_button_set_active ( GTK_TOGGLE_TOOL_BUTTON (priv->tool_button_camera_off), TRUE); @@ -1626,7 +1626,7 @@ empathy_call_window_set_property (GObject *object, switch (property_id) { - case PROP_CALL_HANDLER: + case PROP_STREAMED_MEDIA_HANDLER: priv->handler = g_value_dup_object (value); break; default: @@ -1642,7 +1642,7 @@ empathy_call_window_get_property (GObject *object, switch (property_id) { - case PROP_CALL_HANDLER: + case PROP_STREAMED_MEDIA_HANDLER: g_value_set_object (value, priv->handler); break; default: @@ -1669,10 +1669,10 @@ empathy_call_window_class_init ( param_spec = g_param_spec_object ("handler", "handler", "The call handler", - EMPATHY_TYPE_CALL_HANDLER, + EMPATHY_TYPE_STREAMED_MEDIA_HANDLER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, - PROP_CALL_HANDLER, param_spec); + PROP_STREAMED_MEDIA_HANDLER, param_spec); } static void @@ -1704,7 +1704,7 @@ empathy_call_window_dispose (GObject *object) if (priv->handler != NULL) { - empathy_call_handler_stop_call (priv->handler); + empathy_streamed_media_handler_stop_call (priv->handler); g_object_unref (priv->handler); } priv->handler = NULL; @@ -1801,14 +1801,14 @@ empathy_call_window_finalize (GObject *object) EmpathyCallWindow * -empathy_call_window_new (EmpathyCallHandler *handler) +empathy_call_window_new (EmpathyStreamedMediaHandler *handler) { return EMPATHY_CALL_WINDOW ( g_object_new (EMPATHY_TYPE_CALL_WINDOW, "handler", handler, NULL)); } static void -empathy_call_window_conference_added_cb (EmpathyCallHandler *handler, +empathy_call_window_conference_added_cb (EmpathyStreamedMediaHandler *handler, GstElement *conference, gpointer user_data) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); @@ -1820,7 +1820,7 @@ empathy_call_window_conference_added_cb (EmpathyCallHandler *handler, } static gboolean -empathy_call_window_request_resource_cb (EmpathyCallHandler *handler, +empathy_call_window_request_resource_cb (EmpathyStreamedMediaHandler *handler, FsMediaType type, FsStreamDirection direction, gpointer user_data) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); @@ -1992,7 +1992,7 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, static void -empathy_call_window_channel_closed_cb (EmpathyCallHandler *handler, +empathy_call_window_channel_closed_cb (EmpathyStreamedMediaHandler *handler, gpointer user_data) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); @@ -2005,7 +2005,7 @@ empathy_call_window_channel_closed_cb (EmpathyCallHandler *handler, static void -empathy_call_window_channel_stream_closed_cb (EmpathyCallHandler *handler, +empathy_call_window_channel_stream_closed_cb (EmpathyStreamedMediaHandler *handler, TfStream *stream, gpointer user_data) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); @@ -2514,7 +2514,7 @@ empathy_call_window_connected (gpointer user_data) /* Called from the streaming thread */ static gboolean -empathy_call_window_src_added_cb (EmpathyCallHandler *handler, +empathy_call_window_src_added_cb (EmpathyStreamedMediaHandler *handler, GstPad *src, guint media_type, gpointer user_data) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); @@ -2595,7 +2595,7 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler, } static gboolean -empathy_call_window_sink_added_cb (EmpathyCallHandler *handler, +empathy_call_window_sink_added_cb (EmpathyStreamedMediaHandler *handler, GstPad *sink, guint media_type, gpointer user_data) { EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); @@ -2698,10 +2698,10 @@ start_call (EmpathyCallWindow *self) EmpathyCallWindowPriv *priv = GET_PRIV (self); priv->call_started = TRUE; - empathy_call_handler_start_call (priv->handler, + empathy_streamed_media_handler_start_call (priv->handler, gtk_get_current_event_time ()); - if (empathy_call_handler_has_initial_video (priv->handler)) + if (empathy_streamed_media_handler_has_initial_video (priv->handler)) { /* Enable 'send video' buttons and display the preview */ gtk_toggle_tool_button_set_active ( @@ -2717,7 +2717,7 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, EmpathyCallWindowPriv *priv = GET_PRIV (self); GstState newstate; - empathy_call_handler_bus_message (priv->handler, bus, message); + empathy_streamed_media_handler_bus_message (priv->handler, bus, message); switch (GST_MESSAGE_TYPE (message)) { @@ -2813,7 +2813,7 @@ empathy_call_window_update_avatars_visibility (EmpathyTpStreamedMedia *call, } static void -call_handler_notify_tp_streamed_media_cb (EmpathyCallHandler *handler, +call_handler_notify_tp_streamed_media_cb (EmpathyStreamedMediaHandler *handler, GParamSpec *spec, EmpathyCallWindow *self) { @@ -3124,7 +3124,7 @@ empathy_call_window_hangup_cb (gpointer object, { EmpathyCallWindowPriv *priv = GET_PRIV (window); - empathy_call_handler_stop_call (priv->handler); + empathy_streamed_media_handler_stop_call (priv->handler); if (empathy_call_window_disconnected (window, FALSE)) gtk_widget_destroy (GTK_WIDGET (window)); @@ -3174,7 +3174,7 @@ empathy_call_window_redial_cb (gpointer object, if (priv->call_state == CONNECTED) priv->call_state = REDIALING; - empathy_call_handler_stop_call (priv->handler); + empathy_streamed_media_handler_stop_call (priv->handler); if (priv->call_state != CONNECTED) empathy_call_window_restart_call (window); diff --git a/src/empathy-call-window.h b/src/empathy-call-window.h index 01ea5def7..e6a59c24c 100644 --- a/src/empathy-call-window.h +++ b/src/empathy-call-window.h @@ -23,7 +23,7 @@ #include <glib-object.h> #include <gtk/gtk.h> -#include <libempathy/empathy-call-handler.h> +#include <libempathy/empathy-streamed-media-handler.h> G_BEGIN_DECLS @@ -57,7 +57,7 @@ GType empathy_call_window_get_type (void); (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_CALL_WINDOW, \ EmpathyCallWindowClass)) -EmpathyCallWindow *empathy_call_window_new (EmpathyCallHandler *handler); +EmpathyCallWindow *empathy_call_window_new (EmpathyStreamedMediaHandler *handler); G_END_DECLS |