From 8b20bbc3ada705e0a319ed20e77409997e4dcb6b Mon Sep 17 00:00:00 2001 From: Stéphane Cerveau Date: Thu, 15 Apr 2021 11:48:56 +0200 Subject: template: update make_element update make_element script to work with gstplugin.c and gsttransform.c Part-of: --- gst-plugin/meson.build | 13 +++++++++++++ gst-plugin/src/gstplugin.c | 8 ++++---- gst-plugin/src/gsttransform.c | 8 ++++---- gst-plugin/tools/make_element | 14 ++++++++++---- meson.build | 2 ++ 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/gst-plugin/meson.build b/gst-plugin/meson.build index 9a26d8b..01a21e9 100644 --- a/gst-plugin/meson.build +++ b/gst-plugin/meson.build @@ -37,3 +37,16 @@ gstaudiofilterexample = library('gstaudiofilterexample', install : true, install_dir : plugins_install_dir, ) + +# The TEMPLATE Plugin +### gstTEMPLATE_sources = [ +### 'src/gstTEMPLATE.c', +### ] + +###gstTEMPLATEexample = library('gstTEMPLATE', +### gstTEMPLATE_sources, +### c_args: plugin_c_args, +### dependencies : [gst_dep, gstbase_dep], +### install : true, +### install_dir : plugins_install_dir, +###) diff --git a/gst-plugin/src/gstplugin.c b/gst-plugin/src/gstplugin.c index cb6305f..e90b63d 100644 --- a/gst-plugin/src/gstplugin.c +++ b/gst-plugin/src/gstplugin.c @@ -99,8 +99,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", #define gst_plugin_template_parent_class parent_class G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_ELEMENT); -GST_ELEMENT_REGISTER_DEFINE (myfirstplugin, "myfirstplugin", GST_RANK_NONE, - GST_TYPE_PLUGIN); +GST_ELEMENT_REGISTER_DEFINE (plugin_template, "plugin_template", GST_RANK_NONE, + GST_TYPE_PLUGIN_TEMPLATE); static void gst_plugin_template_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -263,7 +263,7 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin", 0, "Template plugin"); - return GST_ELEMENT_REGISTER (myfirstplugin, plugin); + return GST_ELEMENT_REGISTER (plugin_template, plugin); } /* PACKAGE: this is usually set by meson depending on some _INIT macro @@ -282,6 +282,6 @@ plugin_init (GstPlugin * plugin) GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, plugin, - "Template plugin", + "plugin_template", plugin_init, PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst-plugin/src/gsttransform.c b/gst-plugin/src/gsttransform.c index 984a132..34fb120 100644 --- a/gst-plugin/src/gsttransform.c +++ b/gst-plugin/src/gsttransform.c @@ -76,8 +76,8 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", #define gst_plugin_template_parent_class parent_class G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_BASE_TRANSFORM); -GST_ELEMENT_REGISTER_DEFINE (myfirstplugin, "myfirstplugin", GST_RANK_NONE, - GST_TYPE_PLUGIN); +GST_ELEMENT_REGISTER_DEFINE (plugin_template, "plugin_template", GST_RANK_NONE, + GST_TYPE_PLUGIN_TEMPLATE); static void gst_plugin_template_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -197,7 +197,7 @@ gst_plugin_template_transform_ip (GstBaseTransform * base, GstBuffer * outbuf) static gboolean plugin_init (GstPlugin * plugin) { - return GST_ELEMENT_REGISTER (myfirstplugin, plugin); + return GST_ELEMENT_REGISTER (plugin_template, plugin); } /* gstreamer looks for this structure to register plugins @@ -207,6 +207,6 @@ plugin_init (GstPlugin * plugin) GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, plugin, - "Template plugin", + "plugin_template", plugin_init, PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst-plugin/tools/make_element b/gst-plugin/tools/make_element index 3ae7d18..646b8ea 100755 --- a/gst-plugin/tools/make_element +++ b/gst-plugin/tools/make_element @@ -3,6 +3,7 @@ Template=$1; srcfile=$2.c; srcfile_h=$2.h; +meson_build=../meson.build; if test x"$1" = x ; then echo "$0 Objectname [srcfile]\n"; @@ -45,8 +46,7 @@ sed \ -e "s/gstplugin\.h/gst$filename.h/g" \ -e "s/gsttransform\.h/gst$filename.h/g" \ -e "s/GstPluginTemplate/Gst$Template/g" \ - -e "s/gst_plugin_template/gst_$template_/g" \ - -e "s/gst_type_plugin_template/gst_$template_/g" \ + -e "s/plugin_template/$template_/g" \ -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \ -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \ -e 's/\$I[d]: \([^$]*\)\$/\1/g' \ @@ -63,9 +63,9 @@ if [ -e $srcfile_h ]; then sed \ -e 's/gstplugin\.c/SOURCEFILE/g' \ -e "s/GstPluginTemplate/Gst$Template/g" \ - -e "s/gst_plugin_template/gst_$template_/g" \ + -e "s/plugin_template/$template_/g" \ -e "s/gst_type_plugin_template/gst_$template_/g" \ - -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \ + -e "s/PLUGIN_TEMPLATE/$TEMPLATE/g" \ -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \ -e "s/GST_IS_PLUGIN_TEMPLATE/GST_IS_$TEMPLATE/g" \ -e 's/\$I[d]: \([^$]*\)\$/\1/g' \ @@ -79,3 +79,9 @@ if [ -e $srcfile_h ]; then $srcfile_h >gst$filename.h.tmp && mv gst$filename.h.tmp gst$filename.h fi +if [ -e $meson_build ]; then + sed \ + -e "s/TEMPLATE/$Template/g" \ + -e "s/###//g" \ + $meson_build > $meson_build.tmp && mv $meson_build.tmp $meson_build +fi \ No newline at end of file diff --git a/meson.build b/meson.build index 962c72d..815ec87 100644 --- a/meson.build +++ b/meson.build @@ -10,6 +10,8 @@ api_version = '1.0' gst_dep = dependency('gstreamer-1.0', version : '>=1.19', required : true, fallback : ['gstreamer', 'gst_dep']) +gstbase_dep = dependency('gstreamer-base-1.0', version : '>=1.19', + fallback : ['gstreamer', 'gst_base_dep']) subdir('gst-app') subdir('gst-plugin') -- cgit v1.2.3