From 54ff34dc2d8acd39c02bca66233de0da99242b10 Mon Sep 17 00:00:00 2001 From: Laurent Glayal Date: Wed, 21 Nov 2007 13:27:50 +0000 Subject: [PATCH] plugins/elements/gstidentity.*: Add property to disable handoff signal emission. Fixes #498694. Original commit message from CVS: Patch by: Laurent Glayal * plugins/elements/gstidentity.c: (gst_identity_class_init), (gst_identity_init), (gst_identity_transform_ip), (gst_identity_set_property), (gst_identity_get_property): * plugins/elements/gstidentity.h: Add property to disable handoff signal emission. Fixes #498694. API: GstIdentity::signal-handoffs --- ChangeLog | 11 +++++++++++ plugins/elements/gstidentity.c | 31 +++++++++++++++++++++++++++---- plugins/elements/gstidentity.h | 1 + 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f6dbd787d..f441d14fad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-11-21 Wim Taymans + + Patch by: Laurent Glayal + + * plugins/elements/gstidentity.c: (gst_identity_class_init), + (gst_identity_init), (gst_identity_transform_ip), + (gst_identity_set_property), (gst_identity_get_property): + * plugins/elements/gstidentity.h: + Add property to disable handoff signal emission. Fixes #498694. + API: GstIdentity::signal-handoffs + 2007-11-21 Julien Moutte * docs/faq/gst-uninstalled: Yet another missing library for the diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 12aa738e38..095763c66d 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -71,6 +71,7 @@ enum #define DEFAULT_CHECK_PERFECT FALSE #define DEFAULT_CHECK_IMPERFECT_TIMESTAMP FALSE #define DEFAULT_CHECK_IMPERFECT_OFFSET FALSE +#define DEFAULT_SIGNAL_HANDOFFS TRUE enum { @@ -86,7 +87,8 @@ enum PROP_SYNC, PROP_CHECK_PERFECT, PROP_CHECK_IMPERFECT_TIMESTAMP, - PROP_CHECK_IMPERFECT_OFFSET + PROP_CHECK_IMPERFECT_OFFSET, + PROP_SIGNAL_HANDOFFS }; @@ -229,7 +231,20 @@ gst_identity_class_init (GstIdentityClass * klass) "Send element messages if offset and offset_end do not match up", DEFAULT_CHECK_IMPERFECT_OFFSET, G_PARAM_READWRITE)); - /** + /** + * GstIdentity:signal-handoffs + * + * If set to #TRUE, the identity will emit a handoff signal when handling a buffer. + * When set to #FALSE, no signal will be emited, which might improve performance. + * + * Since: 0.10.16 + */ + g_object_class_install_property (gobject_class, PROP_SIGNAL_HANDOFFS, + g_param_spec_boolean ("signal-handoffs", + "Signal handoffs", "Send a signal before pushing the buffer", + DEFAULT_SIGNAL_HANDOFFS, G_PARAM_READWRITE)); + + /** * GstIdentity::handoff: * @identity: the identity instance * @buffer: the buffer that just has been received @@ -268,6 +283,7 @@ gst_identity_init (GstIdentity * identity, GstIdentityClass * g_class) identity->check_imperfect_offset = DEFAULT_CHECK_IMPERFECT_OFFSET; identity->dump = DEFAULT_DUMP; identity->last_message = NULL; + identity->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS; } static gboolean @@ -548,8 +564,9 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf) GST_BUFFER_SIZE (buf) * GST_SECOND / identity->datarate; } - g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0, - buf); + if (identity->signal_handoffs) + g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0, + buf); if (trans->segment.format == GST_FORMAT_TIME) runtimestamp = gst_segment_to_running_time (&trans->segment, @@ -640,6 +657,9 @@ gst_identity_set_property (GObject * object, guint prop_id, case PROP_CHECK_IMPERFECT_OFFSET: identity->check_imperfect_offset = g_value_get_boolean (value); break; + case PROP_SIGNAL_HANDOFFS: + identity->signal_handoffs = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -693,6 +713,9 @@ gst_identity_get_property (GObject * object, guint prop_id, GValue * value, case PROP_CHECK_IMPERFECT_OFFSET: g_value_set_boolean (value, identity->check_imperfect_offset); break; + case PROP_SIGNAL_HANDOFFS: + g_value_set_boolean (value, identity->signal_handoffs); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h index 2ab66d78ae..fabc66788e 100644 --- a/plugins/elements/gstidentity.h +++ b/plugins/elements/gstidentity.h @@ -72,6 +72,7 @@ struct _GstIdentity { guint64 prev_offset_end; gchar *last_message; guint64 offset; + gboolean signal_handoffs; }; struct _GstIdentityClass {