From 7e8580c9554330a847ed9696000b3df99ee14565 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 6 Sep 2010 03:23:26 -0700 Subject: [PATCH] element-maker: Take parameters on command line Now it's actually useful. --- tools/element-maker | 63 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/tools/element-maker b/tools/element-maker index b91479f687..9a51872067 100755 --- a/tools/element-maker +++ b/tools/element-maker @@ -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. + * + * + * Example launch line + * |[ + * gst-launch -v fakesrc ! $gstreplace ! FIXME ! fakesink + * ]| + * FIXME Describe what the pipeline does. + * + */ +EOF + #grep -A 10000 '^% copyright' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 cat <