[farsight2/master] Indent fs-msn-stream properly
Olivier Crête
olivier.crete at collabora.co.uk
Tue Jul 14 09:50:30 PDT 2009
---
gst/fsmsnconference/fs-msn-stream.c | 1217 +++++++++++++++++------------------
gst/fsmsnconference/fs-msn-stream.h | 25 +-
2 files changed, 614 insertions(+), 628 deletions(-)
diff --git a/gst/fsmsnconference/fs-msn-stream.c b/gst/fsmsnconference/fs-msn-stream.c
index 0e7df8c..e73729f 100644
--- a/gst/fsmsnconference/fs-msn-stream.c
+++ b/gst/fsmsnconference/fs-msn-stream.c
@@ -26,7 +26,6 @@
* SECTION:fs-msn-stream
* @short_description: A MSN stream in a #FsMsnSession in a #FsMsnConference
*
-
*/
#ifdef HAVE_CONFIG_H
@@ -67,28 +66,28 @@ enum
};
struct _FsMsnStreamPrivate
- {
- FsMsnSession *session;
- FsMsnParticipant *participant;
- FsStreamDirection direction;
- GArray *fdlist;
- FsMsnConference *conference;
- GstElement *media_fd_src,*media_fd_sink,*send_valve;
- GstPad *sink_pad,*src_pad;
- guint in_watch, out_watch, main_watch;
- gint local_recipientid, local_sessionid;
- gint remote_recipientid, remote_sessionid;
- gint port;
- GIOChannel *connection;
+{
+ FsMsnSession *session;
+ FsMsnParticipant *participant;
+ FsStreamDirection direction;
+ GArray *fdlist;
+ FsMsnConference *conference;
+ GstElement *media_fd_src,*media_fd_sink,*send_valve;
+ GstPad *sink_pad,*src_pad;
+ guint in_watch, out_watch, main_watch;
+ gint local_recipientid, local_sessionid;
+ gint remote_recipientid, remote_sessionid;
+ gint port;
+ GIOChannel *connection;
- /* Protected by the session mutex */
+ /* Protected by the session mutex */
- GError *construction_error;
+ GError *construction_error;
- gboolean disposed;
- };
+ gboolean disposed;
+};
G_DEFINE_TYPE(FsMsnStream, fs_msn_stream, FS_TYPE_STREAM);
@@ -119,8 +118,8 @@ static gboolean fs_msn_stream_set_remote_candidate (FsMsnStream *stream,
GError **error);
static gboolean main_fd_closed_cb (GIOChannel *ch,
- GIOCondition cond,
- gpointer data);
+ GIOCondition cond,
+ gpointer data);
static gboolean successfull_connection_cb (GIOChannel *ch,
GIOCondition cond,
@@ -134,26 +133,7 @@ static gboolean fs_msn_authenticate_outgoing (FsMsnStream *stream,
gint fd);
static void fs_msn_open_listening_port (FsMsnStream *stream,
- guint16 port);
-
-
-/* Needed ?
-static void _local_candidates_prepared (
- FsStreamTransmitter *stream_transmitter,
- gpointer user_data);
-
-static void _new_active_candidate_pair (
- FsStreamTransmitter *stream_transmitter,
- FsCandidate *candidate1,
- FsCandidate *candidate2,
- gpointer user_data);
-
-static void _new_local_candidate (
- FsStreamTransmitter *stream_transmitter,
- FsCandidate *candidate,
- gpointer user_data);
-
-*/
+ guint16 port);
static GObjectClass *parent_class = NULL;
@@ -179,79 +159,77 @@ fs_msn_stream_class_init (FsMsnStreamClass *klass)
g_type_class_add_private (klass, sizeof (FsMsnStreamPrivate));
g_object_class_override_property (gobject_class,
- PROP_DIRECTION,
- "direction");
+ PROP_DIRECTION,
+ "direction");
g_object_class_override_property (gobject_class,
- PROP_PARTICIPANT,
- "participant");
+ PROP_PARTICIPANT,
+ "participant");
g_object_class_override_property (gobject_class,
- PROP_SESSION,
- "session");
+ PROP_SESSION,
+ "session");
g_object_class_install_property (gobject_class,
- PROP_SINK_PAD,
- g_param_spec_object ("sink-pad",
- "A gstreamer sink pad for this stream",
- "A pad used for sending data on this stream",
- GST_TYPE_PAD,
- G_PARAM_READABLE));
+ PROP_SINK_PAD,
+ g_param_spec_object ("sink-pad",
+ "A gstreamer sink pad for this stream",
+ "A pad used for sending data on this stream",
+ GST_TYPE_PAD,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
- PROP_SRC_PAD,
- g_param_spec_object ("src-pad",
- "A gstreamer src pad for this stream",
- "A pad used for reading data from this stream",
- GST_TYPE_PAD,
- G_PARAM_READABLE));
+ PROP_SRC_PAD,
+ g_param_spec_object ("src-pad",
+ "A gstreamer src pad for this stream",
+ "A pad used for reading data from this stream",
+ GST_TYPE_PAD,
+ G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
- PROP_CONFERENCE,
- g_param_spec_object ("conference",
- "The Conference this stream refers to",
- "This is a conveniance pointer for the Conference",
- FS_TYPE_MSN_CONFERENCE,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ PROP_CONFERENCE,
+ g_param_spec_object ("conference",
+ "The Conference this stream refers to",
+ "This is a conveniance pointer for the Conference",
+ FS_TYPE_MSN_CONFERENCE,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
- PROP_L_RID,
- g_param_spec_uint ("local-recipientid",
- "The local recipientid used for this stream",
- "The session ID used for this stream",
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ PROP_L_RID,
+ g_param_spec_uint ("local-recipientid",
+ "The local recipientid used for this stream",
+ "The session ID used for this stream",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
- PROP_L_SID,
- g_param_spec_uint ("local-sessionid",
- "The local sessionid used for this stream",
- "The session ID used for this stream",
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ PROP_L_SID,
+ g_param_spec_uint ("local-sessionid",
+ "The local sessionid used for this stream",
+ "The session ID used for this stream",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
- PROP_R_RID,
- g_param_spec_uint ("remote-recipientid",
- "The remote recipientid used for this stream",
- "The session ID used for this stream",
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ PROP_R_RID,
+ g_param_spec_uint ("remote-recipientid",
+ "The remote recipientid used for this stream",
+ "The session ID used for this stream",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
- PROP_R_SID,
- g_param_spec_uint ("remote-sessionid",
- "The remote sessionid used for this stream",
- "The session ID used for this stream",
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ PROP_R_SID,
+ g_param_spec_uint ("remote-sessionid",
+ "The remote sessionid used for this stream",
+ "The session ID used for this stream",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
- PROP_PORT,
- g_param_spec_uint ("local-port",
- "The local port used for this stream",
- "The local port used for this stream",
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
-
-
+ PROP_PORT,
+ g_param_spec_uint ("local-port",
+ "The local port used for this stream",
+ "The local port used for this stream",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
}
static void
@@ -274,25 +252,25 @@ fs_msn_stream_dispose (GObject *object)
FsMsnStream *self = FS_MSN_STREAM (object);
if (self->priv->disposed)
- {
- /* If dispose did already run, return. */
- return;
- }
+ {
+ /* If dispose did already run, return. */
+ return;
+ }
if (self->priv->participant)
- {
- g_object_unref (self->priv->participant);
- self->priv->participant = NULL;
- }
+ {
+ g_object_unref (self->priv->participant);
+ self->priv->participant = NULL;
+ }
/* Make sure dispose does not run twice. */
self->priv->disposed = TRUE;
if (self->priv->session)
- {
- g_object_unref (self->priv->session);
- self->priv->session = NULL;
- }
+ {
+ g_object_unref (self->priv->session);
+ self->priv->session = NULL;
+ }
parent_class->dispose (object);
}
@@ -313,44 +291,44 @@ fs_msn_stream_get_property (GObject *object,
FsMsnStream *self = FS_MSN_STREAM (object);
switch (prop_id)
- {
- case PROP_SESSION:
- g_value_set_object (value, self->priv->session);
- break;
- case PROP_PARTICIPANT:
- g_value_set_object (value, self->priv->participant);
- break;
- case PROP_DIRECTION:
- g_value_set_flags (value, self->priv->direction);
- break;
- case PROP_SINK_PAD:
- g_value_set_object (value, self->priv->sink_pad);
- break;
- case PROP_SRC_PAD:
- g_value_set_object (value, self->priv->src_pad);
- break;
- case PROP_CONFERENCE:
- g_value_set_object (value, self->priv->conference);
- break;
- case PROP_L_RID:
- g_value_set_uint (value, self->priv->local_recipientid);
- break;
- case PROP_L_SID:
- g_value_set_uint (value, self->priv->local_sessionid);
- break;
- case PROP_R_RID:
- g_value_set_uint (value, self->priv->remote_recipientid);
- break;
- case PROP_R_SID:
- g_value_set_uint (value, self->priv->remote_sessionid);
- break;
- case PROP_PORT:
- g_value_set_uint (value, self->priv->port);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ {
+ case PROP_SESSION:
+ g_value_set_object (value, self->priv->session);
+ break;
+ case PROP_PARTICIPANT:
+ g_value_set_object (value, self->priv->participant);
+ break;
+ case PROP_DIRECTION:
+ g_value_set_flags (value, self->priv->direction);
+ break;
+ case PROP_SINK_PAD:
+ g_value_set_object (value, self->priv->sink_pad);
+ break;
+ case PROP_SRC_PAD:
+ g_value_set_object (value, self->priv->src_pad);
+ break;
+ case PROP_CONFERENCE:
+ g_value_set_object (value, self->priv->conference);
+ break;
+ case PROP_L_RID:
+ g_value_set_uint (value, self->priv->local_recipientid);
+ break;
+ case PROP_L_SID:
+ g_value_set_uint (value, self->priv->local_sessionid);
+ break;
+ case PROP_R_RID:
+ g_value_set_uint (value, self->priv->remote_recipientid);
+ break;
+ case PROP_R_SID:
+ g_value_set_uint (value, self->priv->remote_sessionid);
+ break;
+ case PROP_PORT:
+ g_value_set_uint (value, self->priv->port);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
@@ -362,38 +340,38 @@ fs_msn_stream_set_property (GObject *object,
FsMsnStream *self = FS_MSN_STREAM (object);
switch (prop_id)
- {
- case PROP_SESSION:
- self->priv->session = FS_MSN_SESSION (g_value_dup_object (value));
- break;
- case PROP_PARTICIPANT:
- self->priv->participant = FS_MSN_PARTICIPANT (g_value_dup_object (value));
- break;
- case PROP_DIRECTION:
- self->priv->direction = g_value_get_flags (value);
- break;
- case PROP_CONFERENCE:
- self->priv->conference = FS_MSN_CONFERENCE (g_value_dup_object (value));
- break;
- case PROP_L_RID:
- self->priv->local_recipientid = g_value_get_uint (value);
- break;
- case PROP_L_SID:
- self->priv->local_sessionid = g_value_get_uint (value);
- break;
- case PROP_R_RID:
- self->priv->remote_recipientid = g_value_get_uint (value);
- break;
- case PROP_R_SID:
- self->priv->remote_sessionid = g_value_get_uint (value);
- break;
- case PROP_PORT:
- self->priv->port = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ {
+ case PROP_SESSION:
+ self->priv->session = FS_MSN_SESSION (g_value_dup_object (value));
+ break;
+ case PROP_PARTICIPANT:
+ self->priv->participant = FS_MSN_PARTICIPANT (g_value_dup_object (value));
+ break;
+ case PROP_DIRECTION:
+ self->priv->direction = g_value_get_flags (value);
+ break;
+ case PROP_CONFERENCE:
+ self->priv->conference = FS_MSN_CONFERENCE (g_value_dup_object (value));
+ break;
+ case PROP_L_RID:
+ self->priv->local_recipientid = g_value_get_uint (value);
+ break;
+ case PROP_L_SID:
+ self->priv->local_sessionid = g_value_get_uint (value);
+ break;
+ case PROP_R_RID:
+ self->priv->remote_recipientid = g_value_get_uint (value);
+ break;
+ case PROP_R_SID:
+ self->priv->remote_sessionid = g_value_get_uint (value);
+ break;
+ case PROP_PORT:
+ self->priv->port = g_value_get_uint (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
@@ -403,251 +381,251 @@ fs_msn_stream_constructed (GObject *object)
FsMsnStream *self = FS_MSN_STREAM_CAST (object);
if (self->priv->direction == FS_DIRECTION_SEND)
- {
- GstElement *mimenc;
- GstElement *ffmpegcolorspace;
+ {
+ GstElement *mimenc;
+ GstElement *ffmpegcolorspace;
- self->priv->send_valve = gst_element_factory_make ("fsvalve","send_valve");
+ self->priv->send_valve = gst_element_factory_make ("fsvalve","send_valve");
- if (!self->priv->send_valve)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the fsvalve element");
- return;
- }
+ if (!self->priv->send_valve)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the fsvalve element");
+ return;
+ }
- if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->send_valve))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the valve element to the FsRtpConference");
- gst_object_unref (self->priv->send_valve);
- return;
- }
+ if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->send_valve))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the valve element to the FsRtpConference");
+ gst_object_unref (self->priv->send_valve);
+ return;
+ }
- g_object_set (G_OBJECT (self->priv->send_valve), "drop", TRUE, NULL);
+ g_object_set (G_OBJECT (self->priv->send_valve), "drop", TRUE, NULL);
- if (!gst_element_sync_state_with_parent (self->priv->send_valve))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not sync state for valve element");
- return;
- }
+ if (!gst_element_sync_state_with_parent (self->priv->send_valve))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not sync state for valve element");
+ return;
+ }
- ffmpegcolorspace = gst_element_factory_make ("ffmpegcolorspace", "ffmpegcolorspace");
+ ffmpegcolorspace = gst_element_factory_make ("ffmpegcolorspace", "ffmpegcolorspace");
- if (!ffmpegcolorspace)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the ffmpegcolorspace element");
- return;
- }
+ if (!ffmpegcolorspace)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the ffmpegcolorspace element");
+ return;
+ }
- if (!gst_bin_add (GST_BIN (self->priv->conference), ffmpegcolorspace))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the ffmpegcolorspace element to the FsMsnConference");
- gst_object_unref (ffmpegcolorspace);
- return;
- }
+ if (!gst_bin_add (GST_BIN (self->priv->conference), ffmpegcolorspace))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the ffmpegcolorspace element to the FsMsnConference");
+ gst_object_unref (ffmpegcolorspace);
+ return;
+ }
- if (!gst_element_sync_state_with_parent (ffmpegcolorspace))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not sync state for ffmpegcolorspace element");
- return;
- }
+ if (!gst_element_sync_state_with_parent (ffmpegcolorspace))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not sync state for ffmpegcolorspace element");
+ return;
+ }
- self->priv->media_fd_sink = gst_element_factory_make ("fdsink", "send_fd_sink");
+ self->priv->media_fd_sink = gst_element_factory_make ("fdsink", "send_fd_sink");
- if (!self->priv->media_fd_sink)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the media_fd_sink element");
- return;
- }
+ if (!self->priv->media_fd_sink)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the media_fd_sink element");
+ return;
+ }
- if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->media_fd_sink))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the media_fd_sink element to the FsMsnConference");
- gst_object_unref (self->priv->media_fd_sink);
- return;
- }
+ if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->media_fd_sink))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the media_fd_sink element to the FsMsnConference");
+ gst_object_unref (self->priv->media_fd_sink);
+ return;
+ }
- if (!gst_element_set_locked_state(self->priv->media_fd_sink,TRUE))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not lock state of media_fd_sink element");
- return;
- }
+ if (!gst_element_set_locked_state(self->priv->media_fd_sink,TRUE))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not lock state of media_fd_sink element");
+ return;
+ }
- mimenc = gst_element_factory_make ("mimenc", "send_mim_enc");
+ mimenc = gst_element_factory_make ("mimenc", "send_mim_enc");
- if (!mimenc)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the mimenc element");
- return;
- }
+ if (!mimenc)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the mimenc element");
+ return;
+ }
- if (!gst_bin_add (GST_BIN (self->priv->conference), mimenc))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the mimenc element to the FsMsnConference");
- gst_object_unref (mimenc);
- return;
- }
+ if (!gst_bin_add (GST_BIN (self->priv->conference), mimenc))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the mimenc element to the FsMsnConference");
+ gst_object_unref (mimenc);
+ return;
+ }
- if (!gst_element_sync_state_with_parent (mimenc))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not set state for mimenc element");
- return;
- }
+ if (!gst_element_sync_state_with_parent (mimenc))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not set state for mimenc element");
+ return;
+ }
- GstPad *tmp_sink_pad = gst_element_get_static_pad (self->priv->send_valve, "sink");
- self->priv->sink_pad = gst_ghost_pad_new ("sink", tmp_sink_pad);
- gst_pad_set_active(self->priv->sink_pad, TRUE);
+ GstPad *tmp_sink_pad = gst_element_get_static_pad (self->priv->send_valve, "sink");
+ self->priv->sink_pad = gst_ghost_pad_new ("sink", tmp_sink_pad);
+ gst_pad_set_active(self->priv->sink_pad, TRUE);
- gst_element_link_many(self->priv->send_valve,ffmpegcolorspace,mimenc,self->priv->media_fd_sink,NULL);
- }
+ gst_element_link_many(self->priv->send_valve,ffmpegcolorspace,mimenc,self->priv->media_fd_sink,NULL);
+ }
else if (self->priv->direction == FS_DIRECTION_RECV)
- {
-
- GstElement *mimdec;
- GstElement *ffmpegcolorspace;
- GstElement *valve;
+ {
- valve = gst_element_factory_make ("fsvalve","recv_valve");
+ GstElement *mimdec;
+ GstElement *ffmpegcolorspace;
+ GstElement *valve;
- if (!valve)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the fsvalve element");
- return;
- }
+ valve = gst_element_factory_make ("fsvalve","recv_valve");
- if (!gst_bin_add (GST_BIN (self->priv->conference), valve))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the valve element to the FsRtpConference");
- gst_object_unref (valve);
- return;
- }
+ if (!valve)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the fsvalve element");
+ return;
+ }
- g_object_set (G_OBJECT (valve), "drop", FALSE, NULL);
+ if (!gst_bin_add (GST_BIN (self->priv->conference), valve))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the valve element to the FsRtpConference");
+ gst_object_unref (valve);
+ return;
+ }
- if (!gst_element_sync_state_with_parent (valve))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not sync state with parent for valve element");
- return;
- }
+ g_object_set (G_OBJECT (valve), "drop", FALSE, NULL);
- ffmpegcolorspace = gst_element_factory_make ("ffmpegcolorspace", "ffmpegcolorspace");
+ if (!gst_element_sync_state_with_parent (valve))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not sync state with parent for valve element");
+ return;
+ }
- if (!ffmpegcolorspace)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the ffmpegcolorspace element");
- return;
- }
+ ffmpegcolorspace = gst_element_factory_make ("ffmpegcolorspace", "ffmpegcolorspace");
- if (!gst_bin_add (GST_BIN (self->priv->conference), ffmpegcolorspace))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the ffmpegcolorspace element to the FsMsnConference");
- gst_object_unref (ffmpegcolorspace);
- return;
- }
+ if (!ffmpegcolorspace)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the ffmpegcolorspace element");
+ return;
+ }
- if (!gst_element_sync_state_with_parent (ffmpegcolorspace))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not sync state with parent for ffmpegcolorspace element");
- return;
- }
+ if (!gst_bin_add (GST_BIN (self->priv->conference), ffmpegcolorspace))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the ffmpegcolorspace element to the FsMsnConference");
+ gst_object_unref (ffmpegcolorspace);
+ return;
+ }
+ if (!gst_element_sync_state_with_parent (ffmpegcolorspace))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not sync state with parent for ffmpegcolorspace element");
+ return;
+ }
- self->priv->media_fd_src = gst_element_factory_make ("fdsrc", "recv_fd_src");
- if (!self->priv->media_fd_src)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the media_fd_src element");
- return;
- }
+ self->priv->media_fd_src = gst_element_factory_make ("fdsrc", "recv_fd_src");
- g_object_set (G_OBJECT(self->priv->media_fd_src), "blocksize", 512, NULL);
- if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->media_fd_src))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the media_fd_src element to the FsMsnConference");
- gst_object_unref (self->priv->media_fd_src);
- return;
- }
+ if (!self->priv->media_fd_src)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the media_fd_src element");
+ return;
+ }
- if (!gst_element_set_locked_state(self->priv->media_fd_src,TRUE))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not lock state of media_fd_src element");
- return;
- }
+ g_object_set (G_OBJECT(self->priv->media_fd_src), "blocksize", 512, NULL);
+ if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->media_fd_src))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the media_fd_src element to the FsMsnConference");
+ gst_object_unref (self->priv->media_fd_src);
+ return;
+ }
+ if (!gst_element_set_locked_state(self->priv->media_fd_src,TRUE))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not lock state of media_fd_src element");
+ return;
+ }
- mimdec = gst_element_factory_make ("mimdec", "recv_mim_dec");
- if (!mimdec)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not create the mimdec element");
- return;
- }
+ mimdec = gst_element_factory_make ("mimdec", "recv_mim_dec");
- if (!gst_bin_add (GST_BIN (self->priv->conference), mimdec))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not add the mimdec element to the FsMsnConference");
- gst_object_unref (mimdec);
- return;
- }
- if (!gst_element_sync_state_with_parent (mimdec))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION,
- "Could not sync state with parent for mimdec element");
- return;
- }
+ if (!mimdec)
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not create the mimdec element");
+ return;
+ }
- GstPad *tmp_src_pad = gst_element_get_static_pad (valve, "src");
- self->priv->src_pad = gst_ghost_pad_new ("src", tmp_src_pad);
- gst_pad_set_active(self->priv->src_pad, TRUE);
- gst_element_link_many(self->priv->media_fd_src,mimdec,ffmpegcolorspace,valve,NULL);
+ if (!gst_bin_add (GST_BIN (self->priv->conference), mimdec))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not add the mimdec element to the FsMsnConference");
+ gst_object_unref (mimdec);
+ return;
}
+ if (!gst_element_sync_state_with_parent (mimdec))
+ {
+ self->priv->construction_error = g_error_new (FS_ERROR,
+ FS_ERROR_CONSTRUCTION,
+ "Could not sync state with parent for mimdec element");
+ return;
+ }
+
+ GstPad *tmp_src_pad = gst_element_get_static_pad (valve, "src");
+ self->priv->src_pad = gst_ghost_pad_new ("src", tmp_src_pad);
+ gst_pad_set_active(self->priv->src_pad, TRUE);
+ gst_element_link_many(self->priv->media_fd_src,mimdec,ffmpegcolorspace,valve,NULL);
+ }
GST_CALL_PARENT (G_OBJECT_CLASS, constructed, (object));
}
@@ -663,23 +641,23 @@ fs_msn_stream_set_remote_candidates (FsStream *stream, GList *candidates,
GList *item = NULL;
for (item = candidates; item; item = g_list_next (item))
- {
- FsCandidate *candidate = item->data;
+ {
+ FsCandidate *candidate = item->data;
- if (!candidate->ip || !candidate->port)
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "The candidate passed does not contain a valid ip or port");
- return FALSE;
- }
+ if (!candidate->ip || !candidate->port)
+ {
+ g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
+ "The candidate passed does not contain a valid ip or port");
+ return FALSE;
}
+ }
for (item = candidates; item; item = g_list_next (item))
- {
- FsCandidate *candidate = item->data;
- if (!fs_msn_stream_set_remote_candidate (self,candidate,error))
- return FALSE;
- }
+ {
+ FsCandidate *candidate = item->data;
+ if (!fs_msn_stream_set_remote_candidate (self,candidate,error))
+ return FALSE;
+ }
return TRUE;
}
@@ -712,122 +690,124 @@ static gboolean successfull_connection_cb (GIOChannel *ch,
errno = 0;
if (!((cond & G_IO_IN) || (cond & G_IO_OUT)))
- {
- g_message ("Condition received is %d", cond);
- goto error;
- }
+ {
+ g_message ("Condition received is %d", cond);
+ goto error;
+ }
option_len = sizeof(error);
/* Get the error option */
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*) &error, &option_len) < 0)
- {
- g_warning ("getsockopt() failed");
- goto error;
- }
+ {
+ g_warning ("getsockopt() failed");
+ goto error;
+ }
/* Check if there is an error */
if (error)
- {
- g_message ("getsockopt gave an error : %d", error);
- goto error;
- }
+ {
+ g_message ("getsockopt gave an error : %d", error);
+ goto error;
+ }
/* Remove NON BLOCKING MODE */
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK) != 0)
- {
- g_warning ("fcntl() failed");
- goto error;
- }
+ {
+ g_warning ("fcntl() failed");
+ goto error;
+ }
g_message ("Got connection on fd %d", fd);
if (fs_msn_authenticate_outgoing (self,fd))
- {
- g_message ("Authenticated outgoing successfully fd %d", fd);
- self->priv->connection = ch;
-
- // success! we need to shutdown/close all other channels
- gint i;
- for (i = 0; i < self->priv->fdlist->len; i++)
- {
- GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
- if (chan != ch)
- {
- g_message ("closing fd %d", g_io_channel_unix_get_fd (chan));
- g_io_channel_shutdown (chan, TRUE, NULL);
- g_io_channel_unref (chan);
- g_array_remove_index (self->priv->fdlist, i);
- }
- }
-
- g_source_remove (self->priv->out_watch);
- if (self->priv->direction == FS_DIRECTION_RECV)
- {
- g_message("Setting media_fd_src on fd %d",fd);
+ {
+ g_message ("Authenticated outgoing successfully fd %d", fd);
+ self->priv->connection = ch;
- GstState state;
- gst_element_get_state(self->priv->media_fd_src,&state,NULL,GST_CLOCK_TIME_NONE);
+ // success! we need to shutdown/close all other channels
+ gint i;
+ for (i = 0; i < self->priv->fdlist->len; i++)
+ {
+ GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
+ if (chan != ch)
+ {
+ g_message ("closing fd %d", g_io_channel_unix_get_fd (chan));
+ g_io_channel_shutdown (chan, TRUE, NULL);
+ g_io_channel_unref (chan);
+ g_array_remove_index (self->priv->fdlist, i);
+ }
+ }
- if ( state > GST_STATE_READY)
- {
- g_message("Error: fdsrc in state above ready");
- gst_element_set_state(self->priv->media_fd_src,GST_STATE_READY);
- }
- g_object_set (G_OBJECT(self->priv->media_fd_src), "fd", fd, NULL);
- gst_element_set_locked_state(self->priv->media_fd_src,FALSE);
- gst_element_sync_state_with_parent(self->priv->media_fd_src);
- }
- else if (self->priv->direction == FS_DIRECTION_SEND)
- {
- g_message("Setting media_fd_sink on fd %d",fd);
+ g_source_remove (self->priv->out_watch);
+ if (self->priv->direction == FS_DIRECTION_RECV)
+ {
+ g_message("Setting media_fd_src on fd %d",fd);
+
+ GstState state;
+ gst_element_get_state(self->priv->media_fd_src,&state,NULL,GST_CLOCK_TIME_NONE);
+
+ if ( state > GST_STATE_READY)
+ {
+ g_message("Error: fdsrc in state above ready");
+ gst_element_set_state(self->priv->media_fd_src,GST_STATE_READY);
+ }
+ g_object_set (G_OBJECT(self->priv->media_fd_src), "fd", fd, NULL);
+ gst_element_set_locked_state(self->priv->media_fd_src,FALSE);
+ gst_element_sync_state_with_parent(self->priv->media_fd_src);
+ }
+ else if (self->priv->direction == FS_DIRECTION_SEND)
+ {
+ g_message("Setting media_fd_sink on fd %d",fd);
- GstState state;
- gst_element_get_state(self->priv->media_fd_sink,&state,NULL,GST_CLOCK_TIME_NONE);
+ GstState state;
+ gst_element_get_state(self->priv->media_fd_sink,&state,NULL,GST_CLOCK_TIME_NONE);
- if ( state > GST_STATE_READY)
- {
- g_message("Error: fdsrc in state above ready");
- gst_element_set_state(self->priv->media_fd_sink,GST_STATE_READY);
- }
- g_object_set (G_OBJECT(self->priv->media_fd_sink), "fd", fd, NULL);
- gst_element_set_locked_state(self->priv->media_fd_sink,FALSE);
- gst_element_sync_state_with_parent(self->priv->media_fd_sink);
- g_object_set (G_OBJECT (self->priv->send_valve), "drop", FALSE, NULL);
+ if ( state > GST_STATE_READY)
+ {
+ g_message("Error: fdsrc in state above ready");
+ gst_element_set_state(self->priv->media_fd_sink,GST_STATE_READY);
+ }
+ g_object_set (G_OBJECT(self->priv->media_fd_sink), "fd", fd, NULL);
+ gst_element_set_locked_state(self->priv->media_fd_sink,FALSE);
+ gst_element_sync_state_with_parent(self->priv->media_fd_sink);
+ g_object_set (G_OBJECT (self->priv->send_valve), "drop", FALSE, NULL);
- }
- // add a watch on this fd to when it disconnects
- self->priv->main_watch = g_io_add_watch (ch,
- (G_IO_ERR|G_IO_HUP|G_IO_NVAL),
- main_fd_closed_cb, self);
- return FALSE;
}
+ // add a watch on this fd to when it disconnects
+ self->priv->main_watch = g_io_add_watch (ch,
+ (G_IO_ERR|G_IO_HUP|G_IO_NVAL),
+ main_fd_closed_cb, self);
+ return FALSE;
+ }
else
- {
- g_message ("Authentification failed on fd %d", fd);
- }
+ {
+ g_message ("Authentification failed on fd %d", fd);
+ }
/* Error */
-error:
+ error:
g_message ("Got error from fd %d, closing", fd);
// find, shutdown and remove channel from fdlist
gint i;
for (i = 0; i < self->priv->fdlist->len; i++)
+ {
+ GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
+ if (ch == chan)
{
- GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
- if (ch == chan)
- {
- g_io_channel_shutdown (chan, TRUE, NULL);
- g_io_channel_unref (chan);
- g_array_remove_index (self->priv->fdlist, i);
- }
+ g_io_channel_shutdown (chan, TRUE, NULL);
+ g_io_channel_unref (chan);
+ g_array_remove_index (self->priv->fdlist, i);
}
+ }
return FALSE;
}
static gboolean
-fs_msn_stream_attempt_connection (FsMsnStream *stream,const gchar *ip, guint16 port)
+fs_msn_stream_attempt_connection (FsMsnStream *stream,
+ const gchar *ip,
+ guint16 port)
{
FsMsnStream *self = FS_MSN_STREAM (stream);
@@ -837,11 +817,11 @@ fs_msn_stream_attempt_connection (FsMsnStream *stream,const gchar *ip, guint16 p
memset(&theiraddr, 0, sizeof(theiraddr));
if ( (fd = socket(PF_INET, SOCK_STREAM, 0)) == -1 )
- {
- // show error
- g_message ("could not create socket!");
- return FALSE;
- }
+ {
+ // show error
+ g_message ("could not create socket!");
+ return FALSE;
+ }
chan = g_io_channel_unix_new (fd);
g_io_channel_set_close_on_unref (chan, TRUE);
@@ -858,20 +838,20 @@ fs_msn_stream_attempt_connection (FsMsnStream *stream,const gchar *ip, guint16 p
// this is non blocking, the return value isn't too usefull
gint ret = connect (fd, (struct sockaddr *) &theiraddr, sizeof (theiraddr));
if (ret < 0)
+ {
+ if (errno != EINPROGRESS)
{
- if (errno != EINPROGRESS)
- {
- g_io_channel_shutdown (chan, TRUE, NULL);
- g_io_channel_unref (chan);
- return FALSE;
- }
+ g_io_channel_shutdown (chan, TRUE, NULL);
+ g_io_channel_unref (chan);
+ return FALSE;
}
+ }
g_message("ret %d %d %s", ret, errno, strerror(errno));
// add a watch on that io for when it connects
self->priv->out_watch = g_io_add_watch (chan,
- (G_IO_IN|G_IO_OUT|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL),
- successfull_connection_cb, self);
+ (G_IO_IN|G_IO_OUT|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL),
+ successfull_connection_cb, self);
return TRUE;
}
@@ -939,26 +919,32 @@ fd_accept_connection_cb (GIOChannel *ch, GIOCondition cond, gpointer data)
socklen_t n = sizeof (in);
if (!(cond & G_IO_IN))
- {
- g_message ("Error in condition not G_IO_IN on %d see next error",g_io_channel_unix_get_fd (ch));
- if (cond & G_IO_OUT)
- g_message("Error: Data can be written (without blocking) in the accept_connection cb");
- else if (cond & G_IO_PRI)
- g_message("Error: There is urgent data to read in the accept_connection cb");
- else if (cond & G_IO_ERR)
- g_message("Error: There is an error in the accept_connection cb");
- else if (cond & G_IO_HUP)
- g_message("Error: Hung up (the connection has been broken, usually for pipes and sockets) in the accept_connection cb");
- else if (cond & G_IO_NVAL)
- g_message("Error: Invalid request. The file descriptor is not open in the accept_connection cb");
- return FALSE;
- }
-
- if ((fd = accept(g_io_channel_unix_get_fd (ch), (struct sockaddr*) &in, &n)) == -1)
- {
- g_message ("Error while running accept() %d", errno);
- return FALSE;
- }
+ {
+ g_message ("Error in condition not G_IO_IN on %d see next error",
+ g_io_channel_unix_get_fd (ch));
+ if (cond & G_IO_OUT)
+ g_message("Error: Data can be written (without blocking) in the"
+ " accept_connection cb");
+ else if (cond & G_IO_PRI)
+ g_message("Error: There is urgent data to read in the accept_connection"
+ " cb");
+ else if (cond & G_IO_ERR)
+ g_message("Error: There is an error in the accept_connection cb");
+ else if (cond & G_IO_HUP)
+ g_message("Error: Hung up (the connection has been broken, usually for"
+ " pipes and sockets) in the accept_connection cb");
+ else if (cond & G_IO_NVAL)
+ g_message("Error: Invalid request. The file descriptor is not open in"
+ " the accept_connection cb");
+ return FALSE;
+ }
+
+ if ((fd = accept(g_io_channel_unix_get_fd (ch),
+ (struct sockaddr*) &in, &n)) == -1)
+ {
+ g_message ("Error while running accept() %d", errno);
+ return FALSE;
+ }
// ok we got a connection, let's set it up
newchan = g_io_channel_unix_new (fd);
@@ -966,72 +952,73 @@ fd_accept_connection_cb (GIOChannel *ch, GIOCondition cond, gpointer data)
/* Remove NON BLOCKING MODE */
if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK) != 0)
- {
- g_warning ("fcntl() failed");
- goto error;
- }
+ {
+ g_warning ("fcntl() failed");
+ goto error;
+ }
// now we try to auth
if (fs_msn_authenticate_incoming(self,fd))
- {
- g_message ("Authenticated incoming successfully fd %d", fd);
- self->priv->connection = newchan;
-
- // success! we need to shutdown/close all other channels
- g_source_remove (self->priv->in_watch);
- gint i;
- for (i = 0; i < self->priv->fdlist->len; i++)
- {
- GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
- if (chan != newchan)
- {
- g_message ("closing fd %d", g_io_channel_unix_get_fd (chan));
- g_io_channel_shutdown (chan, TRUE, NULL);
- g_io_channel_unref (chan);
- g_array_remove_index (self->priv->fdlist, i);
- }
- }
- if (self->priv->direction == FS_DIRECTION_RECV)
- {
- g_message("Setting media_fd_src on fd %d",fd);
-
- GstState state;
- gst_element_get_state(self->priv->media_fd_src,&state,NULL,GST_CLOCK_TIME_NONE);
+ {
+ g_message ("Authenticated incoming successfully fd %d", fd);
+ self->priv->connection = newchan;
- if ( state > GST_STATE_READY)
- {
- g_message("Error: fdsrc in state above ready");
- gst_element_set_state(self->priv->media_fd_src,GST_STATE_READY);
- }
- g_object_set (G_OBJECT(self->priv->media_fd_src), "fd", fd, NULL);
- gst_element_set_locked_state(self->priv->media_fd_src,FALSE);
- gst_element_sync_state_with_parent(self->priv->media_fd_src);
- }
- else if (self->priv->direction == FS_DIRECTION_SEND)
- {
- }
- // add a watch on this fd to when it disconnects
- self->priv->main_watch = g_io_add_watch (newchan,
- (G_IO_ERR|G_IO_HUP|G_IO_NVAL),
- main_fd_closed_cb, self);
- return FALSE;
+ // success! we need to shutdown/close all other channels
+ g_source_remove (self->priv->in_watch);
+ gint i;
+ for (i = 0; i < self->priv->fdlist->len; i++)
+ {
+ GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
+ if (chan != newchan)
+ {
+ g_message ("closing fd %d", g_io_channel_unix_get_fd (chan));
+ g_io_channel_shutdown (chan, TRUE, NULL);
+ g_io_channel_unref (chan);
+ g_array_remove_index (self->priv->fdlist, i);
+ }
}
+ if (self->priv->direction == FS_DIRECTION_RECV)
+ {
+ g_message("Setting media_fd_src on fd %d",fd);
+
+ GstState state;
+ gst_element_get_state(self->priv->media_fd_src, &state, NULL,
+ GST_CLOCK_TIME_NONE);
+
+ if ( state > GST_STATE_READY)
+ {
+ g_message("Error: fdsrc in state above ready");
+ gst_element_set_state(self->priv->media_fd_src, GST_STATE_READY);
+ }
+ g_object_set (G_OBJECT(self->priv->media_fd_src), "fd", fd, NULL);
+ gst_element_set_locked_state(self->priv->media_fd_src,FALSE);
+ gst_element_sync_state_with_parent(self->priv->media_fd_src);
+ }
+ else if (self->priv->direction == FS_DIRECTION_SEND)
+ {
+ }
+ // add a watch on this fd to when it disconnects
+ self->priv->main_watch = g_io_add_watch (newchan,
+ (G_IO_ERR|G_IO_HUP|G_IO_NVAL),
+ main_fd_closed_cb, self);
+ return FALSE;
+ }
/* Error */
-error:
+ error:
g_message ("Got error from fd %d, closing", fd);
// find, shutdown and remove channel from fdlist
gint i;
for (i = 0; i < self->priv->fdlist->len; i++)
+ {
+ GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
+ if (newchan == chan)
{
- GIOChannel *chan = g_array_index(self->priv->fdlist, GIOChannel*, i);
- if (newchan == chan)
- {
- g_io_channel_shutdown (chan, TRUE, NULL);
- g_io_channel_unref (chan);
- g_array_remove_index (self->priv->fdlist, i);
- }
+ g_io_channel_shutdown (chan, TRUE, NULL);
+ g_io_channel_unref (chan);
+ g_array_remove_index (self->priv->fdlist, i);
}
+ }
return FALSE;
}
@@ -1049,11 +1036,11 @@ fs_msn_open_listening_port (FsMsnStream *stream,
memset(&theiraddr, 0, sizeof(theiraddr));
if ( (fd = socket(PF_INET, SOCK_STREAM, 0)) == -1 )
- {
- // show error
- g_message ("could not create socket!");
- return;
- }
+ {
+ // show error
+ g_message ("could not create socket!");
+ return;
+ }
// set non-blocking mode
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
@@ -1061,26 +1048,26 @@ fs_msn_open_listening_port (FsMsnStream *stream,
theiraddr.sin_port = htons (port);
// bind
if (bind(fd, (struct sockaddr *) &theiraddr, sizeof(theiraddr)) != 0)
- {
- close (fd);
- return;
- }
+ {
+ close (fd);
+ return;
+ }
/* Listen */
if (listen(fd, 3) != 0)
- {
- close (fd);
- return;
- }
+ {
+ close (fd);
+ return;
+ }
chan = g_io_channel_unix_new (fd);
g_io_channel_set_close_on_unref (chan, TRUE);
g_array_append_val (self->priv->fdlist, chan);
g_message ("Listening on port %d\n",port);
self->priv->in_watch = g_io_add_watch(chan,
- G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
- fd_accept_connection_cb, self);
+ G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
+ fd_accept_connection_cb, self);
}
@@ -1092,37 +1079,37 @@ fs_msn_authenticate_outgoing (FsMsnStream *stream, gint fd)
gchar str[400];
memset(str, 0, sizeof(str));
if (fd != 0)
+ {
+ g_message ("Authenticating connection on %d...", fd);
+ g_message ("sending : recipientid=%d&sessionid=%d\r\n\r\n",self->priv->remote_recipientid,self->priv->remote_sessionid);
+ sprintf(str, "recipientid=%d&sessionid=%d\r\n\r\n",
+ self->priv->remote_recipientid, self->priv->remote_sessionid);
+ if (send(fd, str, strlen(str), 0) == -1)
{
- g_message ("Authenticating connection on %d...", fd);
- g_message ("sending : recipientid=%d&sessionid=%d\r\n\r\n",self->priv->remote_recipientid,self->priv->remote_sessionid);
- sprintf(str, "recipientid=%d&sessionid=%d\r\n\r\n",
- self->priv->remote_recipientid, self->priv->remote_sessionid);
- if (send(fd, str, strlen(str), 0) == -1)
- {
- g_message("sending failed");
- perror("auth");
- }
+ g_message("sending failed");
+ perror("auth");
+ }
- memset(str, 0, sizeof(str));
- if (recv(fd, str, 13, 0) != -1)
- {
- g_message ("Got %s, checking if it's auth", str);
- // we should get a connected message now
- if (strcmp (str, "connected\r\n\r\n") == 0)
- {
- // send our connected message also
- memset(str, 0, sizeof(str));
- sprintf(str, "connected\r\n\r\n");
- send(fd, str, strlen(str), 0);
- g_message ("Authentication successfull");
- return TRUE;
- }
- }
- else
- {
- perror("auth");
- }
+ memset(str, 0, sizeof(str));
+ if (recv(fd, str, 13, 0) != -1)
+ {
+ g_message ("Got %s, checking if it's auth", str);
+ // we should get a connected message now
+ if (strcmp (str, "connected\r\n\r\n") == 0)
+ {
+ // send our connected message also
+ memset(str, 0, sizeof(str));
+ sprintf(str, "connected\r\n\r\n");
+ send(fd, str, strlen(str), 0);
+ g_message ("Authentication successfull");
+ return TRUE;
+ }
}
+ else
+ {
+ perror("auth");
+ }
+ }
return FALSE;
}
@@ -1147,18 +1134,18 @@ fs_msn_stream_new (FsMsnSession *session,
GError **error)
{
FsMsnStream *self = g_object_new (FS_TYPE_MSN_STREAM,
- "session", session,
- "participant", participant,
- "direction", direction,
- "conference",conference,
- NULL);
+ "session", session,
+ "participant", participant,
+ "direction", direction,
+ "conference",conference,
+ NULL);
if (self->priv->construction_error)
- {
- g_propagate_error (error, self->priv->construction_error);
- g_object_unref (self);
- return NULL;
- }
+ {
+ g_propagate_error (error, self->priv->construction_error);
+ g_object_unref (self);
+ return NULL;
+ }
return self;
}
diff --git a/gst/fsmsnconference/fs-msn-stream.h b/gst/fsmsnconference/fs-msn-stream.h
index 00949cc..0bca0b9 100644
--- a/gst/fsmsnconference/fs-msn-stream.h
+++ b/gst/fsmsnconference/fs-msn-stream.h
@@ -52,31 +52,30 @@ typedef struct _FsMsnStreamPrivate FsMsnStreamPrivate;
struct _FsMsnStreamClass
- {
- FsStreamClass parent_class;
+{
+ FsStreamClass parent_class;
- };
+};
/**
* FsMsnStream:
*
*/
struct _FsMsnStream
- {
- FsStream parent;
+{
+ FsStream parent;
-
-
- FsMsnStreamPrivate *priv;
- };
+ /*< private >*/
+ FsMsnStreamPrivate *priv;
+};
GType fs_msn_stream_get_type (void);
FsMsnStream *fs_msn_stream_new (FsMsnSession *session,
- FsMsnParticipant *participant,
- FsStreamDirection direction,
- FsMsnConference *conference,
- GError **error);
+ FsMsnParticipant *participant,
+ FsStreamDirection direction,
+ FsMsnConference *conference,
+ GError **error);
G_END_DECLS
--
1.5.6.5
More information about the farsight-commits
mailing list