[farsight2/master] Add videoanyrate element

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


---
 configure.ac                    |    4 +-
 gst/videoanyrate/Makefile.am    |   14 ++++
 gst/videoanyrate/videoanyrate.c |  146 +++++++++++++++++++++++++++++++++++++++
 gst/videoanyrate/videoanyrate.h |   65 +++++++++++++++++
 4 files changed, 228 insertions(+), 1 deletions(-)
 create mode 100644 gst/videoanyrate/Makefile.am
 create mode 100644 gst/videoanyrate/videoanyrate.c
 create mode 100644 gst/videoanyrate/videoanyrate.h

diff --git a/configure.ac b/configure.ac
index 511b66d..c79a256 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,7 +101,8 @@ AC_SUBST(GST_INSTALL_PLUGINS_HELPER)
 dnl these are all the gst plug-ins, compilable without additional libs
 FS2_PLUGINS_ALL=" \
 	fsrtpconference \
-	funnel
+	funnel \
+ 	videoanyrate
 	"
 AC_SUBST(FS2_PLUGINS_ALL)
 
@@ -373,6 +374,7 @@ farsight2.pc
 gst/Makefile
 gst/fsrtpconference/Makefile
 gst/funnel/Makefile
+gst/videoanyrate/Makefile
 gst-libs/Makefile
 gst-libs/gst/Makefile
 gst-libs/gst/farsight/Makefile
diff --git a/gst/videoanyrate/Makefile.am b/gst/videoanyrate/Makefile.am
new file mode 100644
index 0000000..0316587
--- /dev/null
+++ b/gst/videoanyrate/Makefile.am
@@ -0,0 +1,14 @@
+plugin_LTLIBRARIES = libfsvideoanyrate.la
+
+libfsvideoanyrate_la_SOURCES = videoanyrate.c
+libfsvideoanyrate_la_CFLAGS = \
+	$(FS2_CFLAGS) \
+	$(GST_BASE_CFLAGS) \
+	$(GST_CFLAGS)
+libfsvideoanyrate_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libfsvideoanyrate_la_LIBADD = \
+	$(FS2_LIBS) \
+	$(GST_BASE_LIBS) \
+	$(GST_LIBS)
+
+noinst_HEADERS = videoanyrate.h
diff --git a/gst/videoanyrate/videoanyrate.c b/gst/videoanyrate/videoanyrate.c
new file mode 100644
index 0000000..542a60e
--- /dev/null
+++ b/gst/videoanyrate/videoanyrate.c
@@ -0,0 +1,146 @@
+/*
+ * Farsight Voice+Video library
+ *
+ *  Copyright 2007 Collabora Ltd, 
+ *  Copyright 2007 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 "videoanyrate.h"
+
+#include <string.h>
+
+GST_DEBUG_CATEGORY (videoanyrate_debug);
+#define GST_CAT_DEFAULT (videoanyrate_debug)
+
+/* elementfactory information */
+static const GstElementDetails gst_videoanyrate_details =
+GST_ELEMENT_DETAILS (
+  "Videoanyrate element",
+  "Filter",
+  "This element removes the framerate from caps",
+  "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);
+
+/* Videoanyrate signals and args */
+enum
+{
+  /* FILL ME */
+  LAST_SIGNAL
+};
+
+enum
+{
+  ARG_0,
+};
+
+
+static GstCaps *
+gst_videoanyrate_transform_caps (GstBaseTransform *trans,
+    GstPadDirection direction,
+    GstCaps *caps);
+
+
+static void
+_do_init (GType type)
+{
+  GST_DEBUG_CATEGORY_INIT
+    (videoanyrate_debug, "fsvideoanyrate", 0, "fsvideoanyrate");
+}
+
+GST_BOILERPLATE_FULL (GstVideoanyrate, gst_videoanyrate, GstBaseTransform,
+    GST_TYPE_BASE_TRANSFORM, _do_init);
+
+static void
+gst_videoanyrate_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, &gst_videoanyrate_details);
+}
+
+static void
+gst_videoanyrate_class_init (GstVideoanyrateClass *klass)
+{
+  GObjectClass *gobject_class;
+  GstBaseTransformClass *gstbasetransform_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstbasetransform_class = (GstBaseTransformClass *) klass;
+
+  gstbasetransform_class->transform_caps =
+    GST_DEBUG_FUNCPTR(gst_videoanyrate_transform_caps);
+}
+
+static void
+gst_videoanyrate_init (GstVideoanyrate *videoanyrate,
+    GstVideoanyrateClass *klass)
+{
+}
+
+static GstCaps *
+gst_videoanyrate_transform_caps (GstBaseTransform *trans,
+    GstPadDirection direction,
+    GstCaps *caps)
+{
+  GstStructure *s;
+  GstCaps *mycaps = gst_caps_make_writable (caps);
+
+  if (gst_caps_get_size (mycaps) == 0)
+    return gst_caps_ref (mycaps);
+
+  s = gst_caps_get_structure (mycaps, 0);
+
+  gst_structure_remove_field (s, "framerate");
+
+  return gst_caps_ref (mycaps);
+}
+
+gboolean
+gst_videoanyrate_plugin_init (GstPlugin *plugin)
+{
+  return gst_element_register (plugin, "fsvideoanyrate",
+      GST_RANK_MARGINAL, GST_TYPE_VIDEOANYRATE);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    "fsvideoanyrate",
+    "Videoanyrate",
+    gst_videoanyrate_plugin_init, VERSION, "LGPL", "Farsight",
+    "http://farsight.sf.net")
diff --git a/gst/videoanyrate/videoanyrate.h b/gst/videoanyrate/videoanyrate.h
new file mode 100644
index 0000000..0dce98e
--- /dev/null
+++ b/gst/videoanyrate/videoanyrate.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 __GST_VIDEOANYRATE_H__
+#define __GST_VIDEOANYRATE_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+G_BEGIN_DECLS
+
+/* #define's don't like whitespacey bits */
+#define GST_TYPE_VIDEOANYRATE \
+  (gst_videoanyrate_get_type())
+#define GST_VIDEOANYRATE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+  GST_TYPE_VIDEOANYRATE,GstVideoanyrate))
+#define GST_VIDEOANYRATE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), \
+  GST_TYPE_VIDEOANYRATE,GstVideoanyrateClass))
+#define GST_IS_VIDEOANYRATE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEOANYRATE))
+#define GST_IS_VIDEOANYRATE_CLASS(obj) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEOANYRATE))
+
+typedef struct _GstVideoanyrate GstVideoanyrate;
+typedef struct _GstVideoanyrateClass GstVideoanyrateClass;
+typedef struct _GstVideoanyratePrivate GstVideoanyratePrivate;
+
+struct _GstVideoanyrate
+{
+  GstBaseTransform parent;
+};
+
+struct _GstVideoanyrateClass
+{
+  GstBaseTransformClass parent_class;
+};
+
+GType gst_videoanyrate_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_VIDEOANYRATE_H__ */
-- 
1.5.6.5




More information about the farsight-commits mailing list