mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-06 14:32:31 +00:00
validate: factor out create_config()
Reviewers: thiblahute Differential Revision: http://phabricator.freedesktop.org/D157
This commit is contained in:
parent
63ca026b03
commit
c2fef15266
1 changed files with 23 additions and 8 deletions
|
@ -88,23 +88,38 @@ _free_plugin_config (gpointer data)
|
||||||
g_list_free_full (data, (GDestroyNotify) gst_structure_free);
|
g_list_free_full (data, (GDestroyNotify) gst_structure_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
create_config (const gchar * path, const gchar * suffix)
|
||||||
|
{
|
||||||
|
GList *structures = NULL, *tmp, *result = NULL;
|
||||||
|
|
||||||
|
if (!suffix)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
structures = gst_validate_utils_structs_parse_from_filename (path);
|
||||||
|
|
||||||
|
for (tmp = structures; tmp; tmp = tmp->next) {
|
||||||
|
if (gst_structure_has_name (tmp->data, suffix))
|
||||||
|
result = g_list_append (result, tmp->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
GList *
|
GList *
|
||||||
gst_validate_plugin_get_config (GstPlugin * plugin)
|
gst_validate_plugin_get_config (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
GList *structures = NULL, *tmp, *plugin_conf = NULL;
|
GList *plugin_conf;
|
||||||
const gchar *config = g_getenv ("GST_VALIDATE_CONFIG");
|
const gchar *suffix;
|
||||||
|
|
||||||
if ((plugin_conf =
|
if ((plugin_conf =
|
||||||
g_object_get_data (G_OBJECT (plugin), GST_VALIDATE_PLUGIN_CONFIG)))
|
g_object_get_data (G_OBJECT (plugin), GST_VALIDATE_PLUGIN_CONFIG)))
|
||||||
return plugin_conf;
|
return plugin_conf;
|
||||||
|
|
||||||
if (config)
|
suffix = gst_plugin_get_name (plugin);
|
||||||
structures = gst_validate_utils_structs_parse_from_filename (config);
|
|
||||||
|
plugin_conf = create_config (g_getenv ("GST_VALIDATE_CONFIG"), suffix);
|
||||||
|
|
||||||
for (tmp = structures; tmp; tmp = tmp->next) {
|
|
||||||
if (gst_structure_has_name (tmp->data, gst_plugin_get_name (plugin)))
|
|
||||||
plugin_conf = g_list_append (plugin_conf, tmp->data);
|
|
||||||
}
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue