bin-monitor: Add a way to specify pipelines on which to set scenarios

When used with LD_PRELOAD,  the application might use various pipelines
for several different thing, we need to make it possible to spcify a
specific pipeline (or set of pipelines) on which to run the scenario.

The format is in the form of:
            scenario_name:pipelinename_pattern*
This commit is contained in:
Thibault Saunier 2013-09-09 19:05:24 -03:00
parent 5cea134655
commit 711946879e

View file

@ -94,11 +94,25 @@ gst_validate_bin_monitor_create_scenarios (GstValidateBinMonitor * monitor)
const gchar *scenario_name; const gchar *scenario_name;
if ((scenario_name = g_getenv ("GST_VALIDATE_SCENARIO"))) { if ((scenario_name = g_getenv ("GST_VALIDATE_SCENARIO"))) {
gchar **scenario_v = g_strsplit (scenario_name, ":", 2);
if (scenario_v[1] && GST_VALIDATE_MONITOR_GET_OBJECT (monitor)) {
if (!g_pattern_match_simple (scenario_v[1],
GST_OBJECT_NAME (GST_VALIDATE_MONITOR_GET_OBJECT (monitor)))) {
GST_INFO_OBJECT (monitor, "Not attaching to bin %" GST_PTR_FORMAT
" as not matching pattern %s",
GST_VALIDATE_MONITOR_GET_OBJECT (monitor), scenario_v[1]);
g_strfreev (scenario_v);
return;
}
}
monitor->scenario = monitor->scenario =
gst_validate_scenario_factory_create (GST_VALIDATE_MONITOR_GET_RUNNER gst_validate_scenario_factory_create (GST_VALIDATE_MONITOR_GET_RUNNER
(monitor), (monitor),
GST_ELEMENT_CAST (GST_VALIDATE_MONITOR_GET_OBJECT (monitor)), GST_ELEMENT_CAST (GST_VALIDATE_MONITOR_GET_OBJECT (monitor)),
scenario_name); scenario_v[0]);
g_strfreev (scenario_v);
} }
} }
} }