Change audiodec rank to MARGINAL for using avdec
[platform/adaptation/emulator/gst-plugins-emulator.git] / tools / make_element
1 #!/bin/sh
2
3 Template=$1;
4 srcfile=$2.c;
5 srcfile_h=$2.h;
6
7 if test x"$1" = x ; then
8         echo "$0 Objectname [srcfile]\n";
9         echo "  creates gstobjectname.{c,h} implementing GstObjectname\n";
10         exit 1;
11 fi
12
13 if test x"$2" = x ; then
14         srcfile="gstplugin.c"
15         srcfile_h="gstplugin.h"
16 fi
17
18 id=$(echo '$Id$' | sed \
19         -e 's/\$I[d]: \([^$]*\)\$/\1/g' \
20         )
21
22 TEMPLATE=$(echo $Template | tr a-z A-Z)
23 template=$(echo $Template | tr A-Z a-z)
24 filename=$(echo $template | tr -d _)
25 Template=$(echo $Template | tr -d _)
26 template_=$(echo $Template | sed "s/\([a-z]\)\([A-Z]\)/\1_\2/g" | tr A-Z a-z)
27
28 YEAR=`date "+%Y"`
29 if [ -z "$REAL_NAME" ]; then
30   user=`id -u`
31   if [ `which 2>/dev/null getent` ]; then
32     entry=`getent passwd $user`
33   else
34     entry=`grep $user /etc/passwd`
35   fi
36   REAL_NAME=`echo $entry | awk -F":" '{ print $5 }' | awk -F"," '{ print $1 }'`
37 fi
38 if [ -z "$EMAIL_ADDRESS" ]; then
39   EMAIL_ADDRESS="<user@hostname.org>"
40 fi
41
42 # remember to break up the Id: in the line below
43 sed \
44         -e 's/gstplugin\.c/SOURCEFILE/g' \
45         -e "s/gstplugin\.h/gst$filename.h/g" \
46         -e "s/gsttransform\.h/gst$filename.h/g" \
47         -e "s/GstPluginTemplate/Gst$Template/g" \
48         -e "s/gst_plugin_template/gst_$template_/g" \
49         -e "s/gst_type_plugin_template/gst_$template_/g" \
50         -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \
51         -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \
52         -e 's/\$I[d]: \([^$]*\)\$/\1/g' \
53         -e 's/SOURCEFILE/gstobject\.c/g' \
54         -e "s%MAKEFILTERVERSION%$id%g" \
55         -e "s/plugin/$template/g" \
56         -e "s/\([^G][^s][^t]\)Plugin/\1$Template/g" \
57         -e "s/YEAR/$YEAR/g" \
58         -e "s/AUTHOR_NAME/$REAL_NAME/g" \
59         -e "s/AUTHOR_EMAIL/<$EMAIL_ADDRESS>/g" \
60         $srcfile >gst$filename.c.tmp && mv gst$filename.c.tmp gst$filename.c
61
62 if [ -e $srcfile_h ]; then
63   sed \
64         -e 's/gstplugin\.c/SOURCEFILE/g' \
65         -e "s/GstPluginTemplate/Gst$Template/g" \
66         -e "s/gst_plugin_template/gst_$template_/g" \
67         -e "s/gst_type_plugin_template/gst_$template_/g" \
68         -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \
69         -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \
70         -e "s/GST_IS_PLUGIN_TEMPLATE/GST_IS_$TEMPLATE/g" \
71         -e 's/\$I[d]: \([^$]*\)\$/\1/g' \
72         -e 's/SOURCEFILE/gstobject\.c/g' \
73         -e "s%MAKEFILTERVERSION%$id%g" \
74         -e "s/plugin/$template/g" \
75         -e "s/\([^G][^s][^t]\)Plugin/\1$Template/g" \
76         -e "s/YEAR/$YEAR/g" \
77         -e "s/AUTHOR_NAME/$REAL_NAME/g" \
78         -e "s/AUTHOR_EMAIL/<$EMAIL_ADDRESS>/g" \
79         $srcfile_h >gst$filename.h.tmp && mv gst$filename.h.tmp gst$filename.h
80 fi
81