[gstreamermm] BaseTransform: Revisit the virtual functions.



commit cb8e80e5cadcac49f4d4c1e0f03f612726de2dc4
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Apr 26 17:12:52 2011 -0400

    BaseTransform: Revisit the virtual functions.
    
    	* gstreamer/src/basetransform.ccg:
    	* gstreamer/src/basetransform.hg: Review the wrapping of the virtual
    	functions because the ogg_player_gtkmm example was failing to execute
    	properly.
    
    	* configure.ac: Tiny correction of the plug-in name extraction in the
    	plug-in processing section.

 ChangeLog                       |   12 ++
 configure.ac                    |    2 +-
 gstreamer/src/basetransform.ccg |  366 +++------------------------------------
 gstreamer/src/basetransform.hg  |   47 +++---
 4 files changed, 56 insertions(+), 371 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a491092..b0fe158 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-04-26  José Alburquerque  <jaalburqu svn gnome org>
+
+	BaseTransform: Revisit the virtual functions.
+
+	* gstreamer/src/basetransform.ccg:
+	* gstreamer/src/basetransform.hg: Review the wrapping of the virtual
+	functions because the ogg_player_gtkmm example was failing to execute
+	properly.
+
+	* configure.ac: Tiny correction of the plug-in name extraction in the
+	plug-in processing section.
+
 2011-04-24  José Alburquerque  <jaalburqu svn gnome org>
 
 	Use the latest mm-common.
diff --git a/configure.ac b/configure.ac
index 7b9431e..8751a5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,7 +169,7 @@ AS_IF([test "x$USE_MAINTAINER_MODE" != xno],
   do
     # Extract plugin name and run gst-inspect to check whether the plugin
     # is installed on the build system.
-    gstmm_plugin_name=`[expr "X$gstmm_plugin_def" : 'X[a-z][a-z0-9]\+|\([^|]*\)' 2>&]AS_MESSAGE_LOG_FD`
+    gstmm_plugin_name=`[expr "X$gstmm_plugin_def" : 'X.*|\([^|]*\)|.*$' 2>&]AS_MESSAGE_LOG_FD`
     AS_IF([$GST_INSPECT "$gstmm_plugin_name" >/dev/null 2>&AS_MESSAGE_LOG_FD],,
           [AC_MSG_FAILURE([[The gstreamer plug-in '$gstmm_plugin_name' does not exist.
 If you built gst-plugins-base from source code then you might need to
diff --git a/gstreamer/src/basetransform.ccg b/gstreamer/src/basetransform.ccg
index be21fc3..5cb7b26 100644
--- a/gstreamer/src/basetransform.ccg
+++ b/gstreamer/src/basetransform.ccg
@@ -39,233 +39,6 @@ void BaseTransform::unlock()
   GST_BASE_TRANSFORM_UNLOCK(gobj());
 }
 
-GstFlowReturn BaseTransform_Class::prepare_output_buffer_vfunc_callback(GstBaseTransform* self, GstBuffer* input, gint size, GstCaps* caps, GstBuffer** buffer)
-{
-  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.
-    {
-      try // Trap C++ exceptions which would normally be lost because this is a C callback.
-      {
-        Glib::RefPtr<Gst::Buffer> cpp_buffer;
-        // Call the virtual member method, which derived classes might override.
-        const GstFlowReturn result =
-          static_cast<GstFlowReturn>(obj->prepare_output_buffer_vfunc(
-          Gst::wrap(input, true), size , Glib::wrap(caps, true), cpp_buffer));
-        *buffer = cpp_buffer->gobj_copy();
-        return result;
-      }
-      catch(...)
-      {
-        Glib::exception_handlers_invoke();
-      }
-    }
-  }
-  
-  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->prepare_output_buffer)
-    return (*base->prepare_output_buffer)(self, input, size, caps, buffer);
-
-
-  typedef GstFlowReturn RType;
-  return RType();
-}
-FlowReturn Gst::BaseTransform::prepare_output_buffer_vfunc(const Glib::RefPtr<Gst::Buffer>& input, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buffer)
-{
-  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->prepare_output_buffer)
-  {
-    GstBuffer* gst_buffer;
-    const Gst::FlowReturn result =
-      static_cast<Gst::FlowReturn>((*base->prepare_output_buffer)(gobj(),
-      Glib::unwrap(input), size, Glib::unwrap(caps), &gst_buffer));
-    buffer = Gst::wrap(gst_buffer, false); // Don't take copy because callback returns a newly created copy.
-    return result;
-  }
-
-  typedef FlowReturn RType;
-  return RType();
-}
-gboolean BaseTransform_Class::transform_size_vfunc_callback(GstBaseTransform* self, GstPadDirection direction, GstCaps* caps, guint size, GstCaps* othercaps, guint* othersize)
-{
-  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 static_cast<int>(obj->transform_size_vfunc(((PadDirection)(direction))
-, Glib::wrap(caps, true)
-, size, Glib::wrap(othercaps, true)
-, *othersize
-));
-      #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->transform_size)
-    return (*base->transform_size)(self, direction, caps, size, othercaps, othersize);
-
-  return true;
-}
-bool Gst::BaseTransform::transform_size_vfunc(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, guint size, const Glib::RefPtr<Gst::Caps>& othercaps, guint& othersize) 
-{
-  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->transform_size)
-    return (*base->transform_size)(gobj(),((GstPadDirection)(direction)),Glib::unwrap(caps),size,Glib::unwrap(othercaps),&(othersize));
-
-  return true;
-}
-gboolean BaseTransform_Class::get_unit_size_vfunc_callback(GstBaseTransform* self, GstCaps* caps, guint* size)
-{
-  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 static_cast<int>(obj->get_unit_size_vfunc(Glib::wrap(caps, true)
-, *size
-));
-      #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->get_unit_size)
-    return (*base->get_unit_size)(self, caps, size);
-
-  return true;
-}
-bool Gst::BaseTransform::get_unit_size_vfunc(const Glib::RefPtr<Gst::Caps>& caps, guint& size) const
-{
-  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->get_unit_size)
-    return (*base->get_unit_size)(const_cast<GstBaseTransform*>(gobj()),Glib::unwrap(caps),&(size));
-
-  return true;
-}
-gboolean BaseTransform_Class::set_caps_vfunc_callback(GstBaseTransform* self, GstCaps* incaps, GstCaps* outcaps)
-{
-  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 static_cast<int>(obj->set_caps_vfunc(Glib::wrap(incaps, true)
-, Glib::wrap(outcaps, true)
-));
-      #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->set_caps)
-    return (*base->set_caps)(self, incaps, outcaps);
-
-  return true;
-}
-bool Gst::BaseTransform::set_caps_vfunc(const Glib::RefPtr<Gst::Caps>& incaps, const Glib::RefPtr<Gst::Caps>& outcaps) 
-{
-  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->set_caps)
-    return (*base->set_caps)(gobj(),Glib::unwrap(incaps),Glib::unwrap(outcaps));
-
-  return true;
-}
 gboolean BaseTransform_Class::start_vfunc_callback(GstBaseTransform* self)
 {
   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
@@ -370,7 +143,7 @@ bool Gst::BaseTransform::stop_vfunc()
 
   return true;
 }
-gboolean BaseTransform_Class::event_vfunc_callback(GstBaseTransform* self, GstEvent* event)
+GstFlowReturn BaseTransform_Class::prepare_output_buffer_vfunc_callback(GstBaseTransform* self, GstBuffer* input, gint size, GstCaps* caps, GstBuffer** buffer)
 {
   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
@@ -385,20 +158,20 @@ gboolean BaseTransform_Class::event_vfunc_callback(GstBaseTransform* self, GstEv
     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
+        Glib::RefPtr<Gst::Buffer> cpp_buffer;
         // Call the virtual member method, which derived classes might override.
-        return static_cast<int>(obj->event_vfunc(Gst::wrap(event, true)
-));
-      #ifdef GLIBMM_EXCEPTIONS_ENABLED
+        const GstFlowReturn result =
+          static_cast<GstFlowReturn>(obj->prepare_output_buffer_vfunc(
+          Gst::wrap(input, true), size , Glib::wrap(caps, true), cpp_buffer));
+        *buffer = cpp_buffer->gobj_copy();
+        return result;
       }
       catch(...)
       {
         Glib::exception_handlers_invoke();
       }
-      #endif //GLIBMM_EXCEPTIONS_ENABLED
     }
   }
   
@@ -407,128 +180,31 @@ gboolean BaseTransform_Class::event_vfunc_callback(GstBaseTransform* self, GstEv
   );
 
   // Call the original underlying C function:
-  if(base && base->event)
-    return (*base->event)(self, event);
-
-  return true;
-}
-bool Gst::BaseTransform::event_vfunc(const Glib::RefPtr<Gst::Event>& event) 
-{
-  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->event)
-    return (*base->event)(gobj(),Gst::unwrap(event));
-
-  return true;
-}
-gboolean BaseTransform_Class::src_event_vfunc_callback(GstBaseTransform* self, GstEvent* event)
-{
-  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 static_cast<int>(obj->src_event_vfunc(Gst::wrap(event, true)
-));
-      #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).
-  );
+  if(base && base->prepare_output_buffer)
+    return (*base->prepare_output_buffer)(self, input, size, caps, buffer);
 
-  // Call the original underlying C function:
-  if(base && base->src_event)
-    return (*base->src_event)(self, event);
 
-  return true;
+  typedef GstFlowReturn RType;
+  return RType();
 }
-bool Gst::BaseTransform::src_event_vfunc(const Glib::RefPtr<Gst::Event>& event) 
+FlowReturn Gst::BaseTransform::prepare_output_buffer_vfunc(const Glib::RefPtr<Gst::Buffer>& input, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buffer)
 {
   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->src_event)
-    return (*base->src_event)(gobj(),Gst::unwrap(event));
-
-  return true;
-}
-gboolean BaseTransform_Class::accept_caps_vfunc_callback(GstBaseTransform* self, GstPadDirection direction, GstCaps* caps)
-{
-  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_())
+  if(base && base->prepare_output_buffer)
   {
-    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 static_cast<int>(obj->accept_caps_vfunc(((PadDirection)(direction))
-, Glib::wrap(caps, true)
-));
-      #ifdef GLIBMM_EXCEPTIONS_ENABLED
-      }
-      catch(...)
-      {
-        Glib::exception_handlers_invoke();
-      }
-      #endif //GLIBMM_EXCEPTIONS_ENABLED
-    }
+    GstBuffer* gst_buffer;
+    const Gst::FlowReturn result =
+      static_cast<Gst::FlowReturn>((*base->prepare_output_buffer)(gobj(),
+      Glib::unwrap(input), size, Glib::unwrap(caps), &gst_buffer));
+    buffer = Gst::wrap(gst_buffer, false); // Don't take copy because callback returns a newly created copy.
+    return result;
   }
-  
-  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->accept_caps)
-    return (*base->accept_caps)(self, direction, caps);
 
-  return true;
-}
-bool Gst::BaseTransform::accept_caps_vfunc(PadDirection direction, const Glib::RefPtr<const Gst::Caps>& caps) 
-{
-  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->accept_caps)
-    return (*base->accept_caps)(gobj(),((GstPadDirection)(direction)),const_cast<GstCaps*>(Glib::unwrap(caps)));
-
-  return true;
+  typedef FlowReturn RType;
+  return RType();
 }
 
 } //namespace Gst
diff --git a/gstreamer/src/basetransform.hg b/gstreamer/src/basetransform.hg
index ffc323e..e83c6c8 100644
--- a/gstreamer/src/basetransform.hg
+++ b/gstreamer/src/basetransform.hg
@@ -181,38 +181,46 @@ public:
    */
   _WRAP_VFUNC(void fixate_caps(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, const Glib::RefPtr<Gst::Caps>& othercaps), "fixate_caps")
 
-  /** Optional. Given the size of a buffer in the given direction with the
-   * given caps, calculate the size in bytes of a buffer on the other pad with
-   * the given other caps. The default implementation uses
-   * get_unit_size_vfunc() and keeps the number of units the same.
-   */
-  virtual bool transform_size_vfunc(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, guint size, const Glib::RefPtr<Gst::Caps>& othercaps, guint& othersize); 
+  //TODO: This virtual function can't be wrapped without causing execution
+  //errors with the ogg_player_gtkmm example.
+  ///** Optional. Given the size of a buffer in the given direction with the
+   //* given caps, calculate the size in bytes of a buffer on the other pad with
+   //* the given other caps. The default implementation uses
+   //* get_unit_size_vfunc() and keeps the number of units the same.
+   //*/
+  //_WRAP_VFUNC(bool transform_size(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, guint size, const Glib::RefPtr<Gst::Caps>& othercaps, guint& othersize), "transform_size")
 
   /** Required if the transform is not in-place. Get the size in bytes of one
    * unit for the given caps.
    */
-  virtual bool get_unit_size_vfunc(const Glib::RefPtr<Gst::Caps>& caps, guint& size) const;
+  _WRAP_VFUNC(bool get_unit_size(const Glib::RefPtr<Gst::Caps>& caps, guint& size) const, "get_unit_size")
 
   /** Allows the subclass to be notified of the actual caps set.
    */
-  virtual bool set_caps_vfunc(const Glib::RefPtr<Gst::Caps>& incaps, const Glib::RefPtr<Gst::Caps>& outcaps);
+  _WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Gst::Caps>& incaps, const Glib::RefPtr<Gst::Caps>& outcaps), "set_caps")
 
+  //TODO: Handwrapped because default return should be true otherwise the
+  //ogg_player_gtkmm example fails to run successfully.
   /** Optional. Called when the element starts processing. Allows opening
    * external resources.
    */
   virtual bool start_vfunc();
 
+  //TODO: Handwrapped because default return should be true otherwise the
+  //ogg_player_gtkmm example fails to run successfully.
   /** Optional. Called when the element stops processing. Allows closing
    * external resources.
    */
   virtual bool stop_vfunc();
 
+#m4 _CONVERSION(`GstEvent*', `const Glib::RefPtr<Gst::Event>&', `Gst::wrap($3, true)')
   /* Optional. Event handler on the sink pad. This function should return
    * <tt>true</tt> if the base class should forward the event.
    */
-  virtual bool event_vfunc(const Glib::RefPtr<Gst::Event>& event);
+  _WRAP_VFUNC(bool event(const Glib::RefPtr<Gst::Event>& event), "event")
 
 #m4 _CONVERSION(`GstBuffer*', `const Glib::RefPtr<Gst::Buffer>&', `Gst::wrap($3, true)')
+
   /** Required if the element does not operate in-place. Transforms one
    * incoming buffer to one outgoing buffer. The function is allowed to change
    * size/timestamp/duration of the outgoing buffer.
@@ -233,7 +241,7 @@ public:
 
   /** Optional. Event handler on the source pad.
    */
-  virtual bool src_event_vfunc(const Glib::RefPtr<Gst::Event>& event);
+  _WRAP_VFUNC(bool src_event(const Glib::RefPtr<Gst::Event>& event), "src_event")
 
   /** Optional. Since 0.10.22 This method is called right before the base class
    * will start processing. Dynamic properties or other delayed configuration
@@ -241,34 +249,23 @@ public:
    */
   _WRAP_VFUNC(void before_transform(const Glib::RefPtr<Gst::Buffer>& buffer), "before_transform")
 
+#m4 _CONVERSION(`GstCaps*', `const Glib::RefPtr<const Gst::Caps>&', `Glib::wrap($3, true)')
   /** Optional. Since 0.10.30 Subclasses can override this method to check if
    * the caps can be handled by the element. The default implementation might
    * not be the most optimal way to check this in all cases.
    */
-  virtual bool accept_caps_vfunc(PadDirection direction, const Glib::RefPtr<const Gst::Caps>& caps);
+  _WRAP_VFUNC(bool accept_caps(PadDirection direction, const Glib::RefPtr<const Gst::Caps>& caps), "accept_caps")
 
 protected:
 #m4begin
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
-  klass->prepare_output_buffer = &prepare_output_buffer_vfunc_callback;
-  klass->transform_size = &transform_size_vfunc_callback;
-  klass->get_unit_size = &get_unit_size_vfunc_callback;
-  klass->set_caps = &set_caps_vfunc_callback;
   klass->start = &start_vfunc_callback;
   klass->stop = &stop_vfunc_callback;
-  klass->event = &event_vfunc_callback;
-  klass->src_event = &src_event_vfunc_callback;
-  klass->accept_caps = &accept_caps_vfunc_callback;
+  klass->prepare_output_buffer = &prepare_output_buffer_vfunc_callback;
   _SECTION(SECTION_PH_VFUNCS)
-  static GstFlowReturn prepare_output_buffer_vfunc_callback(GstBaseTransform* self, GstBuffer* input, gint size, GstCaps* caps, GstBuffer** buf);
-  static gboolean transform_size_vfunc_callback(GstBaseTransform* self, GstPadDirection direction, GstCaps* caps, guint size, GstCaps* othercaps, guint* othersize);
-  static gboolean get_unit_size_vfunc_callback(GstBaseTransform* self, GstCaps* caps, guint* size);
-  static gboolean set_caps_vfunc_callback(GstBaseTransform* self, GstCaps* incaps, GstCaps* outcaps);
   static gboolean start_vfunc_callback(GstBaseTransform* self);
   static gboolean stop_vfunc_callback(GstBaseTransform* self);
-  static gboolean event_vfunc_callback(GstBaseTransform* self, GstEvent* event);
-  static gboolean src_event_vfunc_callback(GstBaseTransform* self, GstEvent* event);
-  static gboolean accept_caps_vfunc_callback(GstBaseTransform* self, GstPadDirection direction, GstCaps* caps);
+  static GstFlowReturn prepare_output_buffer_vfunc_callback(GstBaseTransform* self, GstBuffer* input, gint size, GstCaps* caps, GstBuffer** buf);
   _POP()
 #m4end
 };



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