Hi all,<br><br>I&#39;m just running through the plugin writer&#39;s guide (<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/index.html">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/index.html</a>), specifically the section about building a plugin from generated boilerplate code, and having trouble compiling it.<br>
<br>I have done the following steps:<br>1. Checked out gst-template from cvs<br>2. Generated example filter from template:<br><br>&gt; cd gst-template/gst-plugin/src<br>&gt; ../tools/make_element ExampleFilter<br><br>This created the .c and .h files as expected.<br>
<br>Without making any further changes to the source (since I just want to compile the basic plugin):<br><br>3. added the *.c and *.h to src/Makefile.am, so it looks like:<br><br># plugindir is set in configure<br><br>##############################################################################<br>
# change <a href="http://libgstplugin.la">libgstplugin.la</a> to something more suitable, e.g. <a href="http://libmysomething.la">libmysomething.la</a>&nbsp; #<br>##############################################################################<br>
plugin_LTLIBRARIES = <a href="http://libgstplugin.la">libgstplugin.la</a><br><br>##############################################################################<br># for the next set of variables, rename the prefix if you renamed the .la,&nbsp;&nbsp; #<br>
#&nbsp; e.g. libgstplugin_la_SOURCES =&gt; libmysomething_la_SOURCES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgstplugin_la_CFLAGS&nbsp; =&gt; libmysomething_la_CFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgstplugin_la_LIBADD&nbsp; =&gt; libmysomething_la_LIBADD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #<br>
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libgstplugin_la_LDFLAGS =&gt; libmysomething_la_LDFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #<br>##############################################################################<br><br># sources used to compile this plug-in<br>libgstplugin_la_SOURCES = gstplugin.c gstexamplefilter.c<br>
<br># flags used to compile this plugin<br># add other _CFLAGS and _LIBS as needed<br>libgstplugin_la_CFLAGS = $(GST_CFLAGS)<br>libgstplugin_la_LIBADD = $(GST_LIBS)<br>libgstplugin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)<br><br>
# headers we need but don&#39;t want installed<br>noinst_HEADERS = gstplugin.h gstexamplefilter.h<br><br>4. Run autogen.sh, all good still.<br>5. make - error compiling gstexamplefilter.c:<br><br>$ make<br>cd . &amp;&amp; /bin/bash /space/playpen/gst-template/gst-plugin/missing --run autoheader<br>
touch ./<a href="http://config.h.in">config.h.in</a><br>cd . &amp;&amp; /bin/bash ./config.status config.h<br>config.status: creating config.h<br>config.status: config.h is unchanged<br>make&nbsp; all-recursive<br>make[1]: Entering directory `/space/playpen/gst-template/gst-plugin&#39;<br>
Making all in m4<br>make[2]: Entering directory `/space/playpen/gst-template/gst-plugin/m4&#39;<br>make[2]: Nothing to be done for `all&#39;.<br>make[2]: Leaving directory `/space/playpen/gst-template/gst-plugin/m4&#39;<br>
Making all in src<br>make[2]: Entering directory `/space/playpen/gst-template/gst-plugin/src&#39;<br>if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I..&nbsp;&nbsp;&nbsp; -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2&nbsp;&nbsp;&nbsp; -Wall -Werror -g -O2 -MT libgstplugin_la-gstplugin.lo -MD -MP -MF &quot;.deps/libgstplugin_la-gstplugin.Tpo&quot; \<br>
&nbsp;&nbsp;&nbsp; &nbsp; -c -o libgstplugin_la-gstplugin.lo `test -f &#39;gstplugin.c&#39; || echo &#39;./&#39;`gstplugin.c; \<br>&nbsp;&nbsp;&nbsp; then mv -f &quot;.deps/libgstplugin_la-gstplugin.Tpo&quot; &quot;.deps/libgstplugin_la-gstplugin.Plo&quot;; \<br>
&nbsp;&nbsp;&nbsp; else rm -f &quot;.deps/libgstplugin_la-gstplugin.Tpo&quot;; exit 1; \<br>&nbsp;&nbsp;&nbsp; fi<br>&nbsp;gcc -DHAVE_CONFIG_H -I. -I. -I.. -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -Wall -Werror -g -O2 -MT libgstplugin_la-gstplugin.lo -MD -MP -MF .deps/libgstplugin_la-gstplugin.Tpo -c gstplugin.c&nbsp; -fPIC -DPIC -o .libs/libgstplugin_la-gstplugin.o<br>
&nbsp;gcc -DHAVE_CONFIG_H -I. -I. -I.. -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -Wall -Werror -g -O2 -MT libgstplugin_la-gstplugin.lo -MD -MP -MF .deps/libgstplugin_la-gstplugin.Tpo -c gstplugin.c -o libgstplugin_la-gstplugin.o &gt;/dev/null 2&gt;&amp;1<br>
if /bin/bash ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I..&nbsp;&nbsp;&nbsp; -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2&nbsp;&nbsp;&nbsp; -Wall -Werror -g -O2 -MT libgstplugin_la-gstexamplefilter.lo -MD -MP -MF &quot;.deps/libgstplugin_la-gstexamplefilter.Tpo&quot; \<br>
&nbsp;&nbsp;&nbsp; &nbsp; -c -o libgstplugin_la-gstexamplefilter.lo `test -f &#39;gstexamplefilter.c&#39; || echo &#39;./&#39;`gstexamplefilter.c; \<br>&nbsp;&nbsp;&nbsp; then mv -f &quot;.deps/libgstplugin_la-gstexamplefilter.Tpo&quot; &quot;.deps/libgstplugin_la-gstexamplefilter.Plo&quot;; \<br>
&nbsp;&nbsp;&nbsp; else rm -f &quot;.deps/libgstplugin_la-gstexamplefilter.Tpo&quot;; exit 1; \<br>&nbsp;&nbsp;&nbsp; fi<br>&nbsp;gcc -DHAVE_CONFIG_H -I. -I. -I.. -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -Wall -Werror -g -O2 -MT libgstplugin_la-gstexamplefilter.lo -MD -MP -MF .deps/libgstplugin_la-gstexamplefilter.Tpo -c gstexamplefilter.c&nbsp; -fPIC -DPIC -o .libs/libgstplugin_la-gstexamplefilter.o<br>
cc1: warnings being treated as errors<br>gstexamplefilter.c: In function 'examplefilter_init':<br>gstexamplefilter.c:254: warning: passing argument 1 of 'gst_element_register' from incompatible pointer type<br>gstexamplefilter.c: At top level:<br>
gstexamplefilter.c:261: warning: initialization from incompatible pointer type<br>make[2]: *** [libgstplugin_la-gstexamplefilter.lo] Error 1<br>make[2]: Leaving directory `/space/playpen/gst-template/gst-plugin/src&#39;<br>
make[1]: *** [all-recursive] Error 1<br>make[1]: Leaving directory `/space/playpen/gst-template/gst-plugin&#39;<br>make: *** [all] Error 2<br><br>Complete listing of gstexamplefilter.c at end of this post.<br><br>&quot;gcc -v&quot; gives:<br>
Using built-in specs.<br>Target: i486-linux-gnu<br>Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu<br>
Thread model: posix<br>gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)<br><br>Is it a problem with my gcc being too recent and being stricter on warnings?&nbsp; Please go easy on me, I haven&#39;t any experience with gtk and little with c :-)<br>
<br>Thanks in advance,<br>Jono<br><br>gstexamplefilter.c:<br>/*<br>&nbsp;* GStreamer<br>&nbsp;* Copyright (C) 2005 Thomas Vander Stichele &lt;<a href="mailto:thomas@apestaart.org">thomas@apestaart.org</a>&gt;<br>&nbsp;* Copyright (C) 2005 Ronald S. Bultje &lt;<a href="mailto:rbultje@ronald.bitfreak.net">rbultje@ronald.bitfreak.net</a>&gt;<br>
&nbsp;* Copyright (C) 2008 Jon Burgess &lt;&lt;<a href="mailto:user@hostname.org">user@hostname.org</a>&gt;&gt;<br>&nbsp;* <br>&nbsp;* Permission is hereby granted, free of charge, to any person obtaining a<br>&nbsp;* copy of this software and associated documentation files (the &quot;Software&quot;),<br>
&nbsp;* to deal in the Software without restriction, including without limitation<br>&nbsp;* the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>&nbsp;* and/or sell copies of the Software, and to permit persons to whom the<br>
&nbsp;* Software is furnished to do so, subject to the following conditions:<br>&nbsp;*<br>&nbsp;* The above copyright notice and this permission notice shall be included in<br>&nbsp;* all copies or substantial portions of the Software.<br>&nbsp;*<br>
&nbsp;* THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>&nbsp;* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>&nbsp;* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
&nbsp;* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>&nbsp;* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>&nbsp;* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
&nbsp;* DEALINGS IN THE SOFTWARE.<br>&nbsp;*<br>&nbsp;* Alternatively, the contents of this file may be used under the<br>&nbsp;* GNU Lesser General Public License Version 2.1 (the &quot;LGPL&quot;), in<br>&nbsp;* which case the following provisions apply instead of the ones<br>
&nbsp;* mentioned above:<br>&nbsp;*<br>&nbsp;* This library is free software; you can redistribute it and/or<br>&nbsp;* modify it under the terms of the GNU Library General Public<br>&nbsp;* License as published by the Free Software Foundation; either<br>
&nbsp;* version 2 of the License, or (at your option) any later version.<br>&nbsp;*<br>&nbsp;* This library is distributed in the hope that it will be useful,<br>&nbsp;* but WITHOUT ANY WARRANTY; without even the implied warranty of<br>&nbsp;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp; See the GNU<br>
&nbsp;* Library General Public License for more details.<br>&nbsp;*<br>&nbsp;* You should have received a copy of the GNU Library General Public<br>&nbsp;* License along with this library; if not, write to the<br>&nbsp;* Free Software Foundation, Inc., 59 Temple Place - Suite 330,<br>
&nbsp;* Boston, MA 02111-1307, USA.<br>&nbsp;*/<br><br>/**<br>&nbsp;* SECTION:element-examplefilter<br>&nbsp;*<br>&nbsp;* FIXME:Describe examplefilter here.<br>&nbsp;*<br>&nbsp;* &lt;refsect2&gt;<br>&nbsp;* &lt;title&gt;Example launch line&lt;/title&gt;<br>&nbsp;* |[<br>
&nbsp;* gst-launch -v -m fakesrc ! examplefilter ! fakesink silent=TRUE<br>&nbsp;* ]|<br>&nbsp;* &lt;/refsect2&gt;<br>&nbsp;*/<br><br>#ifdef HAVE_CONFIG_H<br>#&nbsp; include &lt;config.h&gt;<br>#endif<br><br>#include &lt;gst/gst.h&gt;<br><br>#include &quot;gstexamplefilter.h&quot;<br>
<br>GST_DEBUG_CATEGORY_STATIC (gst_example_filter_debug);<br>#define GST_CAT_DEFAULT gst_example_filter_debug<br><br>/* Filter signals and args */<br>enum<br>{<br>&nbsp; /* FILL ME */<br>&nbsp; LAST_SIGNAL<br>};<br><br>enum<br>{<br>
&nbsp; PROP_0,<br>&nbsp; PROP_SILENT<br>};<br><br>/* the capabilities of the inputs and outputs.<br>&nbsp;*<br>&nbsp;* describe the real formats here.<br>&nbsp;*/<br>static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE (&quot;sink&quot;,<br>
&nbsp;&nbsp;&nbsp; GST_PAD_SINK,<br>&nbsp;&nbsp;&nbsp; GST_PAD_ALWAYS,<br>&nbsp;&nbsp;&nbsp; GST_STATIC_CAPS (&quot;ANY&quot;)<br>&nbsp;&nbsp;&nbsp; );<br><br>static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE (&quot;src&quot;,<br>&nbsp;&nbsp;&nbsp; GST_PAD_SRC,<br>&nbsp;&nbsp;&nbsp; GST_PAD_ALWAYS,<br>
&nbsp;&nbsp;&nbsp; GST_STATIC_CAPS (&quot;ANY&quot;)<br>&nbsp;&nbsp;&nbsp; );<br><br>GST_BOILERPLATE (GstExampleFilter, gst_example_filter, GstElement,<br>&nbsp;&nbsp;&nbsp; GST_TYPE_ELEMENT);<br><br>static void gst_example_filter_set_property (GObject * object, guint prop_id,<br>
&nbsp;&nbsp;&nbsp; const GValue * value, GParamSpec * pspec);<br>static void gst_example_filter_get_property (GObject * object, guint prop_id,<br>&nbsp;&nbsp;&nbsp; GValue * value, GParamSpec * pspec);<br><br>static gboolean gst_example_filter_set_caps (GstPad * pad, GstCaps * caps);<br>
static GstFlowReturn gst_example_filter_chain (GstPad * pad, GstBuffer * buf);<br><br>/* GObject vmethod implementations */<br><br>static void<br>gst_example_filter_base_init (gpointer gclass)<br>{<br>&nbsp; GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);<br>
<br>&nbsp; gst_element_class_set_details_simple(element_class,<br>&nbsp;&nbsp;&nbsp; &quot;ExampleFilter&quot;,<br>&nbsp;&nbsp;&nbsp; &quot;FIXME:Generic&quot;,<br>&nbsp;&nbsp;&nbsp; &quot;FIXME:Generic Template Element&quot;,<br>&nbsp;&nbsp;&nbsp; &quot;Jon Burgess &lt;&lt;<a href="mailto:user@hostname.org">user@hostname.org</a>&gt;&gt;&quot;);<br>
<br>&nbsp; gst_element_class_add_pad_template (element_class,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gst_static_pad_template_get (&amp;src_factory));<br>&nbsp; gst_element_class_add_pad_template (element_class,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gst_static_pad_template_get (&amp;sink_factory));<br>
}<br><br>/* initialize the examplefilter&#39;s class */<br>static void<br>gst_example_filter_class_init (GstExampleFilterClass * klass)<br>{<br>&nbsp; GObjectClass *gobject_class;<br>&nbsp; GstElementClass *gstelement_class;<br><br>
&nbsp; gobject_class = (GObjectClass *) klass;<br>&nbsp; gstelement_class = (GstElementClass *) klass;<br><br>&nbsp; gobject_class-&gt;set_property = gst_example_filter_set_property;<br>&nbsp; gobject_class-&gt;get_property = gst_example_filter_get_property;<br>
<br>&nbsp; g_object_class_install_property (gobject_class, PROP_SILENT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_param_spec_boolean (&quot;silent&quot;, &quot;Silent&quot;, &quot;Produce verbose output ?&quot;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE, G_PARAM_READWRITE));<br>}<br>
<br>/* initialize the new element<br>&nbsp;* instantiate pads and add them to element<br>&nbsp;* set pad calback functions<br>&nbsp;* initialize instance structure<br>&nbsp;*/<br>static void<br>gst_example_filter_init (GstExampleFilter * filter,<br>
&nbsp;&nbsp;&nbsp; GstExampleFilterClass * gclass)<br>{<br>&nbsp; filter-&gt;sinkpad = gst_pad_new_from_static_template (&amp;sink_factory, &quot;sink&quot;);<br>&nbsp; gst_pad_set_setcaps_function (filter-&gt;sinkpad,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_DEBUG_FUNCPTR(gst_example_filter_set_caps));<br>
&nbsp; gst_pad_set_getcaps_function (filter-&gt;sinkpad,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));<br>&nbsp; gst_pad_set_chain_function (filter-&gt;sinkpad,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_DEBUG_FUNCPTR(gst_example_filter_chain));<br>
<br>&nbsp; filter-&gt;srcpad = gst_pad_new_from_static_template (&amp;src_factory, &quot;src&quot;);<br>&nbsp; gst_pad_set_getcaps_function (filter-&gt;srcpad,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));<br>
<br>&nbsp; gst_element_add_pad (GST_ELEMENT (filter), filter-&gt;sinkpad);<br>&nbsp; gst_element_add_pad (GST_ELEMENT (filter), filter-&gt;srcpad);<br>&nbsp; filter-&gt;silent = FALSE;<br>}<br><br>static void<br>gst_example_filter_set_property (GObject * object, guint prop_id,<br>
&nbsp;&nbsp;&nbsp; const GValue * value, GParamSpec * pspec)<br>{<br>&nbsp; GstExampleFilter *filter = GST_EXAMPLEFILTER (object);<br><br>&nbsp; switch (prop_id) {<br>&nbsp;&nbsp;&nbsp; case PROP_SILENT:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filter-&gt;silent = g_value_get_boolean (value);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; default:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp; }<br>}<br><br>static void<br>gst_example_filter_get_property (GObject * object, guint prop_id,<br>&nbsp;&nbsp;&nbsp; GValue * value, GParamSpec * pspec)<br>
{<br>&nbsp; GstExampleFilter *filter = GST_EXAMPLEFILTER (object);<br><br>&nbsp; switch (prop_id) {<br>&nbsp;&nbsp;&nbsp; case PROP_SILENT:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_value_set_boolean (value, filter-&gt;silent);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; default:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp; }<br>}<br><br>/* GstElement vmethod implementations */<br><br>/* this function handles the link with other elements */<br>static gboolean<br>gst_example_filter_set_caps (GstPad * pad, GstCaps * caps)<br>
{<br>&nbsp; GstExampleFilter *filter;<br>&nbsp; GstPad *otherpad;<br><br>&nbsp; filter = GST_EXAMPLEFILTER (gst_pad_get_parent (pad));<br>&nbsp; otherpad = (pad == filter-&gt;srcpad) ? filter-&gt;sinkpad : filter-&gt;srcpad;<br>&nbsp; gst_object_unref (filter);<br>
<br>&nbsp; return gst_pad_set_caps (otherpad, caps);<br>}<br><br>/* chain function<br>&nbsp;* this function does the actual processing<br>&nbsp;*/<br>static GstFlowReturn<br>gst_example_filter_chain (GstPad * pad, GstBuffer * buf)<br>{<br>
&nbsp; GstExampleFilter *filter;<br><br>&nbsp; filter = GST_EXAMPLEFILTER (GST_OBJECT_PARENT (pad));<br><br>&nbsp; if (filter-&gt;silent == FALSE)<br>&nbsp;&nbsp;&nbsp; g_print (&quot;I&#39;m plugged, therefore I&#39;m in.\n&quot;);<br><br>&nbsp; /* just push out the incoming buffer without touching it */<br>
&nbsp; return gst_pad_push (filter-&gt;srcpad, buf);<br>}<br><br><br>/* entry point to initialize the plug-in<br>&nbsp;* initialize the plug-in itself<br>&nbsp;* register the element factories and other features<br>&nbsp;*/<br>static gboolean<br>
examplefilter_init (GstExampleFilter * examplefilter)<br>{<br>&nbsp; /* debug category for fltering log messages<br>&nbsp;&nbsp; *<br>&nbsp;&nbsp; * exchange the string &#39;Template examplefilter&#39; with your description<br>&nbsp;&nbsp; */<br>&nbsp; GST_DEBUG_CATEGORY_INIT (gst_example_filter_debug, &quot;examplefilter&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, &quot;Template examplefilter&quot;);<br><br>&nbsp; return gst_element_register (examplefilter, &quot;examplefilter&quot;, GST_RANK_NONE,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GST_TYPE_EXAMPLEFILTER);<br>}<br><br>/* gstreamer looks for this structure to register examplefilters<br>
&nbsp;*<br>&nbsp;* exchange the string &#39;Template examplefilter&#39; with your examplefilter description<br>&nbsp;*/<br>GST_PLUGIN_DEFINE (<br>&nbsp;&nbsp;&nbsp; GST_VERSION_MAJOR,<br>&nbsp;&nbsp;&nbsp; GST_VERSION_MINOR,<br>&nbsp;&nbsp;&nbsp; &quot;examplefilter&quot;,<br>&nbsp;&nbsp;&nbsp; &quot;Template examplefilter&quot;,<br>
&nbsp;&nbsp;&nbsp; examplefilter_init,<br>&nbsp;&nbsp;&nbsp; VERSION,<br>&nbsp;&nbsp;&nbsp; &quot;LGPL&quot;,<br>&nbsp;&nbsp;&nbsp; &quot;GStreamer&quot;,<br>&nbsp;&nbsp;&nbsp; &quot;<a href="http://gstreamer.net/">http://gstreamer.net/</a>&quot;<br>)<br><br><br>gstexamplefilter.h:<br>/*<br>&nbsp;* GStreamer<br>
&nbsp;* Copyright (C) 2005 Thomas Vander Stichele &lt;<a href="mailto:thomas@apestaart.org">thomas@apestaart.org</a>&gt;<br>&nbsp;* Copyright (C) 2005 Ronald S. Bultje &lt;<a href="mailto:rbultje@ronald.bitfreak.net">rbultje@ronald.bitfreak.net</a>&gt;<br>
&nbsp;* Copyright (C) 2008 Jon Burgess &lt;&lt;<a href="mailto:user@hostname.org">user@hostname.org</a>&gt;&gt;<br>&nbsp;* <br>&nbsp;* Permission is hereby granted, free of charge, to any person obtaining a<br>&nbsp;* copy of this software and associated documentation files (the &quot;Software&quot;),<br>
&nbsp;* to deal in the Software without restriction, including without limitation<br>&nbsp;* the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>&nbsp;* and/or sell copies of the Software, and to permit persons to whom the<br>
&nbsp;* Software is furnished to do so, subject to the following conditions:<br>&nbsp;*<br>&nbsp;* The above copyright notice and this permission notice shall be included in<br>&nbsp;* all copies or substantial portions of the Software.<br>&nbsp;*<br>
&nbsp;* THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>&nbsp;* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>&nbsp;* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br>
&nbsp;* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>&nbsp;* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>&nbsp;* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
&nbsp;* DEALINGS IN THE SOFTWARE.<br>&nbsp;*<br>&nbsp;* Alternatively, the contents of this file may be used under the<br>&nbsp;* GNU Lesser General Public License Version 2.1 (the &quot;LGPL&quot;), in<br>&nbsp;* which case the following provisions apply instead of the ones<br>
&nbsp;* mentioned above:<br>&nbsp;*<br>&nbsp;* This library is free software; you can redistribute it and/or<br>&nbsp;* modify it under the terms of the GNU Library General Public<br>&nbsp;* License as published by the Free Software Foundation; either<br>
&nbsp;* version 2 of the License, or (at your option) any later version.<br>&nbsp;*<br>&nbsp;* This library is distributed in the hope that it will be useful,<br>&nbsp;* but WITHOUT ANY WARRANTY; without even the implied warranty of<br>&nbsp;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&nbsp; See the GNU<br>
&nbsp;* Library General Public License for more details.<br>&nbsp;*<br>&nbsp;* You should have received a copy of the GNU Library General Public<br>&nbsp;* License along with this library; if not, write to the<br>&nbsp;* Free Software Foundation, Inc., 59 Temple Place - Suite 330,<br>
&nbsp;* Boston, MA 02111-1307, USA.<br>&nbsp;*/<br><br>#ifndef __GST_EXAMPLEFILTER_H__<br>#define __GST_EXAMPLEFILTER_H__<br><br>#include &lt;gst/gst.h&gt;<br><br>G_BEGIN_DECLS<br><br>/* #defines don&#39;t like whitespacey bits */<br>
#define GST_TYPE_EXAMPLEFILTER \<br>&nbsp; (gst_example_filter_get_type())<br>#define GST_EXAMPLEFILTER(obj) \<br>&nbsp; (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_EXAMPLEFILTER,GstExampleFilter))<br>#define GST_EXAMPLEFILTER_CLASS(klass) \<br>
&nbsp; (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_EXAMPLEFILTER,GstExampleFilterClass))<br>#define GST_IS_EXAMPLEFILTER(obj) \<br>&nbsp; (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_EXAMPLEFILTER))<br>#define GST_IS_EXAMPLEFILTER_CLASS(klass) \<br>
&nbsp; (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_EXAMPLEFILTER))<br><br>typedef struct _GstExampleFilter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GstExampleFilter;<br>typedef struct _GstExampleFilterClass GstExampleFilterClass;<br><br>struct _GstExampleFilter<br>
{<br>&nbsp; GstElement element;<br><br>&nbsp; GstPad *sinkpad, *srcpad;<br><br>&nbsp; gboolean silent;<br>};<br><br>struct _GstExampleFilterClass <br>{<br>&nbsp; GstElementClass parent_class;<br>};<br><br>GType gst_example_filter_get_type (void);<br>
<br>G_END_DECLS<br><br>#endif /* __GST_EXAMPLEFILTER_H__ */<br><br><br>