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



Author: jaalburqu
Date: Tue Mar  3 22:14:09 2009
New Revision: 2078
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2078&view=rev

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

	* gstreamer/src/index.ccg:
	* gstreamer/src/index.hg:
	* gstreamer/src/gst_vfuncs.defs: Wrapped GstIndex vfuncs (except for
	one strange one that has a "user_data" parameter -- see the TODO in
	the .hg file).
	* tools/m4/convert_gst.m4: Fixed Gst::IndexEntry conversion.

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs
   gstreamermm/trunk/gstreamer/src/index.ccg
   gstreamermm/trunk/gstreamer/src/index.hg
   gstreamermm/trunk/tools/m4/convert_gst.m4

Modified: gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs
==============================================================================
--- gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs	(original)
+++ gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs	Tue Mar  3 22:14:09 2009
@@ -208,6 +208,47 @@
   )
 )
 
+; GstIndex
+
+(define-vfunc get_writer_id
+  (of-object "GstIndex")
+  (return-type "gboolean")
+  (parameters
+   '("gint*" "writer_id")
+   '("gchar*" "writer_string")
+  )
+)
+
+(define-vfunc commit
+  (of-object "GstIndex")
+  (return-type "void")
+  (parameters
+   '("gint" "id")
+  )
+)
+
+(define-vfunc add_entry
+  (of-object "GstIndex")
+  (return-type "void")
+  (parameters
+   '("GstIndexEntry*" "entry")
+  )
+)
+
+(define-vfunc get_assoc_entry
+  (of-object "GstIndex")
+  (return-type "GstIndexEntry*")
+  (parameters
+   '("guint" "id")
+   '("GstIndexLookupMethod" "method")
+   '("GstAssocFlags" "flags")
+   '("GstFormat" "format")
+   '("gint64" "value")
+   '("GCompareDataFunc" "func")
+   '("gpointer" "user_data")
+  )
+)
+
 ; GstBaseSrc
 
 (define-vfunc get_caps

Modified: gstreamermm/trunk/gstreamer/src/index.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.ccg	Tue Mar  3 22:14:09 2009
@@ -106,4 +106,58 @@
   gst_index_set_resolver_full(gobj(), &Index_Resolver_gstreamermm_callback, slot_copy, &Index_Resolver_gstreamermm_callback_destroy);
 }
 
+#ifdef GLIBMM_VFUNCS_ENABLED
+void Index_Class::add_entry_vfunc_callback(GstIndex* self, GstIndexEntry* entry)
+{
+  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
+
+  // Non-gtkmmproc-generated custom classes implicitly call the default
+  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+  // generated classes can use this optimisation, which avoids the unnecessary
+  // parameter conversions if there is no possibility of the virtual function
+  // being overridden:
+  if(obj_base && obj_base->is_derived_())
+  {
+    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    if(obj) // This can be NULL during destruction.
+    {
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      try // Trap C++ exceptions which would normally be lost because this is a C callback.
+      {
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+        Gst::IndexEntry wrappedEntry(entry, true);
+        // Call the virtual member method, which derived classes might override.
+        obj->add_entry_vfunc(wrappedEntry);
+        return;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+    }
+  }
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
+  );
+
+  // Call the original underlying C function:
+  if(base && base->add_entry)
+    (*base->add_entry)(self, entry);
+
+}
+void Gst::Index::add_entry_vfunc(Gst::IndexEntry& entry) 
+{
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
+  );
+
+  if(base && base->add_entry)
+    (*base->add_entry)(gobj(),(entry).gobj_copy()); // use gobj_copy() so the copy is permanent to the GstIndex.
+}
+#endif //GLIBMM_VFUNCS_ENABLED
+
 } //namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/index.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/index.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/index.hg	Tue Mar  3 22:14:09 2009
@@ -126,6 +126,27 @@
   _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")
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+  virtual void add_entry_vfunc(Gst::IndexEntry& entry);
+#endif //GLIBMM_VFUNCS_ENABLED
+
+  //TODO: This vfunc is strange because the prototype in the class structure
+  //includes a "gpointer user_data" parameter.  Is this a bug?
+  //_WRAP_VFUNC(void get_assoc_entry(Gst::LookupMethod method, Gst::AssocFlags flags, Gst::Format format, gint64 value, const SlotCompareData& compare_slot), "get_assoc_entry")
+
+protected:
+#m4begin
+  _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+    klass->add_entry = &add_entry_vfunc_callback;
+  _SECTION(SECTION_PH_VFUNCS)
+  static void add_entry_vfunc_callback(GstIndex* self, GstIndexEntry* entry);
+  _POP()
+#m4end
 };
 
 } //namespace Gst

Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4	(original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4	Tue Mar  3 22:14:09 2009
@@ -89,11 +89,13 @@
 #Index
 _CONVERSION(`GstIndex*',`Glib::RefPtr<Gst::Index>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<Gst::Index>&',`GstIndex*',`Glib::unwrap($3)')
-_CONVERSION(`const Gst::IndexAssociation&',`const GstIndexAssociation*',`((GstIndexAssociation*)(&($3)))')
 _CONVERSION(`Glib::RefPtr<Gst::Index>',`GstIndex*',`Glib::unwrap($3)')
 
+#IndexAssociation
+_CONVERSION(`const Gst::IndexAssociation&',`const GstIndexAssociation*',`((GstIndexAssociation*)(&($3)))')
+
 #IndexEntry
-_CONVERSION(`GstIndexEntry*',`Gst::IndexEntry',`Glib::wrap($3)')
+_CONVERSION(`GstIndexEntry*',`Gst::IndexEntry',`Glib::wrap($3, true)')
 _CONVERSION(`const Gst::IndexEntry&',`GstIndexEntry*',`const_cast<GstIndexEntry*>(($3).gobj())')
 
 #IndexFactory



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