validate: Allow passing a GST_VALIDATE_CONFIG as a string

Instead of forcing user to put it in a file.
We are simply using the GstCaps synthax to parse it.
This commit is contained in:
Thibault Saunier 2016-09-21 16:00:18 -03:00
parent e247122051
commit 1fb0f02d6a
2 changed files with 18 additions and 1 deletions

View File

@ -85,7 +85,8 @@
<title><envar>GST_VALIDATE_CONFIG</envar></title> <title><envar>GST_VALIDATE_CONFIG</envar></title>
<para> <para>
Set this variable to a colon-separated list of paths to GstValidate config files. Set this variable to a colon-separated list of paths to GstValidate config files or
directly as a string in the GstCaps serialization format.
The config file has a format similar to the scenario file. The name of the configuration The config file has a format similar to the scenario file. The name of the configuration
corresponds to the name of the plugin the configuration applies to. corresponds to the name of the plugin the configuration applies to.
</para> </para>

View File

@ -157,6 +157,22 @@ gst_validate_plugin_get_config (GstPlugin * plugin)
} }
g_strfreev (tmp); g_strfreev (tmp);
if (!plugin_conf) {
GstCaps *confs;
confs = gst_caps_from_string (config);
if (confs) {
gint i;
for (i = 0; i < gst_caps_get_size (confs); i++)
plugin_conf = g_list_append (plugin_conf,
gst_structure_copy (gst_caps_get_structure (confs, i)));
gst_caps_unref (confs);
}
}
if (plugin) if (plugin)
g_object_set_data_full (G_OBJECT (plugin), GST_VALIDATE_PLUGIN_CONFIG, g_object_set_data_full (G_OBJECT (plugin), GST_VALIDATE_PLUGIN_CONFIG,
plugin_conf, _free_plugin_config); plugin_conf, _free_plugin_config);