From 2cc5c539a3afb8d887990b22fc62a43111281cb5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 6 Sep 2017 10:01:58 -0400 Subject: identity: Add a drop-allocation property When enabled, this property will make the allocation query fail. This is the same as one could have done using a tee before the tee started implementing the allocation query. https://bugzilla.gnome.org/show_bug.cgi?id=730758 --- plugins/elements/gstidentity.c | 21 ++++++++++++++++++++- plugins/elements/gstidentity.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 6867c3eba..d44709ec2 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -74,6 +74,7 @@ enum #define DEFAULT_CHECK_IMPERFECT_OFFSET FALSE #define DEFAULT_SIGNAL_HANDOFFS TRUE #define DEFAULT_TS_OFFSET 0 +#define DEFAULT_DROP_ALLOCATION FALSE enum { @@ -91,7 +92,8 @@ enum PROP_TS_OFFSET, PROP_CHECK_IMPERFECT_TIMESTAMP, PROP_CHECK_IMPERFECT_OFFSET, - PROP_SIGNAL_HANDOFFS + PROP_SIGNAL_HANDOFFS, + PROP_DROP_ALLOCATION }; @@ -230,6 +232,11 @@ gst_identity_class_init (GstIdentityClass * klass) "Signal handoffs", "Send a signal before pushing the buffer", DEFAULT_SIGNAL_HANDOFFS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_DROP_ALLOCATION, + g_param_spec_boolean ("drop-allocation", "Drop allocation query", + "Don't forward allocation queries", DEFAULT_DROP_ALLOCATION, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstIdentity::handoff: * @identity: the identity instance @@ -759,6 +766,9 @@ gst_identity_set_property (GObject * object, guint prop_id, case PROP_SIGNAL_HANDOFFS: identity->signal_handoffs = g_value_get_boolean (value); break; + case PROP_DROP_ALLOCATION: + identity->drop_allocation = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -822,6 +832,9 @@ gst_identity_get_property (GObject * object, guint prop_id, GValue * value, case PROP_SIGNAL_HANDOFFS: g_value_set_boolean (value, identity->signal_handoffs); break; + case PROP_DROP_ALLOCATION: + g_value_set_boolean (value, identity->drop_allocation); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -887,6 +900,12 @@ gst_identity_query (GstBaseTransform * base, GstPadDirection direction, identity = GST_IDENTITY (base); + if (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION && + identity->drop_allocation) { + GST_DEBUG_OBJECT (identity, "Dropping allocation query."); + return FALSE; + } + ret = GST_BASE_TRANSFORM_CLASS (parent_class)->query (base, direction, query); if (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY) { diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h index e622b491a..e9027324c 100644 --- a/plugins/elements/gstidentity.h +++ b/plugins/elements/gstidentity.h @@ -78,6 +78,7 @@ struct _GstIdentity { GCond blocked_cond; gboolean blocked; GstClockTimeDiff ts_offset; + gboolean drop_allocation; }; struct _GstIdentityClass { -- cgit v1.2.3