element-maker: Take parameters on command line

Now it's actually useful.
This commit is contained in:
David Schleef 2010-09-06 03:23:26 -07:00
parent aa3fa6a542
commit 7e8580c955

View file

@ -1,9 +1,52 @@
#!/bin/sh
class=basetransform
prefix=gst
name=edi_test
while [ "$1" ] ; do
case $1 in
--help)
cat <<-EOF
Usage: element-maker [OPTIONS] ELEMENT_NAME BASE_CLASS
Create a GStreamer element that subclasses BASE_CLASS.
Options:
--help Print this information
--prefix PREFIX Use PREFIX instead of "gst"
Example: 'element-maker my_element basetransform' will create the files
gstmyelement.c and gstmyelement.h that implement GstMyElement, a
subclass of GstBaseTransform, as an element named myelement.
EOF
exit 0
;;
--prefix)
shift
prefix=$1
;;
-*)
echo Unknown option: $1
exit 1
;;
*)
if [ "$name" = "" ]; then
name=$1
elif [ "$class" = "" ]; then
class=$1
else
echo Ignored: $1
fi
esac
shift
done
if [ "$name" = "" -o "$class" = "" ] ; then
echo "Usage: element-maker [OPTIONS] ELEMENT_NAME BASE_CLASS"
exit 1
fi
if [ ! -f "gst$class.c" ] ; then
echo "Template file for $class not found."
exit 1
fi
PREFIX=$(echo $prefix | sed -e 's/\(.*\)/\U\1/')
@ -55,6 +98,22 @@ cat <<-EOF
*/
EOF
cat <<-EOF
/**
* SECTION:element-$gstreplace
*
* The $gstreplace element does FIXME stuff.
*
* <refsect2>
* <title>Example launch line</title>
* |[
* gst-launch -v fakesrc ! $gstreplace ! FIXME ! fakesink
* ]|
* FIXME Describe what the pipeline does.
* </refsect2>
*/
EOF
#grep -A 10000 '^% copyright' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1
cat <<EOF