validate:override: Add a vmethod to check whether a monitor can attach it

Summary: Depends on D206

Reviewers: Mathieu_Du

Differential Revision: http://phabricator.freedesktop.org/D207
This commit is contained in:
Thibault Saunier 2015-05-26 15:57:29 +02:00
parent 38df412a54
commit ba0ab132f9
3 changed files with 24 additions and 0 deletions

View file

@ -317,6 +317,13 @@ gst_validate_monitor_attach_override (GstValidateMonitor * monitor,
{
GstValidateRunner *runner;
if (!gst_validate_override_can_attach (override, monitor)) {
GST_INFO_OBJECT (monitor, "Can not attach override %s",
gst_validate_reporter_get_name (GST_VALIDATE_REPORTER (override)));
return;
}
runner = gst_validate_reporter_get_runner (GST_VALIDATE_REPORTER (override));
GST_VALIDATE_MONITOR_OVERRIDES_LOCK (monitor);

View file

@ -251,3 +251,15 @@ gst_validate_override_setcaps_handler (GstValidateOverride * override,
if (override->setcaps_handler)
override->setcaps_handler (override, monitor, caps);
}
gboolean
gst_validate_override_can_attach (GstValidateOverride * override,
GstValidateMonitor * monitor)
{
GstValidateOverrideClass *klass = GST_VALIDATE_OVERRIDE_GET_CLASS (override);
if (klass->can_attach)
return klass->can_attach (override, monitor);
return TRUE;
}

View file

@ -51,6 +51,10 @@ struct _GstValidateOverrideClass
{
/*<private>*/
GObjectClass parent_class;
gboolean (*can_attach)(GstValidateOverride * override,
GstValidateMonitor * monitor);
};
struct _GstValidateOverride
@ -97,6 +101,7 @@ void gst_validate_override_set_query_handler (GstValidateOverride
void gst_validate_override_set_buffer_probe_handler (GstValidateOverride * override, GstValidateOverrideBufferHandler handler);
void gst_validate_override_set_getcaps_handler (GstValidateOverride * override, GstValidateOverrideGetCapsHandler handler);
void gst_validate_override_set_setcaps_handler (GstValidateOverride * override, GstValidateOverrideSetCapsHandler handler);
gboolean gst_validate_override_can_attach (GstValidateOverride * override, GstValidateMonitor *monitor);
G_END_DECLS