[farsight2/master] Make fsrtpconference into a real GStreamer instantiable GStreamer element

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:18:59 PST 2008


---
 gst/fsrtpconference/Makefile.am          |    6 ++-
 gst/fsrtpconference/fs-rtp-conference.c  |   77 +++++++++++++++++-------------
 gst/fsrtpconference/gstfsrtpconference.c |   50 +++++++++++++++++++
 3 files changed, 97 insertions(+), 36 deletions(-)
 create mode 100644 gst/fsrtpconference/gstfsrtpconference.c

diff --git a/gst/fsrtpconference/Makefile.am b/gst/fsrtpconference/Makefile.am
index 5c3fe1f..a91afbf 100644
--- a/gst/fsrtpconference/Makefile.am
+++ b/gst/fsrtpconference/Makefile.am
@@ -1,13 +1,15 @@
 plugin_LTLIBRARIES = libfsrtpconference.la
 
-libfsrtpconference_la_SOURCES = \
+libfsrtpconference_la_SOURCES = gstfsrtpconference.c \
 	fs-rtp-conference.c \
 	fs-rtp-participant.c \
 	fs-rtp-session.c \
 	fs-rtp-stream.c
 libfsrtpconference_la_CFLAGS = $(FS2_INTERNAL_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
 libfsrtpconference_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libfsrtpconference_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
+libfsrtpconference_la_LIBADD = $(FS2_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) \
+	$(top_builddir)/gst-libs/gst/farsight/libgstfarsight-0.10.la
+
 
 noinst_HEADERS = \
 	fs-rtp-conference.h \
diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index d67a909..3ed3756 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -51,47 +51,42 @@ enum
   PROP_0
 };
 
+
+static GstElementDetails fs_rtp_conference_details = {
+  "Farsight RTP Conference",
+  "Generic/Bin/RTP",
+  "A Farsight RTP Conference",
+  "Olivier Crete <olivier.crete at collabora.co.uk>"
+};
+
+
+
+static GstStaticPadTemplate fs_rtp_conference_sink_template =
+  GST_STATIC_PAD_TEMPLATE ("sink_%d",
+                           GST_PAD_SINK,
+                           GST_PAD_SOMETIMES,
+                           GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate fs_rtp_conference_src_template =
+  GST_STATIC_PAD_TEMPLATE ("src_%d",
+                           GST_PAD_SRC,
+                           GST_PAD_SOMETIMES,
+                           GST_STATIC_CAPS_ANY);
+
+
 #define FS_RTP_CONFERENCE_GET_PRIVATE(obj) \
   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), FS_TYPE_RTP_CONFERENCE, FsRtpConferencePrivate))
 
 struct _FsRtpConferencePrivate
 {
+  gint something;
 };
 
-static GstElementClass *parent_class = NULL;
+static void fs_rtp_conference_do_init (gpointer g_class);
 
-static void fs_rtp_conference_base_init (gpointer g_class);
-static void fs_rtp_conference_class_init (FsRtpConferenceClass *klass);
-static void fs_rtp_conference_init (FsRtpConference *conf,
-                                     FsRtpConferenceClass *klass);
-static void fs_rtp_conference_implements_interface_init (
-    GstImplementsInterfaceClass * klass);
 
-GType
-fs_rtp_conference_get_type (void)
-{
-  static GType rtp_conference_type = 0;
-
-  if (!rtp_conference_type) {
-    static const GTypeInfo rtp_conference_info = {
-      sizeof (FsRtpConferenceClass),
-      (GBaseInitFunc) fs_rtp_conference_base_init,
-      NULL,
-      (GClassInitFunc) fs_rtp_conference_class_init,
-      NULL,
-      NULL,
-      sizeof (FsRtpConference),
-      0,
-      (GInstanceInitFunc) fs_rtp_conference_init,
-    };
-
-
-    rtp_conference_type = g_type_register_static (FS_TYPE_BASE_CONFERENCE,
-        "FsRtpConference", &rtp_conference_info, 0);
-  }
-
-  return rtp_conference_type;
-}
+GST_BOILERPLATE_FULL (FsRtpConference, fs_rtp_conference, FsBaseConference,
+                      FS_TYPE_BASE_CONFERENCE, fs_rtp_conference_do_init);
 
 static void fs_rtp_conference_finalize (GObject *object);
 static FsSession *fs_rtp_conference_new_session (FsBaseConference *conf,
@@ -101,7 +96,7 @@ static FsParticipant *fs_rtp_conference_new_participant (FsBaseConference *conf,
 
 
 static void
-fs_rtp_conference_rtp_init (gpointer g_class)
+fs_rtp_conference_do_init (gpointer g_class)
 {
   GST_DEBUG_CATEGORY_INIT (fs_rtp_conference_debug, "fsrtpconference", 0,
       "farsight rtp conference element");
@@ -119,8 +114,8 @@ static void
 fs_rtp_conference_class_init (FsRtpConferenceClass * klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
   FsBaseConferenceClass *baseconf_class = FS_BASE_CONFERENCE_CLASS (klass);
-
   g_type_class_add_private (klass, sizeof (FsRtpConferencePrivate));
 
   parent_class = g_type_class_peek_parent (klass);
@@ -131,6 +126,20 @@ fs_rtp_conference_class_init (FsRtpConferenceClass * klass)
     GST_DEBUG_FUNCPTR (fs_rtp_conference_new_participant);
 
   gobject_class->finalize = GST_DEBUG_FUNCPTR (fs_rtp_conference_finalize);
+
+  gst_element_class_set_details (gstelement_class, &fs_rtp_conference_details);
+
+  gst_element_class_add_pad_template (gstelement_class,
+            gst_static_pad_template_get (&fs_rtp_conference_sink_template));
+  gst_element_class_add_pad_template (gstelement_class,
+            gst_static_pad_template_get (&fs_rtp_conference_src_template));
+
+
+}
+
+static void
+fs_rtp_conference_base_init (gpointer g_class)
+{
 }
 
 static void
diff --git a/gst/fsrtpconference/gstfsrtpconference.c b/gst/fsrtpconference/gstfsrtpconference.c
new file mode 100644
index 0000000..4ecb109
--- /dev/null
+++ b/gst/fsrtpconference/gstfsrtpconference.c
@@ -0,0 +1,50 @@
+/*
+ * Farsight2 - Farsight RTP Conference Implementation
+ *
+ * Copyright 2007 Collabora Ltd.
+ *  @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ * Copyright 2007 Nokia Corp.
+ *
+ * fs-rtp-conference.c - RTP implementation for Farsight Conference Gstreamer
+ *                       Elements
+ *
+ * This program 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "fs-rtp-conference.h"
+
+static gboolean plugin_init (GstPlugin * plugin)
+{
+  return gst_element_register (plugin, "fsrtpconference",
+                               GST_RANK_NONE, FS_TYPE_RTP_CONFERENCE);
+}
+
+GST_PLUGIN_DEFINE (
+  GST_VERSION_MAJOR,
+  GST_VERSION_MINOR,
+  "fsrtpconference",
+  "Farsight RTP Conference plugin",
+  plugin_init,
+  VERSION,
+  "LGPL",
+  "Farsight",
+  "http://farsight.freedesktop.org/"
+)
-- 
1.5.6.5




More information about the farsight-commits mailing list