Prefix=$(echo $prefix | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
Name=$(echo $name | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
+if [ "$prefix" != "gst" ] ; then
+ cmdline_prefix="--prefix $prefix"
+else
+ cmdline_prefix=""
+fi
+
GST_IS_REPLACE=${PREFIX}_IS_${NAME}
GST_REPLACE=${PREFIX}_${NAME}
GST_TYPE_REPLACE=${PREFIX}_TYPE_${NAME}
dnl check for tools (compiler etc.)
AC_PROG_CC
+AM_PROG_CC_C_O
dnl required version of libtool
LT_PREREQ([2.2.6])
GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
AC_SUBST(GST_PLUGIN_LDFLAGS)
-AC_CONFIG_FILES([Makefile plugins/Makefile])
+AC_CONFIG_FILES([Makefile plugins/Makefile tools/Makefile])
AC_OUTPUT
EOF
cat >$basedir/Makefile.am <<EOF
-SUBDIRS = plugins
+SUBDIRS = plugins tools
EXTRA_DIST = autogen.sh
plugin_LTLIBRARIES = lib$gstreplace.la
# sources used to compile this plug-in
-lib${gstreplace}_la_SOURCES = ${gstreplace}.c
+lib${gstreplace}_la_SOURCES = ${gstreplace}plugin.c ${gstreplace}.c ${gstreplace}.h
# compiler and linker flags used to compile this plugin, set in configure.ac
lib${gstreplace}_la_CFLAGS = \$(GST_CFLAGS)
#endif
#include <gst/gst.h>
+#include "gstreplace.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
-#if 0
- gst_element_register (replace, "replace", GST_RANK_NONE,
- GST_TYPE_REPLACE_TEMPLATE);
-#endif
+ gst_element_register (plugin, "replace", GST_RANK_NONE,
+ GST_TYPE_REPLACE);
return TRUE;
}
-e "s/GstReplace/$GstReplace/g" \
-e "s/gst_replace/$gst_replace/g" \
-e "s/gstreplace/$gstreplace/g" \
- -e "s/replace/$replace/g" >$basedir/plugins/$gstreplace.c
+ -e "s/replace/$replace/g" >$basedir/plugins/${gstreplace}plugin.c
+
+gst-indent $basedir/plugins/${gstreplace}plugin.c
+rm -f $basedir/plugins/${gstreplace}plugin.c~
+
+cat >$basedir/plugins/${gstreplace}.c <<EOF
+/* This file should be replaced by element source generated by
+ * gst-element-maker, or by your own source code. To generate suitable
+ * element source using gst-element-maker, run:
+ *
+ * gst-element-maker $cmdline_prefix $replace BASE_CLASS
+ *
+ * Where BASE_CLASS is replaced by one of the base class templates,
+ * such as basesrc, basetransform, audiofilter, videofilter2, etc.
+ * Then copy the resulting $gstreplace.c file over this file, and
+ * $gstreplace.h over $gstreplace.h.
+ */
+/* The rest of this file is shim code to allow the project to compile */
+EOF
-gst-indent $basedir/plugins/$gstreplace.c
-rm -f $basedir/plugins/$gstreplace.c~
+cat >$basedir/plugins/${gstreplace}.h <<EOF
+/* This file should be replaced by element header generated by
+ * gst-element-maker, or by your own source code. To generate suitable
+ * element header using gst-element-maker, run:
+ *
+ * gst-element-maker $cmdline_prefix $replace BASE_CLASS
+ *
+ * Where BASE_CLASS is replaced by one of the base class templates,
+ * such as basesrc, basetransform, audiofilter, videofilter2, etc.
+ * Then copy the resulting $gstreplace.h file over this file, and
+ * $gstreplace.c over $gstreplace.c.
+ */
+/* The rest of this file is shim code to allow the project to compile */
+#define ${GST_TYPE_REPLACE} G_TYPE_NONE
+EOF
+
+
+mkdir -p $basedir/tools
+
+cat >$basedir/tools/Makefile.am <<EOF
+bin_PROGRAMS = ${gst__replace}
+
+# sources used to compile this plug-in
+${gst_replace}_SOURCES = ${gstreplace}.c
+
+# compiler and linker flags used to compile the program, set in configure.ac
+${gst_replace}_CFLAGS = \$(GST_CFLAGS)
+${gst_replace}_LDADD = \$(GST_LIBS)
+
+EOF
+
+cat >$basedir/tools/${gstreplace}.c <<EOF
+/* This file should be replaced by application source generated by
+ * gst-app-maker, or by your own source code. To generate suitable
+ * app source using gst-app-maker, run:
+ *
+ * gst-app-maker $cmdline_prefix $replace
+ *
+ * Then copy the resulting $gstreplace.c file over this file.
+ */
+/* The rest of this file is shim code to allow the project to compile */
+#include <stdio.h>
+int main (void) { printf ("FIXME\n"); return 0; }
+EOF