6 templatedir=$basedir/element-templates
12 Usage: element-maker [OPTIONS] ELEMENT_NAME BASE_CLASS
13 Create a GStreamer element that subclasses BASE_CLASS.
15 --help Print this information
16 --prefix PREFIX Use PREFIX instead of "gst"
17 Example: 'element-maker my_element basetransform' will create the files
18 gstmyelement.c and gstmyelement.h that implement GstMyElement, a
19 subclass of GstBaseTransform, as an element named myelement.
28 echo Unknown option: $1
32 if [ "$name" = "" ]; then
34 elif [ "$class" = "" ]; then
43 if [ "$name" = "" -o "$class" = "" ] ; then
44 echo "Usage: element-maker [OPTIONS] ELEMENT_NAME BASE_CLASS"
48 if [ ! -f "$templatedir/$class" ] ; then
49 echo "Template file for $class not found."
54 PREFIX=$(echo $prefix | sed -e 's/\(.*\)/\U\1/')
55 NAME=$(echo $name | sed -e 's/\(.*\)/\U\1/')
56 Prefix=$(echo $prefix | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
57 Name=$(echo $name | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
58 name=$(echo $name | sed -e 's/\(.*\)/\L\1/')
60 GST_IS_REPLACE=${PREFIX}_IS_${NAME}
61 GST_REPLACE=${PREFIX}_${NAME}
62 GST_TYPE_REPLACE=${PREFIX}_TYPE_${NAME}
63 GstReplace=${Prefix}${Name}
64 gst_replace=${prefix}_${name}
65 gstreplace=${prefix}$(echo $name | sed -e 's/_//g')
66 replace=$(echo $name | sed -e 's/_//g')
68 if [ "$REAL_NAME" = "" ] ; then
71 if [ "$EMAIL_ADDRESS" = "" ] ; then
72 EMAIL_ADDRESS=fixme@example.com
76 pkg=`grep -A 10000 '^% pkg-config' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
77 GST_TYPE_BASE_REPLACE=`grep -A 10000 '^% TYPE_CLASS_NAME' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
78 GstBaseReplace=`grep -A 10000 '^% ClassName' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
79 pads=`grep -A 10000 '^% pads' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
86 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
88 * This library is free software; you can redistribute it and/or
89 * modify it under the terms of the GNU Library General Public
90 * License as published by the Free Software Foundation; either
91 * version 2 of the License, or (at your option) any later version.
93 * This library is distributed in the hope that it will be useful,
94 * but WITHOUT ANY WARRANTY; without even the implied warranty of
95 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
96 * Library General Public License for more details.
98 * You should have received a copy of the GNU Library General Public
99 * License along with this library; if not, write to the
100 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
101 * Boston, MA 02110-1335, USA.
107 * SECTION:element-$gstreplace
109 * The $replace element does FIXME stuff.
112 * <title>Example launch line</title>
114 * gst-launch -v fakesrc ! $replace ! FIXME ! fakesink
116 * FIXME Describe what the pipeline does.
131 grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
132 grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
135 #include "gstreplace.h"
137 GST_DEBUG_CATEGORY_STATIC (gst_replace_debug_category);
138 #define GST_CAT_DEFAULT gst_replace_debug_category
144 grep -A 10000 '^% prototypes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
145 grep -A 10000 '^% prototypes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
148 grep -A 10000 '^% prototypes' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
164 grep -A 10000 '^% pad-template' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
169 /* class initialization */
171 G_DEFINE_TYPE_WITH_CODE (GstReplace, gst_replace, GST_TYPE_BASE_REPLACE,
172 GST_DEBUG_CATEGORY_INIT (gst_replace_debug_category, "replace", 0,
173 "debug category for replace element"));
176 gst_replace_class_init (GstReplaceClass * klass)
179 grep -A 10000 '^% declare-class' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
180 grep -A 10000 '^% declare-class' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
184 /* Setting up pads and setting metadata should be moved to
185 base_class_init if you intend to subclass this class. */
189 grep -A 10000 '^% base-init' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
193 gst_element_class_set_static_metadata (GST_ELEMENT_CLASS(klass),
194 "FIXME Long name", "Generic", "FIXME Description",
195 "$REAL_NAME <$EMAIL_ADDRESS>");
199 grep -A 10000 '^% set-methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
200 grep -A 10000 '^% set-methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
207 gst_replace_init (GstReplace *replace)
213 grep -A 10000 '^% instance-init' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
222 grep -A 10000 '^% methods' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
223 grep -A 10000 '^% methods' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
226 grep -A 10000 '^% methods' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
233 plugin_init (GstPlugin * plugin)
236 return gst_element_register (plugin, "replace", GST_RANK_NONE,
241 #define VERSION "0.0.FIXME"
244 #define PACKAGE "FIXME_package"
247 #define PACKAGE_NAME "FIXME_package_name"
249 #ifndef GST_PACKAGE_ORIGIN
250 #define GST_PACKAGE_ORIGIN "http://FIXME.org/"
253 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
256 "FIXME plugin description",
257 plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
269 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
271 * This library is free software; you can redistribute it and/or
272 * modify it under the terms of the GNU Library General Public
273 * License as published by the Free Software Foundation; either
274 * version 2 of the License, or (at your option) any later version.
276 * This library is distributed in the hope that it will be useful,
277 * but WITHOUT ANY WARRANTY; without even the implied warranty of
278 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
279 * Library General Public License for more details.
281 * You should have received a copy of the GNU Library General Public
282 * License along with this library; if not, write to the
283 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
284 * Boston, MA 02110-1301, USA.
290 #ifndef _GST_REPLACE_H_
291 #define _GST_REPLACE_H_
295 grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
296 grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
302 #define GST_TYPE_REPLACE \
303 (gst_replace_get_type())
304 #define GST_REPLACE(obj) \
305 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_REPLACE,GstReplace))
306 #define GST_REPLACE_CLASS(klass) \
307 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_REPLACE,GstReplaceClass))
308 #define GST_IS_REPLACE(obj) \
309 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_REPLACE))
310 #define GST_IS_REPLACE_CLASS(obj) \
311 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_REPLACE))
313 typedef struct _GstReplace GstReplace;
314 typedef struct _GstReplaceClass GstReplaceClass;
318 GstBaseReplace base_replace;
324 grep -A 10000 '^% instance-members' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
330 struct _GstReplaceClass
332 GstBaseReplaceClass base_replace_class;
335 GType gst_replace_get_type (void);
347 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
348 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
349 -e "s/GstBaseReplace/$GstBaseReplace/g" \
350 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
351 -e "s/GST_REPLACE/$GST_REPLACE/g" \
352 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
353 -e "s/GstReplace/$GstReplace/g" \
354 -e "s/gst_replace/$gst_replace/g" \
355 -e "s/gstreplace/$gstreplace/g" \
356 -e "s/replace/$replace/g" >$gstreplace.c
358 generate_header | sed \
359 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
360 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
361 -e "s/GstBaseReplace/$GstBaseReplace/g" \
362 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
363 -e "s/GST_REPLACE/$GST_REPLACE/g" \
364 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
365 -e "s/GstReplace/$GstReplace/g" \
366 -e "s/gst_replace/$gst_replace/g" \
367 -e "s/gstreplace/$gstreplace/g" \
368 -e "s/replace/$replace/g" >$gstreplace.h
370 gst-indent $gstreplace.c
374 gcc -Wall -fPIC $CPPFLAGS $(pkg-config --cflags gstreamer-1.0 $pkg) -c -o $gstreplace.o $gstreplace.c
375 if test $? -ne 0; then
379 gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-1.0 $pkg)
380 if test $? -ne 0; then