[gstreamermm] BaseTransform: Wrap virtual functions.



commit 8a7dcd74b13903579a0509030f2bbb3b36a21d77
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Aug 10 23:37:39 2010 -0400

    	BaseTransform: Wrap virtual functions.
    
    	* gstreamer/src/basetransform.hg: Uncomment the virtual functions so
    	that they are wrapped.  Wrapped the new "accept_caps" virtual
    	function.  The boolean virtual functions here don't seem to cause
    	problems if they don't return true as the BaseSink ones do.  The
    	ogg_player_gtkmm example works fine even if it uses the AudioConvert
    	element which derives from BaseTransform.
    
    	The media_player_gtkmm example, on the other hand, crashes if the
    	BaseSink boolean virtual functions do not return true because it uses
    	the XimageSink element which derives from BaseSink.
    
    	* gstreamer/src/gst_vfuncs.defs: Added the BaseTransform "accept_caps"
    	virtual function.

 ChangeLog                      |   18 ++++++++
 gstreamer/src/basetransform.hg |   84 +++++++++++++++++-----------------------
 gstreamer/src/gst_vfuncs.defs  |    9 ++++
 3 files changed, 63 insertions(+), 48 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4615b42..2f66936 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-10  José Alburquerque  <jaalburqu svn gnome org>
+
+	BaseTransform: Wrap virtual functions.
+
+	* gstreamer/src/basetransform.hg: Uncomment the virtual functions so
+	that they are wrapped.  Wrapped the new "accept_caps" virtual
+	function.  The boolean virtual functions here don't seem to cause
+	problems if they don't return true as the BaseSink ones do.  The
+	ogg_player_gtkmm example works fine even if it uses the AudioConvert
+	element which derives from BaseTransform.
+	
+	The media_player_gtkmm example, on the other hand, crashes if the
+	BaseSink boolean virtual functions do not return true because it uses
+	the XimageSink element which derives from BaseSink.
+
+	* gstreamer/src/gst_vfuncs.defs: Added the BaseTransform "accept_caps"
+	virtual function.
+
 2010-08-06  José Alburquerque  <jaalburqu svn gnome org>
 
 	BaseSink: Wrap remaining virtual functions.
diff --git a/gstreamer/src/basetransform.hg b/gstreamer/src/basetransform.hg
index f02e2a3..edaa115 100644
--- a/gstreamer/src/basetransform.hg
+++ b/gstreamer/src/basetransform.hg
@@ -181,55 +181,38 @@ public:
    */
   _WRAP_VFUNC(void fixate_caps(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, const Glib::RefPtr<Gst::Caps>& othercaps), "fixate_caps")
 
-  //TODO: Some boolean vfuncs cause strange incorrect functionality when their
-  //callbacks return false with the last "return RType()" line.  Make sure this
-  //one doesn't cause problems and implement later.
-  ///** 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.
+   */
+  _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")
 
-  //TODO: Some boolean vfuncs cause strange incorrect functionality when their
-  //callbacks return false with the last "return RType()" line.  Make sure this
-  //one doesn't cause problems and implement later.
-  ///** 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.
+   */
+  _WRAP_VFUNC(bool get_unit_size(const Glib::RefPtr<Gst::Caps>& caps, guint& size) const, "get_unit_size")
 
-  //TODO: Some boolean vfuncs cause strange incorrect functionality when their
-  //callbacks return false with the last "return RType()" line.  Make sure this
-  //one doesn't cause problems and implement later.
-  ///** 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.
+   */
+  _WRAP_VFUNC(bool set_caps(const Glib::RefPtr<Gst::Caps>& incaps, const Glib::RefPtr<Gst::Caps>& outcaps), "set_caps")
 
-  //TODO: Some boolean vfuncs cause strange incorrect functionality when their
-  //callbacks return false with the last "return RType()" line.  Make sure this
-  //one doesn't cause problems and implement later.
-  ///** 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.
+   */
+  _WRAP_VFUNC(bool start(), "start")
 
-  //TODO: Some boolean vfuncs cause strange incorrect functionality when their
-  //callbacks return false with the last "return RType()" line.  Make sure this
-  //one doesn't cause problems and implement later.
-  ///** 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.
+   */
+  _WRAP_VFUNC(bool stop(), "stop")
 
 #m4 _CONVERSION(`GstEvent*', `const Glib::RefPtr<Gst::Event>&', `Gst::wrap($3, true)')
   ///** Optional. Event handler on the sink pad. This function should return TRUE
-  //TODO: Some boolean vfuncs cause strange incorrect functionality when their
-  //callbacks return false with the last "return RType()" line.  Make sure this
-  //one doesn't cause problems and implement later.
-   //* 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.
+   */
+  _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
@@ -250,12 +233,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: Some boolean vfuncs cause strange incorrect functionality when their
-  //callbacks return false with the last "return RType()" line.  Make sure this
-  //one doesn't cause problems and implement later.
-  ///** 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.
+   */
+  _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
@@ -263,6 +243,14 @@ 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.
+   */
+  _WRAP_VFUNC(bool accept_caps(PadDirection direction,
+    const Glib::RefPtr<const Gst::Caps>& caps), "accept_caps")
+
 protected:
 #m4begin
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
diff --git a/gstreamer/src/gst_vfuncs.defs b/gstreamer/src/gst_vfuncs.defs
index 7d1763b..e72f68e 100644
--- a/gstreamer/src/gst_vfuncs.defs
+++ b/gstreamer/src/gst_vfuncs.defs
@@ -452,6 +452,15 @@
   )
 )
 
+(define-vfunc accept_caps
+  (of-object "GstBaseTransform")
+  (return-type "gboolean")
+  (parameters
+   '("GstPadDirection" "direction")
+   '("GstCaps*" "caps")
+  )
+)
+
 ; GstBin
 
 (define-vfunc add_element



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