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')
67 if [ "${prefix}" = gst ] ; then
68 prefixreplace=$replace
70 prefixreplace=$gstreplace
73 if [ "$REAL_NAME" = "" ] ; then
76 if [ "$EMAIL_ADDRESS" = "" ] ; then
77 EMAIL_ADDRESS=fixme@example.com
81 pkg=`grep -A 10000 '^% pkg-config' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
82 GST_TYPE_BASE_REPLACE=`grep -A 10000 '^% TYPE_CLASS_NAME' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
83 GstBaseReplace=`grep -A 10000 '^% ClassName' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
84 pads=`grep -A 10000 '^% pads' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1`
91 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
93 * This library is free software; you can redistribute it and/or
94 * modify it under the terms of the GNU Library General Public
95 * License as published by the Free Software Foundation; either
96 * version 2 of the License, or (at your option) any later version.
98 * This library is distributed in the hope that it will be useful,
99 * but WITHOUT ANY WARRANTY; without even the implied warranty of
100 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
101 * Library General Public License for more details.
103 * You should have received a copy of the GNU Library General Public
104 * License along with this library; if not, write to the
105 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
106 * Boston, MA 02110-1335, USA.
112 * SECTION:element-$gstreplace
114 * The $replace element does FIXME stuff.
117 * <title>Example launch line</title>
119 * gst-launch -v fakesrc ! $replace ! FIXME ! fakesink
121 * FIXME Describe what the pipeline does.
136 grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
137 grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
140 #include "gstreplace.h"
142 GST_DEBUG_CATEGORY_STATIC (gst_replace_debug_category);
143 #define GST_CAT_DEFAULT gst_replace_debug_category
149 grep -A 10000 '^% prototypes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
150 grep -A 10000 '^% prototypes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
153 grep -A 10000 '^% prototypes' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
169 grep -A 10000 '^% pad-template' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
174 /* class initialization */
176 G_DEFINE_TYPE_WITH_CODE (GstReplace, gst_replace, GST_TYPE_BASE_REPLACE,
177 GST_DEBUG_CATEGORY_INIT (gst_replace_debug_category, "prefixreplace", 0,
178 "debug category for replace element"));
181 gst_replace_class_init (GstReplaceClass * klass)
184 grep -A 10000 '^% declare-class' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
185 grep -A 10000 '^% declare-class' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
189 /* Setting up pads and setting metadata should be moved to
190 base_class_init if you intend to subclass this class. */
194 grep -A 10000 '^% base-init' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
198 gst_element_class_set_static_metadata (GST_ELEMENT_CLASS(klass),
199 "FIXME Long name", "Generic", "FIXME Description",
200 "$REAL_NAME <$EMAIL_ADDRESS>");
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)
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 /* FIXME Remember to set the rank if it's an element that is meant
242 to be autoplugged by decodebin. */
243 return gst_element_register (plugin, "prefixreplace", GST_RANK_NONE,
247 /* FIXME: these are normally defined by the GStreamer build system.
248 If you are creating an element to be included in gst-plugins-*,
249 remove these, as they're always defined. Otherwise, edit as
250 appropriate for your external plugin package. */
252 #define VERSION "0.0.FIXME"
255 #define PACKAGE "FIXME_package"
258 #define PACKAGE_NAME "FIXME_package_name"
260 #ifndef GST_PACKAGE_ORIGIN
261 #define GST_PACKAGE_ORIGIN "http://FIXME.org/"
264 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
267 "FIXME plugin description",
268 plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
280 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
282 * This library is free software; you can redistribute it and/or
283 * modify it under the terms of the GNU Library General Public
284 * License as published by the Free Software Foundation; either
285 * version 2 of the License, or (at your option) any later version.
287 * This library is distributed in the hope that it will be useful,
288 * but WITHOUT ANY WARRANTY; without even the implied warranty of
289 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
290 * Library General Public License for more details.
292 * You should have received a copy of the GNU Library General Public
293 * License along with this library; if not, write to the
294 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
295 * Boston, MA 02110-1301, USA.
301 #ifndef _GST_REPLACE_H_
302 #define _GST_REPLACE_H_
306 grep -A 10000 '^% includes' $templatedir/gobject | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
307 grep -A 10000 '^% includes' $templatedir/$class | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
313 #define GST_TYPE_REPLACE \
314 (gst_replace_get_type())
315 #define GST_REPLACE(obj) \
316 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_REPLACE,GstReplace))
317 #define GST_REPLACE_CLASS(klass) \
318 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_REPLACE,GstReplaceClass))
319 #define GST_IS_REPLACE(obj) \
320 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_REPLACE))
321 #define GST_IS_REPLACE_CLASS(obj) \
322 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_REPLACE))
324 typedef struct _GstReplace GstReplace;
325 typedef struct _GstReplaceClass GstReplaceClass;
329 GstBaseReplace base_replace;
335 grep -A 10000 '^% instance-members' $templatedir/$each | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
341 struct _GstReplaceClass
343 GstBaseReplaceClass base_replace_class;
346 GType gst_replace_get_type (void);
358 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
359 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
360 -e "s/GstBaseReplace/$GstBaseReplace/g" \
361 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
362 -e "s/GST_REPLACE/$GST_REPLACE/g" \
363 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
364 -e "s/GstReplace/$GstReplace/g" \
365 -e "s/gst_replace/$gst_replace/g" \
366 -e "s/gstreplace/$gstreplace/g" \
367 -e "s/prefixreplace/$prefixreplace/g" \
368 -e "s/replace/$replace/g" >$gstreplace.c
370 generate_header | sed \
371 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
372 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
373 -e "s/GstBaseReplace/$GstBaseReplace/g" \
374 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
375 -e "s/GST_REPLACE/$GST_REPLACE/g" \
376 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
377 -e "s/GstReplace/$GstReplace/g" \
378 -e "s/gst_replace/$gst_replace/g" \
379 -e "s/gstreplace/$gstreplace/g" \
380 -e "s/prefixreplace/$prefixreplace/g" \
381 -e "s/replace/$replace/g" >$gstreplace.h
383 gst-indent $gstreplace.c
387 gcc -Wall -Werror -fPIC $CPPFLAGS $(pkg-config --cflags gstreamer-1.0 $pkg) -c -o $gstreplace.o $gstreplace.c
388 if test $? -ne 0; then
392 gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-1.0 $pkg)
393 if test $? -ne 0; then
397 gst-inspect-1.0 ./$gstreplace.so