From 65715dbc6676c74487cf57f91fcf598fbd058803 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 13 May 2008 12:54:00 +0000 Subject: [PATCH] plugins/elements/: Use custom marshalers that take GstMiniObject as first parameter. Original commit message from CVS: * plugins/elements/gstfakesink.c: (marshal_VOID__MINIOBJECT_OBJECT), (gst_fake_sink_class_init): * plugins/elements/gstfakesrc.c: (marshal_VOID__MINIOBJECT_OBJECT), (gst_fake_src_class_init): Use custom marshalers that take GstMiniObject as first parameter. Using OBJECT as parameter while a GstMiniObject is given will lead to assertions if built with G_ENABLE_DEBUG. Fixes bug #525532. --- ChangeLog | 10 ++++++++++ plugins/elements/gstfakesink.c | 32 ++++++++++++++++++++++++++++++-- plugins/elements/gstfakesrc.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 207ff83..3b81af4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2008-05-13 Sebastian Dröge + * plugins/elements/gstfakesink.c: + (marshal_VOID__MINIOBJECT_OBJECT), (gst_fake_sink_class_init): + * plugins/elements/gstfakesrc.c: (marshal_VOID__MINIOBJECT_OBJECT), + (gst_fake_src_class_init): + Use custom marshalers that take GstMiniObject as first parameter. + Using OBJECT as parameter while a GstMiniObject is given will lead + to assertions if built with G_ENABLE_DEBUG. Fixes bug #525532. + +2008-05-13 Sebastian Dröge + * plugins/elements/gsttypefindelement.c: (gst_type_find_element_handle_event), (gst_type_find_element_send_cached_events), diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 813dcbe..47e60e8 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -127,6 +127,34 @@ static gboolean gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event); static guint gst_fake_sink_signals[LAST_SIGNAL] = { 0 }; static void +marshal_VOID__MINIOBJECT_OBJECT (GClosure * closure, GValue * return_value, + guint n_param_values, const GValue * param_values, gpointer invocation_hint, + gpointer marshal_data) +{ + typedef void (*marshalfunc_VOID__MINIOBJECT_OBJECT) (gpointer obj, + gpointer arg1, gpointer arg2, gpointer data2); + register marshalfunc_VOID__MINIOBJECT_OBJECT callback; + register GCClosure *cc = (GCClosure *) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } else { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = + (marshalfunc_VOID__MINIOBJECT_OBJECT) (marshal_data ? marshal_data : cc-> + callback); + + callback (data1, gst_value_get_mini_object (param_values + 1), + g_value_get_object (param_values + 2), data2); +} + +static void gst_fake_sink_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); @@ -201,7 +229,7 @@ gst_fake_sink_class_init (GstFakeSinkClass * klass) gst_fake_sink_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeSinkClass, handoff), NULL, NULL, - gst_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, + marshal_VOID__MINIOBJECT_OBJECT, G_TYPE_NONE, 2, GST_TYPE_BUFFER, GST_TYPE_PAD); /** @@ -217,7 +245,7 @@ gst_fake_sink_class_init (GstFakeSinkClass * klass) gst_fake_sink_signals[SIGNAL_PREROLL_HANDOFF] = g_signal_new ("preroll-handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeSinkClass, preroll_handoff), - NULL, NULL, gst_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, + NULL, NULL, marshal_VOID__MINIOBJECT_OBJECT, G_TYPE_NONE, 2, GST_TYPE_BUFFER, GST_TYPE_PAD); gstelement_class->change_state = diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 01793f0..4d5d24f 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -230,6 +230,34 @@ static GstFlowReturn gst_fake_src_create (GstBaseSrc * src, guint64 offset, static guint gst_fake_src_signals[LAST_SIGNAL] = { 0 }; static void +marshal_VOID__MINIOBJECT_OBJECT (GClosure * closure, GValue * return_value, + guint n_param_values, const GValue * param_values, gpointer invocation_hint, + gpointer marshal_data) +{ + typedef void (*marshalfunc_VOID__MINIOBJECT_OBJECT) (gpointer obj, + gpointer arg1, gpointer arg2, gpointer data2); + register marshalfunc_VOID__MINIOBJECT_OBJECT callback; + register GCClosure *cc = (GCClosure *) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } else { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = + (marshalfunc_VOID__MINIOBJECT_OBJECT) (marshal_data ? marshal_data : cc-> + callback); + + callback (data1, gst_value_get_mini_object (param_values + 1), + g_value_get_object (param_values + 2), data2); +} + +static void gst_fake_src_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); @@ -351,7 +379,7 @@ gst_fake_src_class_init (GstFakeSrcClass * klass) gst_fake_src_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstFakeSrcClass, handoff), NULL, NULL, - gst_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GST_TYPE_BUFFER, + marshal_VOID__MINIOBJECT_OBJECT, G_TYPE_NONE, 2, GST_TYPE_BUFFER, GST_TYPE_PAD); gstbase_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_fake_src_is_seekable); -- 2.7.4