[gstreamermm] Event, Query: Wrap virtual functions.
- From: José Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Event, Query: Wrap virtual functions.
- Date: Wed, 10 Mar 2010 04:10:29 +0000 (UTC)
commit 1bf0a3b106e838eef32d985fd925d9f4a9fe91cf
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Tue Mar 9 23:07:38 2010 -0500
Event, Query: Wrap virtual functions.
* gstreamer/src/event.ccg:
* gstreamer/src/event.hg:
* gstreamer/src/query.ccg:
* gstreamer/src/query.hg: Wrap virtual functions MiniObject classes.
Also use custom wrap_new() functions where the classes have a local
wrap() method.
* gstreamer/src/buffer.hg: Typo.
ChangeLog | 12 ++++++
gstreamer/src/buffer.hg | 1 -
gstreamer/src/event.ccg | 86 +++++++++++++++++++++++++++++++++++++++-------
gstreamer/src/event.hg | 26 +++++++++++++-
gstreamer/src/query.ccg | 84 +++++++++++++++++++++++++++++++++++++++------
gstreamer/src/query.hg | 26 +++++++++++++-
6 files changed, 207 insertions(+), 28 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cce7fd5..65fb37a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2010-03-09 José Alburquerque <jaalburqu svn gnome org>
+ Event, Query: Wrap virtual functions.
+
+ * gstreamer/src/event.ccg:
+ * gstreamer/src/event.hg:
+ * gstreamer/src/query.ccg:
+ * gstreamer/src/query.hg: Wrap virtual functions MiniObject classes.
+ Also use custom wrap_new() functions where the classes have a local
+ wrap() method.
+ * gstreamer/src/buffer.hg: Typo.
+
+2010-03-09 José Alburquerque <jaalburqu svn gnome org>
+
Message: Revert changes for partial fix of bug #608702.
* gstreamer/src/message.ccg: Revert the changes to partially fix bug
diff --git a/gstreamer/src/buffer.hg b/gstreamer/src/buffer.hg
index 713ce02..ac0c0ec 100644
--- a/gstreamer/src/buffer.hg
+++ b/gstreamer/src/buffer.hg
@@ -44,7 +44,6 @@ _WRAP_ENUM(BufferCopyFlags, GstBufferCopyFlags)
*/
class Buffer : public MiniObject
{
-protected:
_CLASS_GSTMINIOBJECT(Buffer, GstBuffer, GST_BUFFER, Gst::MiniObject, GstMiniObject)
public:
diff --git a/gstreamer/src/event.ccg b/gstreamer/src/event.ccg
index 21302e2..d7e629e 100644
--- a/gstreamer/src/event.ccg
+++ b/gstreamer/src/event.ccg
@@ -450,6 +450,7 @@ bool EventStep::parse_intermediate() const
Glib::RefPtr<Gst::Event> Event::wrap(GstEvent* event, bool take_copy)
{
+ Gst::Event* wrapper = 0;
Glib::RefPtr<Gst::Event> result;
if(!event)
@@ -458,46 +459,105 @@ Glib::RefPtr<Gst::Event> Event::wrap(GstEvent* event, bool take_copy)
switch(GST_EVENT_TYPE(event))
{
case GST_EVENT_FLUSH_START:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventFlushStart(event) );
+ wrapper = new Gst::EventFlushStart(event);
break;
case GST_EVENT_FLUSH_STOP:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventFlushStop(event) );
+ wrapper = new Gst::EventFlushStop(event);
break;
case GST_EVENT_EOS:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventEos(event) );
+ wrapper = new Gst::EventEos(event);
break;
case GST_EVENT_NEWSEGMENT:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventNewSegment(event) );
+ wrapper = new Gst::EventNewSegment(event);
break;
case GST_EVENT_TAG:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventTag(event) );
+ wrapper = new Gst::EventTag(event);
break;
case GST_EVENT_BUFFERSIZE:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventBufferSize(event) );
+ wrapper = new Gst::EventBufferSize(event);
break;
case GST_EVENT_QOS:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventQos(event) );
+ wrapper = new Gst::EventQos(event);
break;
case GST_EVENT_SEEK:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventSeek(event) );
+ wrapper = new Gst::EventSeek(event);
break;
case GST_EVENT_NAVIGATION:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventNavigation(event) );
+ wrapper = new Gst::EventNavigation(event);
break;
case GST_EVENT_LATENCY:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventLatency(event) );
+ wrapper = new Gst::EventLatency(event);
break;
case GST_EVENT_STEP:
- result = Glib::RefPtr<Gst::Event>( new Gst::EventStep(event) );
+ wrapper = new Gst::EventStep(event);
break;
default:
- result = Gst::wrap(event, false);
+ wrapper = new Gst::Event(event);
}
- if(result && take_copy)
+ result = Glib::RefPtr<Gst::Event>(wrapper);
+
+ if(take_copy)
result->reference();
return result;
}
+Gst::MiniObject* Event_Class::wrap_new(GstMiniObject* object)
+{
+ // Use the Gst::Event wrap() method to get the right type of Event class
+ // and return the underlying object in the refptr. The extra reference is
+ // needed so that the object does not loose a reference when the local refptr
+ // is destroyed.
+ return Gst::Event::wrap((GstEvent*)object, true).operator->();
+}
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+GstMiniObject* Event_Class::copy_vfunc_callback(const GstMiniObject* self)
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(GST_MINI_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 && GST_MINI_OBJECT_CLASS(base)->copy)
+ return (*GST_MINI_OBJECT_CLASS(base)->copy)(self);
+
+ return 0;
+}
+Glib::RefPtr<Gst::MiniObject> Event::copy_vfunc() const
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobj())) // Get the parent class of the object class (The original underlying C class).
+ );
+
+ if(base && GST_MINI_OBJECT_CLASS(base)->copy)
+ {
+ return Gst::Event::wrap(GST_EVENT((*GST_MINI_OBJECT_CLASS(base)->copy)(
+ GST_MINI_OBJECT(gobj()))));
+ }
+
+ return Glib::RefPtr<Gst::MiniObject>(0);
+}
+void Event_Class::finalize_vfunc_callback(GstMiniObject* self)
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(GST_MINI_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 && GST_MINI_OBJECT_CLASS(base)->finalize)
+ (*GST_MINI_OBJECT_CLASS(base)->finalize)(self);
+}
+void Event::finalize_vfunc()
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobj())) // Get the parent class of the object class (The original underlying C class).
+ );
+
+ if(base && GST_MINI_OBJECT_CLASS(base)->finalize)
+ (*GST_MINI_OBJECT_CLASS(base)->finalize)(GST_MINI_OBJECT(gobj()));
+}
+#endif //GLIBMM_VFUNCS_ENABLED
+
} //namespace Gst
diff --git a/gstreamer/src/event.hg b/gstreamer/src/event.hg
index c7eb458..85b4e69 100644
--- a/gstreamer/src/event.hg
+++ b/gstreamer/src/event.hg
@@ -116,8 +116,9 @@ EventTypeFlags get_flags(EventType type);
*/
class Event : public MiniObject
{
-protected:
_CLASS_GSTMINIOBJECT(Event, GstEvent, GST_EVENT, Gst::MiniObject, GstMiniObject)
+ _IGNORE(gst_event_ref, gst_event_unref)
+ _CUSTOM_WRAP_NEW
public:
/** Wrap a GstEvent* in a C++ instance, creating an instance of a derived
@@ -166,6 +167,29 @@ public:
/** The source Gst::Object that generated this event.
*/
_MEMBER_GET_GOBJECT(source, src, Gst::Object, GstObject*)
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+ /** Virtual function called when the Gst::Event needs to be copied.
+ */
+ virtual Glib::RefPtr<Gst::MiniObject> copy_vfunc() const;
+#endif //GLIBMM_VFUNCS_ENABLED
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+ /** Virtual function called when the Gst::Event is about to be finalized.
+ */
+ virtual void finalize_vfunc();
+#endif //GLIBMM_VFUNCS_ENABLED
+
+protected:
+#m4begin
+ _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+ GST_MINI_OBJECT_CLASS(klass)->copy = ©_vfunc_callback;
+ GST_MINI_OBJECT_CLASS(klass)->finalize = &finalize_vfunc_callback;
+ _SECTION(SECTION_PH_VFUNCS)
+ static GstMiniObject* copy_vfunc_callback(const GstMiniObject* self);
+ static void finalize_vfunc_callback(GstMiniObject* self);
+ _POP()
+#m4end
};
//TODO: Modify create methods of derived Event classes to return
diff --git a/gstreamer/src/query.ccg b/gstreamer/src/query.ccg
index abd0d64..3ff7d75 100644
--- a/gstreamer/src/query.ccg
+++ b/gstreamer/src/query.ccg
@@ -547,6 +547,7 @@ gint64 QueryBuffering::parse_total_time() const
Glib::RefPtr<Gst::Query> Query::wrap(GstQuery* query, bool take_copy)
{
+ Gst::Query* wrapper = 0;
Glib::RefPtr<Gst::Query> result;
if(!query)
@@ -555,42 +556,101 @@ Glib::RefPtr<Gst::Query> Query::wrap(GstQuery* query, bool take_copy)
switch(GST_QUERY_TYPE(query))
{
case GST_QUERY_POSITION:
- result = Glib::RefPtr<Gst::Query>( new Gst::QueryPosition(query) );
+ wrapper = new Gst::QueryPosition(query);
break;
case GST_QUERY_DURATION:
- result = Glib::RefPtr<Gst::Query>( new Gst::QueryDuration(query) );
+ wrapper = new Gst::QueryDuration(query);
break;
case GST_QUERY_LATENCY:
- result = Glib::RefPtr<Gst::Query>( new Gst::QueryLatency(query) );
+ wrapper = new Gst::QueryLatency(query);
break;
case GST_QUERY_SEEKING:
- result = Glib::RefPtr<Gst::Query>( new Gst::QuerySeeking(query) );
+ wrapper = new Gst::QuerySeeking(query);
break;
case GST_QUERY_SEGMENT:
- result = Glib::RefPtr<Gst::Query>( new Gst::QuerySegment(query) );
+ wrapper = new Gst::QuerySegment(query);
break;
case GST_QUERY_CONVERT:
- result = Glib::RefPtr<Gst::Query>( new Gst::QueryConvert(query) );
+ wrapper = new Gst::QueryConvert(query);
break;
case GST_QUERY_FORMATS:
- result = Glib::RefPtr<Gst::Query>( new Gst::QueryFormats(query) );
+ wrapper = new Gst::QueryFormats(query);
break;
case GST_QUERY_BUFFERING:
- result = Glib::RefPtr<Gst::Query>( new Gst::QueryBuffering(query) );
+ wrapper = new Gst::QueryBuffering(query);
break;
case GST_QUERY_NONE:
case GST_QUERY_JITTER:
- result = Gst::wrap(query, false);
+ wrapper = new Gst::Query(query);
break;
- /* The rest of the query types are custom ones */
+ /* The rest of the query types are custom ones */
default:
- result = Glib::RefPtr<Gst::Query>( new Gst::QueryApplication(query) );
+ wrapper = new Gst::QueryApplication(query);
}
- if(result && take_copy)
+ result = Glib::RefPtr<Gst::Query>(wrapper);
+
+ if(take_copy)
result->reference();
return result;
}
+Gst::MiniObject* Query_Class::wrap_new(GstMiniObject* object)
+{
+ // Use the Gst::Query wrap() method to get the right type of Query class
+ // and return the underlying object in the refptr. The extra reference is
+ // needed so that the object does not loose a reference when the local refptr
+ // is destroyed.
+ return Gst::Query::wrap((GstQuery*)object, true).operator->();
+}
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+GstMiniObject* Query_Class::copy_vfunc_callback(const GstMiniObject* self)
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(GST_MINI_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 && GST_MINI_OBJECT_CLASS(base)->copy)
+ return (*GST_MINI_OBJECT_CLASS(base)->copy)(self);
+
+ return 0;
+}
+Glib::RefPtr<Gst::MiniObject> Query::copy_vfunc() const
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobj())) // Get the parent class of the object class (The original underlying C class).
+ );
+
+ if(base && GST_MINI_OBJECT_CLASS(base)->copy)
+ {
+ return Gst::Query::wrap(GST_QUERY((*GST_MINI_OBJECT_CLASS(base)->copy)(
+ GST_MINI_OBJECT(gobj()))));
+ }
+
+ return Glib::RefPtr<Gst::MiniObject>(0);
+}
+void Query_Class::finalize_vfunc_callback(GstMiniObject* self)
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(GST_MINI_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 && GST_MINI_OBJECT_CLASS(base)->finalize)
+ (*GST_MINI_OBJECT_CLASS(base)->finalize)(self);
+}
+void Query::finalize_vfunc()
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobj())) // Get the parent class of the object class (The original underlying C class).
+ );
+
+ if(base && GST_MINI_OBJECT_CLASS(base)->finalize)
+ (*GST_MINI_OBJECT_CLASS(base)->finalize)(GST_MINI_OBJECT(gobj()));
+}
+#endif //GLIBMM_VFUNCS_ENABLED
+
} //namesapce Gst
diff --git a/gstreamer/src/query.hg b/gstreamer/src/query.hg
index 6508d2b..573b276 100644
--- a/gstreamer/src/query.hg
+++ b/gstreamer/src/query.hg
@@ -109,8 +109,9 @@ _IGNORE(gst_query_type_to_quark)
*/
class Query : public MiniObject
{
-protected:
_CLASS_GSTMINIOBJECT(Query, GstQuery, GST_QUERY, Gst::MiniObject, GstMiniObject)
+ _IGNORE(gst_query_ref, qgst_query_unref)
+ _CUSTOM_WRAP_NEW
public:
/** Wrap a GstQuery* in a C++ instance, creating an instance of a derived
@@ -150,6 +151,29 @@ public:
_IGNORE(gst_query_type_get_details)
_WRAP_METHOD(static Gst::IteratorBasic<const Gst::QueryTypeDefinition> iterate_definitions(), gst_query_type_iterate_definitions)
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+ /** Virtual function called when the Gst::Query needs to be copied.
+ */
+ virtual Glib::RefPtr<Gst::MiniObject> copy_vfunc() const;
+#endif //GLIBMM_VFUNCS_ENABLED
+
+#ifdef GLIBMM_VFUNCS_ENABLED
+ /** Virtual function called when the Gst::Query is about to be finalized.
+ */
+ virtual void finalize_vfunc();
+#endif //GLIBMM_VFUNCS_ENABLED
+
+protected:
+#m4begin
+ _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+ GST_MINI_OBJECT_CLASS(klass)->copy = ©_vfunc_callback;
+ GST_MINI_OBJECT_CLASS(klass)->finalize = &finalize_vfunc_callback;
+ _SECTION(SECTION_PH_VFUNCS)
+ static GstMiniObject* copy_vfunc_callback(const GstMiniObject* self);
+ static void finalize_vfunc_callback(GstMiniObject* self);
+ _POP()
+#m4end
};
//TODO: Modify create methods of derived Query classes to return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]