[gstreamermm] Gst::AudioSink: wrap write() vfunc using macro
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Gst::AudioSink: wrap write() vfunc using macro
- Date: Sat, 23 Apr 2016 18:27:04 +0000 (UTC)
commit 8938cd977d48c95481cbe78abc2f818a2b768ed2
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Apr 23 20:06:20 2016 +0200
Gst::AudioSink: wrap write() vfunc using macro
* gstreamer/src/audiosink.{ccg|hg}: fix write() vfunc, fix
includes.
* gstreamer/src/gst_vfuncs.defs: fix write() vfunc declaration.
* tools/m4/convert_gst.m4: cleanup convert_gst.m4 file.
gstreamer/src/audiosink.ccg | 57 ++--------------------------------------
gstreamer/src/audiosink.hg | 9 ++----
gstreamer/src/gst_vfuncs.defs | 2 +-
tools/m4/convert_gst.m4 | 16 ++++++------
4 files changed, 15 insertions(+), 69 deletions(-)
---
diff --git a/gstreamer/src/audiosink.ccg b/gstreamer/src/audiosink.ccg
index 924060d..403926d 100644
--- a/gstreamer/src/audiosink.ccg
+++ b/gstreamer/src/audiosink.ccg
@@ -1,6 +1,6 @@
/* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2016 The gstreamermm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,7 +17,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <gst/audio/gstaudiosink.h>
_PINCLUDE(gstreamermm/private/audiobasesink_p.h)
namespace Gst
@@ -51,7 +50,7 @@ gboolean AudioSink_Class::prepare_vfunc_callback(GstAudioSink* self, GstAudioRin
}
}
}
-
+
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).
);
@@ -76,56 +75,6 @@ bool Gst::AudioSink::prepare_vfunc(Gst::AudioRingBufferSpec& spec)
typedef bool RType;
return RType();
}
-gint AudioSink_Class::write_vfunc_callback(GstAudioSink* self, gpointer data, guint length)
-{
- 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.
- {
- // Call the virtual member method, which derived classes might override.
- return obj->write_vfunc(data, length);
- }
- 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->write)
- return (*base->write)(self, data, length);
-
-
- typedef guint RType;
- return RType();
-}
-guint Gst::AudioSink::write_vfunc(const void* data, guint length)
-{
- 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->write)
- return (*base->write)(gobj(),const_cast<void*>(data),length);
-
- typedef guint RType;
- return RType();
-}
} // namespace Gst
+
diff --git a/gstreamer/src/audiosink.hg b/gstreamer/src/audiosink.hg
index 59ab906..ec8932e 100644
--- a/gstreamer/src/audiosink.hg
+++ b/gstreamer/src/audiosink.hg
@@ -1,6 +1,6 @@
/* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2016 The gstreamermm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,6 @@
*/
#include <gstreamermm/audioringbuffer.h>
-#include <gst/audio/gstaudiosink.h>
#include <gstreamermm/audiobasesink.h>
_DEFS(gstreamermm,gst)
@@ -43,7 +42,7 @@ namespace Gst
* with Gst::AudioBaseSink using a default implementation of a
* Gst::AudioRingBuffer that uses threads.
*
- * Last reviewed on 2006-09-27 (0.10.12)
+ * Last reviewed on 2016-04-23 (1.8.0)
*
* @ingroup GstBaseClasses
*/
@@ -71,7 +70,7 @@ public:
/** vfunc to write data to the device.
*/
- virtual guint write_vfunc(const void* data, guint length);
+ _WRAP_VFUNC(int write(gpointer data, guint lenght), "write")
/** vfunc to return how many samples are still in the device. This is used to
* drive the synchronisation.
@@ -87,10 +86,8 @@ protected:
#m4begin
_PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
klass->prepare = &prepare_vfunc_callback;
- klass->write = &write_vfunc_callback;
_SECTION(SECTION_PH_VFUNCS)
static gboolean prepare_vfunc_callback(GstAudioSink* self, GstAudioRingBufferSpec* spec);
- static gint write_vfunc_callback(GstAudioSink* self, gpointer data, guint length);
_POP()
#m4end
};
diff --git a/gstreamer/src/gst_vfuncs.defs b/gstreamer/src/gst_vfuncs.defs
index 2625aea..6ccf324 100644
--- a/gstreamer/src/gst_vfuncs.defs
+++ b/gstreamer/src/gst_vfuncs.defs
@@ -59,7 +59,7 @@
(define-vfunc write
(of-object "GstAudioSink")
- (return-type "guint")
+ (return-type "gint")
(parameters
'("gpointer" "data")
'("guint" "length")
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 1169e2b..31edc85 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -98,6 +98,13 @@ dnl AudioInfo
_CONVERSION(`const Gst::AudioInfo&', `const GstAudioInfo*', `$3.gobj()')
_CONVERSION(`const GstAudioInfo*', `const Gst::AudioInfo&', `Gst::AudioInfo(const_cast<GstAudioInfo*>($3))')
+dnl AudioRingBuffer
+_CONVERSION(`GstAudioRingBuffer*',`Glib::RefPtr<Gst::AudioRingBuffer>',`Glib::wrap($3)')
+_CONVERSION(`Glib::RefPtr<Gst::AudioRingBuffer>',`GstAudioRingBuffer*',`Glib::unwrap($3)')
+
+dnl AudioRingBufferSpec
+_CONVERSION(`Gst::AudioRingBufferSpec&', `GstAudioRingBufferSpec*', `$3.gobj()')
+
dnl Buffer
_CONVERSION(`GstBuffer*',`Glib::RefPtr<Gst::Buffer>',`Glib::wrap($3)')
_CONVERSION(`GstBuffer*',`const Glib::RefPtr<Gst::Buffer>&',`Glib::wrap($3, true)')
@@ -283,16 +290,9 @@ _CONVERSION(`GstSegment*',`Glib::RefPtr<Gst::Segment>',`Glib::wrap($3)')
_CONVERSION(`GstSegment*',`Glib::RefPtr<const Gst::Segment>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Gst::Segment>&',`GstSegment*', `Glib::unwrap($3)')
-dnl AudioRingBuffer
-_CONVERSION(`GstAudioRingBuffer*',`Glib::RefPtr<Gst::AudioRingBuffer>',`Glib::wrap($3)')
-_CONVERSION(`Glib::RefPtr<Gst::AudioRingBuffer>',`GstAudioRingBuffer*',`Glib::unwrap($3)')
-
-dnl AudioRingBufferSpec
-_CONVERSION(`Gst::AudioRingBufferSpec&', `GstAudioRingBufferSpec*', `$3.gobj()')
-
dnl Structure
_CONVERSION(`Gst::Structure&',`GstStructure*',`$3.gobj()')
-_CONVERSION(`const Gst::Structure&',`GstStructure*',`const_cast<GstStructure*>($3.gobj())')
+_CONVERSION(`const Gst::Structure&',`GstStructure*',`const_cast<GstStructure*>($3.gobj())')
_CONVERSION(`GstStructure*', `Gst::Structure', `Glib::wrap($3)')
_CONVERSION(`const Gst::Structure&',`const GstStructure*',`$3.gobj()')
_CONVERSION(`const GstStructure*',`Gst::Structure', `Glib::wrap($3, false)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]