[farsight2/master] Import empty RTCP filter element

Olivier Crête olivier.crete at collabora.co.uk
Thu Feb 5 06:32:03 PST 2009


---
 configure.ac                    |    2 +
 gst/rtcpfilter/Makefile.am      |   36 ++++++++++
 gst/rtcpfilter/fs-rtcp-filter.c |  142 +++++++++++++++++++++++++++++++++++++++
 gst/rtcpfilter/fs-rtcp-filter.h |   65 ++++++++++++++++++
 4 files changed, 245 insertions(+), 0 deletions(-)
 create mode 100644 gst/rtcpfilter/Makefile.am
 create mode 100644 gst/rtcpfilter/fs-rtcp-filter.c
 create mode 100644 gst/rtcpfilter/fs-rtcp-filter.h

diff --git a/configure.ac b/configure.ac
index 52df8f2..d976c71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,6 +102,7 @@ dnl these are all the gst plug-ins, compilable without additional libs
 FS2_PLUGINS_ALL=" \
 	fsrtpconference \
 	funnel \
+	rtcpfilter \
  	videoanyrate
 	"
 AC_SUBST(FS2_PLUGINS_ALL)
@@ -397,6 +398,7 @@ common-modified/Makefile
 gst/Makefile
 gst/fsrtpconference/Makefile
 gst/funnel/Makefile
+gst/rtcpfilter/Makefile
 gst/videoanyrate/Makefile
 gst-libs/Makefile
 gst-libs/gst/Makefile
diff --git a/gst/rtcpfilter/Makefile.am b/gst/rtcpfilter/Makefile.am
new file mode 100644
index 0000000..5ed7f13
--- /dev/null
+++ b/gst/rtcpfilter/Makefile.am
@@ -0,0 +1,36 @@
+plugin_LTLIBRARIES = libfsrtcpfilter.la
+
+libfsrtcpfilter_la_SOURCES = fs-rtcp-filter.c
+
+noinst_HEADERS = fs-rtcp-filter.h
+
+libfsrtcpfilter_la_CFLAGS = \
+	$(FS2_CFLAGS) \
+	$(GST_BASE_CFLAGS) \
+	$(GST_CFLAGS)
+libfsrtcpfilter_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libfsrtcpfilter_la_LIBADD = \
+	$(FS2_LIBS) \
+	-lgstrtp- at GST_MAJORMINOR@ \
+	$(GST_BASE_LIBS) \
+	$(GST_LIBS)
+
+
+
+fs-rtcp-filter-marshal.list: $(libfsrtcpfilter_la_SOURCES) Makefile.am
+	( cd $(srcdir) && \
+	sed -n -e 's/.*fs_rtcp-filter_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
+	$(libfsrtcpfilter_la_SOURCES) ) \
+	| sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
+	if cmp -s $@.tmp $@; then \
+		rm $@.tmp; \
+		touch $@; \
+	else \
+		mv $@.tmp $@; \
+	fi
+
+glib_enum_define=FS_RTCP_FILTER
+glib_enum_prefix=_fs_rtcp_filter
+
+include $(top_srcdir)/common/glib-gen.mak
+
diff --git a/gst/rtcpfilter/fs-rtcp-filter.c b/gst/rtcpfilter/fs-rtcp-filter.c
new file mode 100644
index 0000000..a0ba6e4
--- /dev/null
+++ b/gst/rtcpfilter/fs-rtcp-filter.c
@@ -0,0 +1,142 @@
+/*
+ * Farsight Voice+Video library
+ *
+ *  Copyright 2008 Collabora Ltd,
+ *  Copyright 2008 Nokia Corporation
+ *   @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+/**
+ * SECTION:element-fsrtcpfilter
+ * @short_description: Removes the framerate from video caps
+ *
+ * This element will remove the framerate from video caps, it is a poor man's
+ * videorate for live pipelines.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "fs-rtcp-filter.h"
+
+#include <gst/rtp/gstrtcpbuffer.h>
+
+GST_DEBUG_CATEGORY (rtcp_filter_debug);
+#define GST_CAT_DEFAULT (rtcp_filter_debug)
+
+/* elementfactory information */
+static const GstElementDetails fs_rtcp_filter_details =
+GST_ELEMENT_DETAILS (
+  "RTCP Filter element",
+  "Filter",
+  "This element removes unneeded parts of rtcp buffers",
+  "Olivier Crete <olivier.crete at collabora.co.uk>");
+
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtcp"));
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/x-rtcp"));
+
+/* signals and args */
+enum
+{
+  /* FILL ME */
+  LAST_SIGNAL
+};
+
+enum
+{
+  ARG_0,
+};
+
+
+GstFlowReturn
+fs_rtcp_filter_transform_ip (GstBaseTransform *transform, GstBuffer *buf);
+
+static void
+_do_init (GType type)
+{
+  GST_DEBUG_CATEGORY_INIT
+    (rtcp_filter_debug, "fsrtcpfilter", 0, "fsrtcpfilter");
+}
+
+GST_BOILERPLATE_FULL (FsRtcpFilter, fs_rtcp_filter, GstBaseTransform,
+    GST_TYPE_BASE_TRANSFORM, _do_init);
+
+static void
+fs_rtcp_filter_base_init (gpointer klass)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&srctemplate));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sinktemplate));
+
+  gst_element_class_set_details (element_class, &fs_rtcp_filter_details);
+}
+
+static void
+fs_rtcp_filter_class_init (FsRtcpFilterClass *klass)
+{
+  GstBaseTransformClass *gstbasetransform_class;
+
+  gstbasetransform_class = (GstBaseTransformClass *) klass;
+
+  gstbasetransform_class->transform_ip = fs_rtcp_filter_transform_ip;
+}
+
+static void
+fs_rtcp_filter_init (FsRtcpFilter *rtcpfilter,
+    FsRtcpFilterClass *klass)
+{
+}
+
+GstFlowReturn
+fs_rtcp_filter_transform_ip (GstBaseTransform *transform, GstBuffer *buf)
+{
+  if (!gst_rtcp_buffer_validate (buf))
+  {
+    GST_ERROR_OBJECT (transform, "Invalid RTCP buffer");
+    return GST_FLOW_ERROR;
+  }
+
+  return GST_FLOW_OK;
+}
+
+gboolean
+fs_rtcp_filter_plugin_init (GstPlugin *plugin)
+{
+  return gst_element_register (plugin, "fsrtcpfilter",
+      GST_RANK_MARGINAL, FS_TYPE_RTCP_FILTER);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    "fsrtcpfilter",
+    "RtcpFilter",
+    fs_rtcp_filter_plugin_init, VERSION, "LGPL", "Farsight",
+    "http://farsight.sf.net")
diff --git a/gst/rtcpfilter/fs-rtcp-filter.h b/gst/rtcpfilter/fs-rtcp-filter.h
new file mode 100644
index 0000000..cb04b2e
--- /dev/null
+++ b/gst/rtcpfilter/fs-rtcp-filter.h
@@ -0,0 +1,65 @@
+/*
+ * Farsight Voice+Video library
+ *
+ *  Copyright 2008 Collabora Ltd,
+ *  Copyright 2008 Nokia Corporation
+ *   @author: Olivier Crete <olivier.crete at collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __FS_RTCP_FILTER_H__
+#define __FS_RTCP_FILTER_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+G_BEGIN_DECLS
+
+/* #define's don't like whitespacey bits */
+#define FS_TYPE_RTCP_FILTER \
+  (fs_rtcp_filter_get_type())
+#define FS_RTCP_FILTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+  FS_TYPE_RTCP_FILTER,FsRtcpFilter))
+#define FS_RTCP_FILTER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), \
+  FS_TYPE_RTCP_FILTER,FsRtcpFilterClass))
+#define FS_IS_RTCP_FILTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),FS_TYPE_RTCP_FILTER))
+#define FS_IS_RTCP_FILTER_CLASS(obj) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),FS_TYPE_RTCP_FILTER))
+
+typedef struct _FsRtcpFilter FsRtcpFilter;
+typedef struct _FsRtcpFilterClass FsRtcpFilterClass;
+typedef struct _FsRtcpFilterPrivate FsRtcpFilterPrivate;
+
+struct _FsRtcpFilter
+{
+  GstBaseTransform parent;
+};
+
+struct _FsRtcpFilterClass
+{
+  GstBaseTransformClass parent_class;
+};
+
+GType fs_rtcp_filter_get_type (void);
+
+G_END_DECLS
+
+#endif /* __FS_RTCP_FILTER_H__ */
-- 
1.5.6.5




More information about the farsight-commits mailing list