summaryrefslogtreecommitdiff
path: root/gst-plugin/tools/make_element
blob: 44471855fc05abf0f5393ac5145dcf3953ae46df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

Template=$1;
srcfile=$2.c;
srcfile_h=$2.h;

if test x"$1" = x ; then
	echo "$0 Objectname [srcfile]\n";
	echo "  creates gstobjectname.{c,h} implementing GstObjectname\n";
	exit 1;
fi

if test x"$2" = x ; then
	srcfile="gstplugin.c"
	srcfile_h="gstplugin.h"
fi

id=$(echo '$Id$' | sed \
	-e 's/\$I[d]: \([^$]*\)\$/\1/g' \
	)

TEMPLATE=$(echo $Template | tr a-z A-Z)
template=$(echo $Template | tr A-Z a-z)

# remember to break up the Id: in the line below
sed \
	-e 's/gstplugin\.c/SOURCEFILE/g' \
	-e "s/gstplugin\.h/gst$template.h/g" \
	-e "s/GstPluginTemplate/Gst$Template/g" \
	-e "s/gst_plugin_template/gst_$template/g" \
	-e "s/gst_type_plugin_template/gst_$template/g" \
	-e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \
	-e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \
	-e 's/\$I[d]: \([^$]*\)\$/\1/g' \
	-e 's/SOURCEFILE/gstobject\.c/g' \
	-e "s%MAKEFILTERVERSION%$id%g" \
	$srcfile >gst$template.c.tmp && mv gst$template.c.tmp gst$template.c

sed \
	-e 's/gstplugin\.c/SOURCEFILE/g' \
	-e "s/GstPluginTemplate/Gst$Template/g" \
	-e "s/gst_plugin_template/gst_$template/g" \
	-e "s/gst_type_plugin_template/gst_$template/g" \
	-e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \
	-e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \
	-e 's/\$I[d]: \([^$]*\)\$/\1/g' \
	-e 's/SOURCEFILE/gstobject\.c/g' \
	-e "s%MAKEFILTERVERSION%$id%g" \
	$srcfile_h >gst$template.h.tmp && mv gst$template.h.tmp gst$template.h