[gstreamermm] BaseTransform: Wrote out bool vfuncs to avoid execution errors.



commit 439126715a516f98a4d759681812c6980c090823
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Thu Oct 21 00:49:08 2010 -0400

    	BaseTransform: Wrote out bool vfuncs to avoid execution errors.
    
    	* gstreamer/src/basetransform.ccg:
    	* gstreamer/src/basetransform.hg: Wrote out the boolean virtual
    	functions ensuring that both the functions and their callbacks return
    	true at the end by default.  This is to make sure that if the C API
    	expects a true result on successful execution of the callbacks it gets
    	it even if it is a default return.  This ensures proper application
    	execution.  I suspect that if any should return false by default, it
    	may be easier to catch those than the ones that should return true by
    	default.

 ChangeLog                       |   14 ++
 gstreamer/src/basetransform.ccg |  428 +++++++++++++++++++++++++++++++++++++++
 gstreamer/src/basetransform.hg  |   94 +++++----
 3 files changed, 491 insertions(+), 45 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d7e753a..662dd2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-21  José Alburquerque  <jaalburqu svn gnome org>
+
+	BaseTransform: Wrote out bool vfuncs to avoid execution errors.
+
+	* gstreamer/src/basetransform.ccg:
+	* gstreamer/src/basetransform.hg: Wrote out the boolean virtual
+	functions ensuring that both the functions and their callbacks return
+	true at the end by default.  This is to make sure that if the C API
+	expects a true result on successful execution of the callbacks it gets
+	it even if it is a default return.  This ensures proper application
+	execution.  I suspect that if any should return false by default, it
+	may be easier to catch those than the ones that should return true by
+	default.
+
 2010-10-18  José Alburquerque  <jaalburqu svn gnome org>
 
 	Update the README and the Doxygen main page documentation.
diff --git a/gstreamer/src/basetransform.ccg b/gstreamer/src/basetransform.ccg
index d823685..be21fc3 100644
--- a/gstreamer/src/basetransform.ccg
+++ b/gstreamer/src/basetransform.ccg
@@ -102,5 +102,433 @@ FlowReturn Gst::BaseTransform::prepare_output_buffer_vfunc(const Glib::RefPtr<Gs
   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*>(
+      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->start_vfunc());
+      #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->start)
+    return (*base->start)(self);
+
+  return true;
+}
+bool Gst::BaseTransform::start_vfunc() 
+{
+  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->start)
+    return (*base->start)(gobj());
+
+  return true;
+}
+gboolean BaseTransform_Class::stop_vfunc_callback(GstBaseTransform* 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 static_cast<int>(obj->stop_vfunc());
+      #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->stop)
+    return (*base->stop)(self);
+
+  return true;
+}
+bool Gst::BaseTransform::stop_vfunc() 
+{
+  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->stop)
+    return (*base->stop)(gobj());
+
+  return true;
+}
+gboolean BaseTransform_Class::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->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).
+  );
+
+  // 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).
+  );
+
+  // Call the original underlying C function:
+  if(base && base->src_event)
+    return (*base->src_event)(self, event);
+
+  return true;
+}
+bool Gst::BaseTransform::src_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->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_())
+  {
+    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
+    }
+  }
+  
+  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;
+}
 
 } //namespace Gst
diff --git a/gstreamer/src/basetransform.hg b/gstreamer/src/basetransform.hg
index b64b741..ffc323e 100644
--- a/gstreamer/src/basetransform.hg
+++ b/gstreamer/src/basetransform.hg
@@ -181,44 +181,36 @@ public:
    */
   _WRAP_VFUNC(void fixate_caps(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, const Glib::RefPtr<Gst::Caps>& othercaps), "fixate_caps")
 
-  //TODO: Make sure this bool vfunc does not cause execution problems.
-  ///** 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")
+  /** 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: Make sure this bool vfunc does not cause execution problems.
-  ///** Required if the transform is not in-place. Get the size in bytes of one
-   //* unit for the given caps.
-   //*/
-  //_WRAP_VFUNC(bool get_unit_size(const Glib::RefPtr<Gst::Caps>& caps, guint& size) const, "get_unit_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;
 
-  //TODO: Make sure this bool vfunc does not cause execution problems.
-  ///** Allows the subclass to be notified of the actual caps set.
-   //*/
-  //_WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Gst::Caps>& incaps, const Glib::RefPtr<Gst::Caps>& outcaps), "set_caps")
+  /** 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);
 
-  //TODO: Make sure this bool vfunc does not cause execution problems.
-  ///** Optional. Called when the element starts processing. Allows opening
-   //* external resources.
-   //*/
-  //_WRAP_VFUNC(bool start(), "start")
+  /** Optional. Called when the element starts processing. Allows opening
+   * external resources.
+   */
+  virtual bool start_vfunc();
 
-  //TODO: Make sure this bool vfunc does not cause execution problems.
-  ///** Optional. Called when the element stops processing. Allows closing
-   //* external resources.
-   //*/
-  //_WRAP_VFUNC(bool stop(), "stop")
+  /** 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)')
-  //TODO: Make sure this bool vfunc does not cause execution problems.
-  ///** Optional. Event handler on the sink pad. This function should return TRUE
-  ///* Optional. Event handler on the sink pad. This function should return
-   //* <tt>true</tt> if the base class should forward the event.
-   //*/
-  //_WRAP_VFUNC(bool event(const Glib::RefPtr<Gst::Event>& event), "event")
+  /* 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);
 
 #m4 _CONVERSION(`GstBuffer*', `const Glib::RefPtr<Gst::Buffer>&', `Gst::wrap($3, true)')
   /** Required if the element does not operate in-place. Transforms one
@@ -239,10 +231,9 @@ public:
    */
   virtual FlowReturn prepare_output_buffer_vfunc(const Glib::RefPtr<Gst::Buffer>& input, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buffer);
 
-  //TODO: Make sure this bool vfunc does not cause execution problems.
-  ///** Optional. Event handler on the source pad.
-   //*/
-  //_WRAP_VFUNC(bool src_event(const Glib::RefPtr<Gst::Event>& event), "src_event")
+  /** Optional. Event handler on the source pad.
+   */
+  virtual bool src_event_vfunc(const Glib::RefPtr<Gst::Event>& event);
 
   /** Optional. Since 0.10.22 This method is called right before the base class
    * will start processing. Dynamic properties or other delayed configuration
@@ -250,21 +241,34 @@ 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)')
-  //TODO: Make sure this bool vfunc does not cause execution problems.
-  ///** 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.
-   //*/
-  //_WRAP_VFUNC(bool accept_caps(PadDirection direction,
-    //const Glib::RefPtr<const Gst::Caps>& caps), "accept_caps")
+  /** 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);
 
 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;
   _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);
   _POP()
 #m4end
 };



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