mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
validate: factor out gst_validate_element_matches_target()
This commit is contained in:
parent
4602ee61c4
commit
40f263e857
3 changed files with 36 additions and 18 deletions
|
@ -3740,24 +3740,7 @@ iterate_children (GstValidateScenario * scenario, GstBin * bin)
|
||||||
static gboolean
|
static gboolean
|
||||||
should_execute_action (GstElement * element, GstValidateAction * action)
|
should_execute_action (GstElement * element, GstValidateAction * action)
|
||||||
{
|
{
|
||||||
const gchar *tmp;
|
return gst_validate_element_matches_target (element, action->structure);
|
||||||
|
|
||||||
tmp = gst_structure_get_string (action->structure, "target-element-name");
|
|
||||||
if (tmp != NULL && !strcmp (tmp, GST_ELEMENT_NAME (element)))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
tmp = gst_structure_get_string (action->structure, "target-element-klass");
|
|
||||||
if (tmp != NULL && gst_validate_element_has_klass (element, tmp))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
tmp =
|
|
||||||
gst_structure_get_string (action->structure,
|
|
||||||
"target-element-factory-name");
|
|
||||||
if (tmp != NULL && gst_element_get_factory (element)
|
|
||||||
&& !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (element)), tmp))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -907,3 +907,35 @@ gst_validate_spin_on_fault_signals (void)
|
||||||
fault_setup ();
|
fault_setup ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_validate_element_matches_target:
|
||||||
|
* @element: a #GstElement to check
|
||||||
|
* @structure: a #GstStructure to use for matching
|
||||||
|
*
|
||||||
|
* Check if @element matches one of the 'target-element-name',
|
||||||
|
* 'target-element-klass' or 'target-element-factory-name' defined in @s.
|
||||||
|
*
|
||||||
|
* Return: %TRUE if it matches, %FALSE otherwise or if @s doesn't contain any
|
||||||
|
* target-element field.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_validate_element_matches_target (GstElement * element, GstStructure * s)
|
||||||
|
{
|
||||||
|
const gchar *tmp;
|
||||||
|
|
||||||
|
tmp = gst_structure_get_string (s, "target-element-name");
|
||||||
|
if (tmp != NULL && !strcmp (tmp, GST_ELEMENT_NAME (element)))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
tmp = gst_structure_get_string (s, "target-element-klass");
|
||||||
|
if (tmp != NULL && gst_validate_element_has_klass (element, tmp))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
tmp = gst_structure_get_string (s, "target-element-factory-name");
|
||||||
|
if (tmp != NULL && gst_element_get_factory (element)
|
||||||
|
&& !g_strcmp0 (GST_OBJECT_NAME (gst_element_get_factory (element)), tmp))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -67,4 +67,7 @@ GstValidateActionReturn gst_validate_object_set_property (GstValidateReporter *
|
||||||
GST_VALIDATE_API
|
GST_VALIDATE_API
|
||||||
void gst_validate_spin_on_fault_signals (void);
|
void gst_validate_spin_on_fault_signals (void);
|
||||||
|
|
||||||
|
GST_VALIDATE_API
|
||||||
|
gboolean gst_validate_element_matches_target (GstElement * element, GstStructure * s);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue