diff options
author | Stefan Kost <ensonic@users.sourceforge.net> | 2006-02-07 18:51:50 +0000 |
---|---|---|
committer | Stefan Kost <ensonic@users.sourceforge.net> | 2006-02-07 18:51:50 +0000 |
commit | a7a372c3c5ff8b317fd36f017bb8524064e52080 (patch) | |
tree | 4ac163e6f603d637851f2937235c8ab2a00baaf3 /gst-plugin | |
parent | d658c57f0048459b7a26ac1024c6aedb5676f46f (diff) |
configure.ac: allow installing to $HOME
Original commit message from CVS:
* 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
Diffstat (limited to 'gst-plugin')
-rw-r--r-- | gst-plugin/ChangeLog | 17 | ||||
-rw-r--r-- | gst-plugin/configure.ac | 21 | ||||
-rw-r--r-- | gst-plugin/src/gstplugin.c | 23 | ||||
-rw-r--r-- | gst-plugin/src/gstplugin.h | 4 | ||||
-rw-r--r-- | gst-plugin/src/gsttransform.c | 207 | ||||
-rw-r--r-- | gst-plugin/src/gsttransform.h | 57 | ||||
-rwxr-xr-x | gst-plugin/tools/make_element | 3 |
7 files changed, 325 insertions, 7 deletions
diff --git a/gst-plugin/ChangeLog b/gst-plugin/ChangeLog index 09334b2..593cae4 100644 --- a/gst-plugin/ChangeLog +++ b/gst-plugin/ChangeLog @@ -1,3 +1,20 @@ +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: diff --git a/gst-plugin/configure.ac b/gst-plugin/configure.ac index 2b41907..f77a695 100644 --- a/gst-plugin/configure.ac +++ b/gst-plugin/configure.ac @@ -100,8 +100,27 @@ dnl make _CFLAGS and _LIBS available AC_SUBST(GSTPB_BASE_CFLAGS) AC_SUBST(GSTPB_BASE_LIBS) +dnl If we need them, we can also use the gstreamer-controller libraries +PKG_CHECK_MODULES(GSTCTRL, + gstreamer-controller-$GST_MAJORMINOR >= $GSTPB_REQUIRED, + HAVE_GSTCTRL=yes, HAVE_GSTCTRL=no) + +dnl Give a warning if we don't have gstreamer-controller +dnl you can turn this into an error if you need them +if test "x$HAVE_GSTCTRL" = "xno"; then + AC_MSG_NOTICE(no GStreamer Controller libraries found (gstreamer-controller-$GST_MAJORMINOR)) +fi + +dnl make _CFLAGS and _LIBS available +AC_SUBST(GSTCTRL_CFLAGS) +AC_SUBST(GSTCTRL_LIBS) + dnl set the plugindir where plugins should be installed -plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" +if test "x${prefix}" = "x$HOME"; then + plugindir="$HOME/.gstreamer-$GST_MAJORMINOR/plugins" +else + plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" +fi AC_SUBST(plugindir) dnl set proper LDFLAGS for plugins diff --git a/gst-plugin/src/gstplugin.c b/gst-plugin/src/gstplugin.c index b20f8e8..661e345 100644 --- a/gst-plugin/src/gstplugin.c +++ b/gst-plugin/src/gstplugin.c @@ -1,4 +1,6 @@ -/* Copyright 2005 Thomas Vander Stichele <thomas@apestaart.org> +/* + * GStreamer + * Copyright 2005 Thomas Vander Stichele <thomas@apestaart.org> * Copyright 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net> * * Permission is hereby granted, free of charge, to any person obtaining a @@ -40,6 +42,19 @@ * Boston, MA 02111-1307, USA. */ +/** + * SECTION:element-plugin + * + * <refsect2> + * <title>Example launch line</title> + * <para> + * <programlisting> + * gst-launch -v -m audiotestsrc ! plugin ! fakesink silent=TRUE + * </programlisting> + * </para> + * </refsect2> + */ + #ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -137,7 +152,7 @@ gst_gst_plugin_template_get_type (void) static void gst_plugin_template_base_init (GstPluginTemplateClass *klass) { - static GstElementDetails plugin_details = { + static GstElementDetails element_details = { "PluginTemplate", "Generic/PluginTemplate", "Generic Template Plugin", @@ -149,7 +164,7 @@ gst_plugin_template_base_init (GstPluginTemplateClass *klass) gst_static_pad_template_get (&src_factory)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_factory)); - gst_element_class_set_details (element_class, &plugin_details); + gst_element_class_set_details (element_class, &element_details); } /* initialize the plugin's class */ @@ -178,7 +193,7 @@ gst_plugin_template_class_init (GstPluginTemplateClass *klass) * initialize structure */ static void -gst_plugin_template_init (GstPluginTemplate *filter) +gst_plugin_template_init (GstPluginTemplate *filter, GstPluginTemplateClass * klass) { GstElementClass *klass = GST_ELEMENT_GET_CLASS (filter); diff --git a/gst-plugin/src/gstplugin.h b/gst-plugin/src/gstplugin.h index 3b744bd..0ef9256 100644 --- a/gst-plugin/src/gstplugin.h +++ b/gst-plugin/src/gstplugin.h @@ -1,4 +1,6 @@ -/* Copyright 2005 Thomas Vander Stichele <thomas@apestaart.org> +/* + * GStreamer + * Copyright 2005 Thomas Vander Stichele <thomas@apestaart.org> * Copyright 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net> * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/gst-plugin/src/gsttransform.c b/gst-plugin/src/gsttransform.c new file mode 100644 index 0000000..19a04df --- /dev/null +++ b/gst-plugin/src/gsttransform.c @@ -0,0 +1,207 @@ +/* + * GStreamer + * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net> + * + * 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 + * + * <refsect2> + * <title>Example launch line</title> + * <para> + * <programlisting> + * gst-launch -v -m audiotestsrc ! plugin ! fakesink silent=TRUE + * </programlisting> + * </para> + * </refsect2> + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <string.h> +#include <gst/gst.h> +#include <gst/base/gstbasetransform.h> +#include <gst/audio/audio.h> +#include <gst/controller/gstcontroller.h> + +#include "gstplugin.h" + +GST_DEBUG_CATEGORY (plugin_debug); + +/* Filter signals and args */ +enum { + /* FILL ME */ + LAST_SIGNAL +}; + +enum { + PROP_0, + PROP_SILENT, +}; + +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 DEBUG_INIT(bla) \ + GST_DEBUG_CATEGORY_INIT (plugin_debug, "plugin", 0, "plugin template element"); + +GST_BOILERPLATE_FULL (GstPluginTemplate, gst_plugin_template, GstBaseTransform, + GST_TYPE_BASE_TRANSFORM, 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 GstFlowReturn gst_plugin_template_transform_ip (GstBaseTransform * base, + GstBuffer * outbuf); + + +static void +gst_plugin_template_base_init (gpointer klass) +{ + static GstElementDetails element_details = { + "PluginTemplate", + "Generic/PluginTemplate", + "Generic Template Plugin", + "Stefan Kost <ensonic@users.sf.net>" + }; + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + gst_element_class_set_details (element_class, &element_details); +} + +static void +gst_plugin_template_class_init (GstPluginTemplateClass * klass) +{ + GObjectClass *gobject_class; + + gobject_class = (GObjectClass *) 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_BASE_TRANSFORM_CLASS (klass)->transform_ip = + GST_DEBUG_FUNCPTR (gst_plugin_template_transform_ip); +} + +static void +gst_plugin_template_init (GstPluginTemplate *filter, GstPluginTemplateClass * klass) +{ + filter->silent = FALSE; +} + +/* 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"); + + return GST_FLOW_OK; +} + +static void +gst_plugin_template_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstPluginTemplate *filter; + + g_return_if_fail (GST_IS_PLUGIN_TEMPLATE (object)); + 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; + + g_return_if_fail (GST_IS_PLUGIN_TEMPLATE (object)); + 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; + } +} + +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); +} + +GST_PLUGIN_DEFINE ( + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "plugin", + "Template plugin", + plugin_init, + VERSION, + "LGPL", + "GStreamer", + "http://gstreamer.net/" +) diff --git a/gst-plugin/src/gsttransform.h b/gst-plugin/src/gsttransform.h new file mode 100644 index 0000000..cdbfbf7 --- /dev/null +++ b/gst-plugin/src/gsttransform.h @@ -0,0 +1,57 @@ +/* + * GStreamer + * Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net> + * + * 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__ */ diff --git a/gst-plugin/tools/make_element b/gst-plugin/tools/make_element index d606bd9..4447185 100755 --- a/gst-plugin/tools/make_element +++ b/gst-plugin/tools/make_element @@ -1,7 +1,8 @@ #!/bin/sh Template=$1; -srcfile=$2; +srcfile=$2.c; +srcfile_h=$2.h; if test x"$1" = x ; then echo "$0 Objectname [srcfile]\n"; |