gnomemm r2038 - in gstreamermm/trunk: . build_shared gstreamer/src tools/extra_defs_gen



Author: jaalburqu
Date: Wed Feb 11 04:19:30 2009
New Revision: 2038
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2038&view=rev

Log:
2009-02-10  Josà Alburquerque  <jaalburqu svn gnome org>

	* configure.ac:
	* gstreamer/src/Makefile_list_of_hg.am_fragment: Modified plug-in list
	so that, instead of the C++ class name, each item in the list is a
	definition of the form "plugin_name=CppClassName" which makes it
	possible to use whatever C++ class name is desired for a "plugin_name"
	that should still be recognized by gst-inspect.

	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Modified so
	that both a plug-in name that can be recognized by gst-inspect and a
	desired C++ class name can be specified for that wrapped plug-in.
	Removed (now unused) option --suggest-hg.  Corrected help message.
	Fixed whitespace in generated .hg and .ccg files.

	* build_shared/Makefile_gensrc.am_fragment: Corrected build process to
	use new plug-in definitions list in configure.ac to get the plug-in
	name and the C++ class name and to pass both a plug-in name and the
	corresponding C++ class name to the plug-in generator.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment
   gstreamermm/trunk/configure.ac
   gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
   gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc

Modified: gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment
==============================================================================
--- gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment	(original)
+++ gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment	Wed Feb 11 04:19:30 2009
@@ -86,26 +86,31 @@
 # signal the successful generation of the .hg file.
 $(files_all_plugin_camel_hg_with_path): $(generate_plugin_dep) \
 	$(tools_plugin_m4) $(files_defs) $(license_header_source_file)
-	$(eval hg_lowercase = $$(shell echo $$@ | tr [:upper:] [:lower:]))
+	$(eval cppname = $$(notdir $$(basename $$@)))
+	$(eval plugin_def = $$(filter %=$$(cppname),$$(defs_plugin_all)))
+	$(eval plugin_name = $$(subst =$$(cppname),,$$(plugin_def)))
+	$(eval hg_lowercase = $$(plugin_name).hg)
 	sed -n '1,/^$$/p' $(license_header_source_file) > \
-		$(srcdir)/$(notdir $(hg_lowercase))
-	$(run_generate_plugin_gmmproc_file) --hg \
-		$(notdir $(subst .hg,,$@)) | $(M4) -I $(tools_dir_m4) >> \
-		$(srcdir)/$(notdir $(hg_lowercase))
-	ln -sf $(realpath $(srcdir))/$(notdir $(hg_lowercase)) $(builddir)/$@
+		$(srcdir)/$(hg_lowercase)
+	$(run_generate_plugin_gmmproc_file) --hg $(plugin_name) \
+		$(cppname) | $(M4) -I $(tools_dir_m4) >> \
+		$(srcdir)/$(hg_lowercase)
+	ln -sf $(realpath $(srcdir))/$(hg_lowercase) $(builddir)/$@
 
 # This is to generate plugin .ccg files.  The .ccg file is generated and then
 # the camel ccg file is linked to the generated .ccg file to signal the
 # successful generation of the .hg file.
 $(files_all_plugin_camel_hg_with_path:.hg=.ccg): $(generate_plugin_dep) \
 	$(tools_plugin_m4) $(files_defs) $(license_header_source_file)
-	$(eval ccg_lowercase = $$(shell echo $$@ | tr '[:upper:]' '[:lower:]'))
+	$(eval cppname = $$(notdir $$(basename $$@)))
+	$(eval plugin_def = $$(filter %=$$(cppname),$$(defs_plugin_all)))
+	$(eval plugin_name = $$(subst =$$(cppname),,$$(plugin_def)))
+	$(eval ccg_lowercase = $$(plugin_name).ccg)
 	sed -n '1,/^$$/p' $(license_header_source_file) > \
-		$(srcdir)/$(notdir $(ccg_lowercase))
-	$(run_generate_plugin_gmmproc_file) --ccg \
-		$(notdir $(subst .ccg,,$@)) >>  \
-		$(srcdir)/$(notdir $(ccg_lowercase))
-	ln -sf $(realpath $(srcdir))/$(notdir $(ccg_lowercase)) $(builddir)/$@
+		$(srcdir)/$(ccg_lowercase)
+	$(run_generate_plugin_gmmproc_file) --ccg $(plugin_name) \
+		$(cppname) >> $(srcdir)/$(ccg_lowercase)
+	ln -sf $(realpath $(srcdir))/$(ccg_lowercase) $(builddir)/$@
 
 $(stamp_dir)/stamp-%: %.hg %.ccg $(tools_m4) $(files_defs)
 	$(run_gmmproc) $(notdir $*) $(srcdir) $(gensrc_destdir)

Modified: gstreamermm/trunk/configure.ac
==============================================================================
--- gstreamermm/trunk/configure.ac	(original)
+++ gstreamermm/trunk/configure.ac	Wed Feb 11 04:19:30 2009
@@ -177,35 +177,49 @@
 AC_ARG_VAR([GST_INSPECT], [Variable to store gst-inspect executable])
 AC_SUBST(GST_INSPECT)
 
-# To add a plugin, add the C++ class name (which must be the plugin name as
-# recognized by gst-inspect but in camel case -- as is appropriate for a class
-# name) to the plug-in C++ name list below.  Also add the target .hg file name
-# (same name all in lowercase with a .hg) to the files_all_plugin_hg variable
-# in the gstreamer/src/Makefile_list_of_hg.am_fragment file.  Finally, be sure
-# to include an #undef in the gstreamermmconfig.h.in file.
-
-GSTREAMERMM_ALL_PLUGIN_CPPNAMES="CapsFilter FakeSrc FakeSink FdSink FdSrc \
-FileSrc FileSink Identity MultiQueue Queue Tee TypeFind Adder AlsaMixer \
-AlsaSink AlsaSrc AudioConvert AudioResample AudioTestSrc CdParanoiaSrc \
-ClockOverlay DecodeBin FfmpegColorSpace GDPDepay GDPPay GioSink GioSrc \
-GioStreamSink GioStreamSrc OggDemux OggMux PlayBin2 TextOverlay TextRender \
-TheoraDec TheoraEnc TimeOverlay VideoRate VideoScale VideoTestSrc Volume \
-VorbisDec VorbisEnc VorbisParse VorbisTag XImageSink XvImageSink"
+# To add a plugin, add the plugin definition, in the form of
+# "plugin=CppClassName" (where "plugin" is the plugin name as recognized by
+# gst-inspect and "CppClassName" is the desired name of the C++ class),  to the
+# list of definitions below.  Also add the target .hg file name (which must be
+# the same as "CppClassName" all in lowercase with a .hg extension) to the
+# files_all_plugin_hg variable in the
+# gstreamer/src/Makefile_list_of_hg.am_fragment file.  Finally, be sure to
+# include an #undef in the form of "#undef GSTREAMERMM_PLUGIN_name" in the
+# gstreamermmconfig.h.in file (where "name" is the plugin name all in caps).
+
+GSTREAMERMM_ALL_PLUGIN_DEFS="capsfilter=CapsFilter fakesrc=FakeSrc \
+fakesink=FakeSink fdsink=FdSink fdsrc=FdSrc filesrc=FileSrc filesink=FileSink \
+identity=Identity multiqueue=MultiQueue queue=Queue tee=Tee typefind=TypeFind \
+adder=Adder alsamixer=AlsaMixer alsasink=AlsaSink alsasrc=AlsaSrc \
+audioconvert=AudioConvert audioresample=AudioResample \
+audiotestsrc=AudioTestSrc cdparanoiasrc=CdParanoiaSrc \
+clockoverlay=ClockOverlay decodebin=DecodeBin \
+ffmpegcolorspace=FfmpegColorSpace gdpdepay=GDPDepay gdppay=GDPPay \
+giosink=GioSink giosrc=GioSrc giostreamsink=GioStreamSink \
+giostreamsrc=GioStreamSrc oggdemux=OggDemux oggmux=OggMux playbin2=PlayBin2 \
+textoverlay=TextOverlay textrender=TextRender theoradec=TheoraDec \
+theoraenc=TheoraEnc timeoverlay=TimeOverlay videorate=VideoRate \
+videoscale=VideoScale videotestsrc=VideoTestSrc volume=Volume \
+vorbisdec=VorbisDec vorbisenc=VorbisEnc vorbisparse=VorbisParse \
+vorbistag=VorbisTag ximagesink=XImageSink xvimagesink=XvImageSink"
 
 # TODO: The following plug-ins (to be added above) can't be wrapped yet because
 # their signals or properties use the GValueArray type which might have to be
 # wrapped in glibmm first: DecodeBin2, MultiFdSink, PlayBin, TcpServerSink,
 # TheoraParse, UriDecodeBin.
 
-for cppname in $GSTREAMERMM_ALL_PLUGIN_CPPNAMES; do
-  plugin=[`echo $cppname | tr [:upper:] [:lower:]`]
-  if test -z "`$GST_INSPECT $plugin | $HEAD -n 1 | $GREP "No such element"`"; then
-    plugin_define=["GSTREAMERMM_PLUGIN_`echo $plugin | tr [:lower:] [:upper:]`"]
+for plugin_def in $GSTREAMERMM_ALL_PLUGIN_DEFS; do
+  plugin_name=[`echo $plugin_def | cut -d'=' -f 1`]
+  cppname=[`echo $plugin_def | cut -d'=' -f 2`]
+  GSTREAMERMM_ALL_PLUGIN_CPPNAMES="$GSTREAMERMM_ALL_PLUGIN_CPPNAMES $cppname"
+  if test -z "`$GST_INSPECT $plugin_name | $HEAD -n 1 | $GREP "No such element"`"; then
+    plugin_define=["GSTREAMERMM_PLUGIN_`echo $plugin_name | tr [:lower:] [:upper:]`"]
     AC_DEFINE_UNQUOTED($plugin_define)
     GSTREAMERMM_EXISTING_PLUGIN_CPPNAMES="$GSTREAMERMM_EXISTING_PLUGIN_CPPNAMES $cppname"
-    GSTREAMERMM_EXISTING_PLUGIN_HG="$GSTREAMERMM_EXISTING_PLUGIN_HG $plugin.hg"
+    GSTREAMERMM_EXISTING_PLUGIN_HG="$GSTREAMERMM_EXISTING_PLUGIN_HG $plugin_name.hg"
   fi
 done
+AC_SUBST(GSTREAMERMM_ALL_PLUGIN_DEFS)
 AC_SUBST(GSTREAMERMM_ALL_PLUGIN_CPPNAMES)
 AC_SUBST(GSTREAMERMM_EXISTING_PLUGIN_CPPNAMES)
 AC_SUBST(GSTREAMERMM_EXISTING_PLUGIN_HG)

Modified: gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment	(original)
+++ gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment	Wed Feb 11 04:19:30 2009
@@ -20,12 +20,14 @@
 
 files_general_deprecated_hg =
 
-# To add a plugin, add the C++ class name (which must be the plugin name as
-# recognized by gst-inspect but in camel case -- as is appropriate for a class
-# name) to the plug-in C++ name list (GSTREAMERMM_ALL_PLUGIN_CPPNAMES) in the
-# configure.ac file.  Also add the target .hg file name (same name all in
-# lowercase with a .hg) to the variable below.  Finally, be sure to include an
-# #undef in the gstreamermmconfig.h.in file.
+# To add a plugin, add the plugin definition, in the form of
+# "plugin=CppClassName" (where "plugin" is the plugin name as recognized by
+# gst-inspect and "CppClassName" is the desired name of the C++ class), to the
+# GSTREAMERMM_ALL_PLUGIN_DEFS variable of the configure.ac file.  Also add the
+# target .hg file name (which must be the same as "CppClassName" all in
+# lowercase with a .hg extension) to the variable below.  Finally, be sure to
+# include an #undef in the form of "#undef GSTREAMERMM_PLUGIN_name" in the
+# gstreamermmconfig.h.in file (where "name" is the plugin name all in caps).
 
 files_all_plugin_hg = capsfilter.hg fakesrc.hg fakesink.hg fdsink.hg fdsrc.hg \
 		  filesrc.hg filesink.hg identity.hg multiqueue.hg queue.hg \
@@ -46,6 +48,7 @@
 # name to use for the plug-ins and the list of the existing plug-ins in the
 # system so only those are included in the build:
 
+defs_plugin_all = $(GSTREAMERMM_ALL_PLUGIN_DEFS)
 cppnames_plugin_all = $(GSTREAMERMM_ALL_PLUGIN_CPPNAMES)
 files_existing_plugin_hg = $(GSTREAMERMM_EXISTING_PLUGIN_HG)
 

Modified: gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
==============================================================================
--- gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc	(original)
+++ gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc	Wed Feb 11 04:19:30 2009
@@ -233,12 +233,12 @@
             get_cast_macro(propertyCType).lowercase() + "_get_type";
 
           enumGTypeFunctionDefinitions +=
-            "static GType " + enumGetTypeFunctionName + "()\n" +
+            "\nstatic GType " + enumGetTypeFunctionName + "()\n" +
             "{\n" +
             "  static GType const type = g_type_from_name(\"" +
               propertyCType + "\");\n" +
             "  return type;\n" +
-            "}\n\n";
+            "}\n";
         }
 
         wrapStatements += "  _WRAP_PROPERTY(\"" + propertyName + "\", " +
@@ -422,7 +422,8 @@
   std::cout << "namespace " << nmspace << std::endl;
   std::cout << "{" << std::endl << std::endl;
 
-  std::cout << enumWrapStatements << std::endl;
+  if (!enumWrapStatements.empty())
+    std::cout << enumWrapStatements << std::endl;
 
   std::cout << "/** " << nmspace << "::" << cppTypeName << " - " << pluginName << " plugin." << std::endl;
   std::cout << " * Please include <" << target << "/" <<
@@ -448,7 +449,8 @@
     ", " << castMacro << ", " << parentNameSpace << "::" <<
     cppParentTypeName << ", " << cParentTypeName << ")" << std::endl;
 
-  std::cout << interfaceMacros << std::endl;
+  if (!interfaceMacros.empty())
+    std::cout << interfaceMacros << std::endl;
 
   std::cout << "  _IS_GSTREAMERMM_PLUGIN" << std::endl << std::endl;
 
@@ -463,12 +465,13 @@
 
   std::cout << "/** Creates a new " << pluginName << " plugin with the given name." << std::endl;
   std::cout << " */" << std::endl;
-  std::cout << "  _WRAP_CREATE(const Glib::ustring& name)" << std::endl <<
-    std::endl;
+  std::cout << "  _WRAP_CREATE(const Glib::ustring& name)" << std::endl;
 
-  std::cout << propertyWrapStatements;
+  if (!propertyWrapStatements.empty())
+    std::cout << std::endl << propertyWrapStatements;
 
-  std::cout << std::endl << signalWrapStatements;
+  if (!signalWrapStatements.empty())
+    std::cout << std::endl << signalWrapStatements;
 
   std::cout << "};" << std::endl;
 
@@ -519,11 +522,12 @@
   std::cout << "  }" << std::endl << std::endl;
 
   std::cout << "  return type;" << std::endl;
-  std::cout << "}" << std::endl << std::endl;
+  std::cout << "}" << std::endl;
 
-  std::cout << enumGTypeFunctionDefinitions;
+  if (!enumGTypeFunctionDefinitions.empty())
+    std::cout << enumGTypeFunctionDefinitions;
 
-  std::cout << "} // extern \"C\"" << std::endl << std::endl;
+  std::cout << std::endl << "} // extern \"C\"" << std::endl << std::endl;
 
   std::cout << "namespace " << nmspace << std::endl;
   std::cout << "{" << std::endl << std::endl;
@@ -532,18 +536,18 @@
   std::cout << ": _CONSTRUCT(\"name\", NULL)" << std::endl;
   std::cout << "{}" << std::endl << std::endl;
 
-  std::cout << cppTypeName << "::" << cppTypeName << "(const Glib::ustring& name)" << std::endl;
+  std::cout << cppTypeName << "::" << cppTypeName <<
+    "(const Glib::ustring& name)" << std::endl;
   std::cout << ": _CONSTRUCT(\"name\", name.c_str())" << std::endl;
   std::cout << "{}" << std::endl << std::endl;
 
-  std::cout << std::endl << "}" << std::endl;
+  std::cout << "}" << std::endl;
 }
 
 int main(int argc, char* argv[])
 {
   gboolean hgFile = false;
   gboolean ccgFile = false;
-  gboolean suggestHg = false;
 
   if (!g_thread_supported())
     g_thread_init(NULL);
@@ -552,20 +556,20 @@
   {
     {"hg", 'h', 0, G_OPTION_ARG_NONE, &hgFile, "Generate preliminary .hg file.", NULL },
     {"ccg", 'c', 0, G_OPTION_ARG_NONE, &ccgFile, "Generate .ccg file.", NULL },
-    {"suggest-hg", 's', 0, G_OPTION_ARG_NONE, &suggestHg, "If the plugin exists, output .hg filename.", NULL },
     {"namespace", 'n', 0, G_OPTION_ARG_STRING, &nmspace, "The namespace of the plugin.", "namespace" },
     {"main-defs", 'm', 0, G_OPTION_ARG_STRING, &defsFile, "The main defs file without .defs extension.", "def" },
     {"target", 't', 0, G_OPTION_ARG_STRING, &target, "The .h and .cc target directory.", "directory" },
     { NULL }
   };
 
-  GOptionContext* gContext = g_option_context_new("<CppPluginClassName>");
+  GOptionContext* gContext =
+    g_option_context_new("<plugin-name> <CppPluginClassName>");
   g_option_context_set_summary(gContext, "Outputs a GStreamer plugin's "
     "gmmproc files to be processed by gmmproc for\nwrapping in gstreamermm.  "
-    "Use the same syntax for CppPluginClassName as in\ngst-inspect except "
-    "that camel casing should be used because this will be the\nname of the "
-    "C++ class.  The .hg file is a preliminary .hg file that needs to\nbe run "
-    "through m4 including the ctocpp*.m4 files in the tools/m4 directory.");
+    "Use the same syntax for plugin-name as in gst-inspect\nand supply the "
+    "desired C++ class name.  The .hg file is a preliminary .hg file\nthat "
+    "needs to be run through m4 including the ctocpp*.m4 files in the "
+    "tools/m4\ndirectory.");
 
   g_option_context_add_main_entries(gContext, optionEntries, NULL);
   g_option_context_add_group(gContext, gst_init_get_option_group());
@@ -589,16 +593,16 @@
       return -1;
   }
 
-  if (argc != 2)
+  if (argc != 3)
   {
-    std::cout << "A plugin name must be supplied to generate an .hg file." <<
-      std::endl << "Run `" << argv[0] << " -?'  for a list of options." <<
-      std::endl;
+    std::cout << "A plugin name and C++ class name must be supplied to "
+      "generate gmmproc files." << std::endl <<
+      "Run `" << argv[0] << " -?'  for help." << std::endl;
     return -1;
   }
 
-  cppTypeName = argv[1];
-  pluginName = cppTypeName.lowercase();
+  pluginName = argv[1];
+  cppTypeName = argv[2];
 
   GstElementFactory* factory = 0;
 
@@ -617,12 +621,6 @@
 
   if (type)
   {
-    if (suggestHg)
-    {
-      std::cout << pluginName << ".hg" << std::endl;
-      return 0;
-    }
-
     if (!nmspace || !defsFile || !target)
     {
       std::cout << "A namespace, a default defs file and a target directory "



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]