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



Author: jaalburqu
Date: Tue Dec 23 05:06:04 2008
New Revision: 1912
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1912&view=rev

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

	* gstreamer/src/element.hg:
	* gstreamerbase/src/audioclock.hg: Moved gstreamerbasemm specific
	Doxygen group definitions to a gstreamerbasemm class. Added a group
	for gstreamerbasemm interfaces.
	* gstreamerbase/src/colorbalance.hg:
	* gstreamerbase/src/xoverlay.hg: Added existing interfaces to defined
	Doxyen interface group.

	* tools/m4/ctocpp.m4:
	* tools/m4/ctocpp_base.m4: Modified C to C++ translation macros to
	allow translations from the C to the C++ type.  Three types of
	translation are now possible: 1) type, 2) parameter and 3) return.
	The type translation is needed so that the classes of the plug-ins
	that implement interfaces can be extended with the C to C++ type
	translation.
	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Modified the
	plug-in generation tool to include code to extend classes that
	implement interfaces with the C++ type of the interface.  Also
	modified the tool to include an _IMPLEMENTS_INTERFACE macro call for
	each interface the plug-in implements.  The code is commented for now
	because the rest of the gstreamerbasemm interfaces have to be wrapped
	before the build is successful with the code uncommented.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/element.hg
   gstreamermm/trunk/gstreamerbase/src/audioclock.hg
   gstreamermm/trunk/gstreamerbase/src/colorbalance.hg
   gstreamermm/trunk/gstreamerbase/src/xoverlay.hg
   gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
   gstreamermm/trunk/tools/m4/ctocpp.m4
   gstreamermm/trunk/tools/m4/ctocpp_base.m4

Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/element.hg	Tue Dec 23 05:06:04 2008
@@ -37,18 +37,10 @@
  *  Wrapped GStreamer base classes (plug-ins derrive from these).
  */
 
-/** @defgroup GstBaseBaseClasses gstreamerbasemm Base Classes
- *  Wrapped gst-plugins-base base classes (plug-ins derrive from these).
- */
-
 /** @defgroup GstPlugins gstreamermm Plugins
  *  Wrapped GStreamer core plugins.
  */
 
-/** @defgroup GstBasePlugins gstreamerbasemm Plugins
- *  Wrapped gst-plugins-base plugins.
- */
-
 class Bus;
 class Caps;
 class Clock;

Modified: gstreamermm/trunk/gstreamerbase/src/audioclock.hg
==============================================================================
--- gstreamermm/trunk/gstreamerbase/src/audioclock.hg	(original)
+++ gstreamermm/trunk/gstreamerbase/src/audioclock.hg	Tue Dec 23 05:06:04 2008
@@ -26,6 +26,18 @@
 namespace GstBase
 {
 
+/** @defgroup GstBaseBaseClasses gstreamerbasemm Base Classes
+ *  Wrapped gst-plugins-base base classes (plug-ins derrive from these).
+ */
+
+/** @defgroup GstBasePlugins gstreamerbasemm Plugins
+ *  Wrapped gst-plugins-base plugins.
+ */
+
+/** @defgroup GstBaseInterfaces gstreamerbasemm Interfaces
+ *  Wrapped gst-plugins-base interfaces.
+ */
+
 /** GstBase::AudioClock â Helper object for implementing audio clocks.
  * GstBase::AudioClock makes it easy for elements to implement a Gst::Clock,
  * they simply need to provide a slot that returns the current clock time.

Modified: gstreamermm/trunk/gstreamerbase/src/colorbalance.hg
==============================================================================
--- gstreamermm/trunk/gstreamerbase/src/colorbalance.hg	(original)
+++ gstreamermm/trunk/gstreamerbase/src/colorbalance.hg	Tue Dec 23 05:06:04 2008
@@ -32,6 +32,7 @@
 class ColorBalanceChannel;
 
 /** GstBase::ColorBalance â Interface for adjusting color balance settings.
+ * @ingroup GstBaseInterfaces
  */
 class ColorBalance : public Glib::Interface
 {

Modified: gstreamermm/trunk/gstreamerbase/src/xoverlay.hg
==============================================================================
--- gstreamermm/trunk/gstreamerbase/src/xoverlay.hg	(original)
+++ gstreamermm/trunk/gstreamerbase/src/xoverlay.hg	Tue Dec 23 05:06:04 2008
@@ -96,6 +96,7 @@
  *   ...
  * }
  * @endcode
+ * @ingroup GstBaseInterfaces
  */
 class XOverlay : public Glib::Interface
 {

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	Tue Dec 23 05:06:04 2008
@@ -223,10 +223,12 @@
         if ((G_TYPE_IS_ENUM(propertyGType) || G_TYPE_IS_FLAGS(propertyGType)) &&
           !(enumIsWrapped = is_wrapped_enum(propertyCType)))
         {
+          Glib::ustring propertyCppType = propertyCType.substr(3);
+
           enumWrapStatements += "_WRAP_ENUM(" + propertyCType.substr(3) + ", " +
             propertyCType + ")\n";
           enumWrapStatements += "_CCONVERSION(`" + propertyCType + "',`" +
-            propertyCType.substr(3) + "')dnl\n";
+            propertyCppType + "',`" + propertyCppType + "')dnl\n";
 
           Glib::ustring enumGetTypeFunctionName =
             get_cast_macro(propertyCType).lowercase() + "_get_type";
@@ -239,7 +241,7 @@
         }
 
         wrapStatements += "  _WRAP_PROPERTY(\"" + propertyName + "\", " +
-          "_CCONVERT(" + propertyCType + ", true))\n";
+          "_CCONVERT(" + propertyCType + ", `ret'))\n";
 
         if (!G_TYPE_IS_ENUM(propertyGType) || enumIsWrapped)
           includeMacroCalls += "_CCONVERSION_INCLUDE(" + propertyCType + ")dnl\n";
@@ -310,7 +312,7 @@
       includeMacroCalls += "_CCONVERSION_INCLUDE(" + returnCType + ")dnl\n";
 
       wrapStatement = "  _WRAP_SIGNAL(_CCONVERT("  + returnCType +
-        ", true) " + signalMethodName + "(";
+        ", `ret') " + signalMethodName + "(";
 
       cClassSignalDeclarations += "  " + returnCType + " (*" +
         signalMethodName + ") (" + cTypeName + "* element";
@@ -338,12 +340,13 @@
           if (gst_type_is_a_pointer(paramGType))
           {
             convertMacros += "#m4 _CONVERSION(``" + paramCType +
-              "'', _LQ()_CCONVERT(" + paramCType + ")_RQ(), ";
+              "'', _LQ()_CCONVERT(" + paramCType + ",`param')_RQ(), ";
             convertMacros += g_type_is_a(paramGType, GST_TYPE_MINI_OBJECT) ?
               "``Gst::wrap($3, true)'')\n" : "``Glib::wrap($3, true)'')\n";
           }
 
-          wrapStatement += "_CCONVERT(" + paramCType + ") " + paramName;
+          wrapStatement += "_CCONVERT(" + paramCType + ", `param') " +
+            paramName;
 
           cClassSignalDeclarations += ", " + paramCType + " " + paramName;
 
@@ -367,8 +370,39 @@
     g_type_default_interface_unref(ginterface_ref); // for interface ref above.
 }
 
+void get_interface_macros(Glib::ustring& interfaceMacros,
+  Glib::ustring& includeMacroCalls,
+  Glib::ustring& cppExtends)
+{
+  guint n_interfaces = 0;
+  GType* interfaces = g_type_interfaces(type, &n_interfaces);
+
+  for (int i = 0; i < n_interfaces; i++)
+  {
+      Glib::ustring  interfaceCType = g_type_name(interfaces[i]) +
+        (Glib::ustring) "*";
+
+      cppExtends += "public _CCONVERT(`" + interfaceCType + "',`type')";
+
+      if (i < n_interfaces - 1)
+        cppExtends += ", ";
+
+      interfaceMacros += "  _IMPLEMENTS_INTERFACE(_CCONVERT(`" +
+              interfaceCType + "',`type'))\n";
+
+      //TODO: The following is to include the interface headers that the
+      //plug-in implements.  Uncomment after the rest of the interfaces have
+      //been wrapped.
+      //includeMacroCalls += "_CCONVERSION_INCLUDE(" + interfaceCType + ")dnl\n";
+  }
+
+  g_free(interfaces);
+}
+
 void generate_hg_file(const Glib::ustring& includeMacroCalls,
   const Glib::ustring& enumWrapStatements,
+  const Glib::ustring& cppExtends,
+  const Glib::ustring& interfaceMacros,
   const Glib::ustring& propertyWrapStatements,
   const Glib::ustring& signalWrapStatements)
 {
@@ -397,13 +431,25 @@
   std::cout << " * @ingroup " << nmspace << "Plugins" << std::endl;
   std::cout << " */" << std::endl;
   std::cout << "class " << cppTypeName << std::endl;
-  std::cout << ": public " << parentNameSpace << "::" << cppParentTypeName <<
-    std::endl;
+  std::cout << ": public " << parentNameSpace << "::" << cppParentTypeName;
+
+  //TODO: The following  is to have the plug-in class extend the interfaces
+  //that it implements.  Include after the rest of the interfaces have been
+  //wrapped.
+  //if (!cppExtends.empty())
+  //  std::cout << ", " << cppExtends;
+  
+  std::cout << std::endl;
+
   std::cout << "{" << std::endl;
   std::cout << "  _CLASS_GOBJECT(" << cppTypeName << ", " << cTypeName <<
     ", " << castMacro << ", " << parentNameSpace << "::" <<
-    cppParentTypeName << ", " << cParentTypeName << ")" << std::endl <<
-    std::endl;
+    cppParentTypeName << ", " << cParentTypeName << ")" << std::endl;
+
+  //TODO: The following is to include the _IMPLEMENT_INTERFACE() macros in the
+  //plug-in class definition.  Uncomment after the rest of the interfaces have
+  //been wrapped.
+  //std::cout << interfaceMacros << std::endl;
 
   std::cout << "protected:" << std::endl;
   std::cout << "  " << cppTypeName << "();" << std::endl;
@@ -628,8 +674,14 @@
 
       if (hgFile)
       {
-        generate_hg_file(includeMacroCalls, enumWrapStatements,
-          propertyWrapStatements, signalWrapStatements);
+        Glib::ustring interfaceMacros;
+        Glib::ustring cppExtends;
+
+        get_interface_macros(interfaceMacros, includeMacroCalls,
+          cppExtends);
+
+        generate_hg_file(includeMacroCalls, enumWrapStatements, cppExtends,
+          interfaceMacros, propertyWrapStatements, signalWrapStatements);
       }
       else
       {

Modified: gstreamermm/trunk/tools/m4/ctocpp.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/ctocpp.m4	(original)
+++ gstreamermm/trunk/tools/m4/ctocpp.m4	Tue Dec 23 05:06:04 2008
@@ -1,15 +1,19 @@
 #Enums
-_CCONVERSION(`GstFormat',`Gst::Format')
+_CCONVERSION(`GstFormat',`Gst::Format',`Gst::Format')
 
 #giomm
-_CCONVERSION(`GFile*',`const Glib::RefPtr<Gio::File>&',`Glib::RefPtr<Gio::File>',`<giomm/file.h>')
-_CCONVERSION(`GInputStream*',`const Glib::RefPtr<Gio::InputStream>&',`Glib::RefPtr<Gio::InputStream>',`<giomm/inputstream.h>')
-_CCONVERSION(`GOutputStream*',`const Glib::RefPtr<Gio::OutputStream>&',`Glib::RefPtr<Gio::OutputStream>',`<giomm/outputstream.h>')
+_CCONVERSION(`GFile*',`Gio::File',`const Glib::RefPtr<Gio::File>&',`Glib::RefPtr<Gio::File>',`<giomm/file.h>')
+_CCONVERSION(`GInputStream*',`Gio::InputStream',`const Glib::RefPtr<Gio::InputStream>&',`Glib::RefPtr<Gio::InputStream>',`<giomm/inputstream.h>')
+_CCONVERSION(`GOutputStream*',`Gio::OutputStream',`const Glib::RefPtr<Gio::OutputStream>&',`Glib::RefPtr<Gio::OutputStream>',`<giomm/outputstream.h>')
 
 #gstreamermm
-_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(`GstElement*',`const Glib::RefPtr<Gst::Element>&',`Glib::RefPtr<Gst::Element>',`<gstreamermm/element.h>')
-_CCONVERSION(`GstPad*',`const Glib::RefPtr<Gst::Pad>&',`Glib::RefPtr<Gst::Pad>',`<gstreamermm/pad.h>')
-_CCONVERSION(`GstTagList*',`Gst::TagList',,`<gstreamermm/taglist.h>')
+_CCONVERSION(`GstBuffer*',`Gst::Buffer',`const Glib::RefPtr<Gst::Buffer>&',`Glib::RefPtr<Gst::Buffer>',`<gstreamermm/buffer.h>')
+_CCONVERSION(`GstCaps*',`Gst::Caps',`const Glib::RefPtr<Gst::Caps>&',`Glib::RefPtr<Gst::Caps>',`<gstreamermm/caps.h>')
+_CCONVERSION(`GstElement*',`Gst::Element',`const Glib::RefPtr<Gst::Element>&',`Glib::RefPtr<Gst::Element>',`<gstreamermm/element.h>')
+_CCONVERSION(`GstPad*',`Gst::Pad',`const Glib::RefPtr<Gst::Pad>&',`Glib::RefPtr<Gst::Pad>',`<gstreamermm/pad.h>')
+_CCONVERSION(`GstTagList*',`Gst::TagList',`Gst::TagList',,`<gstreamermm/taglist.h>')
+
+#Interfaces
+_CCONVERSION(`GstImplementsInterface*',`Gst::Interface',`const Glib::RefPtr<Gst::Interface>&',`Glib::RefPtr<Gst::Interface>',`<gstreamermm/interface.h>')
+_CCONVERSION(`GstURIHandler*',`Gst::URIHandler',`const Glib::RefPtr<Gst::URIHandler>&',`Glib::RefPtr<Gst::URIHandler>',`<gstreamermm/urihandler.h>')
 

Modified: gstreamermm/trunk/tools/m4/ctocpp_base.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/ctocpp_base.m4	(original)
+++ gstreamermm/trunk/tools/m4/ctocpp_base.m4	Tue Dec 23 05:06:04 2008
@@ -14,7 +14,7 @@
 define(`_RQ',`changequote(<,>)dnl`
 'changequote`'')
 
-dnl _CCONVERSION(ctype, param cpptype, return cpptype, cppinclude)
+dnl _CCONVERSION(ctype, cpptype, param cpptype, return cpptype, cppinclude)
 dnl
 dnl Records a translation from a C type to a C++ type.  If a return cpptype is
 dnl not given, it is assumed to be the same as the param cpptype.  A cpp
@@ -23,12 +23,13 @@
 dnl _CCONVERSION_INCLUDE macro.
 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
+define(`TFT'__HASH(`$1'),`$2')dnl
+define(`TFP'__HASH(`$1'),`$3')dnl
+ifelse(`$4',,`dnl
+define(`TFR'__HASH(`$1'),`$3')',`dnl
+define(`TFR'__HASH(`$1'),`$4')dnl
 ')`'dnl
-ifelse(`$4',,,`define(`IF'__HASH(`$1'),`$4')')`'dnl
+ifelse(`$5',,,`define(`IF'__HASH(`$1'),`$5')')`'dnl
 ')dnl
 
 dnl _CCONVERSION_INCLUDE(ctype)
@@ -48,40 +49,52 @@
 ')`'dnl
 ')dnl
 
-dnl _CCONVERT(ctype, return)
+dnl _CCONVERT(ctype, conversion type)
 dnl
-dnl Translates from a specified C type to a C++ param or return type.  If a
-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 Translates from a specified C type to a C++ type, param or return type.
+dnl `conversion type' may be:
+dnl `type' - For a C to C++ type translation.
+dnl `param' - For a C to C++ parameter translation.
+dnl `ret' - For a C to C++ return translation.
 dnl
 define(`_CCONVERT',`dnl
-ifelse(`$2',,`dnl
+ifelse(dnl
+`$2',`type',`dnl
+ifdef(`TFT'__HASH(`$1'), `indir(`TFT'__HASH(`$1'))',`dnl
+errprint(`No C++ type conversion from $1 defined.
+')`'dnl
+m4exit(1)`'dnl
+')',dnl
+`$2',`param',`dnl
 ifdef(`TFP'__HASH(`$1'), `indir(`TFP'__HASH(`$1'))',`dnl
 errprint(`No C++ parameter conversion from $1 defined.
 ')`'dnl
 m4exit(1)`'dnl
-')',`dnl
+')',dnl
+`$2',`ret',`dnl
 ifdef(`TFR'__HASH(`$1'), `indir(`TFR'__HASH(`$1'))',`dnl
+ifdef(`TFP'__HASH(`$1'), `indir(`TFP'__HASH(`$1'))',`dnl
 errprint(`No C++ return conversion from $1 defined.
 ')`'dnl
 m4exit(1)`'dnl
 ')`'dnl
 ')`'dnl
+')`'dnl
 ')dnl
 
 #Basic C to C++ translations
-_CCONVERSION(`void',`void')
-_CCONVERSION(`gboolean',`bool')
-_CCONVERSION(`gint',`int')
-_CCONVERSION(`guint',`guint')
-_CCONVERSION(`gulong',`unsigned long')
-_CCONVERSION(`gint64',`gint64')
-_CCONVERSION(`guint64',`guint64')
-_CCONVERSION(`gfloat',`float')
-_CCONVERSION(`gdouble',`double')
+_CCONVERSION(`void',`void',`void')
+_CCONVERSION(`gboolean',`bool',`bool')
+_CCONVERSION(`gint',`int',`int')
+_CCONVERSION(`guint',`guint',`guint')
+_CCONVERSION(`gulong',`unsigned long',`unsigned long')
+_CCONVERSION(`gint64',`gint64',`gint64')
+_CCONVERSION(`guint64',`guint64',`guint64')
+_CCONVERSION(`gfloat',`float',`float')
+_CCONVERSION(`gdouble',`double',`double')
 
 #String C to C++ translations
-_CCONVERSION(`gchararray',`const Glib::ustring&',`Glib::ustring')
+_CCONVERSION(`gchararray',`Glib::ustring',`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]