gnomemm r1827 - in gstreamermm/trunk: . build_shared gstreamer/src gstreamerbase/src tools/extra_defs_gen tools/m4



Author: jaalburqu
Date: Mon Dec  8 05:41:47 2008
New Revision: 1827
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1827&view=rev

Log:
2008-12-08  Josà Alburquerque  <jaalburqu svn gnome org>

	* tools/m4/Makefile_list_of_sources.am_fragment:
	* tools/m4/convert.m4:
	* tools/m4/ctocpp_base.m4:
	* tools/m4/ctocpp.m4:
	* build_shared/Makefile_gensrc.am_fragment:
	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Modified
	plug-in generation tool to generate preliminary .hg file (when
	generating the .hg file) which would then be run through m4 with
	macros in ctocpp_base.m4 and ctocpp.m4.  Modified the build process to
	generate the preliminary .hg file with the tool and then run the file
	through m4 before running gmmproc on the final .hg file.  Modified the
	tool to generate signals.  Signals are wrapped; testing should be done
	though.

	* gstreamer/src/gst_signals.defs:
	* gstreamer/src/gst_signals.defs.patch: Added `*' to GstBuffer pointer
	type in definitions (it is GstMiniObject and the extra defs utility
	does not know -- see bug #562810).  Modified patch to do this.

	* gstreamerbase/src/Makefile_list_of_hg.am_fragment:
	* gstreamerbase/src/gstbase_signals.defs:
	* tools/extra_defs_gen/generate_defs_gstbase.cc: Added plug-in
	`decodebin' to list of plug-ins to be generated for gstreamerbasemm to
	test plug-in generation that uses API from gstreamermm (properties and
	signals are wrapped).

	* gstreamer/src/basesink.ccg:
	* gstreamer/src/basesink.hg:
	* gstreamer/src/basesrc.ccg:
	* gstreamer/src/basesrc.hg:
	* gstreamer/src/pushsrc.ccg:
	* gstreamer/src/pushsrc.hg: Moved includes from .ccg to .hg files
	because plug-ins relying on these base classes need Gst*Class
	definitions from GStreamer header files.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/build_shared/Makefile_gensrc.am_fragment
   gstreamermm/trunk/gstreamer/src/basesink.ccg
   gstreamermm/trunk/gstreamer/src/basesink.hg
   gstreamermm/trunk/gstreamer/src/basesrc.ccg
   gstreamermm/trunk/gstreamer/src/basesrc.hg
   gstreamermm/trunk/gstreamer/src/gst_signals.defs
   gstreamermm/trunk/gstreamer/src/gst_signals.defs.patch
   gstreamermm/trunk/gstreamer/src/pushsrc.ccg
   gstreamermm/trunk/gstreamer/src/pushsrc.hg
   gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment
   gstreamermm/trunk/gstreamerbase/src/gstbase_signals.defs
   gstreamermm/trunk/tools/extra_defs_gen/generate_defs_gstbase.cc
   gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
   gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment
   gstreamermm/trunk/tools/m4/convert.m4
   gstreamermm/trunk/tools/m4/ctocpp.m4
   gstreamermm/trunk/tools/m4/ctocpp_base.m4

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	Mon Dec  8 05:41:47 2008
@@ -23,6 +23,7 @@
 
 include $(tools_dir)/Makefile_list_of_sources.am_fragment
 tools_m4	= $(files_tools_m4:%.m4=$(tools_dir_m4)/%.m4)
+tools_plugin_m4	= $(files_tools_plugin_m4:%.m4=$(tools_dir_m4)/%.m4)
 # tools_pm	= $(files_tools_pm:%.pm=$(tools_dir_pm)/%.pm)
 
 include $(srcdir)/../src/Makefile_list_of_hg.am_fragment
@@ -70,13 +71,24 @@
 	$(stamp_plugin_dir)/stamp-$(plugin)-plugin)
 
 
+# This is to generate plugin .hg files.  A few variables are defined (in make
+# process), a temp file is used to generate preliminary .hg file which is then
+# run through m4 using the macros in tools/m4/ctocpp_base.m4 which then
+# produces the final .hg file.
 $(files_plugin_hg_with_path): $(generate_plugin_gmmproc_file_path) \
-	$(tools_m4) $(files_defs)
+	$(tools_plugin_m4) $(files_defs)
+	$(eval plugin_hg_without_path = $$(notdir $@))
+	$(eval plugin_mktemp_output = \
+		$$(shell mktemp -t $$(plugin_hg_without_path).XXXXX))
+	$(eval plugin_hg_tmp_file = $(plugin_mktemp_output))
 	$(run_generate_plugin_gmmproc_file) --hg \
-		$(notdir $(subst .hg,,$@)) >  $@
-
-$(files_plugin_hg_with_path:.hg=.ccg): $(subst .ccg,.hg,$@) \
-	$(generate_plugin_gmmproc_file_path) $(tools_m4) $(files_defs)
+		$(subst .hg,,$(plugin_hg_without_path)) >  $(plugin_hg_tmp_file)
+	$(M4) -I $(tools_dir_m4) $(plugin_hg_tmp_file) > $@
+	rm -f $(plugin_hg_tmp_file)
+
+# This is to generate plugin .ccg files.
+$(files_plugin_hg_with_path:.hg=.ccg): $(generate_plugin_gmmproc_file_path) \
+	$(files_defs)
 	$(run_generate_plugin_gmmproc_file) --ccg \
 		$(notdir $(subst .ccg,,$@)) >  $@
 
@@ -84,14 +96,18 @@
 	$(run_gmmproc) $(notdir $*) $(srcdir) $(gensrc_destdir)
 	@echo 'timestamp' > $@
 
+# This is to run generated plugin .hg and .ccg files through gmmproc.
 $(stamp_plugin_dir)/stamp-%-plugin: $(stamp_plugin_dir) $(srcdir)/%.hg \
 	$(srcdir)/%.ccg $(tools_m4) $(files_defs)
 	$(run_gmmproc) $(notdir $*) $(srcdir) $(gensrc_destdir)
 	@echo 'timestamp' > $@
 
+# This is to create the plugin .stamps directory (if builddir is different than
+# srcdir)
 $(stamp_plugin_dir):
 	@(test -d $(stamp_plugin_dir) || mkdir $(stamp_plugin_dir))
 
+# This is to patch generated .h files in $(gensrc_destdir) (e.g. taglist.h).
 $(destdir_stamp_dir)/stamp-%: $(gensrc_destdir)/%.h
 	patch -Ns $(gensrc_destdir)/$*.h $(gensrc_destdir)/$*.h.patch || true
 	rm -f $(gensrc_destdir)/$*.h.rej
@@ -106,7 +122,8 @@
 	  $(srcdir)/$(shell $(run_generate_plugin_gmmproc_file) \
 	  --suggest-hg $(plugin)))) >$@
 
-$(gensrc_destdir)/gst_wrap_init.cc: $(gen_gst_wrap_init_in) $(files_hg_with_path)
+$(gensrc_destdir)/gst_wrap_init.cc: $(gen_gst_wrap_init_in) \
+	$(files_hg_with_path)
 	$(run_gen_gst_wrap_init) $(files_all_hg:%.hg=$(srcdir)/%.hg) >$@
 
 create-stamp-dir: $(stamp_plugin_dir)

Modified: gstreamermm/trunk/gstreamer/src/basesink.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesink.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/basesink.ccg	Mon Dec  8 05:41:47 2008
@@ -19,7 +19,6 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <gst/base/gstbasesink.h>
 #include <gstreamermm/pad.h>
 
 _PINCLUDE(gstreamermm/private/element_p.h)

Modified: gstreamermm/trunk/gstreamer/src/basesink.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesink.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/basesink.hg	Mon Dec  8 05:41:47 2008
@@ -19,6 +19,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <gst/base/gstbasesink.h>
 #include <gstreamermm/element.h>
 #include <gstreamermm/buffer.h>
 #include <gstreamermm/pad.h>

Modified: gstreamermm/trunk/gstreamer/src/basesrc.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesrc.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/basesrc.ccg	Mon Dec  8 05:41:47 2008
@@ -19,7 +19,6 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <gst/base/gstbasesrc.h>
 #include <gstreamermm/caps.h>
 #include <gstreamermm/buffer.h>
 

Modified: gstreamermm/trunk/gstreamer/src/basesrc.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/basesrc.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/basesrc.hg	Mon Dec  8 05:41:47 2008
@@ -19,6 +19,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <gst/base/gstbasesrc.h>
 #include <gstreamermm/element.h>
 #include <gstreamermm/pad.h>
 #include <gstreamermm/format.h>

Modified: gstreamermm/trunk/gstreamer/src/gst_signals.defs
==============================================================================
--- gstreamermm/trunk/gstreamer/src/gst_signals.defs	(original)
+++ gstreamermm/trunk/gstreamer/src/gst_signals.defs	Mon Dec  8 05:41:47 2008
@@ -944,7 +944,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstBuffer" "p0")
+    '("GstBuffer*" "p0")
     '("GstPad*" "p1")
   )
 )
@@ -1154,7 +1154,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstBuffer" "p0")
+    '("GstBuffer*" "p0")
     '("GstPad*" "p1")
   )
 )
@@ -1164,7 +1164,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstBuffer" "p0")
+    '("GstBuffer*" "p0")
     '("GstPad*" "p1")
   )
 )
@@ -1697,7 +1697,7 @@
   (return-type "void")
   (when "last")
   (parameters
-    '("GstBuffer" "p0")
+    '("GstBuffer*" "p0")
   )
 )
 

Modified: gstreamermm/trunk/gstreamer/src/gst_signals.defs.patch
==============================================================================
--- gstreamermm/trunk/gstreamer/src/gst_signals.defs.patch	(original)
+++ gstreamermm/trunk/gstreamer/src/gst_signals.defs.patch	Mon Dec  8 05:41:47 2008
@@ -1,5 +1,5 @@
---- gst_signals.defs.gen	2008-10-15 17:01:33.000000000 -0400
-+++ gst_signals.defs	2008-10-15 17:30:32.000000000 -0400
+--- gst_signals.defs.orig	2008-12-08 00:18:54.000000000 -0500
++++ gst_signals.defs	2008-12-08 00:25:45.000000000 -0500
 @@ -1,3 +1,5 @@
 +;; Apply gst_signals.defs.patch after regenerating.
 +
@@ -24,7 +24,7 @@
    )
  )
  
-@@ -76,7 +78,7 @@
+@@ -82,7 +84,7 @@
    (return-type "void")
    (when "first")
    (parameters
@@ -33,7 +33,7 @@
    )
  )
  
-@@ -85,7 +87,7 @@
+@@ -91,7 +93,7 @@
    (return-type "void")
    (when "first")
    (parameters
@@ -42,7 +42,7 @@
    )
  )
  
-@@ -351,7 +353,7 @@
+@@ -357,7 +359,7 @@
    (return-type "gboolean")
    (when "last")
    (parameters
@@ -51,7 +51,7 @@
    )
  )
  
-@@ -516,7 +518,7 @@
+@@ -522,7 +524,7 @@
    (return-type "void")
    (when "last")
    (parameters
@@ -60,7 +60,7 @@
    )
  )
  
-@@ -525,7 +527,7 @@
+@@ -531,7 +533,7 @@
    (return-type "void")
    (when "last")
    (parameters
@@ -69,7 +69,7 @@
    )
  )
  
-@@ -636,7 +638,7 @@
+@@ -642,7 +644,7 @@
    (when "last")
    (parameters
      '("GstObject*" "p0")
@@ -78,3 +78,39 @@
    )
  )
  
+@@ -942,7 +944,7 @@
+   (return-type "void")
+   (when "last")
+   (parameters
+-    '("GstBuffer" "p0")
++    '("GstBuffer*" "p0")
+     '("GstPad*" "p1")
+   )
+ )
+@@ -1152,7 +1154,7 @@
+   (return-type "void")
+   (when "last")
+   (parameters
+-    '("GstBuffer" "p0")
++    '("GstBuffer*" "p0")
+     '("GstPad*" "p1")
+   )
+ )
+@@ -1162,7 +1164,7 @@
+   (return-type "void")
+   (when "last")
+   (parameters
+-    '("GstBuffer" "p0")
++    '("GstBuffer*" "p0")
+     '("GstPad*" "p1")
+   )
+ )
+@@ -1695,7 +1697,7 @@
+   (return-type "void")
+   (when "last")
+   (parameters
+-    '("GstBuffer" "p0")
++    '("GstBuffer*" "p0")
+   )
+ )
+ 

Modified: gstreamermm/trunk/gstreamer/src/pushsrc.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/pushsrc.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/pushsrc.ccg	Mon Dec  8 05:41:47 2008
@@ -19,6 +19,4 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <gst/base/gstpushsrc.h>
-
 _PINCLUDE(gstreamermm/private/basesrc_p.h)

Modified: gstreamermm/trunk/gstreamer/src/pushsrc.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/pushsrc.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/pushsrc.hg	Mon Dec  8 05:41:47 2008
@@ -19,6 +19,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <gst/base/gstpushsrc.h>
 #include <gstreamermm/basesrc.h>
 
 _DEFS(gstreamermm,gst)

Modified: gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment	(original)
+++ gstreamermm/trunk/gstreamerbase/src/Makefile_list_of_hg.am_fragment	Mon Dec  8 05:41:47 2008
@@ -8,6 +8,6 @@
 
 files_general_deprecated_hg =
 
-files_plugin_hg = oggmux.hg
+files_plugin_hg = decodebin.hg oggmux.hg
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment

Modified: gstreamermm/trunk/gstreamerbase/src/gstbase_signals.defs
==============================================================================
--- gstreamermm/trunk/gstreamerbase/src/gstbase_signals.defs	(original)
+++ gstreamermm/trunk/gstreamerbase/src/gstbase_signals.defs	Mon Dec  8 05:41:47 2008
@@ -61,6 +61,64 @@
   (construct-only #f)
 )
 
+;; From GstDecodeBin
+
+(define-signal new-decoded-pad
+  (of-object "GstDecodeBin")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("GstPad*" "p0")
+    '("gboolean" "p1")
+  )
+)
+
+(define-signal removed-decoded-pad
+  (of-object "GstDecodeBin")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("GstPad*" "p0")
+  )
+)
+
+(define-signal unknown-type
+  (of-object "GstDecodeBin")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("GstPad*" "p0")
+    '("GstCaps*" "p1")
+  )
+)
+
+(define-property name
+  (of-object "GstDecodeBin")
+  (prop-type "GParamString")
+  (docs "The name of the object")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property async-handling
+  (of-object "GstDecodeBin")
+  (prop-type "GParamBoolean")
+  (docs "The bin will handle Asynchronous state changes")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property sink-caps
+  (of-object "GstDecodeBin")
+  (prop-type "GParamBoxed")
+  (docs "The caps of the input data. (NULL = use typefind element)")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From GstOggMux
 
 (define-property name

Modified: gstreamermm/trunk/tools/extra_defs_gen/generate_defs_gstbase.cc
==============================================================================
--- gstreamermm/trunk/tools/extra_defs_gen/generate_defs_gstbase.cc	(original)
+++ gstreamermm/trunk/tools/extra_defs_gen/generate_defs_gstbase.cc	Mon Dec  8 05:41:47 2008
@@ -36,6 +36,7 @@
 
   // gst-plugins-base (GStreamer base) plugin types
             << get_plugin_defs("audioconvert")
+            << get_plugin_defs("decodebin")
             << get_plugin_defs("oggmux")
             ;
 

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	Mon Dec  8 05:41:47 2008
@@ -173,7 +173,7 @@
           enumWrapStatements += "_WRAP_ENUM(" + propertyCType.substr(3) + ", " +
             propertyCType + ")\n";
           enumWrapStatements += "_CCONVERSION(`" + propertyCType + "',`" +
-            propertyCType.substr(3) + "')\n\n";
+            propertyCType.substr(3) + "')dnl\n";
 
           Glib::ustring enumGetTypeFunctionName =
             get_cast_macro(propertyCType).lowercase() + "_get_type";
@@ -186,10 +186,10 @@
         }
 
         wrapStatements += "  _WRAP_PROPERTY(\"" + propertyName + "\", " +
-          "_CCONVERT(" + propertyCType + ", true) )\n";
+          "_CCONVERT(" + propertyCType + ", true))\n";
 
         if (!G_TYPE_IS_ENUM(propertyGType) || enumIsWrapped)
-          includeMacroCalls += "_CCONVERSION_INCLUDE(" + propertyCType + ")\n";
+          includeMacroCalls += "_CCONVERSION_INCLUDE(" + propertyCType + ")dnl\n";
       }
     }
   }
@@ -197,14 +197,138 @@
   g_free(ppParamSpec);
 }
 
-void generate_hg_file(const Glib::ustring& propertyWrapStatements,
-  const Glib::ustring& includeMacroCalls,
-  const Glib::ustring& enumWrapStatements)
+Glib::ustring get_method_name(const Glib::ustring& signalName)
 {
+  Glib::ustring result;
+
+  for (Glib::ustring::const_iterator iter = signalName.begin();
+    iter != signalName.end(); ++iter)
+  {
+    if ((*iter) == '-')
+    {
+      result.push_back('_');
+    }
+    else
+      result.push_back(*iter);
+  }
+
+  return result;
+}
+
+void get_signal_wrap_statements(Glib::ustring& wrapStatements,
+  Glib::ustring& includeMacroCalls, Glib::ustring& cClassSignalDeclarations)
+{
+  gpointer gclass_ref = 0;
+  gpointer ginterface_ref = 0;
+
+  if(G_TYPE_IS_OBJECT(type))
+    gclass_ref = g_type_class_ref(type); //Ensures that class_init() is called.
+  else if(G_TYPE_IS_INTERFACE(type))
+    ginterface_ref = g_type_default_interface_ref(type); //install signals.
+
+  //Get the list of signals:
+  guint iCount = 0;
+  guint* pIDs = g_signal_list_ids (type, &iCount);
+
+  //Loop through the list of signals:
+  if(pIDs)
+  {
+    for(guint i = 0; i < iCount; i++)
+    {
+      Glib::ustring convertMacros;
+      Glib::ustring wrapStatement;
+
+      guint signal_id = pIDs[i];
+
+      //Name:
+      Glib::ustring signalName = g_signal_name(signal_id);
+      Glib::ustring signalMethodName = get_method_name(signalName);
+
+      //Other information about the signal:
+      GSignalQuery signalQuery = { 0, 0, 0, GSignalFlags(0), 0, 0, 0, };
+      g_signal_query(signal_id, &signalQuery);
+
+      //Return type:
+      GType returnGType = signalQuery.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE;
+
+      Glib::ustring  returnCType = g_type_name(returnGType) +
+        (Glib::ustring) (gst_type_is_a_pointer(returnGType) ?  "*" : "");
+
+      includeMacroCalls += "_CCONVERSION_INCLUDE(" + returnCType + ")dnl\n";
+
+      wrapStatement = "  _WRAP_SIGNAL(_CCONVERT("  + returnCType +
+        ", true) " + signalMethodName + "(";
+
+      cClassSignalDeclarations += "  " + returnCType + " (*" +
+        signalMethodName + ") (" + cTypeName + "* element";
+
+      //Loop through the list of parameters:
+      const GType* pParameters = signalQuery.param_types;
+      if(pParameters)
+      {
+        for(unsigned i = 0; i < signalQuery.n_params; i++)
+        {
+          GType paramGType = pParameters[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE;
+
+          //Parameter name:
+          //TODO: How can we get the real parameter name?
+          gchar* pchNum = g_strdup_printf("%d", i);
+          Glib::ustring paramName = "arg" + std::string(pchNum);
+          g_free(pchNum);
+          pchNum = 0;
+
+          Glib::ustring  paramCType = g_type_name(paramGType) +
+            (Glib::ustring) (gst_type_is_a_pointer(paramGType) ?  "*" : "");
+
+          includeMacroCalls += "_CCONVERSION_INCLUDE(" + paramCType + ")dnl\n";
+
+          if (gst_type_is_a_pointer(paramGType))
+          {
+            convertMacros += "#m4 _CONVERSION(``" + paramCType +
+              "'', _LQ()_CCONVERT(" + paramCType + ")_RQ(), ";
+            convertMacros += g_type_is_a(paramGType, GST_TYPE_MINI_OBJECT) ?
+              "``Gst::wrap($3, true)'')\n" : "``Glib::wrap($3, true)'')\n";
+
+            convertMacros += "#m4 _CONVERSION(_LQ()_CCONVERT(" + paramCType +
+              ")_RQ(), ``" + paramCType + "'', ";
+            convertMacros += "``($3)->gobj()'')\n";
+          }
+
+          wrapStatement += "_CCONVERT(" + paramCType + ") " + paramName;
+
+          cClassSignalDeclarations += ", " + paramCType + " " + paramName;
+
+          if (i < signalQuery.n_params - 1)
+            wrapStatement += ", ";
+        }
+      }
+      wrapStatement += "), \"" + signalName + "\")\n";
+
+      wrapStatements += convertMacros + wrapStatement;
+
+      cClassSignalDeclarations += ");\n";
+    }
+  }
+
+  g_free(pIDs);
+
+  if(gclass_ref)
+    g_type_class_unref(gclass_ref); //to match the g_type_class_ref() above.
+  else if(ginterface_ref)
+    g_type_default_interface_unref(ginterface_ref); // for interface ref above.
+}
+
+void generate_hg_file(const Glib::ustring& includeMacroCalls,
+  const Glib::ustring& enumWrapStatements,
+  const Glib::ustring& propertyWrapStatements,
+  const Glib::ustring& signalWrapStatements)
+{
+  std::cout << "include(ctocpp_base.m4)dnl" << std::endl;
+  std::cout << "changecom()dnl" << std::endl;
   std::cout << "#include <" << includeRoot << "/" <<
     cppParentTypeName.lowercase() << ".h>" << std::endl;
 
-  std::cout << includeMacroCalls << std::endl;
+  std::cout << includeMacroCalls;
 
   std::cout << "_DEFS(" << target << "," << defsFile << ")" << std::endl <<
     std::endl;
@@ -212,7 +336,7 @@
   std::cout << "namespace " << nmspace << std::endl;
   std::cout << "{" << std::endl << std::endl;
 
-  std::cout << enumWrapStatements;
+  std::cout << enumWrapStatements << std::endl;
 
   std::cout << "/** " << nmspace << "::" << cppTypeName << " â " << pluginName << " plugin." << std::endl;
   std::cout << " * Please include <" << target << "/" << cppTypeName.lowercase() << ".h> to use." << std::endl;
@@ -243,16 +367,24 @@
 
   std::cout << propertyWrapStatements;
 
+  std::cout << std::endl << signalWrapStatements;
+
   std::cout << "};" << std::endl;
 
   std::cout << std::endl << "} //namespace " << nmspace << std::endl;
 }
 
-void generate_ccg_file(const Glib::ustring& enumGTypeFunctionDefinitions)
+void generate_ccg_file(const Glib::ustring& enumGTypeFunctionDefinitions,
+  const Glib::ustring& cClassSignalDeclarations)
 {
   std::cout << "_PINCLUDE(" << includeRoot << "/private/" <<
-    cppParentTypeName.lowercase() << "_p.h)" << std::endl;
-  std::cout << "#include <glib/gprintf.h>" << std::endl << std::endl;
+    cppParentTypeName.lowercase() << "_p.h)" << std::endl << std::endl;
+
+  std::cout << "struct _" << cTypeName << "Class" << std::endl;
+  std::cout << "{" << std::endl;
+  std::cout << "  " << cParentTypeName << "Class parent_class;" << std::endl;
+  std::cout << cClassSignalDeclarations;
+  std::cout << "};" << std::endl << std::endl;
 
   Glib::ustring getTypeName = castMacro.lowercase() + "_get_type";
 
@@ -309,7 +441,7 @@
 
   GOptionEntry optionEntries[] =
   {
-    {"hg", 'h', 0, G_OPTION_ARG_NONE, &hgFile, "Generate .hg file.", NULL },
+    {"hg", 'h', 0, G_OPTION_ARG_NONE, &hgFile, "Generate a preliminary .hg file.  Run through m4 including macros in tools/m4 directory to get final .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 the suggested .hg filename.", NULL },
     {"namespace", 'n', 0, G_OPTION_ARG_STRING, &nmspace, "The namespace of the plugin.", "namespace" },
@@ -385,6 +517,8 @@
       cppParentTypeName.compare("BaseSink") == 0 ||
       cppParentTypeName.compare("BaseTransform") == 0 ||
       cppParentTypeName.compare("PushSrc") == 0 ||
+      cppParentTypeName.compare("Pipeline") == 0 ||
+      cppParentTypeName.compare("Bin") == 0 ||
       cppParentTypeName.compare("Element") == 0)
     {
       includeRoot = "gstreamermm";
@@ -396,28 +530,34 @@
       parentNameSpace = nmspace;
     }
 
-    Glib::ustring propertyWrapStatements;
-    Glib::ustring includeMacroCalls;
-    Glib::ustring enumWrapStatements;
-    Glib::ustring enumGTypeFunctionDeclarations;
-
-    if (hgFile || ccgFile)
+    if (suggestHg)
+      std::cout << pluginName << ".hg" << std::endl;
+    else if (hgFile || ccgFile)
     {
+      Glib::ustring propertyWrapStatements;
+      Glib::ustring includeMacroCalls;
+      Glib::ustring enumWrapStatements;
+      Glib::ustring signalWrapStatements;
+      Glib::ustring enumGTypeFunctionDeclarations;
+      Glib::ustring cClassSignalDeclarations;
+
       get_property_wrap_statements(propertyWrapStatements, includeMacroCalls,
         enumWrapStatements, enumGTypeFunctionDeclarations);
-    }
 
-    if (hgFile)
-    {
-      generate_hg_file(propertyWrapStatements, includeMacroCalls,
-        enumWrapStatements);
-    }
-    else if (ccgFile)
-    {
-      generate_ccg_file(enumGTypeFunctionDeclarations);
+      get_signal_wrap_statements(signalWrapStatements, includeMacroCalls,
+        cClassSignalDeclarations);
+
+      if (hgFile)
+      {
+        generate_hg_file(includeMacroCalls, enumWrapStatements,
+          propertyWrapStatements, signalWrapStatements);
+      }
+      else
+      {
+        generate_ccg_file(enumGTypeFunctionDeclarations,
+          cClassSignalDeclarations);
+      }
     }
-    else if (suggestHg)
-      std::cout << pluginName << ".hg" << std::endl;
 
     g_object_unref(factory);
   }

Modified: gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment
==============================================================================
--- gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment	(original)
+++ gstreamermm/trunk/tools/m4/Makefile_list_of_sources.am_fragment	Mon Dec  8 05:41:47 2008
@@ -1,3 +1,5 @@
-files_tools_m4 = convert.m4 convert_gst.m4 convert_gstbase.m4 ctocpp_base.m4 \
-		 class_gstminiobject.m4 class_boxedtype_extra.m4 ctocpp.m4
+files_tools_m4 = convert.m4 convert_gst.m4 convert_gstbase.m4 \
+		 class_gstminiobject.m4 class_boxedtype_extra.m4
+
+files_tools_plugin_m4 = ctocpp_base.m4 ctocpp.m4
 

Modified: gstreamermm/trunk/tools/m4/convert.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert.m4	Mon Dec  8 05:41:47 2008
@@ -1,8 +1,6 @@
 include(convert_base.m4)
 include(convert_glib.m4)
-include(ctocpp_base.m4)
 include(convert_gst.m4)
 include(convert_gstbase.m4)
 include(class_gstminiobject.m4)
 include(class_boxedtype_extra.m4)
-include(ctocpp.m4)

Modified: gstreamermm/trunk/tools/m4/ctocpp.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/ctocpp.m4	(original)
+++ gstreamermm/trunk/tools/m4/ctocpp.m4	Mon Dec  8 05:41:47 2008
@@ -1,3 +1,7 @@
-_CCONVERSION(`GstBuffer*',`const Glib::RefPtr<Gst::Buffer>&',`Glib::RefPtr<Gst::Buffer>')
-_CCONVERSION(`GstCaps*',`const Glib::RefPtr<Gst::Caps>&',`Glib::RefPtr<Gst::Caps>')
+#Enums
 _CCONVERSION(`GstFormat',`Gst::Format')
+
+#Reference counted
+_CCONVERSION(`GstBuffer*',`const Glib::RefPtr<Gst::Buffer>&',`Glib::RefPtr<Gst::Buffer>',`<gstreamermm/buffer.h>')
+_CCONVERSION(`GstCaps*',`const Glib::RefPtr<Gst::Caps>&',`Glib::RefPtr<Gst::Caps>',`<gstreamermm/caps.h>')
+_CCONVERSION(`GstPad*',`const Glib::RefPtr<Gst::Pad>&',`Glib::RefPtr<Gst::Pad>',`<gstreamermm/pad.h>')

Modified: gstreamermm/trunk/tools/m4/ctocpp_base.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/ctocpp_base.m4	(original)
+++ gstreamermm/trunk/tools/m4/ctocpp_base.m4	Mon Dec  8 05:41:47 2008
@@ -1,7 +1,19 @@
+divert(-1)
 dnl
 dnl Macros to convert from C to C++ types
 dnl
 
+dnl __HASH variable borrowed form glibmm's convert_base.m4 file
+define(`__HASH',`__`'translit(`$*',`ABCDEFGHIJKLMNOPQRSTUVWXYZ<>[]&*, ',`abcdefghijklmnopqrstuvwxyzVBNMRSC_')`'')
+
+dnl Macro to insert left quote
+define(`_LQ',`changequote(<,>)`dnl'
+changequote`'')
+
+dnl Macro to insert right quote
+define(`_RQ',`changequote(<,>)dnl`
+'changequote`'')
+
 dnl _CCONVERSION(ctype, param cpptype, return cpptype, cppinclude)
 dnl
 dnl Records a translation from a C type to a C++ type.  If a return cpptype is
@@ -10,13 +22,13 @@
 dnl include is specified, a C++ include directive may be generated with the
 dnl _CCONVERSION_INCLUDE macro.
 dnl
-m4_define(`_CCONVERSION',`dnl
-m4_define(`TFP'__HASH(`$1'),`$2')dnl
-m4_ifelse(`$3',,`dnl
-m4_define(`TFR'__HASH(`$1'),`$2')',`dnl
-m4_define(`TFR'__HASH(`$1'),`$3')dnl
+define(`_CCONVERSION',`dnl
+define(`TFP'__HASH(`$1'),`$2')dnl
+ifelse(`$3',,`dnl
+define(`TFR'__HASH(`$1'),`$2')',`dnl
+define(`TFR'__HASH(`$1'),`$3')dnl
 ')`'dnl
-m4_ifelse(`$4',,,`m4_define(`IF'__HASH(`$1'),`$4')')`'dnl
+ifelse(`$4',,,`define(`IF'__HASH(`$1'),`$4')')`'dnl
 ')dnl
 
 dnl _CCONVERSION_INCLUDE(ctype)
@@ -26,11 +38,12 @@
 dnl one directive will be generated for multiple calls (i.e. none but the first
 dnl call produces anything).
 dnl
-m4_define(`_CCONVERSION_INCLUDE',`dnl
-m4_ifdef(`IFC'__HASH(`$1'),,`dnl
-m4_ifdef(`IF'__HASH(`$1'),`dnl
-#include m4_indir(`IF'__HASH(`$1'))`'dnl
-m4_define(`IFC'__HASH(`$1'),`complete')dnl
+define(`_CCONVERSION_INCLUDE',`dnl
+ifdef(`IFC'__HASH(`$1'),,`dnl
+ifdef(`IF'__HASH(`$1'),`dnl
+#include indir(`IF'__HASH(`$1'))
+dnl
+define(`IFC'__HASH(`$1'),`complete')dnl
 ')`'dnl
 ')`'dnl
 ')dnl
@@ -41,15 +54,15 @@
 dnl `return' (boolean) parameter is included, the return C++ type is rendered.
 dnl If not (no second parameter), the C++ parameter type is rendered.
 dnl
-m4_define(`_CCONVERT',`dnl
-m4_ifelse(`$2',,`dnl
-m4_ifdef(`TFP'__HASH(`$1'), `m4_indir(`TFP'__HASH(`$1'))',`dnl
-m4_errprint(`No C++ parameter conversion from $1 defined.
+define(`_CCONVERT',`dnl
+ifelse(`$2',,`dnl
+ifdef(`TFP'__HASH(`$1'), `indir(`TFP'__HASH(`$1'))',`dnl
+errprint(`No C++ parameter conversion from $1 defined.
 ')`'dnl
-m4_m4exit(1)`'dnl
+m4exit(1)`'dnl
 ')',`dnl
-m4_ifdef(`TFR'__HASH(`$1'), `m4_indir(`TFR'__HASH(`$1'))',`dnl
-m4_errprint(`No C++ return conversion from $1 defined.
+ifdef(`TFR'__HASH(`$1'), `indir(`TFR'__HASH(`$1'))',`dnl
+errprint(`No C++ return conversion from $1 defined.
 ')`'dnl
 m4exit(1)`'dnl
 ')`'dnl
@@ -57,9 +70,10 @@
 ')dnl
 
 #Basic C to C++ translations
+_CCONVERSION(`void',`void')
 _CCONVERSION(`gboolean',`bool')
 _CCONVERSION(`gint',`int')
-_CCONVERSION(`guint',`unsigned')
+_CCONVERSION(`guint',`guint')
 _CCONVERSION(`gulong',`unsigned long')
 _CCONVERSION(`gint64',`gint64')
 _CCONVERSION(`guint64',`guint64')
@@ -67,3 +81,6 @@
 
 #String C to C++ translations
 _CCONVERSION(`gchararray',`const Glib::ustring&',`Glib::ustring')
+
+include(ctocpp.m4)
+divert(0)dnl



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