gnomemm r2150 - in gstreamermm/trunk: . gstreamer/gstreamermm gstreamer/src



Author: jaalburqu
Date: Fri Apr 10 04:18:50 2009
New Revision: 2150
URL: http://svn.gnome.org/viewvc/gnomemm?rev=2150&view=rev

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

	* gstreamer/src/mixer.ccg:
	* gstreamer/src/mixer.hg:
	* gstreamer/src/gst_vfuncs.defs: Wrapped Gst::Mixer vfuncs.

	* gstreamer/src/navigation.ccg:
	* gstreamer/src/navigation.hg: Wrapped Gst::Navigation vfuncs.

	* gstreamer/gstreamermm/miniobject.h: Removed erroneous TODO (was
	thinking of signals and dealing with vfuncs).

Modified:
   gstreamermm/trunk/ChangeLog
   gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h
   gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs
   gstreamermm/trunk/gstreamer/src/mixer.ccg
   gstreamermm/trunk/gstreamer/src/mixer.hg
   gstreamermm/trunk/gstreamer/src/navigation.ccg
   gstreamermm/trunk/gstreamer/src/navigation.hg

Modified: gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h	(original)
+++ gstreamermm/trunk/gstreamer/gstreamermm/miniobject.h	Fri Apr 10 04:18:50 2009
@@ -145,11 +145,6 @@
 
 protected:
   GstMiniObject* gobject_; //TODO: Doesn't this shadow a member variable in Glib::ObjectBase?
-
-// TODO: Virtual functions copy_vfunc() and finalize_vfunc() are not easily
-// wrapped because their class member types (GstMiniObjectCopyFunction and
-// GstMiniObjectFinalizeFunction) don't include a gpointer parameter that
-// callbacks can use.
 };
 
 } // namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs
==============================================================================
--- gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs	(original)
+++ gstreamermm/trunk/gstreamer/src/gst_vfuncs.defs	Fri Apr 10 04:18:50 2009
@@ -745,6 +745,11 @@
   )
 )
 
+(define-vfunc get_mixer_flags
+  (of-object "GstMixer")
+  (return-type "GstMixerFlags")
+)
+
 ; GstNavigation
 
 (define-vfunc send_event

Modified: gstreamermm/trunk/gstreamer/src/mixer.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/mixer.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/mixer.ccg	Fri Apr 10 04:18:50 2009
@@ -17,8 +17,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
- #include <gst/interfaces/mixer.h>
- #include <gstreamermm/mixeroptions.h>
+#include <gstreamermm/mixeroptions.h>
 
 namespace Gst
 {
@@ -101,6 +100,63 @@
   typedef Glib::ArrayHandle<int> RType;
   return RType(0, 0, Glib::OWNERSHIP_DEEP);
 }
+const GList* Mixer_Class::list_tracks_vfunc_callback(GstMixer* self)
+{
+  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
+        // Call the virtual member method, which derived classes might override.
+        return (obj->list_tracks_vfunc()).data();
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+    }
+  }
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
+)  );
+
+  // Call the original underlying C function:
+  if(base && base->list_tracks)
+    return (*base->list_tracks)(self);
+
+
+  typedef const GList* RType;
+  return RType();
+}
+Glib::ListHandle< Glib::RefPtr<Gst::MixerTrack> > Gst::Mixer::list_tracks_vfunc() const
+{
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
+)  );
+
+  if(base && base->list_tracks)
+    return Glib::ListHandle< Glib::RefPtr<Gst::MixerTrack> >(const_cast<GList*>((*base->list_tracks)(const_cast<GstMixer*>(gobj()))), Glib::OWNERSHIP_NONE);
+
+  typedef Glib::ListHandle< Glib::RefPtr<Gst::MixerTrack> > RType;
+  return RType(0, Glib::OWNERSHIP_NONE);
+}
 #endif //GLIBMM_VFUNCS_ENABLED
 
 } // namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/mixer.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/mixer.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/mixer.hg	Fri Apr 10 04:18:50 2009
@@ -17,6 +17,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <gst/interfaces/mixer.h>
 #include <gst/interfaces/mixeroptions.h>
 #include <gstreamermm/mixertrack.h>
 #include <glibmm/interface.h>
@@ -80,21 +81,15 @@
   _WRAP_METHOD(static void message_parse_options_list_changed(GstMessage *message, GstMixerOptions **options), gst_mixer_message_parse_options_list_changed)
   */
 
-//TODO:
-//#m4 _CONVERSION(`Glib::ListHandle< Glib::RefPtr<Gst::MixerTrack> >', `const GList*', `($3).data()')
-  //_WRAP_VFUNC(Glib::ListHandle< Glib::RefPtr<Gst::MixerTrack> > list_tracks() const, "list_tracks")
-
 #ifdef GLIBMM_VFUNCS_ENABLED
-  // This vfunc is handcoded because we want to have it return the result
-  // instead of requiring a pointer parameter in which to put it like the C API
-  // does.
   virtual Glib::ArrayHandle<int> get_volume_vfunc(const Glib::RefPtr<const Gst::MixerTrack>& track) const;
+  virtual Glib::ListHandle< Glib::RefPtr<Gst::MixerTrack> > list_tracks_vfunc() const;
 #endif //GLIBMM_VFUNCS_ENABLED
 
 #m4 _CONVERSION(`GstMixerTrack*',`const Glib::RefPtr<Gst::MixerTrack>&', `Glib::wrap(($3), true)')
 
-//TODO:
-  //_WRAP_VFUNC(void set_volume(const Glib::RefPtr<Gst::MixerTrack>& track, const Glib::ArrayHandle<int>& volumes), "set_volume")
+#m4 _CONVERSION(`gint*', `const Glib::ArrayHandle<int>&', `Glib::ArrayHandle<int>(($3), Glib::OWNERSHIP_NONE)')
+  _WRAP_VFUNC(void set_volume(const Glib::RefPtr<Gst::MixerTrack>& track, const Glib::ArrayHandle<int>& volumes), "set_volume")
 
   _WRAP_VFUNC(void set_mute(const Glib::RefPtr<Gst::MixerTrack>& track, bool mute), "set_mute")
   _WRAP_VFUNC(void set_record(const Glib::RefPtr<Gst::MixerTrack>& track, bool record), "set_record")
@@ -102,17 +97,20 @@
 #m4 _CONVERSION(`GstMixerOptions*',`const Glib::RefPtr<Gst::MixerOptions>&', `Glib::wrap(($3), true)')
   _WRAP_VFUNC(void set_option(const Glib::RefPtr<Gst::MixerOptions>& opts, const Glib::ustring& value), "set_option")
 
-  //TODO:
-  //_WRAP_VFUNC(Glib::ustring get_option(const Glib::RefPtr<const Gst::MixerOptions>& opts) const, "get_option")
+#m4 _CONVERSION(`Glib::ustring', `const gchar*', `($3).c_str()')
+#m4 _CONVERSION(`GstMixerOptions*',`const Glib::RefPtr<const Gst::MixerOptions>&', `Glib::wrap(($3), true)')
+  _WRAP_VFUNC(Glib::ustring get_option(const Glib::RefPtr<const Gst::MixerOptions>& opts) const, "get_option")
+
+  _WRAP_VFUNC(Gst::MixerFlags get_mixer_flags() const, "get_mixer_flags")
 
 protected:
 #m4begin
-dnl// This vfunc callback is handcoded because we want to have the C++ vfunc
-dnl// return the result instead of passing in a pointer in which to store it.
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
   klass->get_volume = &get_volume_vfunc_callback;
+  klass->list_tracks = &list_tracks_vfunc_callback;
   _SECTION(SECTION_PH_VFUNCS)
   static void get_volume_vfunc_callback(GstMixer* self, GstMixerTrack* track, gint* volumes);
+  static const GList* list_tracks_vfunc_callback(GstMixer* self);
   _POP()
 #m4end
 };

Modified: gstreamermm/trunk/gstreamer/src/navigation.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/navigation.ccg	(original)
+++ gstreamermm/trunk/gstreamer/src/navigation.ccg	Fri Apr 10 04:18:50 2009
@@ -17,4 +17,65 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
- #include <gstreamermm/structure.h>
+#include <gstreamermm/structure.h>
+
+namespace Gst
+{
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+void Navigation_Class::send_event_vfunc_callback(GstNavigation* self, GstStructure* structure)
+{
+  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
+        // Call the virtual member method, which derived classes might override.
+        Gst::Structure wrapped_structure(structure);
+        obj->send_event_vfunc(wrapped_structure);
+        return;
+      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+      }
+      catch(...)
+      {
+        Glib::exception_handlers_invoke();
+      }
+      #endif //GLIBMM_EXCEPTIONS_ENABLED
+    }
+  }
+  
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
+)  );
+
+  // Call the original underlying C function:
+  if(base && base->send_event)
+    (*base->send_event)(self, structure);
+
+}
+void Gst::Navigation::send_event_vfunc(Gst::Structure& structure) 
+{
+  BaseClassType *const base = static_cast<BaseClassType*>(
+      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
+)  );
+
+  if(base && base->send_event)
+    (*base->send_event)(gobj(),(structure).gobj());
+}
+#endif //GLIBMM_VFUNCS_ENABLED
+
+} // namespace Gst

Modified: gstreamermm/trunk/gstreamer/src/navigation.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/navigation.hg	(original)
+++ gstreamermm/trunk/gstreamer/src/navigation.hg	Fri Apr 10 04:18:50 2009
@@ -40,11 +40,18 @@
   _WRAP_METHOD(void send_key_event(const Glib::ustring& event, const Glib::ustring& key), gst_navigation_send_key_event)
   _WRAP_METHOD(void send_mouse_event(const Glib::ustring& event, int button, double x, double y), gst_navigation_send_mouse_event)
 
-//TODO:
-//#m4 _CONVERSION(`GstStructure*', `Gst::Structure&', `Glib::wrap(($3), true)')
-  ///** Called when an event has been sent to the Gst::Navigation.
-   //*/
-  //_WRAP_VFUNC(void send_event(Gst::Structure& structure), "send_event")
+#ifdef GLIBMM_VFUNCS_ENABLED
+  virtual void send_event_vfunc(Gst::Structure& structure);
+#endif //GLIBMM_VFUNCS_ENABLED
+
+protected:
+#m4begin
+  _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+  klass->send_event = &send_event_vfunc_callback;
+  _SECTION(SECTION_PH_VFUNCS)
+  static void send_event_vfunc_callback(GstNavigation* self, GstStructure* structure);
+  _POP()
+#m4end
 };
 
 } // namespace Gst



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