[farsight2/master] msn: Split fsmsnconference into separate send and recv elements

Olivier Crête olivier.crete at collabora.co.uk
Sun Jul 12 11:53:20 PDT 2009


---
 .gitignore                                       |    2 +-
 docs/plugins/Makefile.am                         |    2 +
 docs/plugins/farsight2-plugins-docs.sgml         |    4 +-
 docs/plugins/farsight2-plugins-sections.txt      |   36 +++++++-
 docs/plugins/farsight2-plugins.types             |    3 +-
 gst/fsmsnconference/Makefile.am                  |   17 +++-
 gst/fsmsnconference/fs-msn-cam-recv-conference.c |  105 ++++++++++++++++++++++
 gst/fsmsnconference/fs-msn-cam-recv-conference.h |   69 ++++++++++++++
 gst/fsmsnconference/fs-msn-cam-send-conference.c |  105 ++++++++++++++++++++++
 gst/fsmsnconference/fs-msn-cam-send-conference.h |   69 ++++++++++++++
 gst/fsmsnconference/fs-msn-conference.c          |   27 ++----
 gst/fsmsnconference/fs-msn-conference.h          |    2 +
 gst/fsmsnconference/fs-msn-session.c             |    2 -
 gst/fsmsnconference/fs-msn-stream.c              |   34 ++++----
 tests/check/msn/conference.c                     |    9 ++-
 15 files changed, 436 insertions(+), 50 deletions(-)
 create mode 100644 gst/fsmsnconference/fs-msn-cam-recv-conference.c
 create mode 100644 gst/fsmsnconference/fs-msn-cam-recv-conference.h
 create mode 100644 gst/fsmsnconference/fs-msn-cam-send-conference.c
 create mode 100644 gst/fsmsnconference/fs-msn-cam-send-conference.h

diff --git a/.gitignore b/.gitignore
index c1df9a1..d1787f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,7 +16,7 @@ Makefile.in
 gst/fsrtpconference/fs-rtp-marshal.[ch]
 gst/fsrtpconference/fs-rtp-marshal.list
 gst/fsrtpconference/gstfsrtpconference_doc.c
-gst/fsmsnconference/fs-msn-conference-doc.c
+gst/fsmsnconference/fs-msn-*-conference-doc.c
 
 transmitters/rawudp/fs-rawudp-marshal.[ch]
 transmitters/rawudp/fs-rawudp-marshal.list
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index d2a32cd..30b26d8 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -82,6 +82,8 @@ EXTRA_HFILES = \
 	$(top_srcdir)/gst/fsrtpconference/fs-rtp-session.h \
 	$(top_srcdir)/gst/fsrtpconference/fs-rtp-stream.h \
 	$(top_srcdir)/gst/fsrtpconference/fs-rtp-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 \
diff --git a/docs/plugins/farsight2-plugins-docs.sgml b/docs/plugins/farsight2-plugins-docs.sgml
index e5ef2bb..ad18243 100644
--- a/docs/plugins/farsight2-plugins-docs.sgml
+++ b/docs/plugins/farsight2-plugins-docs.sgml
@@ -35,7 +35,9 @@
     <title>MSN plugins</title>
     <chapter>
       <title>MSN Webcam plugin</title>
-      <xi:include href="xml/element-fsmsnconference.xml"/>
+      <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"/>
diff --git a/docs/plugins/farsight2-plugins-sections.txt b/docs/plugins/farsight2-plugins-sections.txt
index 9a30d93..2f2d5e3 100644
--- a/docs/plugins/farsight2-plugins-sections.txt
+++ b/docs/plugins/farsight2-plugins-sections.txt
@@ -257,7 +257,7 @@ FS_NICE_STREAM_TRANSMITTER_GET_CLASS
 
 
 <SECTION>
-<FILE>element-fsmsnconference</FILE>
+<FILE>fs-msn-conference</FILE>
 <TITLE>FsMsnConference</TITLE>
 FsMsnConference
 <SUBSECTION Standard>
@@ -334,3 +334,37 @@ 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>
diff --git a/docs/plugins/farsight2-plugins.types b/docs/plugins/farsight2-plugins.types
index 55bc9b7..79a6b2a 100644
--- a/docs/plugins/farsight2-plugins.types
+++ b/docs/plugins/farsight2-plugins.types
@@ -2,6 +2,5 @@
 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
-fs_msn_session_get_type
-fs_msn_stream_get_type
diff --git a/gst/fsmsnconference/Makefile.am b/gst/fsmsnconference/Makefile.am
index cab3762..12263b7 100644
--- a/gst/fsmsnconference/Makefile.am
+++ b/gst/fsmsnconference/Makefile.am
@@ -6,12 +6,15 @@ plugin_LTLIBRARIES = libfsmsnconference.la
 noinst_LTLIBRARIES = libfsmsnconference-convenience.la
 
 libfsmsnconference_convenience_la_SOURCES = \
+	fs-msn-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 \
@@ -27,7 +30,9 @@ AM_CFLAGS = \
 
 # Build the main plugin
 
-libfsmsnconference_la_SOURCES = fs-msn-conference.c
+libfsmsnconference_la_SOURCES = \
+	fs-msn-cam-recv-conference.c \
+	fs-msn-cam-send-conference.c
 
 libfsmsnconference_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libfsmsnconference_la_LIBADD = \
@@ -45,15 +50,17 @@ if ENABLE_GTK_DOC
 noinst_LTLIBRARIES += libfsmsnconference_doc.la
 
 nodist_libfsmsnconference_doc_la_SOURCES = \
-	fs-msn-conference-doc.c
+	fs-msn-cam-recv-conference-doc.c \
+	fs-msn-cam-send-conference-doc.c
 
 libfsmsnconference_doc_la_LIBADD = $(libfsmsnconference_la_LIBADD)
 
-fs-msn-conference-doc.c: fs-msn-conference.c
+%-doc.c: %.c
 	sed -e 's:GST_PLUGIN_DEFINE:GST_PLUGIN_DEFINE_STATIC:' \
-		$(srcdir)/fs-msn-conference.c > fs-msn-conference-doc.c
+		$< > $@
+
+BUILT_SOURCES = $(nodist_libfsmsnconference_doc_la_SOURCES)
 
-BUILT_SOURCES = fs-msn-conference-doc.c
 CLEANFILES = $(BUILT_SOURCES)
 
 endif
diff --git a/gst/fsmsnconference/fs-msn-cam-recv-conference.c b/gst/fsmsnconference/fs-msn-cam-recv-conference.c
new file mode 100644
index 0000000..12824ae
--- /dev/null
+++ b/gst/fsmsnconference/fs-msn-cam-recv-conference.c
@@ -0,0 +1,105 @@
+/*
+ * Farsight2 - Farsight MSN Conference Implementation
+ *
+ * Copyright 2007 Nokia Corp.
+ * Copyright 2007-2009 Collabora Ltd.
+ *  @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ *
+ * fs-msn-recv-conference.c - MSN implementation for Farsight 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: Farsight 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
+
+/* Signals */
+enum
+{
+  LAST_SIGNAL
+};
+
+/* Properties */
+enum
+{
+  PROP_0
+};
+
+
+static GstElementDetails fs_msn_cam_recv_conference_details =
+{
+  "Farsight MSN Reception Conference",
+  "Generic/Bin/MSN",
+  "A Farsight MSN Reception Conference",
+  "Richard Spiers <richard.spiers at gmail.com>, "
+  "Youness Alaoui <youness.alaoui at collabora.co.uk>, "
+  "Olivier Crete <olivier.crete at collabora.co.uk>"
+};
+
+
+static void fs_msn_cam_recv_conference_do_init (GType type);
+
+GST_BOILERPLATE_FULL (FsMsnCamRecvConference, fs_msn_cam_recv_conference,
+    FsMsnConference, FS_TYPE_MSN_CONFERENCE, fs_msn_cam_recv_conference_do_init);
+
+static void
+fs_msn_cam_recv_conference_do_init (GType type)
+{
+}
+
+static void
+fs_msn_cam_recv_conference_class_init (FsMsnCamRecvConferenceClass * klass)
+{
+}
+
+static void
+fs_msn_cam_recv_conference_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &fs_msn_cam_recv_conference_details);
+}
+
+static void
+fs_msn_cam_recv_conference_init (FsMsnCamRecvConference *self,
+                        FsMsnCamRecvConferenceClass *bclass)
+{
+  FsMsnConference *conf = FS_MSN_CONFERENCE (self);
+
+  GST_DEBUG_OBJECT (conf, "fs_msn_cam_recv_conference_init");
+
+  conf->max_direction = FS_DIRECTION_RECV;
+}
+
diff --git a/gst/fsmsnconference/fs-msn-cam-recv-conference.h b/gst/fsmsnconference/fs-msn-cam-recv-conference.h
new file mode 100644
index 0000000..c5ade9d
--- /dev/null
+++ b/gst/fsmsnconference/fs-msn-cam-recv-conference.h
@@ -0,0 +1,69 @@
+/*
+ * Farsight2 - Farsight MSN Conference Implementation
+ *
+ * Copyright 2007 Nokia Corp.
+ * Copyright 2007-2009 Collabora Ltd.
+ *  @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ *
+ * fs-msn-recv-conference.h - MSN implementation for Farsight 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
new file mode 100644
index 0000000..d63180f
--- /dev/null
+++ b/gst/fsmsnconference/fs-msn-cam-send-conference.c
@@ -0,0 +1,105 @@
+/*
+ * Farsight2 - Farsight MSN Conference Implementation
+ *
+ * Copyright 2007 Nokia Corp.
+ * Copyright 2007-2009 Collabora Ltd.
+ *  @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ *
+ * fs-msn-send-conference.c - MSN implementation for Farsight 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: Farsight 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
+
+/* Signals */
+enum
+{
+  LAST_SIGNAL
+};
+
+/* Properties */
+enum
+{
+  PROP_0
+};
+
+
+static GstElementDetails fs_msn_cam_send_conference_details =
+{
+  "Farsight MSN Sending Conference",
+  "Generic/Bin/MSN",
+  "A Farsight MSN Sending Conference",
+  "Richard Spiers <richard.spiers at gmail.com>, "
+  "Youness Alaoui <youness.alaoui at collabora.co.uk>, "
+  "Olivier Crete <olivier.crete at collabora.co.uk>"
+};
+
+
+static void fs_msn_cam_send_conference_do_init (GType type);
+
+GST_BOILERPLATE_FULL (FsMsnCamSendConference, fs_msn_cam_send_conference,
+    FsMsnConference, FS_TYPE_MSN_CONFERENCE, fs_msn_cam_send_conference_do_init);
+
+static void
+fs_msn_cam_send_conference_do_init (GType type)
+{
+}
+
+static void
+fs_msn_cam_send_conference_class_init (FsMsnCamSendConferenceClass * klass)
+{
+}
+
+static void
+fs_msn_cam_send_conference_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &fs_msn_cam_send_conference_details);
+}
+
+static void
+fs_msn_cam_send_conference_init (FsMsnCamSendConference *self,
+                        FsMsnCamSendConferenceClass *bclass)
+{
+  FsMsnConference *conf = FS_MSN_CONFERENCE (self);
+
+  GST_DEBUG_OBJECT (conf, "fs_msn_cam_send_conference_init");
+
+  conf->max_direction = FS_DIRECTION_SEND;
+}
+
diff --git a/gst/fsmsnconference/fs-msn-cam-send-conference.h b/gst/fsmsnconference/fs-msn-cam-send-conference.h
new file mode 100644
index 0000000..3229c77
--- /dev/null
+++ b/gst/fsmsnconference/fs-msn-cam-send-conference.h
@@ -0,0 +1,69 @@
+/*
+ * Farsight2 - Farsight MSN Conference Implementation
+ *
+ * Copyright 2007 Nokia Corp.
+ * Copyright 2007-2009 Collabora Ltd.
+ *  @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ *
+ * fs-msn-send-conference.h - MSN implementation for Farsight 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
index 30a7bd3..4eb499c 100644
--- a/gst/fsmsnconference/fs-msn-conference.c
+++ b/gst/fsmsnconference/fs-msn-conference.c
@@ -25,8 +25,8 @@
  */
 
 /**
- * SECTION:element-fsmsnconference
- * @short_description: Farsight MSN Conference Gstreamer Elements
+ * SECTION:fs-msn-conference
+ * @short_description: Farsight 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).
@@ -42,6 +42,9 @@
 #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
 
@@ -58,18 +61,6 @@ enum
 };
 
 
-static GstElementDetails fs_msn_conference_details =
-{
-  "Farsight MSN Conference",
-  "Generic/Bin/MSN",
-  "A Farsight MSN Conference",
-  "Richard Spiers <richard.spiers at gmail.com>, "
-  "Youness Alaoui <youness.alaoui at collabora.co.uk>, "
-  "Olivier Crete <olivier.crete at collabora.co.uk>"
-};
-
-
-
 static GstStaticPadTemplate fs_msn_conference_sink_template =
   GST_STATIC_PAD_TEMPLATE ("sink_%d",
       GST_PAD_SINK,
@@ -171,8 +162,6 @@ fs_msn_conference_base_init (gpointer g_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));
-
-  gst_element_class_set_details (gstelement_class, &fs_msn_conference_details);
 }
 
 static void
@@ -285,8 +274,10 @@ fs_msn_conference_new_participant (FsBaseConference *conf,
 
 static gboolean plugin_init (GstPlugin * plugin)
 {
-  return gst_element_register (plugin, "fsmsncamconference",
-                               GST_RANK_NONE, FS_TYPE_MSN_CONFERENCE);
+  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);
 }
 
 GST_PLUGIN_DEFINE (
diff --git a/gst/fsmsnconference/fs-msn-conference.h b/gst/fsmsnconference/fs-msn-conference.h
index 84636f8..fd4876a 100644
--- a/gst/fsmsnconference/fs-msn-conference.h
+++ b/gst/fsmsnconference/fs-msn-conference.h
@@ -54,6 +54,8 @@ struct _FsMsnConference
 {
   FsBaseConference parent;
   FsMsnConferencePrivate *priv;
+
+  FsStreamDirection max_direction;
 };
 
 struct _FsMsnConferenceClass
diff --git a/gst/fsmsnconference/fs-msn-session.c b/gst/fsmsnconference/fs-msn-session.c
index 0e09a7f..6738da9 100644
--- a/gst/fsmsnconference/fs-msn-session.c
+++ b/gst/fsmsnconference/fs-msn-session.c
@@ -30,8 +30,6 @@
  *
  * There can be only one stream per session.
  *
- * The direction is chosen when creating the stream using the direction
- * parameter in the fs_session_new_stream() function.
  * It can afterwards be modified to pause sending (or receiving) by modifying
  * the #FsMsnStream::direction property.
  *
diff --git a/gst/fsmsnconference/fs-msn-stream.c b/gst/fsmsnconference/fs-msn-stream.c
index 5c8df3f..763a5ea 100644
--- a/gst/fsmsnconference/fs-msn-stream.c
+++ b/gst/fsmsnconference/fs-msn-stream.c
@@ -85,7 +85,6 @@ struct _FsMsnStreamPrivate
   FsMsnConference *conference;
   FsMsnSession *session;
   FsMsnParticipant *participant;
-  FsStreamDirection orig_direction;
   FsStreamDirection direction;
   GstElement *codecbin;
   GstElement *recv_valve;
@@ -205,7 +204,6 @@ fs_msn_stream_init (FsMsnStream *self)
   self->priv->participant = NULL;
 
   self->priv->direction = FS_DIRECTION_NONE;
-  self->priv->orig_direction = FS_DIRECTION_NONE;
 
   self->priv->session_id = g_random_int_range (9000, 9999);
 
@@ -374,24 +372,26 @@ fs_msn_stream_set_property (GObject *object,
       self->priv->participant = FS_MSN_PARTICIPANT (g_value_dup_object (value));
       break;
     case PROP_DIRECTION:
-      if (self->priv->orig_direction == FS_DIRECTION_NONE)
-      {
-        self->priv->orig_direction = g_value_get_flags (value);
-        self->priv->direction = g_value_get_flags (value);
-        break;
-      }
-
       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) & self->priv->orig_direction;
+          g_value_get_flags (value) & conference->max_direction;
 
         if (self->priv->direction == FS_DIRECTION_NONE)
         {
@@ -452,7 +452,7 @@ fs_msn_stream_constructed (GObject *object)
   FsMsnStream *self = FS_MSN_STREAM_CAST (object);
   gboolean producer = FALSE;
 
-  if (self->priv->direction == FS_DIRECTION_SEND)
+  if (self->priv->conference->max_direction == FS_DIRECTION_SEND)
   {
     GstElementFactory *fact = NULL;
 
@@ -470,7 +470,7 @@ fs_msn_stream_constructed (GObject *object)
       return;
     }
   }
-  else if (self->priv->direction == FS_DIRECTION_RECV)
+  else if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
   {
     GstElementFactory *fact = NULL;
 
@@ -591,7 +591,7 @@ _connected (
               "state", FS_TYPE_STREAM_STATE, FS_STREAM_STATE_READY,
               NULL)));
 
-  if (self->priv->orig_direction == FS_DIRECTION_RECV)
+  if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
     codecbin = gst_parse_bin_from_description (
         "fdsrc name=fdsrc ! mimdec ! valve name=recv_valve", TRUE, &error);
   else
@@ -607,7 +607,7 @@ _connected (
     goto error;
   }
 
-  if (self->priv->orig_direction == FS_DIRECTION_RECV)
+  if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
     fdelem = gst_bin_get_by_name (GST_BIN (codecbin), "fdsrc");
   else
     fdelem = gst_bin_get_by_name (GST_BIN (codecbin), "fdsink");
@@ -631,7 +631,7 @@ _connected (
     goto error;
   }
 
-  if (self->priv->orig_direction == FS_DIRECTION_RECV)
+  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");
@@ -657,7 +657,7 @@ _connected (
   self->priv->codecbin = gst_object_ref (codecbin);
   GST_OBJECT_UNLOCK (conference);
 
-  if (self->priv->orig_direction == FS_DIRECTION_RECV)
+  if (self->priv->conference->max_direction == FS_DIRECTION_RECV)
   {
     FsCodec *mimic_codec;
     GstPad *src_pad;
@@ -754,7 +754,7 @@ _connected (
     goto error;
   }
 
-  if (self->priv->orig_direction == FS_DIRECTION_SEND)
+  if (self->priv->conference->max_direction == FS_DIRECTION_SEND)
   {
     GST_OBJECT_LOCK (conference);
     drop = !(self->priv->direction & FS_DIRECTION_SEND);
diff --git a/tests/check/msn/conference.c b/tests/check/msn/conference.c
index 66cb295..d22198a 100644
--- a/tests/check/msn/conference.c
+++ b/tests/check/msn/conference.c
@@ -220,8 +220,12 @@ setup_conference (FsStreamDirection dir, struct SimpleMsnConference *target)
   gst_bus_add_watch (bus, bus_watch, dat);
   gst_object_unref (bus);
 
-  dat->conf = FS_CONFERENCE (
-      gst_element_factory_make ("fsmsnconference", NULL));
+  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),
@@ -413,5 +417,4 @@ fsmsnconference_suite (void)
   return s;
 }
 
-
 GST_CHECK_MAIN (fsmsnconference);
-- 
1.5.6.5




More information about the farsight-commits mailing list