summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2010-09-06 03:23:26 -0700
committerDavid Schleef <ds@schleef.org>2010-09-06 03:25:16 -0700
commit7e8580c9554330a847ed9696000b3df99ee14565 (patch)
tree9370d5b04cf30a489bee4d7252375aca5b229e93 /tools
parentaa3fa6a5421b71d92a49dba9004b9eab73ccd4b4 (diff)
downloadgstreamer-plugins-bad-7e8580c9554330a847ed9696000b3df99ee14565.tar.gz
element-maker: Take parameters on command line
Now it's actually useful.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/element-maker63
1 files changed, 61 insertions, 2 deletions
diff --git a/tools/element-maker b/tools/element-maker
index b91479f68..9a5187206 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.
+ *
+ * <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