[gst-devel] Building boilerplate plugin on ubuntu hardy
Zheng, Huan
huan.zheng at intel.com
Mon Oct 27 08:20:46 CET 2008
My understanding is that the automatically generated Makefile treats warning as erros.
You can try to find the “-Werror” in the Makefile and remove it.
Then it will compile successfully. Have a try.
Best Regards, Zheng, Huan(ZBT)
OTC/SSD/SSG
Intel Aisa-Pacific Research & Developement Ltd
Tel: 021-6116 6435
Inet: 8821 6435
Cub: 3W035
________________________________
From: Jon Burgess [mailto:jkburges at gmail.com]
Sent: 2008年10月27日 15:04
To: gstreamer-devel at lists.sourceforge.net
Subject: [gst-devel] Building boilerplate plugin on ubuntu hardy
Hi all,
I'm just running through the plugin writer's guide (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/index.html), specifically the section about building a plugin from generated boilerplate code, and having trouble compiling it.
I have done the following steps:
1. Checked out gst-template from cvs
2. Generated example filter from template:
> cd gst-template/gst-plugin/src
> ../tools/make_element ExampleFilter
This created the .c and .h files as expected.
Without making any further changes to the source (since I just want to compile the basic plugin):
3. added the *.c and *.h to src/Makefile.am, so it looks like:
# plugindir is set in configure
##############################################################################
# change libgstplugin.la<http://libgstplugin.la> to something more suitable, e.g. libmysomething.la<http://libmysomething.la> #
##############################################################################
plugin_LTLIBRARIES = libgstplugin.la<http://libgstplugin.la>
##############################################################################
# for the next set of variables, rename the prefix if you renamed the .la, #
# e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES #
# libgstplugin_la_CFLAGS => libmysomething_la_CFLAGS #
# libgstplugin_la_LIBADD => libmysomething_la_LIBADD #
# libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS #
##############################################################################
# sources used to compile this plug-in
libgstplugin_la_SOURCES = gstplugin.c gstexamplefilter.c
# flags used to compile this plugin
# add other _CFLAGS and _LIBS as needed
libgstplugin_la_CFLAGS = $(GST_CFLAGS)
libgstplugin_la_LIBADD = $(GST_LIBS)
libgstplugin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
# headers we need but don't want installed
noinst_HEADERS = gstplugin.h gstexamplefilter.h
4. Run autogen.sh, all good still.
5. make - error compiling gstexamplefilter.c:
$ make
cd . && /bin/bash /space/playpen/gst-template/gst-plugin/missing --run autoheader
touch ./config.h.in<http://config.h.in>
cd . && /bin/bash ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
make all-recursive
make[1]: Entering directory `/space/playpen/gst-template/gst-plugin'
Making all in m4
make[2]: Entering directory `/space/playpen/gst-template/gst-plugin/m4'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/space/playpen/gst-template/gst-plugin/m4'
Making all in src
make[2]: Entering directory `/space/playpen/gst-template/gst-plugin/src'
if /bin/bash ../libtool --mode=compile 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 -o libgstplugin_la-gstplugin.lo `test -f 'gstplugin.c' || echo './'`gstplugin.c; \
then mv -f ".deps/libgstplugin_la-gstplugin.Tpo" ".deps/libgstplugin_la-gstplugin.Plo"; \
else rm -f ".deps/libgstplugin_la-gstplugin.Tpo"; exit 1; \
fi
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 -fPIC -DPIC -o .libs/libgstplugin_la-gstplugin.o
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 >/dev/null 2>&1
if /bin/bash ../libtool --mode=compile 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 -o libgstplugin_la-gstexamplefilter.lo `test -f 'gstexamplefilter.c' || echo './'`gstexamplefilter.c; \
then mv -f ".deps/libgstplugin_la-gstexamplefilter.Tpo" ".deps/libgstplugin_la-gstexamplefilter.Plo"; \
else rm -f ".deps/libgstplugin_la-gstexamplefilter.Tpo"; exit 1; \
fi
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 -fPIC -DPIC -o .libs/libgstplugin_la-gstexamplefilter.o
cc1: warnings being treated as errors
gstexamplefilter.c: In function 'examplefilter_init':
gstexamplefilter.c:254: warning: passing argument 1 of 'gst_element_register' from incompatible pointer type
gstexamplefilter.c: At top level:
gstexamplefilter.c:261: warning: initialization from incompatible pointer type
make[2]: *** [libgstplugin_la-gstexamplefilter.lo] Error 1
make[2]: Leaving directory `/space/playpen/gst-template/gst-plugin/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/space/playpen/gst-template/gst-plugin'
make: *** [all] Error 2
Complete listing of gstexamplefilter.c at end of this post.
"gcc -v" gives:
Using built-in specs.
Target: i486-linux-gnu
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
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Is it a problem with my gcc being too recent and being stricter on warnings? Please go easy on me, I haven't any experience with gtk and little with c :-)
Thanks in advance,
Jono
gstexamplefilter.c:
/*
* GStreamer
* Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart.org<mailto:thomas at apestaart.org>>
* Copyright (C) 2005 Ronald S. Bultje <rbultje at ronald.bitfreak.net<mailto:rbultje at ronald.bitfreak.net>>
* Copyright (C) 2008 Jon Burgess <<user at hostname.org<mailto:user at hostname.org>>>
*
* 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-examplefilter
*
* FIXME:Describe examplefilter here.
*
* <refsect2>
* <title>Example launch line</title>
* |[
* gst-launch -v -m fakesrc ! examplefilter ! fakesink silent=TRUE
* ]|
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gst/gst.h>
#include "gstexamplefilter.h"
GST_DEBUG_CATEGORY_STATIC (gst_example_filter_debug);
#define GST_CAT_DEFAULT gst_example_filter_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")
);
GST_BOILERPLATE (GstExampleFilter, gst_example_filter, GstElement,
GST_TYPE_ELEMENT);
static void gst_example_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_example_filter_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_example_filter_set_caps (GstPad * pad, GstCaps * caps);
static GstFlowReturn gst_example_filter_chain (GstPad * pad, GstBuffer * buf);
/* GObject vmethod implementations */
static void
gst_example_filter_base_init (gpointer gclass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
gst_element_class_set_details_simple(element_class,
"ExampleFilter",
"FIXME:Generic",
"FIXME:Generic Template Element",
"Jon Burgess <<user at hostname.org<mailto:user at hostname.org>>>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
}
/* initialize the examplefilter's class */
static void
gst_example_filter_class_init (GstExampleFilterClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_example_filter_set_property;
gobject_class->get_property = gst_example_filter_get_property;
g_object_class_install_property (gobject_class, PROP_SILENT,
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
FALSE, G_PARAM_READWRITE));
}
/* initialize the new element
* instantiate pads and add them to element
* set pad calback functions
* initialize instance structure
*/
static void
gst_example_filter_init (GstExampleFilter * filter,
GstExampleFilterClass * gclass)
{
filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
gst_pad_set_setcaps_function (filter->sinkpad,
GST_DEBUG_FUNCPTR(gst_example_filter_set_caps));
gst_pad_set_getcaps_function (filter->sinkpad,
GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));
gst_pad_set_chain_function (filter->sinkpad,
GST_DEBUG_FUNCPTR(gst_example_filter_chain));
filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
gst_pad_set_getcaps_function (filter->srcpad,
GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->silent = FALSE;
}
static void
gst_example_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstExampleFilter *filter = GST_EXAMPLEFILTER (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_example_filter_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstExampleFilter *filter = GST_EXAMPLEFILTER (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 the link with other elements */
static gboolean
gst_example_filter_set_caps (GstPad * pad, GstCaps * caps)
{
GstExampleFilter *filter;
GstPad *otherpad;
filter = GST_EXAMPLEFILTER (gst_pad_get_parent (pad));
otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad;
gst_object_unref (filter);
return gst_pad_set_caps (otherpad, caps);
}
/* chain function
* this function does the actual processing
*/
static GstFlowReturn
gst_example_filter_chain (GstPad * pad, GstBuffer * buf)
{
GstExampleFilter *filter;
filter = GST_EXAMPLEFILTER (GST_OBJECT_PARENT (pad));
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
examplefilter_init (GstExampleFilter * examplefilter)
{
/* debug category for fltering log messages
*
* exchange the string 'Template examplefilter' with your description
*/
GST_DEBUG_CATEGORY_INIT (gst_example_filter_debug, "examplefilter",
0, "Template examplefilter");
return gst_element_register (examplefilter, "examplefilter", GST_RANK_NONE,
GST_TYPE_EXAMPLEFILTER);
}
/* gstreamer looks for this structure to register examplefilters
*
* exchange the string 'Template examplefilter' with your examplefilter description
*/
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"examplefilter",
"Template examplefilter",
examplefilter_init,
VERSION,
"LGPL",
"GStreamer",
"http://gstreamer.net/"
)
gstexamplefilter.h:
/*
* GStreamer
* Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart.org<mailto:thomas at apestaart.org>>
* Copyright (C) 2005 Ronald S. Bultje <rbultje at ronald.bitfreak.net<mailto:rbultje at ronald.bitfreak.net>>
* Copyright (C) 2008 Jon Burgess <<user at hostname.org<mailto:user at hostname.org>>>
*
* 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_EXAMPLEFILTER_H__
#define __GST_EXAMPLEFILTER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
#define GST_TYPE_EXAMPLEFILTER \
(gst_example_filter_get_type())
#define GST_EXAMPLEFILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_EXAMPLEFILTER,GstExampleFilter))
#define GST_EXAMPLEFILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_EXAMPLEFILTER,GstExampleFilterClass))
#define GST_IS_EXAMPLEFILTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_EXAMPLEFILTER))
#define GST_IS_EXAMPLEFILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_EXAMPLEFILTER))
typedef struct _GstExampleFilter GstExampleFilter;
typedef struct _GstExampleFilterClass GstExampleFilterClass;
struct _GstExampleFilter
{
GstElement element;
GstPad *sinkpad, *srcpad;
gboolean silent;
};
struct _GstExampleFilterClass
{
GstElementClass parent_class;
};
GType gst_example_filter_get_type (void);
G_END_DECLS
#endif /* __GST_EXAMPLEFILTER_H__ */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20081027/9c3f275d/attachment.htm>
More information about the gstreamer-devel
mailing list