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
This commit is contained in:
Nicolas Dufresne 2017-09-06 10:01:58 -04:00
parent 1cd0dd3503
commit 2cc5c539a3
2 changed files with 21 additions and 1 deletions

View file

@ -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) {

View file

@ -78,6 +78,7 @@ struct _GstIdentity {
GCond blocked_cond;
gboolean blocked;
GstClockTimeDiff ts_offset;
gboolean drop_allocation;
};
struct _GstIdentityClass {