summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2015-07-24 19:29:38 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-01-17 15:39:29 -0500
commit182fb0223bee9067cafa00c5c6a56b71e6c892a6 (patch)
tree7c2096220de2562b2b89a39a573aac8facce5d3b
parent11dde55cbaf5179e8e1885cf1483e538a8d5a4a9 (diff)
downloadfarstream-182fb0223bee9067cafa00c5c6a56b71e6c892a6.tar.gz
Remove MSN plugin
-rw-r--r--.gitignore1
-rw-r--r--README3
-rw-r--r--configure.ac2
-rw-r--r--docs/plugins/Makefile.am8
-rw-r--r--docs/plugins/farstream-plugins-docs.sgml9
-rw-r--r--docs/plugins/farstream-plugins-sections.txt115
-rw-r--r--docs/plugins/farstream-plugins.types4
-rw-r--r--gst/fsmsnconference/Makefile.am66
-rw-r--r--gst/fsmsnconference/fs-msn-cam-recv-conference.c86
-rw-r--r--gst/fsmsnconference/fs-msn-cam-recv-conference.h69
-rw-r--r--gst/fsmsnconference/fs-msn-cam-send-conference.c85
-rw-r--r--gst/fsmsnconference/fs-msn-cam-send-conference.h69
-rw-r--r--gst/fsmsnconference/fs-msn-conference.c311
-rw-r--r--gst/fsmsnconference/fs-msn-conference.h75
-rw-r--r--gst/fsmsnconference/fs-msn-connection.c1134
-rw-r--r--gst/fsmsnconference/fs-msn-connection.h97
-rw-r--r--gst/fsmsnconference/fs-msn-participant.c65
-rw-r--r--gst/fsmsnconference/fs-msn-participant.h79
-rw-r--r--gst/fsmsnconference/fs-msn-session.c544
-rw-r--r--gst/fsmsnconference/fs-msn-session.h90
-rw-r--r--gst/fsmsnconference/fs-msn-stream.c912
-rw-r--r--gst/fsmsnconference/fs-msn-stream.h86
-rw-r--r--tests/check/Makefile.am5
-rw-r--r--tests/check/msn/conference.c424
24 files changed, 0 insertions, 4339 deletions
diff --git a/.gitignore b/.gitignore
index 344262b6..a72a514a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,7 +75,6 @@ tests/check/rtp/conference
tests/check/rtp/codecs
tests/check/rtp/sendcodecs
tests/check/rtp/recvcodecs
-tests/check/msn/conference
tests/check/utils/binadded
tests/check/elements/rtcpfilter
tests/check/elements/funnel
diff --git a/README b/README
index 55e482cc..cc8efeda 100644
--- a/README
+++ b/README
@@ -29,9 +29,6 @@ Run time for the RTP plugin:
- gst-plugins-good 1.4.0
- gst-plugins-bad 1.4.0
-Run time for the MSN plugin:
- - gst-plugins-bad 1.4.0
-
For the GUI example:
- Gtk 3.0
diff --git a/configure.ac b/configure.ac
index 240a4859..38c49807 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,6 @@ dnl these are all the gst plug-ins, compilable without additional libs
FS_PLUGINS_ALL=" \
fsrawconference \
fsrtpconference \
- fsmsnconference \
fsvideoanyrate \
fsrtpxdata \
"
@@ -403,7 +402,6 @@ common-modified/Makefile
gst/Makefile
gst/fsrawconference/Makefile
gst/fsrtpconference/Makefile
-gst/fsmsnconference/Makefile
gst/fsvideoanyrate/Makefile
gst/fsrtpxdata/Makefile
farstream/Makefile
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index da8678ff..7b4913fb 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -60,7 +60,6 @@ SCANOBJ_DEPS = \
$(top_builddir)/transmitters/nice/libnice-transmitter.la \
$(top_builddir)/transmitters/shm/libshm-transmitter.la \
$(top_builddir)/gst/fsrtpconference/libfsrtpconference_doc.la \
- $(top_builddir)/gst/fsmsnconference/libfsmsnconference_doc.la \
$(top_builddir)/gst/fsrawconference/libfsrawconference_doc.la \
$(top_builddir)/gst/fsvideoanyrate/libfsvideoanyrate.la \
$(top_builddir)/gst/fsrtpxdata/libfsrtpxdata.la
@@ -89,12 +88,6 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/fsrawconference/fs-raw-session.h \
$(top_srcdir)/gst/fsrawconference/fs-raw-stream.h \
$(top_srcdir)/gst/fsrawconference/fs-raw-participant.h \
- $(top_srcdir)/gst/fsmsnconference/fs-msn-cam-recv-conference.h \
- $(top_srcdir)/gst/fsmsnconference/fs-msn-cam-send-conference.h \
- $(top_srcdir)/gst/fsmsnconference/fs-msn-conference.h \
- $(top_srcdir)/gst/fsmsnconference/fs-msn-session.h \
- $(top_srcdir)/gst/fsmsnconference/fs-msn-stream.h \
- $(top_srcdir)/gst/fsmsnconference/fs-msn-participant.h \
$(top_srcdir)/transmitters/rawudp/fs-rawudp-transmitter.h \
$(top_srcdir)/transmitters/rawudp/fs-rawudp-stream-transmitter.h \
$(top_srcdir)/transmitters/multicast/fs-multicast-transmitter.h \
@@ -130,7 +123,6 @@ GTKDOC_LIBS = \
$(top_builddir)/farstream/libfarstream-@FS_APIVERSION@.la \
$(top_builddir)/gst/fsrtpconference/libfsrtpconference_doc.la \
$(top_builddir)/gst/fsrawconference/libfsrawconference_doc.la \
- $(top_builddir)/gst/fsmsnconference/libfsmsnconference_doc.la \
$(GST_BASE_LIBS)
GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)
diff --git a/docs/plugins/farstream-plugins-docs.sgml b/docs/plugins/farstream-plugins-docs.sgml
index 1a7a365e..b5572a4d 100644
--- a/docs/plugins/farstream-plugins-docs.sgml
+++ b/docs/plugins/farstream-plugins-docs.sgml
@@ -33,15 +33,6 @@
<xi:include href="xml/fs-raw-session.xml"/>
<xi:include href="xml/fs-raw-stream.xml"/>
</chapter>
- <chapter>
- <title>MSN Webcam plugin</title>
- <xi:include href="xml/element-fsmsncamsendconference.xml"/>
- <xi:include href="xml/element-fsmsncamrecvconference.xml"/>
- <xi:include href="xml/fs-msn-conference.xml"/>
- <xi:include href="xml/fs-msn-participant.xml"/>
- <xi:include href="xml/fs-msn-session.xml"/>
- <xi:include href="xml/fs-msn-stream.xml"/>
- </chapter>
</part>
<part>
diff --git a/docs/plugins/farstream-plugins-sections.txt b/docs/plugins/farstream-plugins-sections.txt
index c4eef75b..095d1b2a 100644
--- a/docs/plugins/farstream-plugins-sections.txt
+++ b/docs/plugins/farstream-plugins-sections.txt
@@ -332,121 +332,6 @@ FS_SHM_STREAM_TRANSMITTER_GET_CLASS
<SECTION>
-<FILE>fs-msn-conference</FILE>
-<TITLE>FsMsnConference</TITLE>
-FsMsnConference
-<SUBSECTION Standard>
-FS_MSN_CONFERENCE_CAST
-FsMsnConferencePrivate
-FsMsnConferenceClass
-FS_MSN_CONFERENCE
-FS_IS_MSN_CONFERENCE
-FS_TYPE_MSN_CONFERENCE
-fs_msn_conference_get_type
-FS_MSN_CONFERENCE_CLASS
-FS_IS_MSN_CONFERENCE_CLASS
-FS_MSN_CONFERENCE_GET_CLASS
-</SECTION>
-
-
-<SECTION>
-<FILE>fs-msn-session</FILE>
-<TITLE>FsMsnSession</TITLE>
-FsMsnSession
-<SUBSECTION Standard>
-FS_IS_MSN_SESSION
-FS_IS_MSN_SESSION_CLASS
-FS_MSN_SESSION
-FS_MSN_SESSION_CAST
-FS_MSN_SESSION_CLASS
-FS_MSN_SESSION_GET_CLASS
-FS_TYPE_MSN_SESSION
-FsMsnSessionClass
-FsMsnSessionPrivate
-fs_msn_session_get_type
-<SUBSECTION Private>
-fs_msn_session_new
-fs_msn_session_new_recv_pad
-connection
-</SECTION>
-
-
-<SECTION>
-<FILE>fs-msn-stream</FILE>
-<TITLE>FsMsnStream</TITLE>
-FsMsnStream
-<SUBSECTION Standard>
-FS_IS_MSN_STREAM
-FS_IS_MSN_STREAM_CLASS
-FS_MSN_STREAM
-FS_MSN_STREAM_CAST
-FS_MSN_STREAM_CLASS
-FS_MSN_STREAM_GET_CLASS
-FS_TYPE_MSN_STREAM
-FsMsnStreamClass
-FsMsnStreamPrivate
-fs_msn_stream_get_type
-<SUBSECTION Private>
-fs_msn_stream_new
-fs_msn_stream_set_tos_locked
-</SECTION>
-
-
-<SECTION>
-<FILE>fs-msn-participant</FILE>
-<TITLE>FsMsnParticipant</TITLE>
-FsMsnParticipant
-<SUBSECTION Standard>
-FS_IS_MSN_PARTICIPANT
-FS_IS_MSN_PARTICIPANT_CLASS
-FS_MSN_PARTICIPANT
-FS_MSN_PARTICIPANT_CAST
-FS_MSN_PARTICIPANT_CLASS
-FS_MSN_PARTICIPANT_GET_CLASS
-FS_TYPE_MSN_PARTICIPANT
-FsMsnParticipantClass
-FsMsnParticipantPrivate
-fs_msn_participant_get_type
-<SUBSECTION Private>
-fs_msn_participant_new
-</SECTION>
-
-<SECTION>
-<FILE>element-fsmsncamrecvconference</FILE>
-<TITLE>FsMsnCamCamRecvConference</TITLE>
-FsMsnCamRecvConference
-<SUBSECTION Private>
-FS_IS_MSN_CAM_RECV_CONFERENCE
-FS_IS_MSN_CAM_RECV_CONFERENCE_CLASS
-FS_MSN_CAM_RECV_CONFERENCE
-FS_MSN_CAM_RECV_CONFERENCE_CAST
-FS_MSN_CAM_RECV_CONFERENCE_CLASS
-FS_MSN_CAM_RECV_CONFERENCE_GET_CLASS
-FS_TYPE_MSN_CAM_RECV_CONFERENCE
-FsMsnCamRecvConferenceClass
-FsMsnCamRecvConferencePrivate
-fs_msn_cam_recv_conference_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-fsmsncamsendconference</FILE>
-<TITLE>FsMsnCamSendConference</TITLE>
-FsMsnCamSendConference
-<SUBSECTION Private>
-FS_IS_MSN_CAM_SEND_CONFERENCE
-FS_IS_MSN_CAM_SEND_CONFERENCE_CLASS
-FS_MSN_CAM_SEND_CONFERENCE
-FS_MSN_CAM_SEND_CONFERENCE_CAST
-FS_MSN_CAM_SEND_CONFERENCE_CLASS
-FS_MSN_CAM_SEND_CONFERENCE_GET_CLASS
-FS_TYPE_MSN_CAM_SEND_CONFERENCE
-FsMsnCamSendConferenceClass
-FsMsnCamSendConferencePrivate
-fs_msn_cam_send_conference_get_type
-</SECTION>
-
-
-<SECTION>
<FILE>element-fsrawconference</FILE>
<TITLE>FsRawConference</TITLE>
FsRawConference
diff --git a/docs/plugins/farstream-plugins.types b/docs/plugins/farstream-plugins.types
index 892ca678..4dbbef27 100644
--- a/docs/plugins/farstream-plugins.types
+++ b/docs/plugins/farstream-plugins.types
@@ -2,10 +2,6 @@
#include "../../gst/fsrtpconference/fs-rtp-participant.h"
#include "../../gst/fsrtpconference/fs-rtp-session.h"
#include "../../gst/fsrtpconference/fs-rtp-stream.h"
-#include "../../gst/fsmsnconference/fs-msn-conference.h"
-#include "../../gst/fsmsnconference/fs-msn-participant.h"
fs_rtp_participant_get_type
fs_rtp_session_get_type
fs_rtp_stream_get_type
-fs_msn_conference_get_type
-fs_msn_participant_get_type
diff --git a/gst/fsmsnconference/Makefile.am b/gst/fsmsnconference/Makefile.am
deleted file mode 100644
index 3faa34d8..00000000
--- a/gst/fsmsnconference/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-plugin_LTLIBRARIES = libfsmsnconference.la
-
-
-# First build a convenience lib with the common stuff so its not built twice
-
-noinst_LTLIBRARIES = libfsmsnconference-convenience.la
-
-libfsmsnconference_convenience_la_SOURCES = \
- fs-msn-cam-recv-conference.c \
- fs-msn-cam-send-conference.c \
- fs-msn-participant.c \
- fs-msn-session.c \
- fs-msn-connection.c \
- fs-msn-stream.c
-
-noinst_HEADERS = \
- fs-msn-cam-recv-conference.h \
- fs-msn-cam-send-conference.h \
- fs-msn-conference.h \
- fs-msn-participant.h \
- fs-msn-session.h \
- fs-msn-connection.h \
- fs-msn-stream.h
-
-
-AM_CFLAGS = \
- $(FS_INTERNAL_CFLAGS) \
- $(FS_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CFLAGS) \
- $(NICE_CFLAGS)
-
-# Build the main plugin
-
-libfsmsnconference_la_SOURCES = \
- fs-msn-conference.c
-
-libfsmsnconference_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libfsmsnconference_la_LIBTOOLFLAGS = $(PLUGIN_LIBTOOLFLAGS)
-libfsmsnconference_la_LIBADD = \
- libfsmsnconference-convenience.la \
- $(top_builddir)/farstream/libfarstream-@FS_APIVERSION@.la \
- $(FS_LIBS) \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(NICE_LIBS)
-
-
-
-# Optionally build a library to allow building the gtk-doc
-
-if ENABLE_GTK_DOC
-noinst_LTLIBRARIES += libfsmsnconference_doc.la
-
-nodist_libfsmsnconference_doc_la_CFLAGS = -DBUILD_GTK_DOC
-
-nodist_libfsmsnconference_doc_la_SOURCES = $(libfsmsnconference_la_SOURCES)
-
-
-libfsmsnconference_doc_la_LIBADD = libfsmsnconference-convenience.la \
- $(libfsmsnconference_la_LIBADD)
-
-CLEANFILES = $(BUILT_SOURCES)
-
-endif
-
diff --git a/gst/fsmsnconference/fs-msn-cam-recv-conference.c b/gst/fsmsnconference/fs-msn-cam-recv-conference.c
deleted file mode 100644
index 462bc4dc..00000000
--- a/gst/fsmsnconference/fs-msn-cam-recv-conference.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Farstream - Farstream MSN Conference Implementation
- *
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * fs-msn-recv-conference.c - MSN implementation for Farstream Conference
- * Gstreamer Elements
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SECTION:element-fsmsncamrecvconference
- * @short_description: Farstream MSN Receive Conference Gstreamer Element
- *
- * This element implements the unidirection webcam feature found in various
- * version of MSN Messenger (tm) and Windows Live Messenger (tm). This is
- * to receive someone else's webcam.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "fs-msn-cam-recv-conference.h"
-
-#include "fs-msn-conference.h"
-#include "fs-msn-session.h"
-#include "fs-msn-stream.h"
-#include "fs-msn-participant.h"
-
-#define GST_CAT_DEFAULT fsmsnconference_debug
-
-
-G_DEFINE_TYPE (FsMsnCamRecvConference, fs_msn_cam_recv_conference,
- FS_TYPE_MSN_CONFERENCE);
-
-
-static void
-fs_msn_cam_recv_conference_class_init (FsMsnCamRecvConferenceClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_set_metadata (gstelement_class,
- "Farstream MSN Reception Conference",
- "Generic/Bin/MSN",
- "A Farstream MSN Reception Conference",
- "Richard Spiers <richard.spiers@gmail.com>, "
- "Youness Alaoui <youness.alaoui@collabora.com>, "
- "Olivier Crete <olivier.crete@collabora.com>");
-}
-
-static void
-fs_msn_cam_recv_conference_init (FsMsnCamRecvConference *self)
-{
- FsMsnConference *conf = FS_MSN_CONFERENCE (self);
- GstElementFactory *fact = NULL;
-
- GST_DEBUG_OBJECT (conf, "fs_msn_cam_recv_conference_init");
-
- conf->max_direction = FS_DIRECTION_RECV;
-
- fact = gst_element_factory_find ("mimenc");
- if (fact)
- gst_object_unref (fact);
- else
- g_set_error (&conf->missing_element_error,
- FS_ERROR, FS_ERROR_CONSTRUCTION,
- "mimenc missing");
-}
-
diff --git a/gst/fsmsnconference/fs-msn-cam-recv-conference.h b/gst/fsmsnconference/fs-msn-cam-recv-conference.h
deleted file mode 100644
index dcd43547..00000000
--- a/gst/fsmsnconference/fs-msn-cam-recv-conference.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Farstream - Farstream MSN Conference Implementation
- *
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * fs-msn-recv-conference.h - MSN implementation for Farstream Conference
- * Gstreamer Elements
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FS_MSN_CAM_RECV_CONFERENCE_H__
-#define __FS_MSN_CAM_RECV_CONFERENCE_H__
-
-#include "fs-msn-conference.h"
-
-G_BEGIN_DECLS
-
-#define FS_TYPE_MSN_CAM_RECV_CONFERENCE (fs_msn_cam_recv_conference_get_type ())
-#define FS_MSN_CAM_RECV_CONFERENCE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_MSN_CAM_RECV_CONFERENCE, \
- FsMsnCamRecvConference))
-#define FS_MSN_CAM_RECV_CONFERENCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_MSN_CAM_RECV_CONFERENCE, \
- FsMsnCamRecvConferenceClass))
-#define FS_MSN_CAM_RECV_CONFERENCE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), FS_TYPE_MSN_CAM_RECV_CONFERENCE, \
- FsMsnCamRecvConferenceClass))
-#define FS_IS_MSN_CAM_RECV_CONFERENCE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_MSN_CAM_RECV_CONFERENCE))
-#define FS_IS_MSN_CAM_RECV_CONFERENCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_MSN_CAM_RECV_CONFERENCE))
-#define FS_MSN_CAM_RECV_CONFERENCE_CAST(obj) \
- ((FsMsnCamRecvConference *)(obj))
-
-typedef struct _FsMsnCamRecvConference FsMsnCamRecvConference;
-typedef struct _FsMsnCamRecvConferenceClass FsMsnCamRecvConferenceClass;
-typedef struct _FsMsnCamRecvConferencePrivate FsMsnCamRecvConferencePrivate;
-
-struct _FsMsnCamRecvConference
-{
- FsMsnConference parent;
-};
-
-struct _FsMsnCamRecvConferenceClass
-{
- FsMsnConferenceClass parent_class;
-};
-
-GType fs_msn_cam_recv_conference_get_type (void);
-
-
-G_END_DECLS
-
-#endif /* __FS_MSN_CAM_RECV_CONFERENCE_H__ */
diff --git a/gst/fsmsnconference/fs-msn-cam-send-conference.c b/gst/fsmsnconference/fs-msn-cam-send-conference.c
deleted file mode 100644
index 12d3ec70..00000000
--- a/gst/fsmsnconference/fs-msn-cam-send-conference.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Farstream - Farstream MSN Conference Implementation
- *
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * fs-msn-send-conference.c - MSN implementation for Farstream Conference
- * Gstreamer Elements
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SECTION:element-fsmsncamsendconference
- * @short_description: Farstream MSN send Conference Gstreamer Element
- *
- * This element implements the unidirection webcam feature found in various
- * version of MSN Messenger (tm) and Windows Live Messenger (tm). This is
- * to send the local webcam's video to someone else.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "fs-msn-cam-send-conference.h"
-
-#include "fs-msn-conference.h"
-#include "fs-msn-session.h"
-#include "fs-msn-stream.h"
-#include "fs-msn-participant.h"
-
-#define GST_CAT_DEFAULT fsmsnconference_debug
-
-
-G_DEFINE_TYPE (FsMsnCamSendConference, fs_msn_cam_send_conference,
- FS_TYPE_MSN_CONFERENCE);
-
-static void
-fs_msn_cam_send_conference_class_init (FsMsnCamSendConferenceClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_set_metadata (gstelement_class,
- "Farstream MSN Sending Conference",
- "Generic/Bin/MSN",
- "A Farstream MSN Sending Conference",
- "Richard Spiers <richard.spiers@gmail.com>, "
- "Youness Alaoui <youness.alaoui@collabora.co.uk>, "
- "Olivier Crete <olivier.crete@collabora.co.uk>");
-}
-
-static void
-fs_msn_cam_send_conference_init (FsMsnCamSendConference *self)
-{
- FsMsnConference *conf = FS_MSN_CONFERENCE (self);
- GstElementFactory *fact = NULL;
-
- GST_DEBUG_OBJECT (conf, "fs_msn_cam_send_conference_init");
-
- conf->max_direction = FS_DIRECTION_SEND;
-
- fact = gst_element_factory_find ("mimenc");
- if (fact)
- gst_object_unref (fact);
- else
- g_set_error (&conf->missing_element_error,
- FS_ERROR, FS_ERROR_CONSTRUCTION,
- "mimenc missing");
-}
-
diff --git a/gst/fsmsnconference/fs-msn-cam-send-conference.h b/gst/fsmsnconference/fs-msn-cam-send-conference.h
deleted file mode 100644
index 2c8897ea..00000000
--- a/gst/fsmsnconference/fs-msn-cam-send-conference.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Farstream - Farstream MSN Conference Implementation
- *
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * fs-msn-send-conference.h - MSN implementation for Farstream Conference
- * Gstreamer Elements
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FS_MSN_CAM_SEND_CONFERENCE_H__
-#define __FS_MSN_CAM_SEND_CONFERENCE_H__
-
-#include "fs-msn-conference.h"
-
-G_BEGIN_DECLS
-
-#define FS_TYPE_MSN_CAM_SEND_CONFERENCE (fs_msn_cam_send_conference_get_type ())
-#define FS_MSN_CAM_SEND_CONFERENCE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_MSN_CAM_SEND_CONFERENCE, \
- FsMsnCamSendConference))
-#define FS_MSN_CAM_SEND_CONFERENCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_MSN_CAM_SEND_CONFERENCE, \
- FsMsnCamSendConferenceClass))
-#define FS_MSN_CAM_SEND_CONFERENCE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), FS_TYPE_MSN_CAM_SEND_CONFERENCE, \
- FsMsnCamSendConferenceClass))
-#define FS_IS_MSN_CAM_SEND_CONFERENCE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_MSN_CAM_SEND_CONFERENCE))
-#define FS_IS_MSN_CAM_SEND_CONFERENCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_MSN_CAM_SEND_CONFERENCE))
-#define FS_MSN_CAM_SEND_CONFERENCE_CAST(obj) \
- ((FsMsnCamSendConference *)(obj))
-
-typedef struct _FsMsnCamSendConference FsMsnCamSendConference;
-typedef struct _FsMsnCamSendConferenceClass FsMsnCamSendConferenceClass;
-typedef struct _FsMsnCamSendConferencePrivate FsMsnCamSendConferencePrivate;
-
-struct _FsMsnCamSendConference
-{
- FsMsnConference parent;
-};
-
-struct _FsMsnCamSendConferenceClass
-{
- FsMsnConferenceClass parent_class;
-};
-
-GType fs_msn_cam_send_conference_get_type (void);
-
-
-G_END_DECLS
-
-#endif /* __FS_MSN_CAM_SEND_CONFERENCE_H__ */
diff --git a/gst/fsmsnconference/fs-msn-conference.c b/gst/fsmsnconference/fs-msn-conference.c
deleted file mode 100644
index ab79674b..00000000
--- a/gst/fsmsnconference/fs-msn-conference.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Farstream - Farstream MSN Conference Implementation
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * fs-msn-conference.c - MSN implementation for Farstream Conference Gstreamer
- * Elements
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SECTION:fs-msn-conference
- * @short_description: Farstream MSN Conference Gstreamer Elements Base class
- *
- * This element implements the unidirection webcam feature found in various
- * version of MSN Messenger (tm) and Windows Live Messenger (tm).
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include "fs-msn-conference.h"
-
-#include "fs-msn-session.h"
-#include "fs-msn-stream.h"
-#include "fs-msn-participant.h"
-
-#include "fs-msn-cam-send-conference.h"
-#include "fs-msn-cam-recv-conference.h"
-
-GST_DEBUG_CATEGORY (fsmsnconference_debug);
-#define GST_CAT_DEFAULT fsmsnconference_debug
-
-/* Signals */
-enum
-{
- LAST_SIGNAL
-};
-
-/* Properties */
-enum
-{
- PROP_0
-};
-
-
-static GstStaticPadTemplate fs_msn_conference_sink_template =
- GST_STATIC_PAD_TEMPLATE ("sink_%d",
- GST_PAD_SINK,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate fs_msn_conference_src_template =
- GST_STATIC_PAD_TEMPLATE ("src_%d_%d_%d",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-#define FS_MSN_CONFERENCE_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), FS_TYPE_MSN_CONFERENCE, \
- FsMsnConferencePrivate))
-
-struct _FsMsnConferencePrivate
-{
- gboolean disposed;
- /* Protected by GST_OBJECT_LOCK */
- FsMsnParticipant *participant;
- FsMsnSession *session;
-};
-
-G_DEFINE_ABSTRACT_TYPE (FsMsnConference, fs_msn_conference,
- FS_TYPE_CONFERENCE);
-
-static FsSession *fs_msn_conference_new_session (FsConference *conf,
- FsMediaType media_type,
- GError **error);
-
-static FsParticipant *fs_msn_conference_new_participant (FsConference *conf,
- GError **error);
-
-static void _remove_session (gpointer user_data,
- GObject *where_the_object_was);
-static void _remove_participant (gpointer user_data,
- GObject *where_the_object_was);
-
-static void
-fs_msn_conference_dispose (GObject * object)
-{
- FsMsnConference *self = FS_MSN_CONFERENCE (object);
-
- if (self->priv->disposed)
- return;
-
- GST_OBJECT_LOCK (object);
- if (self->priv->session)
- g_object_weak_unref (G_OBJECT (self->priv->session), _remove_session, self);
- self->priv->session = NULL;
-
- if (self->priv->participant)
- g_object_weak_unref (G_OBJECT (self->priv->participant),
- _remove_participant, self);
- self->priv->participant = NULL;
- GST_OBJECT_UNLOCK (object);
-
- self->priv->disposed = TRUE;
-
- g_clear_error (&self->missing_element_error);
-
- G_OBJECT_CLASS (fs_msn_conference_parent_class)->dispose (object);
-}
-
-static void
-fs_msn_conference_class_init (FsMsnConferenceClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
- FsConferenceClass *baseconf_class = FS_CONFERENCE_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (FsMsnConferencePrivate));
-
- GST_DEBUG_CATEGORY_INIT (fsmsnconference_debug, "fsmsnconference", 0,
- "Farstream MSN Conference Element");
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&fs_msn_conference_sink_template));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&fs_msn_conference_src_template));
-
- baseconf_class->new_session =
- GST_DEBUG_FUNCPTR (fs_msn_conference_new_session);
- baseconf_class->new_participant =
- GST_DEBUG_FUNCPTR (fs_msn_conference_new_participant);
-
- gobject_class->dispose = GST_DEBUG_FUNCPTR (fs_msn_conference_dispose);
-}
-
-
-static void
-fs_msn_conference_init (FsMsnConference *conf)
-{
- GST_DEBUG_OBJECT (conf, "fs_msn_conference_init");
-
- conf->priv = FS_MSN_CONFERENCE_GET_PRIVATE (conf);
-}
-
-static void
-_remove_session (gpointer user_data,
- GObject *where_the_object_was)
-{
- FsMsnConference *self = FS_MSN_CONFERENCE (user_data);
-
- GST_OBJECT_LOCK (self);
- if (self->priv->session == (FsMsnSession *) where_the_object_was)
- self->priv->session = NULL;
- GST_OBJECT_UNLOCK (self);
-}
-
-static void
-_remove_participant (gpointer user_data,
- GObject *where_the_object_was)
-{
- FsMsnConference *self = FS_MSN_CONFERENCE (user_data);
-
- GST_OBJECT_LOCK (self);
- if (self->priv->participant == (FsMsnParticipant *) where_the_object_was)
- self->priv->participant = NULL;
- GST_OBJECT_UNLOCK (self);
-}
-
-
-static FsSession *
-fs_msn_conference_new_session (FsConference *conf,
- FsMediaType media_type,
- GError **error)
-{
- FsMsnConference *self = FS_MSN_CONFERENCE (conf);
- FsMsnSession *new_session = NULL;
-
- if (self->missing_element_error)
- {
- if (error)
- *error = g_error_copy (self->missing_element_error);
- return NULL;
- }
-
- if (media_type != FS_MEDIA_TYPE_VIDEO)
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "Only video supported for msn webcam");
- return NULL;
- }
-
- GST_OBJECT_LOCK (self);
- if (self->priv->session)
- {
- GST_OBJECT_UNLOCK (self);
- g_set_error (error, FS_ERROR, FS_ERROR_ALREADY_EXISTS,
- "There already is a session");
- return NULL;
- }
-
- GST_OBJECT_UNLOCK (self);
-
- new_session = fs_msn_session_new (media_type, self, error);
-
- if (new_session)
- {
- GST_OBJECT_LOCK (self);
- self->priv->session = new_session;
- g_object_weak_ref (G_OBJECT (new_session), _remove_session, self);
- GST_OBJECT_UNLOCK (self);
- }
-
- return FS_SESSION (new_session);
-}
-
-
-static FsParticipant *
-fs_msn_conference_new_participant (FsConference *conf,
- GError **error)
-{
- FsMsnConference *self = FS_MSN_CONFERENCE (conf);
- FsMsnParticipant *new_participant = NULL;
-
- if (self->missing_element_error)
- {
- if (error)
- *error = g_error_copy (self->missing_element_error);
- return NULL;
- }
-
- GST_OBJECT_LOCK (self);
- if (self->priv->participant)
- {
- GST_OBJECT_UNLOCK (self);
- g_set_error (error, FS_ERROR, FS_ERROR_ALREADY_EXISTS,
- "There already is a participant");
- return NULL;
- }
-
- GST_OBJECT_UNLOCK (self);
-
- new_participant = fs_msn_participant_new ();
-
- if (new_participant)
- {
- GST_OBJECT_LOCK (self);
- self->priv->participant = new_participant;
- g_object_weak_ref (G_OBJECT (new_participant), _remove_participant, self);
- GST_OBJECT_UNLOCK (self);
- }
-
- return FS_PARTICIPANT (new_participant);
-
-}
-
-
-static gboolean plugin_init (GstPlugin * plugin)
-{
- return gst_element_register (plugin, "fsmsncamsendconference",
- GST_RANK_NONE, FS_TYPE_MSN_CAM_SEND_CONFERENCE) &&
- gst_element_register (plugin, "fsmsncamrecvconference",
- GST_RANK_NONE, FS_TYPE_MSN_CAM_RECV_CONFERENCE);
-}
-
-
-
-#ifdef BUILD_GTK_DOC
-void
-fs_msn_plugin_init_real (void)
-{
- gst_plugin_register_static (
-#else
-GST_PLUGIN_DEFINE (
-#endif
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- fsmsnconference,
- "Farstream MSN Conference plugin",
- plugin_init,
- VERSION,
- "LGPL",
- "Farstream",
- "http://www.freedesktop.org/wiki/Software/Farstream"
-#ifdef BUILD_GTK_DOC
- );
-}
-#else
-)
-#endif
-
diff --git a/gst/fsmsnconference/fs-msn-conference.h b/gst/fsmsnconference/fs-msn-conference.h
deleted file mode 100644
index 9e1afc51..00000000
--- a/gst/fsmsnconference/fs-msn-conference.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Farstream - Farstream MSN Conference Implementation
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * gstfsmsnconference.h - MSN implementation for Farstream Conference Gstreamer
- * Elements
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FS_MSN_CONFERENCE_H__
-#define __FS_MSN_CONFERENCE_H__
-
-#include <farstream/fs-conference.h>
-
-G_BEGIN_DECLS
-
-#define FS_TYPE_MSN_CONFERENCE \
- (fs_msn_conference_get_type ())
-#define FS_MSN_CONFERENCE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),FS_TYPE_MSN_CONFERENCE,FsMsnConference))
-#define FS_MSN_CONFERENCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),FS_TYPE_MSN_CONFERENCE,FsMsnConferenceClass))
-#define FS_MSN_CONFERENCE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj),FS_TYPE_MSN_CONFERENCE,FsMsnConferenceClass))
-#define FS_IS_MSN_CONFERENCE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),FS_TYPE_MSN_CONFERENCE))
-#define FS_IS_MSN_CONFERENCE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),FS_TYPE_MSN_CONFERENCE))
-#define FS_MSN_CONFERENCE_CAST(obj) \
- ((FsMsnConference *)(obj))
-
-typedef struct _FsMsnConference FsMsnConference;
-typedef struct _FsMsnConferenceClass FsMsnConferenceClass;
-typedef struct _FsMsnConferencePrivate FsMsnConferencePrivate;
-
-struct _FsMsnConference
-{
- FsConference parent;
- FsMsnConferencePrivate *priv;
-
- FsStreamDirection max_direction;
-
- GError *missing_element_error;
-};
-
-struct _FsMsnConferenceClass
-{
- FsConferenceClass parent_class;
-};
-
-GType fs_msn_conference_get_type (void);
-
-
-GST_DEBUG_CATEGORY_EXTERN (fsmsnconference_debug);
-
-G_END_DECLS
-
-#endif /* __FS_MSN_CONFERENCE_H__ */
diff --git a/gst/fsmsnconference/fs-msn-connection.c b/gst/fsmsnconference/fs-msn-connection.c
deleted file mode 100644
index 0acf8c33..00000000
--- a/gst/fsmsnconference/fs-msn-connection.c
+++ /dev/null
@@ -1,1134 +0,0 @@
-/*
- * Farstream - Farstream MSN Connection
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- * @author: Youness Alaoui <youness.alaoui@collabora.co.uk>
- *
- * fs-msn-connection.c - A MSN Connection gobject
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "fs-msn-connection.h"
-
-#include <arpa/inet.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include <gst/gst.h>
-#include <nice/interfaces.h>
-
-#define GST_CAT_DEFAULT fsmsnconference_debug
-
-/* Signals */
-enum
-{
- SIGNAL_NEW_LOCAL_CANDIDATE,
- SIGNAL_LOCAL_CANDIDATES_PREPARED,
- SIGNAL_CONNECTED,
- SIGNAL_CONNECTION_FAILED,
- N_SIGNALS
-};
-
-
-static guint signals[N_SIGNALS];
-
-/* props */
-enum
-{
- PROP_0,
- PROP_SESSION_ID
-};
-
-
-typedef enum {
- FS_MSN_STATUS_AUTH,
- FS_MSN_STATUS_CONNECTED,
- FS_MSN_STATUS_CONNECTED2,
- FS_MSN_STATUS_SEND_RECEIVE,
- FS_MSN_STATUS_PAUSED,
-} FsMsnStatus;
-
-typedef struct _FsMsnPollFD FsMsnPollFD;
-typedef void (*PollFdCallback) (FsMsnConnection *self, FsMsnPollFD *pollfd);
-
-struct _FsMsnPollFD {
- GstPollFD pollfd;
- FsMsnStatus status;
- gboolean server;
- gboolean want_read;
- gboolean want_write;
- PollFdCallback callback;
-};
-
-#define FS_MSN_CONNECTION_LOCK(conn) g_rec_mutex_lock(&(conn)->mutex)
-#define FS_MSN_CONNECTION_UNLOCK(conn) g_rec_mutex_unlock(&(conn)->mutex)
-
-
-G_DEFINE_TYPE(FsMsnConnection, fs_msn_connection, G_TYPE_OBJECT);
-
-static void fs_msn_connection_dispose (GObject *object);
-static void fs_msn_connection_finalize (GObject *object);
-static void fs_msn_connection_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void fs_msn_connection_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-
-
-static gboolean fs_msn_connection_attempt_connection_locked (
- FsMsnConnection *connection,
- FsCandidate *candidate,
- GError **error);
-static gboolean fs_msn_open_listening_port_unlock (FsMsnConnection *connection,
- guint16 port,
- GError **error);
-
-static void successful_connection_cb (FsMsnConnection *self, FsMsnPollFD *fd);
-static void accept_connection_cb (FsMsnConnection *self, FsMsnPollFD *fd);
-static void connection_cb (FsMsnConnection *self, FsMsnPollFD *fd);
-
-static gpointer connection_polling_thread (gpointer data);
-static void shutdown_fd (FsMsnConnection *self, FsMsnPollFD *pollfd,
- gboolean equal);
-static void shutdown_fd_locked (FsMsnConnection *self, FsMsnPollFD *pollfd,
- gboolean equal);
-static FsMsnPollFD * add_pollfd_locked (FsMsnConnection *self, int fd,
- PollFdCallback callback, gboolean read, gboolean write, gboolean server);
-
-static void
-fs_msn_connection_class_init (FsMsnConnectionClass *klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- gobject_class->dispose = fs_msn_connection_dispose;
- gobject_class->finalize = fs_msn_connection_finalize;
- gobject_class->get_property = fs_msn_connection_get_property;
- gobject_class->set_property = fs_msn_connection_set_property;
-
- signals[SIGNAL_NEW_LOCAL_CANDIDATE] = g_signal_new
- ("new-local-candidate",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE, 1, FS_TYPE_CANDIDATE);
-
- signals[SIGNAL_LOCAL_CANDIDATES_PREPARED] = g_signal_new
- ("local-candidates-prepared",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- signals[SIGNAL_CONNECTED] = g_signal_new
- ("connected",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__UINT,
- G_TYPE_NONE, 1, G_TYPE_UINT);
-
- signals[SIGNAL_CONNECTION_FAILED] = g_signal_new
- ("connection-failed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- g_object_class_install_property (gobject_class,
- PROP_SESSION_ID,
- g_param_spec_uint ("session-id",
- "The session-id of the session",
- "This is the session-id of the MSN session",
- 1, 9999, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-fs_msn_connection_init (FsMsnConnection *self)
-{
- /* member init */
-
- self->poll_timeout = GST_CLOCK_TIME_NONE;
- self->poll = gst_poll_new (TRUE);
- gst_poll_set_flushing (self->poll, FALSE);
- self->pollfds = g_ptr_array_new ();
-
- g_rec_mutex_init (&self->mutex);
-}
-
-static void
-fs_msn_connection_dispose (GObject *object)
-{
- FsMsnConnection *self = FS_MSN_CONNECTION (object);
-
- FS_MSN_CONNECTION_LOCK(self);
-
- if (self->polling_thread)
- {
- GThread *polling_thread = g_thread_ref (self->polling_thread);
- gst_poll_set_flushing (self->poll, TRUE);
- FS_MSN_CONNECTION_UNLOCK(self);
- g_thread_join (polling_thread);
- FS_MSN_CONNECTION_LOCK(self);
- g_thread_unref (polling_thread);
- self->polling_thread = NULL;
- }
-
- FS_MSN_CONNECTION_UNLOCK(self);
-
- G_OBJECT_CLASS (fs_msn_connection_parent_class)->dispose (object);
-}
-
-static void
-fs_msn_connection_finalize (GObject *object)
-{
- FsMsnConnection *self = FS_MSN_CONNECTION (object);
- gint i;
-
- g_free (self->local_recipient_id);
- g_free (self->remote_recipient_id);
-
- gst_poll_free (self->poll);
-
- for (i = 0; i < self->pollfds->len; i++)
- {
- FsMsnPollFD *p = g_ptr_array_index(self->pollfds, i);
- close (p->pollfd.fd);
- g_slice_free (FsMsnPollFD, p);
- }
- g_ptr_array_free (self->pollfds, TRUE);
-
- g_rec_mutex_clear (&self->mutex);
-
- G_OBJECT_CLASS (fs_msn_connection_parent_class)->finalize (object);
-}
-
-/**
- * fs_msn_connection_new:
- * @session: The #FsMsnSession this connection is a child of
- * @participant: The #FsMsnParticipant this connection is for
- * @direction: the initial #FsDirection for this connection
- *
- *
- * This function create a new connection
- *
- * Returns: the newly created string or NULL on error
- */
-
-FsMsnConnection *
-fs_msn_connection_new (guint session_id, gboolean producer, guint initial_port)
-{
- FsMsnConnection *self = g_object_new (FS_TYPE_MSN_CONNECTION, NULL);
-
- if (self) {
- self->session_id = session_id;
- self->initial_port = initial_port;
- self->producer = producer;
- }
-
- return self;
-}
-
-static void
-fs_msn_connection_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- FsMsnConnection *self = FS_MSN_CONNECTION (object);
-
- FS_MSN_CONNECTION_LOCK (self);
- switch (prop_id)
- {
- case PROP_SESSION_ID:
- g_value_set_uint (value, self->session_id);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- FS_MSN_CONNECTION_UNLOCK (self);
-}
-
-static void
-fs_msn_connection_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- FsMsnConnection *self = FS_MSN_CONNECTION (object);
-
- FS_MSN_CONNECTION_LOCK (self);
- switch (prop_id)
- {
- case PROP_SESSION_ID:
- self->session_id = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- FS_MSN_CONNECTION_LOCK (self);
-
-}
-
-gboolean
-fs_msn_connection_gather_local_candidates (FsMsnConnection *self,
- GError **error)
-{
- gboolean ret;
-
- FS_MSN_CONNECTION_LOCK(self);
-
- self->polling_thread = g_thread_try_new ("msn polling thread",
- connection_polling_thread, self, error);
-
- if (!self->polling_thread)
- {
- FS_MSN_CONNECTION_UNLOCK(self);
- return FALSE;
- }
-
- ret = fs_msn_open_listening_port_unlock (self, self->initial_port, error);
-
- g_signal_emit (self, signals[SIGNAL_LOCAL_CANDIDATES_PREPARED], 0);
-
- return ret;
-}
-
-
-/**
- * fs_msn_connection_add_remote_candidate:
- */
-gboolean
-fs_msn_connection_add_remote_candidates (FsMsnConnection *self,
- GList *candidates, GError **error)
-{
- GList *item = NULL;
- gchar *recipient_id = NULL;
- gboolean ret = FALSE;
- guint session_id = 0;
-
- if (!candidates)
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "Candidate list can no be empty");
- return FALSE;
- }
-
- FS_MSN_CONNECTION_LOCK(self);
-
- recipient_id = self->remote_recipient_id;
-
- for (item = candidates; item; item = g_list_next (item))
- {
- 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");
- goto out;
- }
- if (!candidate->foundation)
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "The candidate passed does not have a foundation (MSN recipient ID)");
- goto out;
- }
- if (recipient_id)
- {
- if (g_strcmp0 (candidate->foundation, recipient_id) != 0)
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "The candidates do not have the same recipient ID");
- goto out;
- }
- }
- else
- {
- recipient_id = candidate->foundation;
- }
-
- if (candidate->username)
- {
- gint sid = atoi (candidate->username);
-
- if (sid < 1 || sid > 9999)
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "The session ID (in the username) must be between 1 and 9999,"
- " %d is invalid", sid);
- goto out;
- }
-
- if (session_id)
- {
- if (session_id != sid)
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "The candidates do not have the same session ID"
- " (in the username)");
- goto out;
- }
- }
- else
- {
- session_id = sid;
- }
- }
- }
-
- self->remote_recipient_id = g_strdup (recipient_id);
- self->session_id = session_id;
- ret = TRUE;
- for (item = candidates; item; item = g_list_next (item))
- {
- FsCandidate *candidate = item->data;
- if (!fs_msn_connection_attempt_connection_locked (self, candidate, error))
- {
- ret = FALSE;
- break;
- }
- }
-
- out:
- FS_MSN_CONNECTION_UNLOCK(self);
- return ret;
-}
-
-
-
-static GList *
-filter_ips_ipv4 (GList *ips)
-{
- GList *item;
-
- for (item = ips; item;)
- {
- gchar *ip = item->data;
- GList *next = item->next;
-
- if (!strchr (ip, '.'))
- {
- g_free (ip);
- ips = g_list_delete_link (ips, item);
- }
- item = next;
- }
-
- return ips;
-}
-
-static gboolean
-fs_msn_open_listening_port_unlock (FsMsnConnection *self, guint16 port,
- GError **error)
-{
- gint fd = -1;
- struct sockaddr_in myaddr;
- guint myaddr_len = sizeof (struct sockaddr_in);
- FsCandidate * candidate = NULL;
- GList *addresses = nice_interfaces_get_local_ips (FALSE);
- GList *item = NULL;
- gchar *session_id;
-
- addresses = filter_ips_ipv4 (addresses);
-
-
- GST_DEBUG ("Attempting to listen on port %d.....",port);
-
- if ( (fd = socket(PF_INET, SOCK_STREAM, 0)) < 0 )
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- g_set_error (error, FS_ERROR, FS_ERROR_NETWORK,
- "Could not create socket: %s", error_str);
- goto error;
- }
-
- // set non-blocking mode
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
- for (;;) {
- GST_DEBUG ("Attempting to listen on port %d.....",port);
- memset(&myaddr, 0, sizeof(myaddr));
- myaddr.sin_family = AF_INET;
- myaddr.sin_port = htons (port);
- // bind
- if (bind(fd, (struct sockaddr *) &myaddr, sizeof(myaddr)) != 0)
- {
- if (port != 0 && errno == EADDRINUSE)
- {
- port++;
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- g_set_error (error, FS_ERROR, FS_ERROR_NETWORK,
- "Could not bind socket: %s", error_str);
- goto error;
- }
- } else {
- /* Listen */
- if (listen(fd, 3) != 0)
- {
- if (port != 0 && errno == EADDRINUSE)
- {
- port++;
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- g_set_error (error, FS_ERROR, FS_ERROR_NETWORK,
- "Could not listen on socket: %s", error_str);
- goto error;
- }
- }
- else
- {
- goto done;
- }
- }
- }
-
- done:
-
- if (getsockname (fd, (struct sockaddr *) &myaddr, &myaddr_len) < 0) {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- g_set_error (error, FS_ERROR, FS_ERROR_NETWORK,
- "Could not get the socket name: %s", error_str);
- goto error;
- }
- port = ntohs (myaddr.sin_port);
- add_pollfd_locked (self, fd, accept_connection_cb, TRUE, TRUE, FALSE);
-
- GST_DEBUG ("Listening on port %d", port);
-
- self->local_recipient_id = g_strdup_printf ("%d",
- g_random_int_range (100, 199));
- session_id = g_strdup_printf ("%u", self->session_id);
-
- FS_MSN_CONNECTION_UNLOCK (self);
-
- for (item = addresses;
- item;
- item = g_list_next (item))
- {
- candidate = fs_candidate_new (self->local_recipient_id, 1,
- FS_CANDIDATE_TYPE_HOST, FS_NETWORK_PROTOCOL_TCP, item->data, port);
- candidate->username = g_strdup (session_id);
-
- g_signal_emit (self, signals[SIGNAL_NEW_LOCAL_CANDIDATE], 0, candidate);
-
- fs_candidate_destroy (candidate);
- }
-
- g_free (session_id);
-
- g_list_foreach (addresses, (GFunc) g_free, NULL);
- g_list_free (addresses);
-
- return TRUE;
-
- error:
- if (fd >= 0)
- close (fd);
- g_list_foreach (addresses, (GFunc) g_free, NULL);
- g_list_free (addresses);
- FS_MSN_CONNECTION_UNLOCK (self);
- return FALSE;
-}
-
-static gboolean
-fs_msn_connection_attempt_connection_locked (FsMsnConnection *connection,
- FsCandidate *candidate,
- GError **error)
-{
- FsMsnConnection *self = FS_MSN_CONNECTION (connection);
- gint fd = -1;
- gint ret;
- struct sockaddr_in theiraddr;
- memset(&theiraddr, 0, sizeof(theiraddr));
-
-
- if ( (fd = socket(PF_INET, SOCK_STREAM, 0)) == -1 )
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- g_set_error (error, FS_ERROR, FS_ERROR_NETWORK,
- "Could not create socket: %s", error_str);
- return FALSE;
- }
-
- // set non-blocking mode
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
-
- theiraddr.sin_family = AF_INET;
- theiraddr.sin_addr.s_addr = inet_addr (candidate->ip);
- theiraddr.sin_port = htons (candidate->port);
-
- GST_DEBUG ("Attempting connection to %s %d on socket %d", candidate->ip,
- candidate->port, fd);
- // this is non blocking, the return value isn't too usefull
- ret = connect (fd, (struct sockaddr *) &theiraddr, sizeof (theiraddr));
- if (ret < 0 && errno != EINPROGRESS)
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- g_set_error (error, FS_ERROR, FS_ERROR_NETWORK,
- "Could not connect socket: %s", error_str);
- close (fd);
- return FALSE;
- }
-
- FS_MSN_CONNECTION_LOCK (self);
- add_pollfd_locked (self, fd, successful_connection_cb, TRUE, TRUE, FALSE);
- FS_MSN_CONNECTION_UNLOCK (self);
-
- return TRUE;
-}
-
-static void
-accept_connection_cb (FsMsnConnection *self, FsMsnPollFD *pollfd)
-{
- struct sockaddr_in in;
- int fd = -1;
- socklen_t n = sizeof (in);
-
- if (gst_poll_fd_has_error (self->poll, &pollfd->pollfd) ||
- gst_poll_fd_has_closed (self->poll, &pollfd->pollfd))
- {
- GST_WARNING ("Error in accept socket : %d", pollfd->pollfd.fd);
- goto error;
- }
-
- if ((fd = accept(pollfd->pollfd.fd,
- (struct sockaddr*) &in, &n)) == -1)
- {
- GST_ERROR ("Error while running accept() %d", errno);
- return;
- }
-
- FS_MSN_CONNECTION_LOCK (self);
- add_pollfd_locked (self, fd, connection_cb, TRUE, FALSE, TRUE);
- FS_MSN_CONNECTION_UNLOCK (self);
-
- return;
-
- /* Error */
- error:
- GST_WARNING ("Got error from fd %d, closing", fd);
- // find, shutdown and remove channel from fdlist
- shutdown_fd (self, pollfd, TRUE);
-
- return;
-}
-
-
-static void
-successful_connection_cb (FsMsnConnection *self, FsMsnPollFD *pollfd)
-{
- gint error;
- socklen_t option_len;
-
- GST_DEBUG ("handler called on fd %d", pollfd->pollfd.fd);
-
- errno = 0;
- if (gst_poll_fd_has_error (self->poll, &pollfd->pollfd) ||
- gst_poll_fd_has_closed (self->poll, &pollfd->pollfd))
- {
- GST_WARNING ("connecton closed or error");
- goto error;
- }
-
- option_len = sizeof(error);
-
- /* Get the error option */
- if (getsockopt(pollfd->pollfd.fd, SOL_SOCKET, SO_ERROR, (void*) &error, &option_len) < 0)
- {
- g_warning ("getsockopt() failed");
- goto error;
- }
-
- /* Check if there is an error */
- if (error)
- {
- GST_WARNING ("getsockopt gave an error : %d", error);
- goto error;
- }
-
- pollfd->callback = connection_cb;
-
- GST_DEBUG ("connection succeeded on socket %p", pollfd);
- return;
-
- /* Error */
- error:
- GST_WARNING ("Got error from fd %d, closing", pollfd->pollfd.fd);
- // find, shutdown and remove channel from fdlist
- shutdown_fd (self, pollfd, TRUE);
-
- return;
-}
-
-
-static void
-connection_cb (FsMsnConnection *self, FsMsnPollFD *pollfd)
-{
- gboolean success = FALSE;
-
- GST_DEBUG ("handler called on fd:%d server: %d status:%d r:%d w:%d",
- pollfd->pollfd.fd,
- pollfd->server, pollfd->status,
- gst_poll_fd_can_read (self->poll, &pollfd->pollfd),
- gst_poll_fd_can_write (self->poll, &pollfd->pollfd));
-
- if (gst_poll_fd_has_error (self->poll, &pollfd->pollfd) ||
- gst_poll_fd_has_closed (self->poll, &pollfd->pollfd))
- {
- GST_WARNING ("connecton closed or error (error: %d closed: %d)",
- gst_poll_fd_has_error (self->poll, &pollfd->pollfd),
- gst_poll_fd_has_closed (self->poll, &pollfd->pollfd));
- goto error;
- }
-
- if (gst_poll_fd_can_read (self->poll, &pollfd->pollfd))
- {
- switch (pollfd->status)
- {
- case FS_MSN_STATUS_AUTH:
- if (pollfd->server)
- {
- gchar str[35] = {0};
- gchar check[35] = {0};
-
- if (recv (pollfd->pollfd.fd, str, 34, 0) == 34)
- {
- GST_DEBUG ("Got %s, checking if it's auth", str);
- FS_MSN_CONNECTION_LOCK(self);
- snprintf(check, 35, "recipientid=%s&sessionid=%d\r\n\r\n",
- self->local_recipient_id, self->session_id);
- FS_MSN_CONNECTION_UNLOCK(self);
- if (strncmp (str, check, 35) == 0)
- {
- GST_DEBUG ("Authentication successful");
- pollfd->status = FS_MSN_STATUS_CONNECTED;
- pollfd->want_write = TRUE;
- gst_poll_fd_ctl_write (self->poll, &pollfd->pollfd, TRUE);
- }
- else
- {
- GST_WARNING ("Authentication failed check=%s", check);
- goto error;
- }
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- GST_WARNING ("auth: %s", error_str);
- goto error;
- }
-
- } else {
- GST_ERROR ("shouldn't receive data when client on AUTH state");
- goto error;
- }
- break;
- case FS_MSN_STATUS_CONNECTED:
- if (!pollfd->server)
- {
- gchar str[14] = {0};
- ssize_t size;
-
- size = recv (pollfd->pollfd.fd, str, 13, MSG_PEEK);
- if (size > 0)
- {
- GST_DEBUG ("Got %s, checking if it's connected", str);
- if (size == 13 && strcmp (str, "connected\r\n\r\n") == 0)
- {
- GST_DEBUG ("connection successful");
- if (recv (pollfd->pollfd.fd, str, 13, 0) != 13)
- {
- GST_WARNING ("Could not read 13 bytes that had previously"
- " been peeked at!");
- goto error;
- }
- pollfd->status = FS_MSN_STATUS_CONNECTED2;
- pollfd->want_write = TRUE;
- gst_poll_fd_ctl_write (self->poll, &pollfd->pollfd, TRUE);
- }
- else if (!self->producer)
- {
- GST_DEBUG ("connection successful");
- pollfd->status = FS_MSN_STATUS_SEND_RECEIVE;
- success = TRUE;
- }
- else
- {
- GST_WARNING ("connected failed");
- goto error;
- }
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- GST_WARNING ("recv: %s", error_str);
- goto error;
- }
- } else {
- GST_ERROR ("shouldn't receive data when server on CONNECTED state");
- goto error;
- }
- break;
- case FS_MSN_STATUS_CONNECTED2:
- if (pollfd->server)
- {
- gchar str[14] = {0};
- ssize_t size;
-
- size = recv (pollfd->pollfd.fd, str, 13, MSG_PEEK);
- if (size > 0)
- {
- GST_DEBUG ("Got %s, checking if it's connected", str);
- if (size == 13 && strcmp (str, "connected\r\n\r\n") == 0)
- {
- GST_DEBUG ("connection successful");
- if (recv (pollfd->pollfd.fd, str, 13, 0) != 13)
- {
- GST_WARNING ("Could not read 13 bytes that had previously"
- " been peeked at!");
-
- goto error;
- }
- pollfd->status = FS_MSN_STATUS_SEND_RECEIVE;
- success = TRUE;
- }
- else if (!self->producer)
- {
- GST_DEBUG ("connection successful");
- pollfd->status = FS_MSN_STATUS_SEND_RECEIVE;
- success = TRUE;
- }
- else
- {
- GST_WARNING ("connected failed");
- goto error;
- }
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- GST_WARNING ("recv: %s", error_str);
- goto error;
- }
-
- } else {
- GST_ERROR ("shouldn't receive data when client on CONNECTED2 state");
- goto error;
- }
- break;
- default:
- GST_ERROR ("Invalid status %d", pollfd->status);
- goto error;
- break;
-
- }
- }
- else if (gst_poll_fd_can_write (self->poll, &pollfd->pollfd))
- {
- pollfd->want_write = FALSE;
- gst_poll_fd_ctl_write (self->poll, &pollfd->pollfd, FALSE);
- switch (pollfd->status)
- {
- case FS_MSN_STATUS_AUTH:
- if (!pollfd->server)
- {
- gchar *str;
- FS_MSN_CONNECTION_LOCK(self);
- str = g_strdup_printf("recipientid=%s&sessionid=%d\r\n\r\n",
- self->remote_recipient_id, self->session_id);
- FS_MSN_CONNECTION_UNLOCK(self);
- if (send(pollfd->pollfd.fd, str, strlen (str), 0) != -1)
- {
- GST_DEBUG ("Sent %s", str);
- pollfd->status = FS_MSN_STATUS_CONNECTED;
- g_free (str);
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- GST_WARNING ("auth send: %s", error_str);
- g_free (str);
- goto error;
- }
-
- }
- break;
- case FS_MSN_STATUS_CONNECTED:
- if (pollfd->server)
- {
-
- if (send(pollfd->pollfd.fd, "connected\r\n\r\n", 13, 0) != -1)
- {
- GST_DEBUG ("sent connected");
- if (self->producer)
- {
- pollfd->status = FS_MSN_STATUS_SEND_RECEIVE;
- success = TRUE;
- }
- else
- {
- pollfd->status = FS_MSN_STATUS_CONNECTED2;
- }
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- GST_WARNING ("sending connected: %s", error_str);
- goto error;
- }
- } else {
- GST_DEBUG ("shouldn't receive data when server on CONNECTED state");
- goto error;
- }
- break;
- case FS_MSN_STATUS_CONNECTED2:
- if (!pollfd->server)
- {
-
- if (send(pollfd->pollfd.fd, "connected\r\n\r\n", 13, 0) != -1)
- {
- GST_DEBUG ("sent connected");
- pollfd->status = FS_MSN_STATUS_SEND_RECEIVE;
- success = TRUE;
- }
- else
- {
- gchar error_str[256];
- strerror_r (errno, error_str, 256);
- GST_WARNING ("sending connected: %s", error_str);
- goto error;
- }
- } else {
- GST_ERROR ("shouldn't receive data when client on CONNECTED2 state");
- goto error;
- }
- break;
- default:
- GST_ERROR ("Invalid status %d", pollfd->status);
- goto error;
- break;
- }
- }
-
- if (success) {
- // success! we need to shutdown/close all other channels
- shutdown_fd (self, pollfd, FALSE);
-
- g_signal_emit (self, signals[SIGNAL_CONNECTED], 0, pollfd->pollfd.fd);
-
- pollfd->want_read = FALSE;
- pollfd->want_write = FALSE;
- gst_poll_fd_ctl_read (self->poll, &pollfd->pollfd, FALSE);
- gst_poll_fd_ctl_write (self->poll, &pollfd->pollfd, FALSE);
- }
-
- return;
- error:
- /* Error */
- GST_WARNING ("Got error from fd %d, closing", pollfd->pollfd.fd);
- shutdown_fd (self, pollfd, TRUE);
-
- FS_MSN_CONNECTION_LOCK (self);
- success = (self->pollfds->len > 1);
- FS_MSN_CONNECTION_UNLOCK (self);
-
- if (!success)
- g_signal_emit (self, signals[SIGNAL_CONNECTION_FAILED], 0);
-
- return;
-}
-
-static gpointer
-connection_polling_thread (gpointer data)
-{
- FsMsnConnection *self = data;
- gint ret;
- GstClockTime timeout;
- GstPoll * poll;
-
- FS_MSN_CONNECTION_LOCK(self);
- timeout = self->poll_timeout;
- poll = self->poll;
- GST_DEBUG ("poll waiting %d", self->pollfds->len);
- FS_MSN_CONNECTION_UNLOCK(self);
-
- while ((ret = gst_poll_wait (poll, timeout)) >= 0)
- {
- GST_DEBUG ("gst_poll_wait returned : %d", ret);
- FS_MSN_CONNECTION_LOCK(self);
- if (ret > 0)
- {
- gint i;
-
- for (i = 0; i < self->pollfds->len; i++)
- {
- FsMsnPollFD *pollfd = NULL;
-
- pollfd = g_ptr_array_index(self->pollfds, i);
-
- GST_DEBUG ("ret %d - i = %d, len = %d", ret, i, self->pollfds->len);
-
- GST_DEBUG ("%p - error %d, close %d, read %d-%d, write %d-%d",
- pollfd,
- gst_poll_fd_has_error (poll, &pollfd->pollfd),
- gst_poll_fd_has_closed (poll, &pollfd->pollfd),
- pollfd->want_read,
- gst_poll_fd_can_read (poll, &pollfd->pollfd),
- pollfd->want_write,
- gst_poll_fd_can_write (poll, &pollfd->pollfd));
-
- if (gst_poll_fd_has_error (poll, &pollfd->pollfd) ||
- gst_poll_fd_has_closed (poll, &pollfd->pollfd))
- {
- pollfd->callback (self, pollfd);
- shutdown_fd_locked (self, pollfd, TRUE);
- i--;
- continue;
- }
- if ((pollfd->want_read &&
- gst_poll_fd_can_read (poll, &pollfd->pollfd)) ||
- (pollfd->want_write &&
- gst_poll_fd_can_write (poll, &pollfd->pollfd)))
- {
- pollfd->callback (self, pollfd);
- }
-
- }
- }
- timeout = self->poll_timeout;
- FS_MSN_CONNECTION_UNLOCK(self);
- }
-
- return NULL;
-}
-
-
-static void
-shutdown_fd (FsMsnConnection *self, FsMsnPollFD *pollfd, gboolean equal)
-{
- FS_MSN_CONNECTION_LOCK (self);
- shutdown_fd_locked (self, pollfd, equal);
- FS_MSN_CONNECTION_UNLOCK (self);
-}
-
-static void
-shutdown_fd_locked (FsMsnConnection *self, FsMsnPollFD *pollfd, gboolean equal)
-{
- gint i;
- guint closed = 0;
-
- for (i = 0; i < self->pollfds->len; i++)
- {
- FsMsnPollFD *p = g_ptr_array_index(self->pollfds, i);
- if ((equal && p == pollfd) || (!equal && p != pollfd))
- {
- GST_DEBUG ("Shutting down p %p (fd %d)", p, p->pollfd.fd);
-
- if (!gst_poll_fd_has_closed (self->poll, &p->pollfd))
- close (p->pollfd.fd);
- if (!gst_poll_remove_fd (self->poll, &p->pollfd))
- GST_WARNING ("Could not remove pollfd %p", p);
- g_ptr_array_remove_index_fast (self->pollfds, i);
- g_slice_free (FsMsnPollFD, p);
- closed++;
- i--;
- }
- }
-
- if (closed)
- gst_poll_restart (self->poll);
- else
- GST_WARNING ("Could find pollfd to remove");
-}
-
-static FsMsnPollFD *
-add_pollfd_locked (FsMsnConnection *self, int fd, PollFdCallback callback,
- gboolean read, gboolean write, gboolean server)
-{
- FsMsnPollFD *pollfd = g_slice_new0 (FsMsnPollFD);
- gst_poll_fd_init (&pollfd->pollfd);
- pollfd->pollfd.fd = fd;
- pollfd->server = server;
- pollfd->want_read = read;
- pollfd->want_write = write;
- pollfd->status = FS_MSN_STATUS_AUTH;
-
- gst_poll_add_fd (self->poll, &pollfd->pollfd);
-
- gst_poll_fd_ctl_read (self->poll, &pollfd->pollfd, read);
- gst_poll_fd_ctl_write (self->poll, &pollfd->pollfd, write);
- pollfd->callback = callback;
-
- GST_DEBUG ("ADD_POLLFD %p (%p) - error %d, close %d, read %d-%d, write %d-%d",
- self->pollfds, pollfd,
- gst_poll_fd_has_error (self->poll, &pollfd->pollfd),
- gst_poll_fd_has_closed (self->poll, &pollfd->pollfd),
- pollfd->want_read,
- gst_poll_fd_can_read (self->poll, &pollfd->pollfd),
- pollfd->want_write,
- gst_poll_fd_can_write (self->poll, &pollfd->pollfd));
-
- g_ptr_array_add (self->pollfds, pollfd);
- gst_poll_restart (self->poll);
- return pollfd;
-}
diff --git a/gst/fsmsnconference/fs-msn-connection.h b/gst/fsmsnconference/fs-msn-connection.h
deleted file mode 100644
index a3563cca..00000000
--- a/gst/fsmsnconference/fs-msn-connection.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Farstream - Farstream MSN Stream
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- * @author: Youness Alaoui <youness.alaoui@collabora.co.uk>
- *
- * fs-msn-connection.h - An MSN Connection class
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FS_MSN_CONNECTION_H__
-#define __FS_MSN_CONNECTION_H__
-
-#include "fs-msn-participant.h"
-#include "fs-msn-session.h"
-
-G_BEGIN_DECLS
-
-/* TYPE MACROS */
-#define FS_TYPE_MSN_CONNECTION \
- (fs_msn_connection_get_type ())
-#define FS_MSN_CONNECTION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_MSN_CONNECTION, FsMsnConnection))
-#define FS_MSN_CONNECTION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_MSN_CONNECTION, FsMsnConnectionClass))
-#define FS_IS_MSN_CONNECTION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_MSN_CONNECTION))
-#define FS_IS_MSN_CONNECTION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_MSN_CONNECTION))
-#define FS_MSN_CONNECTION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), FS_TYPE_MSN_CONNECTION, FsMsnConnectionClass))
-#define FS_MSN_CONNECTION_CAST(obj) ((FsMsnConnection*) (obj))
-
-typedef struct _FsMsnConnection FsMsnConnection;
-typedef struct _FsMsnConnectionClass FsMsnConnectionClass;
-typedef struct _FsMsnConnectionPrivate FsMsnConnectionPrivate;
-
-
-struct _FsMsnConnectionClass
-{
- GObjectClass parent_class;
-};
-
-/**
- * FsMsnConnection:
- *
- */
-struct _FsMsnConnection
-{
- GObject parent;
-
- /* All variables that are not protected by the lock are read-only */
-
- gchar *local_recipient_id;
- gchar *remote_recipient_id; /* protected by lock */
- guint session_id; /* protected by lock */
- guint initial_port;
- gboolean producer;
-
- GThread *polling_thread; /* protected by lock */
- GstClockTime poll_timeout; /* protected by lock */
- GstPoll *poll;
- GPtrArray *pollfds; /* protected by lock */
- GRecMutex mutex;
-};
-
-GType fs_msn_connection_get_type (void);
-
-FsMsnConnection *fs_msn_connection_new (guint session_id, gboolean producer,
- guint initial_port);
-
-gboolean fs_msn_connection_gather_local_candidates (FsMsnConnection *connection,
- GError **error);
-
-gboolean fs_msn_connection_add_remote_candidates (FsMsnConnection *connection,
- GList *candidates, GError **error);
-
-
-G_END_DECLS
-
-#endif /* __FS_MSN_CONNECTION_H__ */
diff --git a/gst/fsmsnconference/fs-msn-participant.c b/gst/fsmsnconference/fs-msn-participant.c
deleted file mode 100644
index 1dcf72c9..00000000
--- a/gst/fsmsnconference/fs-msn-participant.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Farstream - Farstream MSN Participant
- *
- * Copyright 2007 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- *
- * fs-msn-participant.c - A MSN Farstream Participant gobject
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SECTION:fs-msn-participant
- * @short_description: A MSN participant in a #FsMsnConference
- *
- * This object represents one participant or person in a conference
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "fs-msn-participant.h"
-
-/* Signals */
-enum
-{
- LAST_SIGNAL
-};
-
-/* props */
-enum
-{
- PROP_0,
-};
-
-G_DEFINE_TYPE(FsMsnParticipant, fs_msn_participant, FS_TYPE_PARTICIPANT);
-
-static void
-fs_msn_participant_class_init (FsMsnParticipantClass *klass)
-{
-}
-
-static void
-fs_msn_participant_init (FsMsnParticipant *self)
-{
-}
-
-FsMsnParticipant *fs_msn_participant_new (void)
-{
- return g_object_new (FS_TYPE_MSN_PARTICIPANT, NULL);
-}
diff --git a/gst/fsmsnconference/fs-msn-participant.h b/gst/fsmsnconference/fs-msn-participant.h
deleted file mode 100644
index 44c6a0a2..00000000
--- a/gst/fsmsnconference/fs-msn-participant.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Farstream - Farstream MSN Participant
- *
- * Copyright 2007 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- *
- * fs-msn-participant.h - A Farstream MSN Participant gobject
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FS_MSN_PARTICIPANT_H__
-#define __FS_MSN_PARTICIPANT_H__
-
-#include <farstream/fs-participant.h>
-
-G_BEGIN_DECLS
-
-/* TYPE MACROS */
-#define FS_TYPE_MSN_PARTICIPANT (fs_msn_participant_get_type())
-#define FS_MSN_PARTICIPANT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_MSN_PARTICIPANT, \
- FsMsnParticipant))
-#define FS_MSN_PARTICIPANT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_MSN_PARTICIPANT, \
- FsMsnParticipantClass))
-#define FS_IS_MSN_PARTICIPANT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_MSN_PARTICIPANT))
-#define FS_IS_MSN_PARTICIPANT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_MSN_PARTICIPANT))
-#define FS_MSN_PARTICIPANT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), FS_TYPE_MSN_PARTICIPANT, \
- FsMsnParticipantClass))
-#define FS_MSN_PARTICIPANT_CAST(obj) ((FsMsnParticipant *) (obj))
-
-typedef struct _FsMsnParticipant FsMsnParticipant;
-typedef struct _FsMsnParticipantClass FsMsnParticipantClass;
-typedef struct _FsMsnParticipantPrivate FsMsnParticipantPrivate;
-
-struct _FsMsnParticipantClass
-{
- FsParticipantClass parent_class;
-
- /*virtual functions */
-
- /*< private >*/
- FsMsnParticipantPrivate *priv;
-};
-
-/**
- * FsMsnParticipant:
- *
- */
-struct _FsMsnParticipant
-{
- FsParticipant parent;
- FsMsnParticipantPrivate *priv;
-};
-
-GType fs_msn_participant_get_type (void);
-
-FsMsnParticipant *fs_msn_participant_new (void);
-
-G_END_DECLS
-
-#endif /* __FS_MSN_PARTICIPANT_H__ */
diff --git a/gst/fsmsnconference/fs-msn-session.c b/gst/fsmsnconference/fs-msn-session.c
deleted file mode 100644
index cf455fd0..00000000
--- a/gst/fsmsnconference/fs-msn-session.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * Farstream - Farstream MSN Session
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- * @author: Youness Alaoui <youness.alaoui@collabora.co.uk>
- *
- * fs-msn-session.c - A Farstream Msn Session gobject
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SECTION:fs-msn-session
- * @short_description: A MSN session in a #FsMsnConference
- *
- * There can be only one stream per session.
- *
- * It can afterwards be modified to pause sending (or receiving) by modifying
- * the #FsMsnStream::direction property.
- *
- * The transmitter parameters to the fs_session_new_stream() function are
- * used to set the initial value of the construct properties of the stream
- * object. This plugin does not use transmitter plugins, so the transmitter
- * parameter itself is ignored.
- *
- * The codecs preferences can not be modified and the codec is a fixed value.
- * It is always "MIMIC".
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "fs-msn-session.h"
-
-#include <string.h>
-
-#include <gst/gst.h>
-
-#include "fs-msn-stream.h"
-#include "fs-msn-participant.h"
-
-#define GST_CAT_DEFAULT fsmsnconference_debug
-
-/* Signals */
-enum
-{
- LAST_SIGNAL
-};
-
-/* props */
-enum
-{
- PROP_0,
- PROP_MEDIA_TYPE,
- PROP_ID,
- PROP_SINK_PAD,
- PROP_CODEC_PREFERENCES,
- PROP_CODECS,
- PROP_CODECS_WITHOUT_CONFIG,
- PROP_CURRENT_SEND_CODEC,
- PROP_CONFERENCE,
- PROP_TOS
-};
-
-
-
-struct _FsMsnSessionPrivate
-{
- FsMediaType media_type;
-
- FsMsnConference *conference;
- FsMsnStream *stream;
-
- GError *construction_error;
-
- GstPad *media_sink_pad;
-
- guint tos; /* Protected by conf lock */
-
- GMutex mutex; /* protects the conference */
-};
-
-G_DEFINE_TYPE (FsMsnSession, fs_msn_session, FS_TYPE_SESSION);
-
-#define FS_MSN_SESSION_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), FS_TYPE_MSN_SESSION, FsMsnSessionPrivate))
-
-static void fs_msn_session_dispose (GObject *object);
-static void fs_msn_session_finalize (GObject *object);
-
-static void fs_msn_session_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void fs_msn_session_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static void fs_msn_session_constructed (GObject *object);
-
-static FsStream *fs_msn_session_new_stream (FsSession *session,
- FsParticipant *participant,
- FsStreamDirection direction,
- GError **error);
-
-static GType
-fs_msn_session_get_stream_transmitter_type (FsSession *session,
- const gchar *transmitter);
-
-static void _remove_stream (gpointer user_data,
- GObject *where_the_object_was);
-
-static void
-fs_msn_session_class_init (FsMsnSessionClass *klass)
-{
- GObjectClass *gobject_class;
- FsSessionClass *session_class;
-
- gobject_class = (GObjectClass *) klass;
- session_class = FS_SESSION_CLASS (klass);
-
- gobject_class->set_property = fs_msn_session_set_property;
- gobject_class->get_property = fs_msn_session_get_property;
- gobject_class->constructed = fs_msn_session_constructed;
-
- session_class->new_stream = fs_msn_session_new_stream;
- session_class->get_stream_transmitter_type =
- fs_msn_session_get_stream_transmitter_type;
-
- g_object_class_override_property (gobject_class,
- PROP_MEDIA_TYPE, "media-type");
- g_object_class_override_property (gobject_class,
- PROP_ID, "id");
- g_object_class_override_property (gobject_class,
- PROP_SINK_PAD, "sink-pad");
-
- g_object_class_override_property (gobject_class,
- PROP_CODEC_PREFERENCES, "codec-preferences");
- g_object_class_override_property (gobject_class,
- PROP_CODECS, "codecs");
- g_object_class_override_property (gobject_class,
- PROP_CODECS_WITHOUT_CONFIG, "codecs-without-config");
- g_object_class_override_property (gobject_class,
- PROP_CURRENT_SEND_CODEC, "current-send-codec");
- g_object_class_override_property (gobject_class,
- PROP_TOS, "tos");
- g_object_class_override_property (gobject_class,
- PROP_CONFERENCE, "conference");
-
- gobject_class->dispose = fs_msn_session_dispose;
- gobject_class->finalize = fs_msn_session_finalize;
-
- g_type_class_add_private (klass, sizeof (FsMsnSessionPrivate));
-}
-
-static void
-fs_msn_session_init (FsMsnSession *self)
-{
- /* member init */
- self->priv = FS_MSN_SESSION_GET_PRIVATE (self);
- self->priv->construction_error = NULL;
-
- g_mutex_init (&self->priv->mutex);
-
- self->priv->media_type = FS_MEDIA_TYPE_LAST + 1;
-}
-
-
-static FsMsnConference *
-fs_msn_session_get_conference (FsMsnSession *self, GError **error)
-{
- FsMsnConference *conference;
-
- g_mutex_lock (&self->priv->mutex);
- conference = self->priv->conference;
- if (conference)
- g_object_ref (conference);
- g_mutex_unlock (&self->priv->mutex);
-
- if (!conference)
- g_set_error (error, FS_ERROR, FS_ERROR_DISPOSED,
- "Called function after session has been disposed");
-
- return conference;
-}
-
-
-static void
-fs_msn_session_dispose (GObject *object)
-{
- FsMsnSession *self = FS_MSN_SESSION (object);
- GstBin *conferencebin = NULL;
- FsMsnConference *conference = fs_msn_session_get_conference (self, NULL);
- GstElement *valve = NULL;
-
- g_mutex_lock (&self->priv->mutex);
- self->priv->conference = NULL;
- g_mutex_unlock (&self->priv->mutex);
-
- if (!conference)
- goto out;
-
- if (self->priv->stream)
- {
- g_object_weak_unref (G_OBJECT (self->priv->stream), _remove_stream, self);
- fs_stream_destroy (FS_STREAM (self->priv->stream));
- self->priv->stream = NULL;
- }
-
- conferencebin = GST_BIN (conference);
-
- if (!conferencebin)
- goto out;
-
- if (self->priv->media_sink_pad)
- gst_pad_set_active (self->priv->media_sink_pad, FALSE);
-
- GST_OBJECT_LOCK (conference);
- valve = self->valve;
- self->valve = NULL;
- GST_OBJECT_UNLOCK (conference);
-
- if (valve)
- {
- gst_element_set_locked_state (valve, TRUE);
- gst_element_set_state (valve, GST_STATE_NULL);
- gst_bin_remove (conferencebin, valve);
- }
-
- if (self->priv->media_sink_pad)
- gst_element_remove_pad (GST_ELEMENT (conference),
- self->priv->media_sink_pad);
- self->priv->media_sink_pad = NULL;
-
- gst_object_unref (conferencebin);
- gst_object_unref (conference);
-
- out:
-
- G_OBJECT_CLASS (fs_msn_session_parent_class)->dispose (object);
-}
-
-static void
-fs_msn_session_finalize (GObject *object)
-{
- FsMsnSession *self = FS_MSN_SESSION (object);
-
- g_mutex_clear (&self->priv->mutex);
-
- G_OBJECT_CLASS (fs_msn_session_parent_class)->finalize (object);
-}
-
-static void
-fs_msn_session_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- FsMsnSession *self = FS_MSN_SESSION (object);
- FsMsnConference *conference = fs_msn_session_get_conference (self, NULL);
-
- if (!conference)
- return;
-
- switch (prop_id)
- {
- case PROP_MEDIA_TYPE:
- g_value_set_enum (value, self->priv->media_type);
- break;
- case PROP_ID:
- g_value_set_uint (value, 1);
- break;
- case PROP_CONFERENCE:
- g_value_set_object (value, self->priv->conference);
- break;
- case PROP_SINK_PAD:
- g_value_set_object (value, self->priv->media_sink_pad);
- break;
- case PROP_CODEC_PREFERENCES:
- /* There are no preferences, so return NULL */
- break;
- case PROP_CODECS:
- case PROP_CODECS_WITHOUT_CONFIG:
- {
- GList *codecs = NULL;
- FsCodec *mimic_codec = fs_codec_new (FS_CODEC_ID_ANY, "mimic",
- FS_MEDIA_TYPE_VIDEO, 0);
- codecs = g_list_append (codecs, mimic_codec);
- g_value_take_boxed (value, codecs);
- }
- break;
- case PROP_CURRENT_SEND_CODEC:
- {
- FsCodec *send_codec = fs_codec_new (FS_CODEC_ID_ANY, "mimic",
- FS_MEDIA_TYPE_VIDEO, 0);
- g_value_take_boxed (value, send_codec);
- break;
- }
- case PROP_TOS:
- GST_OBJECT_LOCK (conference);
- g_value_set_uint (value, self->priv->tos);
- GST_OBJECT_UNLOCK (conference);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- gst_object_unref (conference);
-}
-
-static void
-fs_msn_session_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- FsMsnSession *self = FS_MSN_SESSION (object);
- FsMsnConference *conference = fs_msn_session_get_conference (self, NULL);
-
- if (!conference && !(pspec->flags & G_PARAM_CONSTRUCT_ONLY))
- return;
-
- switch (prop_id)
- {
- case PROP_MEDIA_TYPE:
- self->priv->media_type = g_value_get_enum (value);
- break;
- case PROP_ID:
- break;
- case PROP_CONFERENCE:
- self->priv->conference = FS_MSN_CONFERENCE (g_value_dup_object (value));
- break;
- case PROP_TOS:
- if (conference)
- GST_OBJECT_LOCK (conference);
- self->priv->tos = g_value_get_uint (value);
- if (self->priv->stream)
- fs_msn_stream_set_tos_locked (self->priv->stream, self->priv->tos);
- if (conference)
- GST_OBJECT_UNLOCK (conference);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- if (conference)
- gst_object_unref (conference);
-}
-
-static void
-fs_msn_session_constructed (GObject *object)
-{
- FsMsnSession *self = FS_MSN_SESSION (object);
- GstPad *pad;
-
- g_assert (self->priv->conference);
-
- self->valve = gst_element_factory_make ("valve", NULL);
-
- if (!self->valve)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION, "Could not make sink valve");
- return;
- }
-
- if (!gst_bin_add (GST_BIN (self->priv->conference), self->valve))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION, "Could not add valve to conference");
- return;
- }
-
- g_object_set (G_OBJECT (self->valve), "drop", TRUE, NULL);
-
- pad = gst_element_get_static_pad (self->valve, "sink");
- self->priv->media_sink_pad = gst_ghost_pad_new ("sink1", pad);
- gst_object_unref (pad);
-
- if (!self->priv->media_sink_pad)
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION, "Could not create sink ghost pad");
- return;
- }
-
- gst_pad_set_active (self->priv->media_sink_pad, TRUE);
- if (!gst_element_add_pad (GST_ELEMENT (self->priv->conference),
- self->priv->media_sink_pad))
- {
- self->priv->construction_error = g_error_new (FS_ERROR,
- FS_ERROR_CONSTRUCTION, "Could not add sink pad to conference");
- gst_object_unref (self->priv->media_sink_pad);
- self->priv->media_sink_pad = NULL;
- return;
- }
-
- gst_element_sync_state_with_parent (self->valve);
-
- if (G_OBJECT_CLASS (fs_msn_session_parent_class)->constructed)
- G_OBJECT_CLASS (fs_msn_session_parent_class)->constructed (object);
-}
-
-
-static void
-_remove_stream (gpointer user_data,
- GObject *where_the_object_was)
-{
- FsMsnSession *self = FS_MSN_SESSION (user_data);
- FsMsnConference *conference = fs_msn_session_get_conference (self, NULL);
-
- if (!conference)
- return;
-
- GST_OBJECT_LOCK (conference);
- if (self->priv->stream == (FsMsnStream *) where_the_object_was)
- self->priv->stream = NULL;
- GST_OBJECT_UNLOCK (conference);
- gst_object_unref (conference);
-}
-
-/**
- * fs_msn_session_new_stream:
- * @session: an #FsMsnSession
- * @participant: #FsParticipant of a participant for the new stream
- * @direction: #FsStreamDirection describing the direction of the new stream
- * that will be created for this participant
- * @error: location of a #GError, or NULL if no error occured
- *
- * This function creates a stream for the given participant into the active
- * session.
- *
- * Returns: the new #FsStream that has been created. User must unref the
- * #FsStream when the stream is ended. If an error occured, returns NULL.
- */
-static FsStream *
-fs_msn_session_new_stream (FsSession *session,
- FsParticipant *participant,
- FsStreamDirection direction,
- GError **error)
-{
- FsMsnSession *self = FS_MSN_SESSION (session);
- FsMsnParticipant *msnparticipant = NULL;
- FsStream *new_stream = NULL;
- FsMsnConference *conference;
-
- if (!FS_IS_MSN_PARTICIPANT (participant))
- {
- g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
- "You have to provide a participant of type MSN");
- return NULL;
- }
-
- conference = fs_msn_session_get_conference (self, error);
- if (!conference)
- return FALSE;
-
- GST_OBJECT_LOCK (conference);
- if (self->priv->stream)
- goto already_have_stream;
- GST_OBJECT_UNLOCK (conference);
-
- msnparticipant = FS_MSN_PARTICIPANT (participant);
-
- new_stream = FS_STREAM_CAST (fs_msn_stream_new (self, msnparticipant,
- direction, conference));
-
- GST_OBJECT_LOCK (conference);
- if (self->priv->stream)
- {
- g_object_unref (new_stream);
- goto already_have_stream;
- }
- self->priv->stream = (FsMsnStream *) new_stream;
- g_object_weak_ref (G_OBJECT (new_stream), _remove_stream, self);
-
- fs_msn_stream_set_tos_locked (self->priv->stream, self->priv->tos);
- GST_OBJECT_UNLOCK (conference);
-
- gst_object_unref (conference);
-
-
- return new_stream;
-
- already_have_stream:
- GST_OBJECT_UNLOCK (conference);
- gst_object_unref (conference);
-
- g_set_error (error, FS_ERROR, FS_ERROR_ALREADY_EXISTS,
- "There already is a stream in this session");
- return NULL;
-}
-
-FsMsnSession *
-fs_msn_session_new (FsMediaType media_type,
- FsMsnConference *conference,
- GError **error)
-{
- FsMsnSession *session = g_object_new (FS_TYPE_MSN_SESSION,
- "media-type", media_type,
- "conference", conference,
- NULL);
-
- if (!session)
- {
- *error = g_error_new (FS_ERROR, FS_ERROR_CONSTRUCTION,
- "Could not create object");
- }
- else if (session->priv->construction_error)
- {
- g_propagate_error (error, session->priv->construction_error);
- g_object_unref (session);
- return NULL;
- }
-
- return session;
-}
-
-
-static GType
-fs_msn_session_get_stream_transmitter_type (FsSession *session,
- const gchar *transmitter)
-{
- return FS_TYPE_MSN_STREAM;
-}
diff --git a/gst/fsmsnconference/fs-msn-session.h b/gst/fsmsnconference/fs-msn-session.h
deleted file mode 100644
index 79189e17..00000000
--- a/gst/fsmsnconference/fs-msn-session.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Farstream - Farstream MSN Session
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * fs-msn-session.h - A Farstream Msn Session gobject
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FS_MSN_SESSION_H__
-#define __FS_MSN_SESSION_H__
-
-#include <gst/gst.h>
-
-#include <farstream/fs-session.h>
-
-#include "fs-msn-conference.h"
-
-G_BEGIN_DECLS
-
-/* TYPE MACROS */
-#define FS_TYPE_MSN_SESSION \
- (fs_msn_session_get_type ())
-#define FS_MSN_SESSION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_MSN_SESSION, FsMsnSession))
-#define FS_MSN_SESSION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_MSN_SESSION, FsMsnSessionClass))
-#define FS_IS_MSN_SESSION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_MSN_SESSION))
-#define FS_IS_MSN_SESSION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_MSN_SESSION))
-#define FS_MSN_SESSION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), FS_TYPE_MSN_SESSION, FsMsnSessionClass))
-#define FS_MSN_SESSION_CAST(obj) ((FsMsnSession *) (obj))
-
-typedef struct _FsMsnSession FsMsnSession;
-typedef struct _FsMsnSessionClass FsMsnSessionClass;
-typedef struct _FsMsnSessionPrivate FsMsnSessionPrivate;
-
-struct _FsMsnSessionClass
- {
- FsSessionClass parent_class;
- };
-
-/**
- * FsMsnSession:
- *
- */
-struct _FsMsnSession
-{
- FsSession parent;
-
- /* Protected by the conf lock */
- GstElement *valve;
-
- /*< private >*/
-
- FsMsnSessionPrivate *priv;
-};
-
-
-GType fs_msn_session_get_type (void);
-
-FsMsnSession *fs_msn_session_new (FsMediaType media_type,
- FsMsnConference *conference,
- GError **error);
-
-void fs_msn_session_new_recv_pad (FsMsnSession *session,
- GstPad *new_pad,
- guint32 ssrc, guint pt);
-
-G_END_DECLS
-
-#endif /* __FS_MSN_SESSION_H__ */
diff --git a/gst/fsmsnconference/fs-msn-stream.c b/gst/fsmsnconference/fs-msn-stream.c
deleted file mode 100644
index 7ac0a85e..00000000
--- a/gst/fsmsnconference/fs-msn-stream.c
+++ /dev/null
@@ -1,912 +0,0 @@
-/*
- * Farstream - Farstream MSN Stream
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007-2009 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- * @author: Youness Alaoui <youness.alaoui@collabora.co.uk>
- *
- * fs-msn-stream.c - A Farstream MSN Stream gobject
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SECTION:fs-msn-stream
- * @short_description: A MSN stream in a #FsMsnSession in a #FsMsnConference
- *
- * The #FsMsnStream::direction property can be used to pause the stream, but not
- * to change the direction between sending and receiving since this protocol
- * is unidirectional.
- *
- * The "foundation" field of the local #FsCandidate contains the "recipient-id"
- * that must be transmitted to the peer.
- *
- * The session id can either be retrieved as a property, but it is also
- * put into every #FsCandidate in the "username" field.
- *
- * If the peer started the webcam session, it picks the session-id, it can then
- * be set either in the transmitter parameters field of fs_session_new_stream()
- * or by putting it in the "username" field of the remote #FsCandidate.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "fs-msn-stream.h"
-
-#include <arpa/inet.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <gst/gst.h>
-
-#include <gst/base/gstbasesrc.h>
-
-
-#include "fs-msn-connection.h"
-
-
-#define GST_CAT_DEFAULT fsmsnconference_debug
-
-/* Signals */
-enum
-{
- LAST_SIGNAL
-};
-
-/* props */
-enum
-{
- PROP_0,
- PROP_DIRECTION,
- PROP_PARTICIPANT,
- PROP_SESSION,
- PROP_CONFERENCE,
- PROP_SESSION_ID,
- PROP_INITIAL_PORT
-};
-
-
-
-struct _FsMsnStreamPrivate
-{
- FsMsnConference *conference;
- FsMsnSession *session;
- FsMsnParticipant *participant;
- FsStreamDirection direction;
- GstElement *codecbin;
- GstElement *recv_valve;
- GstPad *src_pad;
- FsMsnConnection *connection;
-
- guint session_id;
- guint initial_port;
-
- gint fd;
- gint tos;
-
- GMutex mutex; /* protects the conference */
-};
-
-
-G_DEFINE_TYPE(FsMsnStream, fs_msn_stream, FS_TYPE_STREAM);
-
-#define FS_MSN_STREAM_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), FS_TYPE_MSN_STREAM, FsMsnStreamPrivate))
-
-static void fs_msn_stream_dispose (GObject *object);
-static void fs_msn_stream_finalize (GObject *object);
-
-static void fs_msn_stream_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void fs_msn_stream_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static gboolean
-fs_msn_stream_set_transmitter (FsStream *stream,
- const gchar *transmitter,
- GParameter *stream_transmitter_parameters,
- guint stream_transmitter_n_parameters,
- GError **error);
-
-static gboolean fs_msn_stream_add_remote_candidates (FsStream *stream,
- GList *candidates,
- GError **error);
-
-static void _local_candidates_prepared (FsMsnConnection *connection,
- gpointer user_data);
-
-static void _new_local_candidate (
- FsMsnConnection *connection,
- FsCandidate *candidate,
- gpointer user_data);
-
-static void
-_connected (
- FsMsnConnection *connection,
- guint fd,
- gpointer user_data);
-
-static void
-_connection_failed (FsMsnConnection *connection, FsMsnStream *self);
-
-
-static void
-fs_msn_stream_class_init (FsMsnStreamClass *klass)
-{
- GObjectClass *gobject_class;
- FsStreamClass *stream_class = FS_STREAM_CLASS (klass);
-
- gobject_class = (GObjectClass *) klass;
-
- gobject_class->set_property = fs_msn_stream_set_property;
- gobject_class->get_property = fs_msn_stream_get_property;
- gobject_class->dispose = fs_msn_stream_dispose;
- gobject_class->finalize = fs_msn_stream_finalize;
-
- stream_class->add_remote_candidates = fs_msn_stream_add_remote_candidates;
- stream_class->set_transmitter = fs_msn_stream_set_transmitter;
-
- g_type_class_add_private (klass, sizeof (FsMsnStreamPrivate));
-
- g_object_class_override_property (gobject_class,
- PROP_DIRECTION,
- "direction");
- g_object_class_override_property (gobject_class,
- PROP_PARTICIPANT,
- "participant");
- g_object_class_override_property (gobject_class,
- PROP_SESSION,
- "session");
-
- 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 | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class,
- PROP_SESSION_ID,
- g_param_spec_uint ("session-id",
- "The session-id of the session",
- "This is the session-id of the MSN session",
- 0, 9999, 0,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class,
- PROP_INITIAL_PORT,
- g_param_spec_uint ("initial-port",
- "The initial port to listen on",
- "The initial port to try to listen on for incoming connection."
- " If already used, port+1 is tried until one succeeds",
- 1025, 65535, 1025,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-fs_msn_stream_init (FsMsnStream *self)
-{
- /* member init */
- self->priv = FS_MSN_STREAM_GET_PRIVATE (self);
-
- self->priv->session = NULL;
- self->priv->participant = NULL;
- self->priv->fd = -1;
-
- self->priv->direction = FS_DIRECTION_NONE;
-
- g_mutex_init (&self->priv->mutex);
-}
-
-
-static FsMsnConference *
-fs_msn_stream_get_conference (FsMsnStream *self, GError **error)
-{
- FsMsnConference *conference;
-
- g_mutex_lock (&self->priv->mutex);
- conference = self->priv->conference;
- if (conference)
- g_object_ref (conference);
- g_mutex_unlock (&self->priv->mutex);
-
- if (!conference)
- g_set_error (error, FS_ERROR, FS_ERROR_DISPOSED,
- "Called function after stream has been disposed");
-
- return conference;
-}
-
-static void
-fs_msn_stream_dispose (GObject *object)
-{
- FsMsnStream *self = FS_MSN_STREAM (object);
- FsMsnConference *conference = fs_msn_stream_get_conference (self, NULL);
-
- if (!conference)
- return;
-
- g_mutex_lock (&self->priv->mutex);
- self->priv->conference = NULL;
- g_mutex_unlock (&self->priv->mutex);
-
- if (self->priv->src_pad)
- {
- gst_pad_set_active (self->priv->src_pad, FALSE);
- gst_element_remove_pad (GST_ELEMENT (conference), self->priv->src_pad);
- self->priv->src_pad = NULL;
- }
-
- if (self->priv->recv_valve)
- {
- gst_object_unref (self->priv->recv_valve);
- self->priv->recv_valve = NULL;
- }
-
- if (self->priv->codecbin)
- {
- gst_element_set_locked_state (self->priv->codecbin, TRUE);
- gst_element_set_state (self->priv->codecbin, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (conference), self->priv->codecbin);
- self->priv->codecbin = NULL;
- }
-
- if (self->priv->participant)
- {
- g_object_unref (self->priv->participant);
- self->priv->participant = NULL;
- }
-
- if (self->priv->session)
- {
- g_object_unref (self->priv->session);
- self->priv->session = NULL;
- }
-
- if (self->priv->connection)
- {
- g_object_unref (self->priv->connection);
- self->priv->connection = NULL;
- }
-
- gst_object_unref (conference);
- gst_object_unref (conference);
-
- G_OBJECT_CLASS (fs_msn_stream_parent_class)->dispose (object);
-}
-
-static void
-fs_msn_stream_finalize (GObject *object)
-{
- FsMsnStream *self = FS_MSN_STREAM (object);
-
- g_mutex_clear (&self->priv->mutex);
-
- G_OBJECT_CLASS (fs_msn_stream_parent_class)->finalize (object);
-}
-
-
-static void
-fs_msn_stream_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- FsMsnStream *self = FS_MSN_STREAM (object);
- FsMsnConference *conference = fs_msn_stream_get_conference (self, NULL);
-
- if (!conference &&
- !(pspec->flags & (G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT)))
- return;
-
- if (conference)
- GST_OBJECT_LOCK (conference);
-
- 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_CONFERENCE:
- g_value_set_object (value, self->priv->conference);
- break;
- case PROP_SESSION_ID:
- g_object_get_property (G_OBJECT (self->priv->connection), "session-id",
- value);
- break;
- case PROP_INITIAL_PORT:
- g_value_set_uint (value, self->priv->initial_port);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- if (conference)
- {
- GST_OBJECT_UNLOCK (conference);
- gst_object_unref (conference);
- }
-}
-
-static void
-fs_msn_stream_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- FsMsnStream *self = FS_MSN_STREAM (object);
- FsMsnConference *conference = fs_msn_stream_get_conference (self, NULL);
-
- if (!conference &&
- !(pspec->flags & (G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT)))
- return;
-
- if (conference)
- GST_OBJECT_LOCK (conference);
-
- 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:
- if (g_value_get_flags (value) != self->priv->direction)
- {
- GstElement *recv_valve = NULL;
- GstElement *session_valve = NULL;
-
- if (!conference ||
- !self->priv->recv_valve ||
- !self->priv->session)
- {
- self->priv->direction = g_value_get_flags (value);
- break;
- }
-
- if (self->priv->recv_valve)
- recv_valve = gst_object_ref (self->priv->recv_valve);
- if (self->priv->session->valve)
- session_valve = gst_object_ref (self->priv->session->valve);
-
- self->priv->direction =
- g_value_get_flags (value) & conference->max_direction;
-
- if (self->priv->direction == FS_DIRECTION_NONE)
- {
- GST_OBJECT_UNLOCK (conference);
- if (recv_valve)
- g_object_set (recv_valve, "drop", TRUE, NULL);
- g_object_set (session_valve, "drop", TRUE, NULL);
- GST_OBJECT_LOCK (conference);
- }
- else if (self->priv->direction == FS_DIRECTION_SEND)
- {
- if (self->priv->codecbin)
- {
- GST_OBJECT_UNLOCK (conference);
- g_object_set (session_valve, "drop", FALSE, NULL);
- GST_OBJECT_LOCK (conference);
- }
- }
- else if (self->priv->direction == FS_DIRECTION_RECV)
- {
- GST_OBJECT_UNLOCK (conference);
- if (recv_valve)
- g_object_set (recv_valve, "drop", FALSE, NULL);
- GST_OBJECT_LOCK (conference);
- }
-
- if (session_valve)
- gst_object_unref (session_valve);
- if (recv_valve)
- gst_object_unref (recv_valve);
- }
- 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_SESSION_ID:
- self->priv->session_id = g_value_get_uint (value);
- if (self->priv->session_id == 0)
- self->priv->session_id = g_random_int_range (9000, 9999);
- break;
- case PROP_INITIAL_PORT:
- self->priv->initial_port = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-
- if (conference)
- {
- GST_OBJECT_UNLOCK (conference);
- gst_object_unref (conference);
- }
-}
-
-static void
-_local_candidates_prepared (FsMsnConnection *connection,
- gpointer user_data)
-{
- FsMsnStream *self = FS_MSN_STREAM (user_data);
- FsMsnConference *conference = fs_msn_stream_get_conference (self, NULL);
-
- if (!conference)
- return;
-
- gst_element_post_message (GST_ELEMENT (conference),
- gst_message_new_element (GST_OBJECT (conference),
- gst_structure_new ("farstream-local-candidates-prepared",
- "stream", FS_TYPE_STREAM, self,
- NULL)));
-
- gst_object_unref (conference);
-}
-
-static void
-_new_local_candidate (
- FsMsnConnection *connection,
- FsCandidate *candidate,
- gpointer user_data)
-{
- FsMsnStream *self = FS_MSN_STREAM (user_data);
- FsMsnConference *conference = fs_msn_stream_get_conference (self, NULL);
-
- if (!conference)
- return;
-
- gst_element_post_message (GST_ELEMENT (conference),
- gst_message_new_element (GST_OBJECT (conference),
- gst_structure_new ("farstream-new-local-candidate",
- "stream", FS_TYPE_STREAM, self,
- "candidate", FS_TYPE_CANDIDATE, candidate,
- NULL)));
-
- gst_object_unref (conference);
-}
-
-static void
-_connected (
- FsMsnConnection *connection,
- guint fd,
- gpointer user_data)
-{
- FsMsnStream *self = FS_MSN_STREAM (user_data);
- GError *error = NULL;
- GstPad *pad;
- GstElement *fdelem;
- int checkfd;
- FsMsnConference *conference = fs_msn_stream_get_conference (self, NULL);
- GstElement *codecbin = NULL;
- GstElement *recv_valve = NULL;
- GstElement *send_valve = NULL;
- gboolean drop;
-
- if (!conference)
- goto error;
-
- GST_DEBUG ("******** CONNECTED %d**********", fd);
-
- gst_element_post_message (GST_ELEMENT (conference),
- gst_message_new_element (GST_OBJECT (conference),
- gst_structure_new ("farstream-component-state-changed",
- "stream", FS_TYPE_STREAM, self,
- "component", G_TYPE_UINT, 1,
- "state", FS_TYPE_STREAM_STATE, FS_STREAM_STATE_READY,
- NULL)));
-
- if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
- codecbin = gst_parse_bin_from_description (
- "fdsrc name=fdsrc do-timestamp=true ! mimdec ! valve name=recv_valve", TRUE, &error);
- else
- codecbin = gst_parse_bin_from_description (
- "videoconvert ! videoscale ! mimenc name=enc !"
- " fdsink name=fdsink sync=false async=false",
- TRUE, &error);
-
- if (!codecbin)
- {
- g_prefix_error (&error, "Error creating codecbin: ");
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- error->message);
- g_clear_error (&error);
- goto error;
- }
-
- /* So we don't require an unlreased gst-plugins-bad mimenc */
- if (self->priv->conference->max_direction == FS_DIRECTION_SEND)
- {
- GstElement *mimenc = gst_bin_get_by_name (GST_BIN (codecbin), "enc");
- if (g_object_class_find_property (
- G_OBJECT_GET_CLASS (mimenc), "paused-mode"))
- g_object_set (mimenc, "paused-mode", TRUE, NULL);
- gst_object_unref (mimenc);
- }
-
- if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
- {
- fdelem = gst_bin_get_by_name (GST_BIN (codecbin), "fdsrc");
- gst_base_src_set_format (GST_BASE_SRC (fdelem), GST_FORMAT_TIME);
- }
- else
- {
- fdelem = gst_bin_get_by_name (GST_BIN (codecbin), "fdsink");
- }
-
- if (!fdelem)
- {
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not get fd element");
- goto error;
- }
-
- g_object_set (fdelem, "fd", fd, NULL);
- g_object_get (fdelem, "fd", &checkfd, NULL);
- gst_object_unref (fdelem);
-
- if (fd != checkfd)
- {
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_INTERNAL,
- "Could not set file descriptor");
- goto error;
- }
-
-
- if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
- pad = gst_element_get_static_pad (codecbin, "src");
- else
- pad = gst_element_get_static_pad (codecbin, "sink");
-
- if (!pad)
- {
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not get codecbin pad");
- goto error;
- }
-
- if (!gst_bin_add (GST_BIN (conference), codecbin))
- {
- gst_object_unref (pad);
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not add codecbin to the conference");
- goto error;
- }
-
- GST_OBJECT_LOCK (conference);
- self->priv->fd = fd;
- self->priv->codecbin = gst_object_ref (codecbin);
- GST_OBJECT_UNLOCK (conference);
-
- if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
- {
- FsCodec *mimic_codec;
- GstPad *src_pad;
-
- src_pad = gst_ghost_pad_new ("src_1_1_1", pad);
- gst_object_unref (pad);
-
- GST_OBJECT_LOCK (conference);
- self->priv->src_pad = gst_object_ref (src_pad);
- GST_OBJECT_UNLOCK (conference);
-
- gst_pad_set_active (src_pad, TRUE);
- if (!gst_element_add_pad (GST_ELEMENT (conference), src_pad))
- {
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not add src_1_1_1 pad");
- gst_object_unref (src_pad);
- goto error;
- }
-
- recv_valve = gst_bin_get_by_name (GST_BIN (codecbin), "recv_valve");
-
- if (!recv_valve)
- {
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not get recv_valve");
- gst_object_unref (src_pad);
- goto error;
- }
-
- GST_OBJECT_LOCK (conference);
- self->priv->recv_valve = gst_object_ref (recv_valve);
- drop = !(self->priv->direction & FS_DIRECTION_RECV);
- GST_OBJECT_UNLOCK (conference);
-
- g_object_set (recv_valve, "drop", drop, NULL);
-
-
- mimic_codec = fs_codec_new (0, "mimic",
- FS_MEDIA_TYPE_VIDEO, 0);
- fs_stream_emit_src_pad_added (FS_STREAM (self), src_pad, mimic_codec);
- fs_codec_destroy (mimic_codec);
- gst_object_unref (src_pad);
-
- }
- else
- {
- GstPad *valvepad;
-
- GST_OBJECT_LOCK (conference);
- if (self->priv->session->valve)
- send_valve = gst_object_ref (self->priv->session->valve);
- GST_OBJECT_UNLOCK (conference);
-
- if (!send_valve)
- {
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_DISPOSED,
- "Session was disposed");
- goto error;
- }
-
- valvepad = gst_element_get_static_pad (send_valve, "src");
-
- if (!valvepad)
- {
- gst_object_unref (pad);
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not get valve sink pad");
- goto error;
- }
-
- if (GST_PAD_LINK_FAILED (gst_pad_link (valvepad, pad)))
- {
- gst_object_unref (valvepad);
- gst_object_unref (pad);
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not link valve to codec bin");
- goto error;
- }
- gst_object_unref (valvepad);
- gst_object_unref (pad);
- }
-
- if (!gst_element_sync_state_with_parent (codecbin))
- {
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONSTRUCTION,
- "Could not start codec bin");
- goto error;
- }
-
- if (self->priv->conference->max_direction == FS_DIRECTION_SEND)
- {
- GST_OBJECT_LOCK (conference);
- fs_msn_stream_set_tos_locked (self, self->priv->tos);
- drop = !(self->priv->direction & FS_DIRECTION_SEND);
- GST_OBJECT_UNLOCK (conference);
- g_object_set (send_valve, "drop", drop, NULL);
- }
-
- error:
-
- if (send_valve)
- gst_object_unref (send_valve);
- if (recv_valve)
- gst_object_unref (recv_valve);
- if (codecbin)
- gst_object_unref (codecbin);
- if (conference)
- gst_object_unref (conference);
-}
-
-static void
-_connection_failed (FsMsnConnection *connection, FsMsnStream *self)
-{
- FsMsnConference *conference = fs_msn_stream_get_conference (self, NULL);
-
- if (!conference)
- return;
-
- GST_OBJECT_LOCK (conference);
- self->priv->fd = -1;
- GST_OBJECT_UNLOCK (conference);
-
- gst_element_post_message (GST_ELEMENT (conference),
- gst_message_new_element (GST_OBJECT (conference),
- gst_structure_new ("farstream-component-state-changed",
- "stream", FS_TYPE_STREAM, self,
- "component", G_TYPE_UINT, 1,
- "state", FS_TYPE_STREAM_STATE, FS_STREAM_STATE_FAILED,
- NULL)));
-
- fs_stream_emit_error (FS_STREAM (self), FS_ERROR_CONNECTION_FAILED,
- "Could not establish streaming connection");
-
- gst_object_unref (conference);
-}
-
-/**
- * fs_msn_stream_add_remote_candidate:
- */
-static gboolean
-fs_msn_stream_add_remote_candidates (FsStream *stream, GList *candidates,
- GError **error)
-{
- FsMsnStream *self = FS_MSN_STREAM (stream);
- FsMsnConference *conference = fs_msn_stream_get_conference (self, error);
- FsMsnConnection *conn = NULL;
- gboolean ret = FALSE;
-
- if (!conference)
- return FALSE;
-
- GST_OBJECT_LOCK (conference);
- if (self->priv->connection)
- conn = g_object_ref (self->priv->connection);
- GST_OBJECT_UNLOCK (conference);
-
- if (conn)
- {
- ret = fs_msn_connection_add_remote_candidates (conn, candidates, error);
- g_object_unref (conn);
- }
-
- if (ret)
- gst_element_post_message (GST_ELEMENT (conference),
- gst_message_new_element (GST_OBJECT (conference),
- gst_structure_new ("farstream-component-state-changed",
- "stream", FS_TYPE_STREAM, self,
- "component", G_TYPE_UINT, 1,
- "state", FS_TYPE_STREAM_STATE, FS_STREAM_STATE_CONNECTING,
- NULL)));
-
- gst_object_unref (conference);
-
- return ret;
-}
-
-
-/**
- * fs_msn_stream_new:
- * @session: The #FsMsnSession this stream is a child of
- * @participant: The #FsMsnParticipant this stream is for
- * @direction: the initial #FsDirection for this stream
- *
- *
- * This function create a new stream
- *
- * Returns: the newly created string or NULL on error
- */
-
-FsMsnStream *
-fs_msn_stream_new (FsMsnSession *session,
- FsMsnParticipant *participant,
- FsStreamDirection direction,
- FsMsnConference *conference)
-{
- FsMsnStream *self;
-
- self = g_object_new (FS_TYPE_MSN_STREAM,
- "session", session,
- "participant", participant,
- "direction", direction,
- "conference", conference,
- NULL);
-
- return self;
-}
-
-void
-fs_msn_stream_set_tos_locked (FsMsnStream *self, gint tos)
-{
- self->priv->tos = tos;
-
- if (self->priv->fd < 0)
- return;
-
- if (setsockopt (self->priv->fd, IPPROTO_IP, IP_TOS, &tos, sizeof (tos)) < 0)
- GST_WARNING ( "could not set socket ToS: %s", g_strerror (errno));
-
-#ifdef IPV6_TCLASS
- if (setsockopt (self->priv->fd, IPPROTO_IPV6, IPV6_TCLASS,
- &tos, sizeof (tos)) < 0)
- GST_WARNING ("could not set TCLASS: %s", g_strerror (errno));
-#endif
-}
-
-
-static gboolean
-fs_msn_stream_set_transmitter (FsStream *stream,
- const gchar *transmitter,
- GParameter *stream_transmitter_parameters,
- guint stream_transmitter_n_parameters,
- GError **error)
-{
- FsMsnStream *self = FS_MSN_STREAM (stream);
- FsMsnConference *conference = fs_msn_stream_get_conference (self, error);
- gboolean producer;
- guint i;
-
- if (!conference)
- return FALSE;
-
- for (i = 0; i < stream_transmitter_n_parameters; i++)
- {
- if (!g_ascii_strcasecmp (stream_transmitter_parameters[i].name,
- "session-id"))
- {
- if (g_value_get_uint (&stream_transmitter_parameters[i].value) >= 1025 &&
- g_value_get_uint (&stream_transmitter_parameters[i].value) < 65536)
- self->priv->session_id =
- g_value_get_uint (&stream_transmitter_parameters[i].value);
- }
- else if (!g_ascii_strcasecmp (stream_transmitter_parameters[i].name,
- "initial-port"))
- {
- if (g_value_get_uint (&stream_transmitter_parameters[i].value) < 10000)
- self->priv->initial_port =
- g_value_get_uint (&stream_transmitter_parameters[i].value);
- }
- }
-
- if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
- producer = FALSE;
- else if (self->priv->conference->max_direction == FS_DIRECTION_SEND)
- producer = TRUE;
- else
- g_assert_not_reached ();
-
-
- self->priv->connection = fs_msn_connection_new (self->priv->session_id,
- producer, self->priv->initial_port);
-
- g_signal_connect (self->priv->connection,
- "new-local-candidate",
- G_CALLBACK (_new_local_candidate), self);
- g_signal_connect (self->priv->connection,
- "local-candidates-prepared",
- G_CALLBACK (_local_candidates_prepared), self);
- g_signal_connect (self->priv->connection,
- "connected",
- G_CALLBACK (_connected), self);
- g_signal_connect (self->priv->connection,
- "connection-failed",
- G_CALLBACK (_connection_failed), self);
-
- if (!fs_msn_connection_gather_local_candidates (self->priv->connection,
- error))
- {
- g_object_unref (self->priv->connection);
- self->priv->connection = NULL;
- g_object_unref (conference);
- return FALSE;
- }
-
- g_object_unref (conference);
-
- return TRUE;
-}
diff --git a/gst/fsmsnconference/fs-msn-stream.h b/gst/fsmsnconference/fs-msn-stream.h
deleted file mode 100644
index 725c8968..00000000
--- a/gst/fsmsnconference/fs-msn-stream.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Farstream - Farstream MSN Stream
- *
- * Copyright 2008 Richard Spiers <richard.spiers@gmail.com>
- * Copyright 2007 Nokia Corp.
- * Copyright 2007 Collabora Ltd.
- * @author: Olivier Crete <olivier.crete@collabora.co.uk>
- *
- * fs-msn-stream.h - A Farstream MSN Stream
- *
- * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FS_MSN_STREAM_H__
-#define __FS_MSN_STREAM_H__
-
-#include <farstream/fs-stream.h>
-
-#include "fs-msn-participant.h"
-#include "fs-msn-session.h"
-
-G_BEGIN_DECLS
-
-/* TYPE MACROS */
-#define FS_TYPE_MSN_STREAM \
- (fs_msn_stream_get_type ())
-#define FS_MSN_STREAM(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), FS_TYPE_MSN_STREAM, FsMsnStream))
-#define FS_MSN_STREAM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), FS_TYPE_MSN_STREAM, FsMsnStreamClass))
-#define FS_IS_MSN_STREAM(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), FS_TYPE_MSN_STREAM))
-#define FS_IS_MSN_STREAM_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), FS_TYPE_MSN_STREAM))
-#define FS_MSN_STREAM_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), FS_TYPE_MSN_STREAM, FsMsnStreamClass))
-#define FS_MSN_STREAM_CAST(obj) ((FsMsnStream*) (obj))
-
-typedef struct _FsMsnStream FsMsnStream;
-typedef struct _FsMsnStreamClass FsMsnStreamClass;
-typedef struct _FsMsnStreamPrivate FsMsnStreamPrivate;
-
-
-struct _FsMsnStreamClass
-{
- FsStreamClass parent_class;
-
-};
-
-/**
- * FsMsnStream:
- *
- */
-struct _FsMsnStream
-{
- FsStream parent;
-
- /*< private >*/
- FsMsnStreamPrivate *priv;
-};
-
-GType fs_msn_stream_get_type (void);
-
-FsMsnStream *fs_msn_stream_new (FsMsnSession *session,
- FsMsnParticipant *participant,
- FsStreamDirection direction,
- FsMsnConference *conference);
-
-void fs_msn_stream_set_tos_locked (FsMsnStream *self, gint tos);
-
-
-G_END_DECLS
-
-#endif /* __FS_MSN_STREAM_H__ */
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index a963967b..d50fc264 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -55,7 +55,6 @@ check_PROGRAMS = \
rtp/sendcodecs \
rtp/conference \
rtp/recvcodecs \
- msn/conference \
utils/binadded
AM_CFLAGS = \
@@ -156,10 +155,6 @@ rtp_sendcodecs_SOURCES = \
rtp_recvcodecs_CFLAGS = $(AM_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
rtp_recvcodecs_LDADD = $(LDADD) -lgstrtp-@GST_API_VERSION@
-msn_conference_CFLAGS = $(AM_CFLAGS)
-msn_conference_SOURCES = \
- msn/conference.c
-
utils_binadded_CFLAGS = $(AM_CFLAGS)
utils_binadded_SOURCES = \
testutils.c \
diff --git a/tests/check/msn/conference.c b/tests/check/msn/conference.c
deleted file mode 100644
index 1e3a209e..00000000
--- a/tests/check/msn/conference.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/* Farstream unit tests for FsMsnConference
- *
- * Copyright (C) 2009 Collabora
- * @author: Olivier Crete <olivier.crete@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 Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/check/gstcheck.h>
-#include <farstream/fs-conference.h>
-
-#include "check-threadsafe.h"
-
-GMainLoop *loop;
-int count = 0;
-
-#define WAITING_ON_LAST_CODEC (1<<0)
-#define SHOULD_BE_LAST_CODEC (1<<1)
-#define HAS_BEEN_RESET (1<<2)
-
-gint max_buffer_count = 20;
-
-
-struct SimpleMsnConference {
- GstElement *pipeline;
- FsConference *conf;
- FsSession *session;
- FsParticipant *part;
- FsStream *stream;
-
- struct SimpleMsnConference *target;
- FsStreamDirection direction;
-};
-
-static gboolean
-bus_watch (GstBus *bus, GstMessage *message, gpointer user_data)
-{
- struct SimpleMsnConference *dat = user_data;
-
- switch (GST_MESSAGE_TYPE (message))
- {
- case GST_MESSAGE_ELEMENT:
- {
- const GstStructure *s = gst_message_get_structure (message);
- ts_fail_if (s==NULL, "NULL structure in element message");
- if (gst_structure_has_name (s, "farstream-error"))
- {
- const GValue *value;
- FsError errorno;
- const gchar *error;
-
- ts_fail_unless (
- gst_structure_has_field_typed (s, "src-object", G_TYPE_OBJECT),
- "farstream-error structure has no src-object field");
- ts_fail_unless (
- gst_structure_has_field_typed (s, "error-no", FS_TYPE_ERROR),
- "farstream-error structure has no src-object field");
- ts_fail_unless (
- gst_structure_has_field_typed (s, "error-msg", G_TYPE_STRING),
- "farstream-error structure has no src-object field");
-
- value = gst_structure_get_value (s, "error-no");
- errorno = g_value_get_enum (value);
- error = gst_structure_get_string (s, "error-msg");
-
- ts_fail ("Error on BUS (%d) %s", errorno, error);
- }
- else if (gst_structure_has_name (s, "farstream-new-local-candidate"))
- {
- FsStream *stream;
- FsCandidate *candidate;
- const GValue *value;
-
- ts_fail_unless (
- gst_structure_has_field_typed (s, "stream", FS_TYPE_STREAM),
- "farstream-new-local-candidate structure has no stream field");
- ts_fail_unless (
- gst_structure_has_field_typed (s, "candidate", FS_TYPE_CANDIDATE),
- "farstream-new-local-candidate structure has no candidate field");
-
- value = gst_structure_get_value (s, "stream");
- stream = g_value_get_object (value);
-
- value = gst_structure_get_value (s, "candidate");
- candidate = g_value_get_boxed (value);
-
- ts_fail_unless (stream && candidate, "new-local-candidate with NULL"
- " stream(%p) or candidate(%p)", stream, candidate);
-
- if (dat->target)
- {
- GError *error = NULL;
- GList *list = g_list_append (NULL, candidate);
- gboolean add_remote_candidates_res;
-
- GST_DEBUG ("Setting candidate: %s %d",
- candidate->ip, candidate->port);
- add_remote_candidates_res = fs_stream_add_remote_candidates (
- dat->target->stream, list, &error);
- ts_fail_unless (add_remote_candidates_res,
- "Could not set remote candidate: %s",
- error ? error->message : "No GError");
- ts_fail_unless (error == NULL);
- g_list_free (list);
- }
- }
- }
- break;
- case GST_MESSAGE_ERROR:
- {
- GError *error = NULL;
- gchar *debug = NULL;
- gst_message_parse_error (message, &error, &debug);
-
- ts_fail ("Got an error on the BUS (%d): %s (%s)", error->code,
- error->message, debug);
- g_error_free (error);
- g_free (debug);
- }
- break;
- case GST_MESSAGE_WARNING:
- {
- GError *error = NULL;
- gchar *debug = NULL;
- gst_message_parse_warning (message, &error, &debug);
-
- GST_DEBUG ("%d: Got a warning on the BUS: %s (%s)",
- error->code,
- error->message, debug);
- g_error_free (error);
- g_free (debug);
- }
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-
-static GstPadProbeReturn
-pad_probe_cb (GstPad *pad, GstPadProbeInfo *info, gpointer user_data)
-{
- count++;
-
- if (count > 20)
- g_main_loop_quit (loop);
-
- return GST_PAD_PROBE_OK;
-}
-
-static void
-stream_src_pad_added (FsStream *stream, GstPad *pad, FsCodec *codec,
- struct SimpleMsnConference *dat)
-{
- GstElement *sink = gst_element_factory_make ("fakesink", NULL);
- GstPad *sinkpad;
-
- GST_DEBUG ("pad added");
-
- ts_fail_unless (sink != NULL);
-
- ts_fail_unless (gst_bin_add (GST_BIN (dat->pipeline), sink));
-
- sinkpad = gst_element_get_static_pad (sink, "sink");
- ts_fail_unless (sinkpad != NULL);
-
- gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_BUFFER, pad_probe_cb, dat,
- NULL);
-
- ts_fail_if (GST_PAD_LINK_FAILED (gst_pad_link (pad, sinkpad)));
-
- gst_object_unref (sinkpad);
-
- ts_fail_if (gst_element_set_state (sink, GST_STATE_PLAYING) ==
- GST_STATE_CHANGE_FAILURE);
-
-}
-
-struct SimpleMsnConference *
-setup_conference (FsStreamDirection dir, struct SimpleMsnConference *target)
-{
- struct SimpleMsnConference *dat = g_new0 (struct SimpleMsnConference, 1);
- GError *error = NULL;
- GstBus *bus;
- GParameter param = {NULL, {0}};
- gint n_params = 0;
- guint tos;
-
- dat->target = target;
- dat->direction = dir;
-
- dat->pipeline = gst_pipeline_new (NULL);
-
- bus = gst_element_get_bus (dat->pipeline);
- gst_bus_add_watch (bus, bus_watch, dat);
- gst_object_unref (bus);
-
- if (dir == FS_DIRECTION_SEND)
- dat->conf = FS_CONFERENCE (
- gst_element_factory_make ("fsmsncamsendconference", NULL));
- else
- dat->conf = FS_CONFERENCE (
- gst_element_factory_make ("fsmsncamrecvconference", NULL));
- ts_fail_unless (dat->conf != NULL);
-
- ts_fail_unless (gst_bin_add (GST_BIN (dat->pipeline),
- GST_ELEMENT (dat->conf)));
-
- dat->part = fs_conference_new_participant (dat->conf, &error);
- ts_fail_unless (error == NULL, "Error: %s", error ? error->message: "");
- ts_fail_unless (dat->part != NULL);
-
- dat->session = fs_conference_new_session (dat->conf, FS_MEDIA_TYPE_VIDEO,
- &error);
- ts_fail_unless (dat->session != NULL, "Session create error: %s:",
- error ? error->message : "No GError");
- ts_fail_unless (error == NULL);
-
- g_object_set (dat->session, "tos", 2, NULL);
- g_object_get (dat->session, "tos", &tos, NULL);
- ts_fail_unless (tos == 2);
-
- if (dir == FS_DIRECTION_SEND)
- {
- GstPad *sinkpad, *srcpad;
- GstElement *src;
- src = gst_element_factory_make ("videotestsrc", NULL);
- ts_fail_unless (src != NULL);
- g_object_set (src, "is-live", TRUE, NULL);
- ts_fail_unless (gst_bin_add (GST_BIN (dat->pipeline),
- GST_ELEMENT (src)));
-
- g_object_get (dat->session, "sink-pad", &sinkpad, NULL);
- ts_fail_if (sinkpad == NULL);
- srcpad = gst_element_get_static_pad (src, "src");
- ts_fail_if (srcpad == NULL);
-
- ts_fail_if (GST_PAD_LINK_FAILED (gst_pad_link ( srcpad, sinkpad)));
- gst_object_unref (srcpad);
- gst_object_unref (sinkpad);
- }
-
- if (target)
- {
- guint session_id = 0;
- n_params = 1;
- g_object_get (target->stream, "session-id", &session_id, NULL);
- ts_fail_unless (session_id >= 9000 && session_id < 10000);
- param.name = "session-id";
- g_value_init (&param.value, G_TYPE_UINT);
- g_value_set_uint (&param.value, session_id);
- }
-
- dat->stream = fs_session_new_stream (dat->session, dat->part, dir, &error);
- ts_fail_unless (dat->stream != NULL);
- ts_fail_unless (error == NULL);
-
- fail_unless (fs_stream_set_transmitter (dat->stream, NULL, &param, n_params,
- &error));
- fail_unless (error == NULL);
-
- g_signal_connect (dat->stream, "src-pad-added",
- G_CALLBACK (stream_src_pad_added), dat);
-
- ts_fail_if (gst_element_set_state (dat->pipeline, GST_STATE_PLAYING) ==
- GST_STATE_CHANGE_FAILURE);
-
- return dat;
-}
-
-static void
-free_conference (struct SimpleMsnConference *dat)
-{
- ts_fail_if (gst_element_set_state (dat->pipeline, GST_STATE_NULL) ==
- GST_STATE_CHANGE_FAILURE);
-
- fs_session_destroy (dat->session);
- gst_object_unref (dat->stream);
- gst_object_unref (dat->session);
- gst_object_unref (dat->part);
- gst_object_unref (dat->pipeline);
-
- free (dat);
-}
-
-
-GST_START_TEST (test_msnconference_new)
-{
- struct SimpleMsnConference *senddat = setup_conference (FS_DIRECTION_SEND,
- NULL);
- struct SimpleMsnConference *recvdat = setup_conference (FS_DIRECTION_RECV,
- NULL);
-
-
- free_conference (senddat);
- free_conference (recvdat);
-}
-GST_END_TEST;
-
-
-
-GST_START_TEST (test_msnconference_send_to_recv)
-{
- struct SimpleMsnConference *senddat = setup_conference (FS_DIRECTION_SEND,
- NULL);
- struct SimpleMsnConference *recvdat = setup_conference (FS_DIRECTION_RECV,
- senddat);
-
- loop = g_main_loop_new (NULL, FALSE);
-
- g_main_loop_run (loop);
-
- free_conference (senddat);
- free_conference (recvdat);
- g_main_loop_unref (loop);
-}
-GST_END_TEST;
-
-
-GST_START_TEST (test_msnconference_recv_to_send)
-{
- struct SimpleMsnConference *recvdat = setup_conference (FS_DIRECTION_RECV,
- NULL);
- struct SimpleMsnConference *senddat = setup_conference (FS_DIRECTION_SEND,
- recvdat);
-
- loop = g_main_loop_new (NULL, FALSE);
-
- g_main_loop_run (loop);
-
- free_conference (senddat);
- free_conference (recvdat);
- g_main_loop_unref (loop);
-}
-GST_END_TEST;
-
-
-GST_START_TEST (test_msnconference_error)
-{
- struct SimpleMsnConference *dat = setup_conference (FS_DIRECTION_SEND,
- NULL);
- GError *error = NULL;
-
- ts_fail_unless (
- fs_conference_new_participant (dat->conf, &error) == NULL);
- ts_fail_unless (error->domain == FS_ERROR &&
- error->code == FS_ERROR_ALREADY_EXISTS);
- g_clear_error (&error);
-
-
- ts_fail_unless (
- fs_conference_new_session (dat->conf, FS_MEDIA_TYPE_VIDEO, &error) == NULL);
- ts_fail_unless (error->domain == FS_ERROR &&
- error->code == FS_ERROR_ALREADY_EXISTS);
- g_clear_error (&error);
-
-
- ts_fail_unless (
- fs_session_new_stream (dat->session, dat->part, FS_DIRECTION_SEND,
- &error) == NULL);
- ts_fail_unless (error->domain == FS_ERROR &&
- error->code == FS_ERROR_ALREADY_EXISTS);
- g_clear_error (&error);
-
- fail_unless (fs_stream_set_transmitter (dat->stream, NULL, NULL, 0,
- &error));
- fail_unless (error == NULL);
-
-
- free_conference (dat);
-}
-GST_END_TEST;
-
-static Suite *
-fsmsnconference_suite (void)
-{
- Suite *s = suite_create ("fsmsnconference");
- TCase *tc_chain;
- GLogLevelFlags fatal_mask;
-
- fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
- fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
- g_log_set_always_fatal (fatal_mask);
-
- tc_chain = tcase_create ("fsmsnconference_new");
- tcase_add_test (tc_chain, test_msnconference_new);
- suite_add_tcase (s, tc_chain);
-
-
- tc_chain = tcase_create ("fsmsnconference_send_to_recv");
- tcase_add_test (tc_chain, test_msnconference_send_to_recv);
- suite_add_tcase (s, tc_chain);
-
- tc_chain = tcase_create ("fsmsnconference_recv_to_send");
- tcase_add_test (tc_chain, test_msnconference_recv_to_send);
- suite_add_tcase (s, tc_chain);
-
-
- tc_chain = tcase_create ("fsmsnconference_error");
- tcase_add_test (tc_chain, test_msnconference_error);
- suite_add_tcase (s, tc_chain);
-
-
- return s;
-}
-
-GST_CHECK_MAIN (fsmsnconference);