[farsight2/master] Add Fake filter element for transmitter tests

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


---
 tests/check/Makefile.am               |    2 +
 tests/check/transmitter/fake-filter.c |  177 +++++++++++++++++++++++++++++++++
 tests/check/transmitter/fake-filter.h |   68 +++++++++++++
 3 files changed, 247 insertions(+), 0 deletions(-)
 create mode 100644 tests/check/transmitter/fake-filter.c
 create mode 100644 tests/check/transmitter/fake-filter.h

diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index a45bf6e..6aa61f4 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -83,6 +83,8 @@ transmitter_multicast_SOURCES = \
 	check-threadsafe.h  \
 	transmitter/generic.c \
 	transmitter/generic.h \
+	transmitter/fake-filter.c \
+	transmitter/fake-filter.h \
 	transmitter/multicast.c 
 
 transmitter_nice_CFLAGS = $(FS2_INTERNAL_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
diff --git a/tests/check/transmitter/fake-filter.c b/tests/check/transmitter/fake-filter.c
new file mode 100644
index 0000000..9537365
--- /dev/null
+++ b/tests/check/transmitter/fake-filter.c
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "fake-filter.h"
+
+GST_DEBUG_CATEGORY (fake_filter_debug);
+#define GST_CAT_DEFAULT (fake_filter_debug)
+
+/* elementfactory information */
+static const GstElementDetails fs_fake_filter_details =
+GST_ELEMENT_DETAILS (
+  "Fake Filter element",
+  "Filter",
+  "This element ignores the sending property",
+  "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_ANY);
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+/* signals and args */
+enum
+{
+  /* FILL ME */
+  LAST_SIGNAL
+};
+
+enum
+{
+  PROP_0,
+  PROP_SENDING
+};
+
+static void fs_fake_filter_get_property (GObject *object,
+    guint prop_id,
+    GValue *value,
+    GParamSpec *pspec);
+static void fs_fake_filter_set_property (GObject *object,
+    guint prop_id,
+    const GValue *value,
+    GParamSpec *pspec);
+
+static void
+_do_init (GType type)
+{
+  GST_DEBUG_CATEGORY_INIT
+    (fake_filter_debug, "fsfakefilter", 0, "fsfakefilter");
+}
+
+GST_BOILERPLATE_FULL (FsFakeFilter, fs_fake_filter, GstBaseTransform,
+    GST_TYPE_BASE_TRANSFORM, _do_init);
+
+static void
+fs_fake_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_fake_filter_details);
+}
+
+static void
+fs_fake_filter_class_init (FsFakeFilterClass *klass)
+{
+  GObjectClass *gobject_class;
+
+  gobject_class = (GObjectClass *) klass;
+
+  gobject_class->set_property = GST_DEBUG_FUNCPTR (fs_fake_filter_set_property);
+  gobject_class->get_property = GST_DEBUG_FUNCPTR (fs_fake_filter_get_property);
+
+  g_object_class_install_property (gobject_class,
+      PROP_SENDING,
+      g_param_spec_boolean ("sending",
+          "Sending RTP?",
+          "If set to FALSE, it assumes that all RTP has been dropped",
+          FALSE,
+          G_PARAM_READWRITE));
+}
+
+static void
+fs_fake_filter_init (FsFakeFilter *fakefilter,
+    FsFakeFilterClass *klass)
+{
+}
+
+static void
+fs_fake_filter_get_property (GObject *object,
+    guint prop_id,
+    GValue *value,
+    GParamSpec *pspec)
+{
+  switch (prop_id)
+  {
+    case PROP_SENDING:
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+static void
+fs_fake_filter_set_property (GObject *object,
+    guint prop_id,
+    const GValue *value,
+    GParamSpec *pspec)
+{
+  switch (prop_id)
+  {
+    case PROP_SENDING:
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+
+gboolean
+fs_fake_filter_plugin_init (GstPlugin *plugin)
+{
+  return gst_element_register (plugin, "fsfakefilter",
+      GST_RANK_MARGINAL, FS_TYPE_FAKE_FILTER);
+}
+
+gboolean
+fs_fake_filter_register (void)
+{
+  return gst_plugin_register_static (
+      GST_VERSION_MAJOR,
+      GST_VERSION_MINOR,
+      "fsfakefilter",
+      "FakeFilter",
+      fs_fake_filter_plugin_init,
+      VERSION,
+      "LGPL",
+      "Farsight",
+      "Farsight2",
+      "Farsight2 testing suite");
+}
diff --git a/tests/check/transmitter/fake-filter.h b/tests/check/transmitter/fake-filter.h
new file mode 100644
index 0000000..f93642e
--- /dev/null
+++ b/tests/check/transmitter/fake-filter.h
@@ -0,0 +1,68 @@
+/*
+ * 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_FAKE_FILTER_H__
+#define __FS_FAKE_FILTER_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+G_BEGIN_DECLS
+
+/* #define's don't like whitespacey bits */
+#define FS_TYPE_FAKE_FILTER \
+  (fs_fake_filter_get_type())
+#define FS_FAKE_FILTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+  FS_TYPE_FAKE_FILTER,FsFakeFilter))
+#define FS_FAKE_FILTER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), \
+  FS_TYPE_FAKE_FILTER,FsFakeFilterClass))
+#define FS_IS_FAKE_FILTER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),FS_TYPE_FAKE_FILTER))
+#define FS_IS_FAKE_FILTER_CLASS(obj) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),FS_TYPE_FAKE_FILTER))
+
+typedef struct _FsFakeFilter FsFakeFilter;
+typedef struct _FsFakeFilterClass FsFakeFilterClass;
+typedef struct _FsFakeFilterPrivate FsFakeFilterPrivate;
+
+struct _FsFakeFilter
+{
+  GstBaseTransform parent;
+};
+
+struct _FsFakeFilterClass
+{
+  GstBaseTransformClass parent_class;
+};
+
+GType fs_fake_filter_get_type (void);
+
+gboolean fs_fake_filter_register (void);
+
+
+G_END_DECLS
+
+#endif /* __FS_FAKE_FILTER_H__ */
-- 
1.5.6.5




More information about the farsight-commits mailing list