mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
validate: overrides: Add a hook about newly added elements in a bin
This commit is contained in:
parent
e0484a7cdd
commit
6439494f40
3 changed files with 45 additions and 0 deletions
|
@ -203,6 +203,22 @@ gst_validate_bin_monitor_new (GstBin * bin, GstValidateRunner * runner,
|
|||
return monitor;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_bin_child_added_overrides (GstValidateMonitor * monitor,
|
||||
GstElement * element)
|
||||
{
|
||||
GList *iter;
|
||||
|
||||
GST_VALIDATE_MONITOR_OVERRIDES_LOCK (monitor);
|
||||
for (iter = GST_VALIDATE_MONITOR_OVERRIDES (monitor).head; iter;
|
||||
iter = g_list_next (iter)) {
|
||||
GstValidateOverride *override = iter->data;
|
||||
|
||||
gst_validate_override_element_added_handler (override, monitor, element);
|
||||
}
|
||||
GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK (monitor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_validate_bin_monitor_setup (GstValidateMonitor * monitor)
|
||||
{
|
||||
|
@ -279,6 +295,8 @@ gst_validate_bin_monitor_wrap_element (GstValidateBinMonitor * monitor,
|
|||
GST_VALIDATE_ELEMENT_MONITOR_CAST (gst_validate_monitor_factory_create
|
||||
(GST_OBJECT_CAST (element), runner, GST_VALIDATE_MONITOR_CAST (monitor)));
|
||||
g_return_if_fail (element_monitor != NULL);
|
||||
gst_validate_bin_child_added_overrides (GST_VALIDATE_MONITOR (monitor),
|
||||
element);
|
||||
|
||||
GST_VALIDATE_MONITOR_LOCK (monitor);
|
||||
monitor->element_monitors = g_list_prepend (monitor->element_monitors,
|
||||
|
|
|
@ -288,6 +288,27 @@ gst_validate_override_setcaps_handler (GstValidateOverride * override,
|
|||
override->setcaps_handler (override, monitor, caps);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_validate_override_element_added_handler: (skip):
|
||||
*/
|
||||
void
|
||||
gst_validate_override_element_added_handler (GstValidateOverride * override,
|
||||
GstValidateMonitor * monitor, GstElement * child)
|
||||
{
|
||||
if (override->element_added_handler)
|
||||
override->element_added_handler (override, monitor, child);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_validate_override_set_element_added_handler: (skip):
|
||||
*/
|
||||
void
|
||||
gst_validate_override_set_element_added_handler (GstValidateOverride * override,
|
||||
GstValidateOverrideElementAddedHandler func)
|
||||
{
|
||||
override->element_added_handler = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_validate_override_can_attach: (skip):
|
||||
*/
|
||||
|
|
|
@ -45,6 +45,8 @@ typedef void (*GstValidateOverrideGetCapsHandler)(GstValidateOverride * override
|
|||
GstValidateMonitor * pad_monitor, GstCaps * caps);
|
||||
typedef void (*GstValidateOverrideSetCapsHandler)(GstValidateOverride * override,
|
||||
GstValidateMonitor * pad_monitor, GstCaps * caps);
|
||||
typedef void (*GstValidateOverrideElementAddedHandler)(GstValidateOverride * override,
|
||||
GstValidateMonitor * bin_monitor, GstElement * new_child);
|
||||
|
||||
struct _GstValidateOverrideClass
|
||||
{
|
||||
|
@ -66,6 +68,7 @@ struct _GstValidateOverride
|
|||
GstValidateOverrideBufferHandler buffer_probe_handler;
|
||||
GstValidateOverrideGetCapsHandler getcaps_handler;
|
||||
GstValidateOverrideSetCapsHandler setcaps_handler;
|
||||
GstValidateOverrideElementAddedHandler element_added_handler;
|
||||
|
||||
/*<private>*/
|
||||
GstValidateOverridePriv *priv;
|
||||
|
@ -100,6 +103,9 @@ 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);
|
||||
void gst_validate_override_element_added_handler (GstValidateOverride * override, GstValidateMonitor * monitor, GstElement * child);
|
||||
void gst_validate_override_set_element_added_handler (GstValidateOverride * override, GstValidateOverrideElementAddedHandler func);
|
||||
|
||||
gboolean gst_validate_override_can_attach (GstValidateOverride * override, GstValidateMonitor *monitor);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue