aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprasanth kamuju <prasanth.kamuju@linaro.org>2014-08-25 16:20:59 +0530
committerprasanth kamuju <prasanth.kamuju@linaro.org>2014-08-25 16:20:59 +0530
commit2170fb096d98c370d7a29485e2b69c81e4633ce5 (patch)
tree615692f34c9a68f757a1eb9b505ddf324d286d16
initial commit
-rw-r--r--AUTHORS1
-rw-r--r--COPYING2
-rw-r--r--ChangeLog217
-rw-r--r--Makefile.am3
-rw-r--r--NEWS1
-rw-r--r--README49
-rwxr-xr-xautogen.sh18
-rw-r--r--configure.ac87
-rw-r--r--src/Makefile.am26
-rw-r--r--src/gstaudiofilter.c297
-rw-r--r--src/gstplugin.c285
-rw-r--r--src/gstplugin.h86
-rw-r--r--src/gsttransform.c223
-rw-r--r--src/gsttransform.h58
14 files changed, 1353 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..1bb7449
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Thomas Vander Stichele <thomas@apestaart.org>
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..09ec995
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,2 @@
+Put your license in here!
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..5c25746
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,217 @@
+2008-11-04 Stefan Kost <ensonic@users.sf.net>
+
+ * src/Makefile.am:
+ Don't install static libs for plugins. Fixes #550851 for the template.
+
+2008-10-30 Stefan Kost <ensonic@users.sf.net>
+
+ * tools/make_element:
+ Don't replace GstPlugin.
+
+2008-08-11 Stefan Kost <ensonic@users.sf.net>
+
+ * README:
+ * src/gstaudiofilter.c:
+ * src/gstplugin.c:
+ * src/gsttransform.c:
+ * tools/make_element:
+ Integrate new template and improve search'n'replace ops. Update
+ templates to use current API.
+
+2008-07-26 Stefan Kost <ensonic@users.sf.net>
+
+ * tools/make_element:
+ Fix username detection. tries getent first and falls back to grep
+ passwd. Spotted by Karoly Segesdi.
+
+2008-06-09 Jan Schmidt <jan.schmidt@sun.com>
+
+ * src/gstplugin.c:
+ Fix some memory leaks, and make the setcaps function actually
+ sets the caps on the other pad.
+
+2008-05-08 Stefan Kost <ensonic@users.sf.net>
+
+ * README:
+ Add simple usage explanation and make it look like the other READMEs.
+
+ * src/gstplugin.c:
+ * src/gstplugin.h:
+ * src/gsttransform.c:
+ * src/gsttransform.h:
+ * tools/make_element:
+ Add year, username and email fields. Update the templates here and
+ there a bit. Add more comments.
+
+2007-08-01 Tim-Philipp Müller <tim at centricular dot net>
+
+ * src/gsttransform.c:
+ Include right header to avoid structure size mismatches etc.
+
+2007-07-25 Tim-Philipp Müller <tim at centricular dot net>
+
+ Patch by: Steve Fink <sphink gmail com>
+
+ * src/gstplugin.c:
+ Use GST_DEBUG_FUNCPTR() macros where it makes sense.
+
+2007-07-19 Stefan Kost <ensonic@users.sf.net>
+
+ * configure.ac:
+ Fix CVS-build detection.
+
+2007-01-23 Tim-Philipp Müller <tim at centricular dot net>
+
+ * src/Makefile.am:
+ Make clearer which Makefile variables need renaming if the plugin
+ name is changes (#399746) (pretty it is not, but it's the content
+ that counts, right?)
+
+2007-01-22 Tim-Philipp Müller <tim at centricular dot net>
+
+ Patch by: Philip Jägenstedt <philipj at opera com>
+
+ * tools/make_element:
+ Translate FOO_IS_MY_PLUGIN macro as well according to the template
+ (#399323).
+
+2006-07-04 Tim-Philipp Müller <tim at centricular dot net>
+
+ * autogen.sh:
+ Run autoheader to create config.h.in and fix the build.`
+
+2006-07-03 Tim-Philipp Müller <tim at centricular dot net>
+
+ * Makefile.am:
+ * autogen.sh:
+ * gst-autogen.sh:
+ Throw an error if autotools versions are too old. We require
+ automake 1.7 or newer (#346054). Add gst-autogen.sh to check
+ for this.
+
+ * COPYING:
+ Add placeholder COPYING file so it doesn't get overwritten
+ by a GPL one by automake.
+
+2006-06-22 Tim-Philipp Müller <tim at centricular dot net>
+
+ Patch by: Philip Jägenstedt <philip at lysator liu se>
+
+ * src/gstplugin.c: (gst_plugin_template_base_init),
+ (gst_plugin_template_class_init), (gst_plugin_template_init),
+ (plugin_init):
+ Use GST_BOILERPLATE, add debug category (#345601).
+
+2006-04-20 Stefan Kost <ensonic@users.sf.net>
+
+ Patch by: Johan Rydberg <jrydberg@gnu.org>
+
+ * src/gstplugin.c: (gst_plugin_template_get_type),
+ (gst_plugin_template_base_init), (gst_plugin_template_class_init),
+ (gst_plugin_template_set_property),
+ (gst_plugin_template_get_property):
+ * src/gstplugin.h:
+ * src/gsttransform.c: (gst_plugin_template_base_init),
+ (gst_plugin_template_set_property),
+ (gst_plugin_template_get_property):
+ * tools/make_element:
+ remove double gst_get_, fix '_' in names
+
+
+2006-02-26 Tim-Philipp Müller <tim at centricular dot net>
+
+ * src/gstplugin.c: (gst_plugin_template_init),
+ (gst_plugin_template_chain):
+ Fix function declaration of _init() function.
+ Remove unnecessary assertion clutter in chain function
+ (that also failed to return a flow value, causing
+ compiler warnings).
+
+2006-02-07 Stefan Kost <ensonic@users.sf.net>
+
+ * src/gstplugin.c: (gst_plugin_template_set_caps),
+ (gst_plugin_template_chain):
+ * src/gsttransform.c: (gst_plugin_template_transform_ip):
+ more code cleanups, more comments
+
+2006-02-07 Stefan Kost <ensonic@users.sf.net>
+
+ * configure.ac:
+ allow installing to $HOME
+ * src/gstplugin.c: (gst_plugin_template_base_init),
+ (gst_plugin_template_init):
+ * src/gstplugin.h:
+ * src/gsttransform.c: (gst_plugin_template_base_init),
+ (gst_plugin_template_class_init), (gst_plugin_template_init),
+ (gst_plugin_template_transform_ip),
+ (gst_plugin_template_set_property),
+ (gst_plugin_template_get_property), (plugin_init):
+ * src/gsttransform.h:
+ add another template
+ * tools/make_element:
+ fix generator, when template (arg2) is given
+
+2006-01-23 Tim-Philipp Müller <tim at centricular dot net>
+
+ * src/gstplugin.h:
+ FOO_BAR_CLASS(klass) should cast to FooBarClass*,
+ not FooBar*.
+
+2006-01-13 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * autogen.sh:
+ * configure.ac:
+ * src/Makefile.am:
+ * src/gstplugin.c:
+ bring into the 0.10 world
+ Fix #315582
+
+2005-12-16 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * src/gstplugin.c: (gst_plugin_template_class_init):
+ Need to have the set_property and get_property methods
+ before installing properties
+
+2005-12-14 Tim-Philipp Müller <tim at centricular dot net>
+
+ * src/gstplugin.h:
+ Fix GST_IS_FOO_BAR_CLASS macro.
+
+2005-06-30 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+ * configure.ac:
+ * src/gstplugin.c: (gst_plugin_template_set_caps),
+ (gst_plugin_template_init), (gst_plugin_template_chain):
+ Fix for GStreamer 0.9.
+
+2004-04-22 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * Makefile.am:
+ * autogen.sh:
+ * configure.ac:
+ * src/Makefile.am:
+ use proper LDFLAGS for plugins
+ run in maintainer mode by default
+
+2004-04-22 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * configure.ac: ... and fix comments too
+
+2004-04-03 Benjamin Otte <otte@gnome.org>
+
+ * configure.ac:
+ update for GStreamer 0.8
+
+2004-01-25 Ronald Bultje <rbultje@ronald.bitfreak.net>
+
+ * src/gstplugin.c: (gst_plugin_template_link),
+ (gst_plugin_template_base_init), (gst_plugin_template_init):
+ Fix for GStreamer 0.7.x.
+
+2003-02-06 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * updated for GStreamer 0.6.0
+
+2002-07-17 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * initial creation on a flight to New York
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..5ff2f58
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = src
+
+EXTRA_DIST = autogen.sh
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..3474a99
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+Nothing much yet.
diff --git a/README b/README
new file mode 100644
index 0000000..e7b724e
--- /dev/null
+++ b/README
@@ -0,0 +1,49 @@
+This git module contains template code for possible GStreamer projects.
+
+gst-app
+ basic autotools layout for writing a GStreamer-based application.
+
+gst-plugin
+ basic autotools layout and basic filter code for writing a
+ GStreamer plug-in.
+
+This code is provided under a MIT license [1], which basically means "do
+with it as you wish, but don't blame us if it doesn't work". You can use
+this code for any project as you wish, under any license as you wish. We
+recommend the use of the LGPL [2] license for applications and plugins,
+given the minefield of patents the multimedia is nowadays. See our website
+for details [3].
+
+Build each module like this:
+
+ cd gst-plugin
+ ./autogen.sh
+ make
+
+Modify gst-plugin/src/Makefile.am to add or remove source files to build or
+add additional dependencies or compiler flags or change the name of the
+plugin file to be installed. Run ./autoregen.sh if changes don't take effect
+automatically on 'make'.
+
+Modify gst-plugin/configure.ac to check for additional library dependencies
+or other features needed by your plugin. Run ./autoregen.sh if changes don't
+take effect automatically on 'make'.
+
+Once the plugin is built you can either install it with 'sudo make install'
+(however, this will by default go into the /usr/local prefix where it won't
+be picked up by a GStreamer installed from packages, so you would need to
+set the GST_PLUGIN_PATH environment variable to include or point to
+/usr/local/lib/gstreamer-1.0/ for your plugin to be found by a from-package
+GStreamer). Alternatively, you will find your plugin binary in
+gst-plugins/src/.libs/ as libgstplugin.so or similar (the extension may vary),
+so you can also set the GST_PLUGIN_PATH environmen variable to the
+gst-plugins/src/.libs/ directory (best to specify an absolute path though).
+
+You can also check if it has been built correctly with:
+
+ gst-inspect-1.0 gst-plugins/src/.libs/libgstplugin.so
+
+
+[1] http://www.opensource.org/licenses/mit-license.php or COPYING.MIT
+[2] http://www.opensource.org/licenses/lgpl-license.php or COPYING.LIB
+[3] http://gstreamer.freedesktop.org/documentation/licensing.html
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..9df38d3
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# you can either set the environment variables AUTOCONF, AUTOHEADER, AUTOMAKE,
+# ACLOCAL, AUTOPOINT and/or LIBTOOLIZE to the right versions, or leave them
+# unset and get the defaults
+
+autoreconf --verbose --force --install --make || {
+ echo 'autogen.sh failed';
+ exit 1;
+}
+
+./configure || {
+ echo 'configure failed';
+ exit 1;
+}
+
+echo
+echo "Now type 'make' to compile this module."
+echo
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..1908b28
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,87 @@
+dnl required version of autoconf
+AC_PREREQ([2.53])
+
+dnl TODO: fill in your package name and package version here
+AC_INIT([my-plugin-package],[1.0.0])
+
+dnl required versions of gstreamer and plugins-base
+GST_REQUIRED=1.0.0
+GSTPB_REQUIRED=1.0.0
+
+AC_CONFIG_SRCDIR([src/gstplugin.c])
+AC_CONFIG_HEADERS([config.h])
+
+dnl required version of automake
+AM_INIT_AUTOMAKE([1.10])
+
+dnl enable mainainer mode by default
+AM_MAINTAINER_MODE([enable])
+
+dnl check for tools (compiler etc.)
+AC_PROG_CC
+
+dnl required version of libtool
+LT_PREREQ([2.2.6])
+LT_INIT
+
+dnl give error and exit if we don't have pkgconfig
+AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, [ ], [
+ AC_MSG_ERROR([You need to have pkg-config installed!])
+])
+
+dnl Check for the required version of GStreamer core (and gst-plugins-base)
+dnl This will export GST_CFLAGS and GST_LIBS variables for use in Makefile.am
+dnl
+dnl If you need libraries from gst-plugins-base here, also add:
+dnl for libgstaudio-1.0: gstreamer-audio-1.0 >= $GST_REQUIRED
+dnl for libgstvideo-1.0: gstreamer-video-1.0 >= $GST_REQUIRED
+dnl for libgsttag-1.0: gstreamer-tag-1.0 >= $GST_REQUIRED
+dnl for libgstpbutils-1.0: gstreamer-pbutils-1.0 >= $GST_REQUIRED
+dnl for libgstfft-1.0: gstreamer-fft-1.0 >= $GST_REQUIRED
+dnl for libgstinterfaces-1.0: gstreamer-interfaces-1.0 >= $GST_REQUIRED
+dnl for libgstrtp-1.0: gstreamer-rtp-1.0 >= $GST_REQUIRED
+dnl for libgstrtsp-1.0: gstreamer-rtsp-1.0 >= $GST_REQUIRED
+dnl etc.
+PKG_CHECK_MODULES(GST, [
+ gstreamer-1.0 >= $GST_REQUIRED
+ gstreamer-base-1.0 >= $GST_REQUIRED
+ gstreamer-controller-1.0 >= $GST_REQUIRED
+], [
+ AC_SUBST(GST_CFLAGS)
+ AC_SUBST(GST_LIBS)
+], [
+ AC_MSG_ERROR([
+ You need to install or upgrade the GStreamer development
+ packages on your system. On debian-based systems these are
+ libgstreamer1.0-dev and libgstreamer-plugins-base1.0-dev.
+ on RPM-based systems gstreamer1.0-devel, libgstreamer1.0-devel
+ or similar. The minimum version required is $GST_REQUIRED.
+ ])
+])
+
+dnl check if compiler understands -Wall (if yes, add -Wall to GST_CFLAGS)
+AC_MSG_CHECKING([to see if compiler understands -Wall])
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ], [ ])], [
+ GST_CFLAGS="$GST_CFLAGS -Wall"
+ AC_MSG_RESULT([yes])
+], [
+ AC_MSG_RESULT([no])
+])
+
+dnl set the plugindir where plugins should be installed (for src/Makefile.am)
+if test "x${prefix}" = "x$HOME"; then
+ plugindir="$HOME/.gstreamer-1.0/plugins"
+else
+ plugindir="\$(libdir)/gstreamer-1.0"
+fi
+AC_SUBST(plugindir)
+
+dnl set proper LDFLAGS for plugins
+GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
+AC_SUBST(GST_PLUGIN_LDFLAGS)
+
+AC_CONFIG_FILES([Makefile src/Makefile])
+AC_OUTPUT
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..8f2bc4b
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,26 @@
+# Note: plugindir is set in configure
+
+##############################################################################
+# TODO: change libgstplugin.la to something else, e.g. libmysomething.la #
+##############################################################################
+plugin_LTLIBRARIES = libgstplugin.la
+
+##############################################################################
+# TODO: for the next set of variables, name the prefix if you named the .la, #
+# e.g. libmysomething.la => libmysomething_la_SOURCES #
+# libmysomething_la_CFLAGS #
+# libmysomething_la_LIBADD #
+# libmysomething_la_LDFLAGS #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstplugin_la_SOURCES = gstplugin.c gstplugin.h
+
+# compiler and linker flags used to compile this plugin, set in configure.ac
+libgstplugin_la_CFLAGS = $(GST_CFLAGS)
+libgstplugin_la_LIBADD = $(GST_LIBS)
+libgstplugin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstplugin_la_LIBTOOLFLAGS = --tag=disable-static
+
+# headers we need but don't want installed
+noinst_HEADERS = gstplugin.h
diff --git a/src/gstaudiofilter.c b/src/gstaudiofilter.c
new file mode 100644
index 0000000..462b763
--- /dev/null
+++ b/src/gstaudiofilter.c
@@ -0,0 +1,297 @@
+/*
+ * GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2003> David Schleef <ds@schleef.org>
+ * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
+ * which case the following provisions apply instead of the ones
+ * mentioned above:
+ *
+ * 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-plugin
+ *
+ * FIXME:Describe plugin here.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch -v -m audiotestsrc ! plugin ! autoaudiosink
+ * ]|
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/audio/audio.h>
+#include <gst/audio/gstaudiofilter.h>
+#include <string.h>
+
+GST_DEBUG_CATEGORY_STATIC (gst_plugin_template_debug);
+#define GST_CAT_DEFAULT gst_plugin_template_debug
+
+typedef struct _GstPluginTemplate GstPluginTemplate;
+typedef struct _GstPluginTemplateClass GstPluginTemplateClass;
+
+#define GST_TYPE_PLUGIN_TEMPLATE \
+ (gst_plugin_template_get_type())
+#define GST_PLUGIN_TEMPLATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplate))
+#define GST_PLUGIN_TEMPLATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplateClass))
+#define GST_IS_PLUGIN_TEMPLATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLUGIN_TEMPLATE))
+#define GST_IS_PLUGIN_TEMPLATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLUGIN_TEMPLATE))
+
+struct _GstPluginTemplate
+{
+ GstAudioFilter audiofilter;
+};
+
+struct _GstPluginTemplateClass
+{
+ GstAudioFilterClass parent_class;
+};
+
+
+enum
+{
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum
+{
+ ARG_0
+ /* FILL ME */
+};
+
+/* debug category for fltering log messages
+ *
+ * FIXME:exchange the string 'Template plugin' with your description
+ */
+#define DEBUG_INIT(bla) \
+ GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin", 0, "Template plugin");
+
+GST_BOILERPLATE_FULL (GstPluginTemplate, gst_plugin_template,
+ GstAudioFilter, GST_TYPE_AUDIO_FILTER, DEBUG_INIT);
+
+static void gst_plugin_template_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_plugin_template_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+
+static gboolean gst_plugin_template_setup (GstAudioFilter * filter,
+ GstRingBufferSpec * spec);
+static GstFlowReturn gst_plugin_template_filter (GstBaseTransform * bt,
+ GstBuffer * outbuf, GstBuffer * inbuf);
+static GstFlowReturn
+gst_plugin_template_filter_inplace (GstBaseTransform * base_transform,
+ GstBuffer * buf);
+
+#define ALLOWED_CAPS_STRING \
+ GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS
+
+/* GObject vmethod implementations */
+
+static void
+gst_plugin_template_base_init (gpointer klass)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstAudioFilterClass *audiofilter_class = GST_AUDIO_FILTER_CLASS (klass);
+ GstCaps *caps;
+
+ gst_element_class_set_details_simple (element_class,
+ "Plugin",
+ "Filter/Effect/Audio",
+ "FIXME:Filters audio",
+ "AUTHOR_NAME AUTHOR_EMAIL");
+
+ caps = gst_caps_from_string (ALLOWED_CAPS_STRING);
+ gst_audio_filter_class_add_pad_templates (audiofilter_class, caps);
+ gst_caps_unref (caps);
+}
+
+static void
+gst_plugin_template_class_init (GstPluginTemplateClass * klass)
+{
+ GObjectClass *gobject_class;
+ GstBaseTransformClass *btrans_class;
+ GstAudioFilterClass *audio_filter_class;
+
+ gobject_class = (GObjectClass *) klass;
+ btrans_class = (GstBaseTransformClass *) klass;
+ audio_filter_class = (GstAudioFilterClass *) klass;
+
+#if 0
+ g_object_class_install_property (gobject_class, ARG_METHOD,
+ g_param_spec_enum ("method", "method", "method",
+ GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#endif
+
+ gobject_class->set_property = gst_plugin_template_set_property;
+ gobject_class->get_property = gst_plugin_template_get_property;
+
+ /* this function will be called whenever the format changes */
+ audio_filter_class->setup = gst_plugin_template_setup;
+
+ /* here you set up functions to process data (either in place, or from
+ * one input buffer to another output buffer); only one is required */
+ btrans_class->transform = gst_plugin_template_filter;
+ btrans_class->transform_ip = gst_plugin_template_filter_inplace;
+}
+
+static void
+gst_plugin_template_init (GstPluginTemplate * plugin_template,
+ GstPluginTemplateClass * g_class)
+{
+ GST_DEBUG ("init");
+
+ /* do stuff if you need to */
+}
+
+static void
+gst_plugin_template_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);
+
+ GST_OBJECT_LOCK (filter);
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+ GST_OBJECT_UNLOCK (filter);
+}
+
+static void
+gst_plugin_template_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);
+
+ GST_OBJECT_LOCK (filter);
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+ GST_OBJECT_UNLOCK (filter);
+}
+
+static gboolean
+gst_plugin_template_setup (GstAudioFilter * filter,
+ GstRingBufferSpec * spec)
+{
+ GstPluginTemplate *plugin_template;
+
+ plugin_template = GST_PLUGIN_TEMPLATE (filter);
+
+ /* if any setup needs to be done, do it here */
+
+ return TRUE; /* it's all good */
+}
+
+/* You may choose to implement either a copying filter or an
+ * in-place filter (or both). Implementing only one will give
+ * full functionality, however, implementing both will cause
+ * audiofilter to use the optimal function in every situation,
+ * with a minimum of memory copies. */
+
+static GstFlowReturn
+gst_plugin_template_filter (GstBaseTransform * base_transform,
+ GstBuffer * inbuf, GstBuffer * outbuf)
+{
+ GstPluginTemplate *plugin_template;
+ GstAudioFilter *audiofilter;
+
+ audiofilter = GST_AUDIO_FILTER (base_transform);
+ plugin_template = GST_PLUGIN_TEMPLATE (base_transform);
+
+ /* FIXME: do something interesting here. This simply copies the source
+ * to the destination. */
+
+ memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf),
+ GST_BUFFER_SIZE (inbuf));
+
+ return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+gst_plugin_template_filter_inplace (GstBaseTransform * base_transform,
+ GstBuffer * buf)
+{
+ GstPluginTemplate *plugin_template;
+ GstAudioFilter *audiofilter;
+
+ audiofilter = GST_AUDIO_FILTER (base_transform);
+ plugin_template = GST_PLUGIN_TEMPLATE (base_transform);
+
+ /* FIXME: do something interesting here. This simply copies the source
+ * to the destination. */
+
+ return GST_FLOW_OK;
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ return gst_element_register (plugin, "plugin", GST_RANK_NONE,
+ GST_TYPE_PLUGIN_TEMPLATE);
+}
+
+/* gstreamer looks for this structure to register plugins
+ *
+ * FIXME:exchange the string 'Template plugin' with you plugin description
+ */
+GST_PLUGIN_DEFINE (
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "plugin",
+ "Template plugin",
+ plugin_init,
+ VERSION, "LGPL",
+ "GStreamer",
+ "http://gstreamer.net/"
+);
diff --git a/src/gstplugin.c b/src/gstplugin.c
new file mode 100644
index 0000000..d6617ea
--- /dev/null
+++ b/src/gstplugin.c
@@ -0,0 +1,285 @@
+/*
+ * GStreamer
+ * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
+ * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
+ * which case the following provisions apply instead of the ones
+ * mentioned above:
+ *
+ * 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-plugin
+ *
+ * FIXME:Describe plugin here.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch -v -m fakesrc ! plugin ! fakesink silent=TRUE
+ * ]|
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gst/gst.h>
+
+#include "gstplugin.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_plugin_template_debug);
+#define GST_CAT_DEFAULT gst_plugin_template_debug
+
+/* Filter signals and args */
+enum
+{
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_SILENT
+};
+
+/* the capabilities of the inputs and outputs.
+ *
+ * describe the real formats here.
+ */
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("ANY")
+ );
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("ANY")
+ );
+
+#define gst_plugin_template_parent_class parent_class
+G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_ELEMENT);
+
+static void gst_plugin_template_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_plugin_template_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+
+static gboolean gst_plugin_template_sink_event (GstPad * pad, GstObject * parent, GstEvent * event);
+static GstFlowReturn gst_plugin_template_chain (GstPad * pad, GstObject * parent, GstBuffer * buf);
+
+/* GObject vmethod implementations */
+
+/* initialize the plugin's class */
+static void
+gst_plugin_template_class_init (GstPluginTemplateClass * klass)
+{
+ GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
+
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
+
+ gobject_class->set_property = gst_plugin_template_set_property;
+ gobject_class->get_property = gst_plugin_template_get_property;
+
+ g_object_class_install_property (gobject_class, PROP_SILENT,
+ g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
+ FALSE, G_PARAM_READWRITE));
+
+ gst_element_class_set_details_simple(gstelement_class,
+ "Plugin",
+ "FIXME:Generic",
+ "FIXME:Generic Template Element",
+ "AUTHOR_NAME AUTHOR_EMAIL");
+
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sink_factory));
+}
+
+/* initialize the new element
+ * instantiate pads and add them to element
+ * set pad calback functions
+ * initialize instance structure
+ */
+static void
+gst_plugin_template_init (GstPluginTemplate * filter)
+{
+ filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
+ gst_pad_set_event_function (filter->sinkpad,
+ GST_DEBUG_FUNCPTR(gst_plugin_template_sink_event));
+ gst_pad_set_chain_function (filter->sinkpad,
+ GST_DEBUG_FUNCPTR(gst_plugin_template_chain));
+ GST_PAD_SET_PROXY_CAPS (filter->sinkpad);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
+
+ filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
+ GST_PAD_SET_PROXY_CAPS (filter->srcpad);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
+
+ filter->silent = FALSE;
+}
+
+static void
+gst_plugin_template_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);
+
+ switch (prop_id) {
+ case PROP_SILENT:
+ filter->silent = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_plugin_template_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);
+
+ switch (prop_id) {
+ case PROP_SILENT:
+ g_value_set_boolean (value, filter->silent);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/* GstElement vmethod implementations */
+
+/* this function handles sink events */
+static gboolean
+gst_plugin_template_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
+{
+ gboolean ret;
+ GstPluginTemplate *filter;
+
+ filter = GST_PLUGIN_TEMPLATE (parent);
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps * caps;
+
+ gst_event_parse_caps (event, &caps);
+ /* do something with the caps */
+
+ /* and forward */
+ ret = gst_pad_event_default (pad, parent, event);
+ break;
+ }
+ default:
+ ret = gst_pad_event_default (pad, parent, event);
+ break;
+ }
+ return ret;
+}
+
+/* chain function
+ * this function does the actual processing
+ */
+static GstFlowReturn
+gst_plugin_template_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
+{
+ GstPluginTemplate *filter;
+
+ filter = GST_PLUGIN_TEMPLATE (parent);
+
+ if (filter->silent == FALSE)
+ g_print ("I'm plugged, therefore I'm in.\n");
+
+ /* just push out the incoming buffer without touching it */
+ return gst_pad_push (filter->srcpad, buf);
+}
+
+
+/* entry point to initialize the plug-in
+ * initialize the plug-in itself
+ * register the element factories and other features
+ */
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ /* debug category for fltering log messages
+ *
+ * exchange the string 'Template plugin' with your description
+ */
+ GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin",
+ 0, "Template plugin");
+
+ return gst_element_register (plugin, "plugin", GST_RANK_NONE,
+ GST_TYPE_PLUGIN_TEMPLATE);
+}
+
+/* PACKAGE: this is usually set by autotools depending on some _INIT macro
+ * in configure.ac and then written into and defined in config.h, but we can
+ * just set it ourselves here in case someone doesn't use autotools to
+ * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
+ */
+#ifndef PACKAGE
+#define PACKAGE "myfirstplugin"
+#endif
+
+/* gstreamer looks for this structure to register plugins
+ *
+ * exchange the string 'Template plugin' with your plugin description
+ */
+GST_PLUGIN_DEFINE (
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ plugin,
+ "Template plugin",
+ plugin_init,
+ VERSION,
+ "LGPL",
+ "GStreamer",
+ "http://gstreamer.net/"
+)
diff --git a/src/gstplugin.h b/src/gstplugin.h
new file mode 100644
index 0000000..f1fe4ed
--- /dev/null
+++ b/src/gstplugin.h
@@ -0,0 +1,86 @@
+/*
+ * GStreamer
+ * Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
+ * Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
+ * which case the following provisions apply instead of the ones
+ * mentioned above:
+ *
+ * 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_PLUGIN_TEMPLATE_H__
+#define __GST_PLUGIN_TEMPLATE_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+/* #defines don't like whitespacey bits */
+#define GST_TYPE_PLUGIN_TEMPLATE \
+ (gst_plugin_template_get_type())
+#define GST_PLUGIN_TEMPLATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplate))
+#define GST_PLUGIN_TEMPLATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplateClass))
+#define GST_IS_PLUGIN_TEMPLATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLUGIN_TEMPLATE))
+#define GST_IS_PLUGIN_TEMPLATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLUGIN_TEMPLATE))
+
+typedef struct _GstPluginTemplate GstPluginTemplate;
+typedef struct _GstPluginTemplateClass GstPluginTemplateClass;
+
+struct _GstPluginTemplate
+{
+ GstElement element;
+
+ GstPad *sinkpad, *srcpad;
+
+ gboolean silent;
+};
+
+struct _GstPluginTemplateClass
+{
+ GstElementClass parent_class;
+};
+
+GType gst_plugin_template_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_PLUGIN_TEMPLATE_H__ */
diff --git a/src/gsttransform.c b/src/gsttransform.c
new file mode 100644
index 0000000..536357b
--- /dev/null
+++ b/src/gsttransform.c
@@ -0,0 +1,223 @@
+/*
+ * GStreamer
+ * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
+ * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL
+ *
+ * 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-plugin
+ *
+ * FIXME:Describe plugin here.
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch -v -m fakesrc ! plugin ! fakesink silent=TRUE
+ * ]|
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+#include <gst/controller/gstcontroller.h>
+
+#include "gsttransform.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_plugin_template_debug);
+#define GST_CAT_DEFAULT gst_plugin_template_debug
+
+/* Filter signals and args */
+enum
+{
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_SILENT,
+};
+
+/* the capabilities of the inputs and outputs.
+ *
+ * FIXME:describe the real formats here.
+ */
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("ANY")
+);
+
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("ANY")
+);
+
+#define gst_plugin_template_parent_class parent_class
+G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_BASE_TRANSFORM);
+
+static void gst_plugin_template_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_plugin_template_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+
+static GstFlowReturn gst_plugin_template_transform_ip (GstBaseTransform * base,
+ GstBuffer * outbuf);
+
+/* GObject vmethod implementations */
+
+/* initialize the plugin's class */
+static void
+gst_plugin_template_class_init (GstPluginTemplateClass * klass)
+{
+ GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
+
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
+
+ gobject_class->set_property = gst_plugin_template_set_property;
+ gobject_class->get_property = gst_plugin_template_get_property;
+
+ g_object_class_install_property (gobject_class, PROP_SILENT,
+ g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
+ FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Plugin",
+ "Generic/Filter",
+ "FIXME:Generic Template Filter",
+ "AUTHOR_NAME AUTHOR_EMAIL");
+
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&src_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sink_template));
+
+ GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
+ GST_DEBUG_FUNCPTR (gst_plugin_template_transform_ip);
+
+ /* debug category for fltering log messages
+ *
+ * FIXME:exchange the string 'Template plugin' with your description
+ */
+ GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin", 0, "Template plugin");
+}
+
+/* initialize the new element
+ * initialize instance structure
+ */
+static void
+gst_plugin_template_init (GstPluginTemplate *filter)
+{
+ filter->silent = FALSE;
+}
+
+static void
+gst_plugin_template_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);
+
+ switch (prop_id) {
+ case PROP_SILENT:
+ filter->silent = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_plugin_template_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);
+
+ switch (prop_id) {
+ case PROP_SILENT:
+ g_value_set_boolean (value, filter->silent);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/* GstBaseTransform vmethod implementations */
+
+/* this function does the actual processing
+ */
+static GstFlowReturn
+gst_plugin_template_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
+{
+ GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (base);
+
+ if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (outbuf)))
+ gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (outbuf));
+
+ if (filter->silent == FALSE)
+ g_print ("I'm plugged, therefore I'm in.\n");
+
+ /* FIXME: do something interesting here. This simply copies the source
+ * to the destination. */
+
+ return GST_FLOW_OK;
+}
+
+
+/* entry point to initialize the plug-in
+ * initialize the plug-in itself
+ * register the element factories and other features
+ */
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ /* initialize gst controller library */
+ gst_controller_init(NULL, NULL);
+
+ return gst_element_register (plugin, "plugin", GST_RANK_NONE,
+ GST_TYPE_PLUGIN_TEMPLATE);
+}
+
+/* gstreamer looks for this structure to register plugins
+ *
+ * FIXME:exchange the string 'Template plugin' with you plugin description
+ */
+GST_PLUGIN_DEFINE (
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ plugin,
+ "Template plugin",
+ plugin_init,
+ VERSION,
+ "LGPL",
+ "GStreamer",
+ "http://gstreamer.net/"
+)
diff --git a/src/gsttransform.h b/src/gsttransform.h
new file mode 100644
index 0000000..be9ce86
--- /dev/null
+++ b/src/gsttransform.h
@@ -0,0 +1,58 @@
+/*
+ * GStreamer
+ * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
+ * Copyright (C) YEAR AUTHOR_NAME AUTHOR_EMAIL
+ *
+ * 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_PLUGIN_TEMPLATE_H__
+#define __GST_PLUGIN_TEMPLATE_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PLUGIN_TEMPLATE \
+ (gst_plugin_template_get_type())
+#define GST_PLUGIN_TEMPLATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplate))
+#define GST_PLUGIN_TEMPLATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PLUGIN_TEMPLATE,GstPluginTemplateClass))
+#define GST_IS_PLUGIN_TEMPLATE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLUGIN_TEMPLATE))
+#define GST_IS_PLUGIN_TEMPLATE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLUGIN_TEMPLATE))
+
+typedef struct _GstPluginTemplate GstPluginTemplate;
+typedef struct _GstPluginTemplateClass GstPluginTemplateClass;
+
+struct _GstPluginTemplate {
+ GstBaseTransform element;
+
+ gboolean silent;
+};
+
+struct _GstPluginTemplateClass {
+ GstBaseTransformClass parent_class;
+};
+
+GType gst_plugin_template_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_PLUGIN_TEMPLATE_H__ */