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



Author: jaalburqu
Date: Thu Apr 16 03:08:33 2009
New Revision: 2158
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2158&view=rev

Log:
2009-04-15  Josà Alburquerque  <jaalburqu svn gnome org>

	* tools/m4/convert_gst.m4:
	* gstreamer/src/index.hg: Placed property above signals and moved
	signal specific conversion to .hg file.

	* tools/extra_defs_gen/generate_plugin_gmmproc_file.cc: Added lines
	in signal generation to include m4 conversion macros for signal return
	types, in particular unwrapping macros for boxed types which should
	use gobj_copy() so that if the wrapper disappears, the unwrapped
	gobj_copy() is still valid.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/index.hg
   gstreamermm/trunk/tools/extra_defs_gen/generate_plugin_gmmproc_file.cc
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/gstreamer/src/index.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.hg	Thu Apr 16 03:08:33 2009
@@ -150,13 +150,14 @@
    */
   void set_resolver(const SlotResolver& slot);
 
+  _WRAP_PROPERTY("resolver", Gst::Index::SlotResolver)
+
 #m4 _CONVERSION(`GstIndexEntry*',`const Gst::IndexEntry&',`Glib::wrap($3, true)')
+#m4 _CONVERSION(`const Gst::IndexEntry&',`GstIndexEntry*',`const_cast<GstIndexEntry*>(($3).gobj())')
   /** Emitted when a new entry is added to the index.
    */
   _WRAP_SIGNAL(void entry_added(const Gst::IndexEntry& entry), "entry-added")
 
-  _WRAP_PROPERTY("resolver", Gst::Index::SlotResolver)
-
   _WRAP_VFUNC(bool get_writer_id(int& writer_id, const Glib::ustring& writer_string) const, "get_writer_id")
 
   _WRAP_VFUNC(void commit(gint id), "commit")

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	Thu Apr 16 03:08:33 2009
@@ -330,6 +330,51 @@
       Glib::ustring  returnCType = g_type_name(returnGType) +
         (Glib::ustring) (gst_type_is_a_pointer(returnGType) ?  "*" : "");
 
+      if (gst_type_is_a_pointer(returnGType))
+      {
+        if (g_type_is_a(returnGType, G_TYPE_BOXED))
+        // Boxed type returns for signals need special conversions because
+        // when unwrapping them, gobj_copy() should be used instead of just
+        // gobj() to guard against losing the original with a temporary
+        // wrapper.
+        {
+          // Unwrapping conversion:
+          convertMacros += "#m4 _CONVERSION(_LQ()_CCONVERT(" + returnCType +
+            ",`type')_RQ(), ``" + returnCType + "'', ";
+          convertMacros +=  "``($3).gobj_copy()'')\n";
+
+          // Also include a wrapping conversion:
+
+          if (returnGType == GST_TYPE_TAG_LIST)
+          // Dealing with a GstTagList* return which has a special Glib::wrap()
+          // because of the conflict with the Glib::wrap() for GstStructure*
+          // (GstTagList is infact a GstStructure).
+          {
+            convertMacros += "#m4 _CONVERSION(``" + returnCType +
+              "'', _LQ()_CCONVERT(" + returnCType + ",`return')_RQ(), ";
+            convertMacros +=  "``Glib::wrap($3, 0)'')\n";
+          }
+          else
+          // Dealing with a regular boxed type return.
+          {
+            convertMacros += "#m4 _CONVERSION(``" + returnCType +
+              "'', _LQ()_CCONVERT(" + returnCType + ",`return')_RQ(), ";
+            convertMacros +=  "``Glib::wrap($3)'')\n";
+          }
+        }
+        else
+        // Dealing with a RefPtr<> return so include a wrapping conversion
+        // just so these conversions can be automatic for plug-ins and not
+        // needed in the global convert file.  (An unwrapping conversion will
+        // already probably be included in the global convert file).
+        {
+          convertMacros += "#m4 _CONVERSION(``" + returnCType +
+            "'', _LQ()_CCONVERT(" + returnCType + ",`return')_RQ(), ";
+          convertMacros += g_type_is_a(returnGType, GST_TYPE_MINI_OBJECT) ?
+            "``Gst::wrap($3)'')\n" : "``Glib::wrap($3)'')\n";
+        }
+      }
+
       includeMacroCalls += "_CCONVERSION_INCLUDE(" + returnCType + ")dnl\n";
 
       wrapStatement = "  _WRAP_SIGNAL(_CCONVERT("  + returnCType +
@@ -358,18 +403,23 @@
 
           includeMacroCalls += "_CCONVERSION_INCLUDE(" + paramCType + ")dnl\n";
 
+          // Include wrapping conversions for signal parameters.  (Unwrapping
+          // conversions will already probably be defined in the global convert
+          // file):
+
           if (gst_type_is_a_pointer(paramGType))
           {
             if (paramGType == GST_TYPE_TAG_LIST)
-            // dealing with a GstTagList* which has a special Glib::wrap()
+            // Dealing with a GstTagList* which has a special Glib::wrap()
             // because of the conflict with the Glib::wrap() for GstStructure*
-            // (GstTagList is infact a GstStructure).
+            // (GstTagList is in fact a GstStructure).
             {
               convertMacros += "#m4 _CONVERSION(``" + paramCType +
                 "'', _LQ()_CCONVERT(" + paramCType + ",`param')_RQ(), ";
               convertMacros +=  "``Glib::wrap($3, 0, true)'')\n";
             }
             else
+            // Dealing with reference counted parameter or a boxed type.
             {
               convertMacros += "#m4 _CONVERSION(``" + paramCType +
                 "'', _LQ()_CCONVERT(" + paramCType + ",`param')_RQ(), ";

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Thu Apr 16 03:08:33 2009
@@ -92,9 +92,6 @@
 _CONVERSION(`const Glib::RefPtr<Gst::Index>&',`GstIndex*',`Glib::unwrap($3)')
 _CONVERSION(`Glib::RefPtr<Gst::Index>',`GstIndex*',`Glib::unwrap($3)')
 
-#IndexEntry
-_CONVERSION(`const Gst::IndexEntry&',`GstIndexEntry*',`const_cast<GstIndexEntry*>(($3).gobj())')
-
 #IndexFactory
 _CONVERSION(`GstIndexFactory*',`Glib::RefPtr<Gst::IndexFactory>',`Glib::wrap($3)')
 



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