5 templatedir=element-templates
11 Usage: element-maker [OPTIONS] ELEMENT_NAME BASE_CLASS
12 Create a GStreamer element that subclasses BASE_CLASS.
14 --help Print this information
15 --prefix PREFIX Use PREFIX instead of "gst"
16 Example: 'element-maker my_element basetransform' will create the files
17 gstmyelement.c and gstmyelement.h that implement GstMyElement, a
18 subclass of GstBaseTransform, as an element named myelement.
27 echo Unknown option: $1
31 if [ "$name" = "" ]; then
33 elif [ "$class" = "" ]; then
42 if [ "$name" = "" -o "$class" = "" ] ; then
43 echo "Usage: element-maker [OPTIONS] ELEMENT_NAME BASE_CLASS"
47 if [ ! -f "element-templates/$class" ] ; then
48 echo "Template file for $class not found."
53 PREFIX=$(echo $prefix | sed -e 's/\(.*\)/\U\1/')
54 NAME=$(echo $name | sed -e 's/\(.*\)/\U\1/')
55 Prefix=$(echo $prefix | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
56 Name=$(echo $name | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
57 name=$(echo $name | sed -e 's/\(.*\)/\L\1/')
59 GST_IS_REPLACE=${PREFIX}_IS_${NAME}
60 GST_REPLACE=${PREFIX}_${NAME}
61 GST_TYPE_REPLACE=${PREFIX}_TYPE_${NAME}
62 GstReplace=${Prefix}${Name}
63 gst_replace=${prefix}_${name}
64 gstreplace=${prefix}$(echo $name | sed -e 's/_//g')
65 replace=$(echo $name | sed -e 's/_//g')
67 if [ "$REAL_NAME" = "" ] ; then
70 if [ "$EMAIL_ADDRESS" = "" ] ; then
71 EMAIL_ADDRESS=fixme@example.com
75 pkg=`grep -A 10000 '^% pkg-config' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
76 GST_TYPE_BASE_REPLACE=`grep -A 10000 '^% TYPE_CLASS_NAME' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
77 GstBaseReplace=`grep -A 10000 '^% ClassName' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
78 pads=`grep -A 10000 '^% pads' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
85 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
87 * This library is free software; you can redistribute it and/or
88 * modify it under the terms of the GNU Library General Public
89 * License as published by the Free Software Foundation; either
90 * version 2 of the License, or (at your option) any later version.
92 * This library is distributed in the hope that it will be useful,
93 * but WITHOUT ANY WARRANTY; without even the implied warranty of
94 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95 * Library General Public License for more details.
97 * You should have received a copy of the GNU Library General Public
98 * License along with this library; if not, write to the
99 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
100 * Boston, MA 02110-1335, USA.
106 * SECTION:element-$gstreplace
108 * The $replace element does FIXME stuff.
111 * <title>Example launch line</title>
113 * gst-launch -v fakesrc ! $replace ! FIXME ! fakesink
115 * FIXME Describe what the pipeline does.
130 grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
131 grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
134 #include "gstreplace.h"
136 GST_DEBUG_CATEGORY_STATIC (gst_replace_debug_category);
137 #define GST_CAT_DEFAULT gst_replace_debug_category
143 grep -A 10000 '^% prototypes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
144 grep -A 10000 '^% prototypes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
147 grep -A 10000 '^% prototypes' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
163 grep -A 10000 '^% pad-template' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
168 /* class initialization */
170 #define DEBUG_INIT(bla) \\
171 GST_DEBUG_CATEGORY_INIT (gst_replace_debug_category, "replace", 0, \\
172 "debug category for replace element");
174 GST_BOILERPLATE_FULL (GstReplace, gst_replace, GstBaseReplace,
175 GST_TYPE_BASE_REPLACE, DEBUG_INIT);
178 gst_replace_base_init (gpointer g_class)
180 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
186 grep -A 10000 '^% base-init' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
191 gst_element_class_set_details_simple (element_class, "FIXME Long name",
192 "Generic", "FIXME Description", "$REAL_NAME <$EMAIL_ADDRESS>");
196 gst_replace_class_init (GstReplaceClass * klass)
199 grep -A 10000 '^% declare-class' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
200 grep -A 10000 '^% declare-class' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
204 grep -A 10000 '^% set-methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
205 grep -A 10000 '^% set-methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
212 gst_replace_init (GstReplace * replace, GstReplaceClass * replace_class)
218 grep -A 10000 '^% instance-init' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
227 grep -A 10000 '^% methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
228 grep -A 10000 '^% methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
231 grep -A 10000 '^% methods' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
238 plugin_init (GstPlugin * plugin)
241 gst_element_register (plugin, "replace", GST_RANK_NONE,
242 gst_replace_get_type ());
248 #define VERSION "0.0.FIXME"
251 #define PACKAGE "FIXME_package"
254 #define PACKAGE_NAME "FIXME_package_name"
256 #ifndef GST_PACKAGE_ORIGIN
257 #define GST_PACKAGE_ORIGIN "http://FIXME.org/"
260 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
263 "FIXME plugin description",
264 plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
276 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
278 * This library is free software; you can redistribute it and/or
279 * modify it under the terms of the GNU Library General Public
280 * License as published by the Free Software Foundation; either
281 * version 2 of the License, or (at your option) any later version.
283 * This library is distributed in the hope that it will be useful,
284 * but WITHOUT ANY WARRANTY; without even the implied warranty of
285 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
286 * Library General Public License for more details.
288 * You should have received a copy of the GNU Library General Public
289 * License along with this library; if not, write to the
290 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
291 * Boston, MA 02111-1307, USA.
297 #ifndef _GST_REPLACE_H_
298 #define _GST_REPLACE_H_
302 grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
303 grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
309 #define GST_TYPE_REPLACE \
310 (gst_replace_get_type())
311 #define GST_REPLACE(obj) \
312 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_REPLACE,GstReplace))
313 #define GST_REPLACE_CLASS(klass) \
314 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_REPLACE,GstReplaceClass))
315 #define GST_IS_REPLACE(obj) \
316 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_REPLACE))
317 #define GST_IS_REPLACE_CLASS(obj) \
318 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_REPLACE))
320 typedef struct _GstReplace GstReplace;
321 typedef struct _GstReplaceClass GstReplaceClass;
325 GstBaseReplace base_replace;
331 grep -A 10000 '^% instance-members' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
337 struct _GstReplaceClass
339 GstBaseReplaceClass base_replace_class;
342 GType gst_replace_get_type (void);
354 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
355 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
356 -e "s/GstBaseReplace/$GstBaseReplace/g" \
357 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
358 -e "s/GST_REPLACE/$GST_REPLACE/g" \
359 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
360 -e "s/GstReplace/$GstReplace/g" \
361 -e "s/gst_replace/$gst_replace/g" \
362 -e "s/gstreplace/$gstreplace/g" \
363 -e "s/replace/$replace/g" >$gstreplace.c
365 generate_header | sed \
366 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
367 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
368 -e "s/GstBaseReplace/$GstBaseReplace/g" \
369 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
370 -e "s/GST_REPLACE/$GST_REPLACE/g" \
371 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
372 -e "s/GstReplace/$GstReplace/g" \
373 -e "s/gst_replace/$gst_replace/g" \
374 -e "s/gstreplace/$gstreplace/g" \
375 -e "s/replace/$replace/g" >$gstreplace.h
377 gst-indent $gstreplace.c
381 gcc -Wall -fPIC $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o $gstreplace.o $gstreplace.c
382 gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-0.10 $pkg)