mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-03 02:33:53 +00:00
validate: Handle having a list of structure based/file path configs
This commit is contained in:
parent
a70658a464
commit
b9ea967275
1 changed files with 43 additions and 44 deletions
|
@ -90,29 +90,6 @@ _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) {
|
|
||||||
GstStructure *structure = tmp->data;
|
|
||||||
|
|
||||||
if (gst_structure_has_name (structure, suffix))
|
|
||||||
result = g_list_append (result, structure);
|
|
||||||
else
|
|
||||||
gst_structure_free (structure);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (structures);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copied from gststructure.c to avoid assertion */
|
/* Copied from gststructure.c to avoid assertion */
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_structure_validate_name (const gchar * name)
|
gst_structure_validate_name (const gchar * name)
|
||||||
|
@ -143,6 +120,49 @@ gst_structure_validate_name (const gchar * name)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
create_config (const gchar * config, const gchar * suffix)
|
||||||
|
{
|
||||||
|
GList *structures = NULL, *tmp, *result = NULL;
|
||||||
|
|
||||||
|
if (!suffix)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
structures = gst_validate_utils_structs_parse_from_filename (config);
|
||||||
|
if (!structures) {
|
||||||
|
GstCaps *confs = NULL;
|
||||||
|
|
||||||
|
if (gst_structure_validate_name (config))
|
||||||
|
confs = gst_caps_from_string (config);
|
||||||
|
|
||||||
|
if (confs) {
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
for (i = 0; i < gst_caps_get_size (confs); i++) {
|
||||||
|
GstStructure *structure = gst_caps_get_structure (confs, i);
|
||||||
|
|
||||||
|
if (gst_structure_has_name (structure, suffix))
|
||||||
|
structures =
|
||||||
|
g_list_append (structures, gst_structure_copy (structure));
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_caps_unref (confs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (tmp = structures; tmp; tmp = tmp->next) {
|
||||||
|
GstStructure *structure = tmp->data;
|
||||||
|
|
||||||
|
if (gst_structure_has_name (structure, suffix))
|
||||||
|
result = g_list_append (result, structure);
|
||||||
|
else
|
||||||
|
gst_structure_free (structure);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free (structures);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_validate_plugin_get_config:
|
* gst_validate_plugin_get_config:
|
||||||
* @plugin, a #GstPlugin, or #NULL
|
* @plugin, a #GstPlugin, or #NULL
|
||||||
|
@ -188,27 +208,6 @@ gst_validate_plugin_get_config (GstPlugin * plugin)
|
||||||
}
|
}
|
||||||
g_strfreev (tmp);
|
g_strfreev (tmp);
|
||||||
|
|
||||||
if (!plugin_conf) {
|
|
||||||
GstCaps *confs = NULL;
|
|
||||||
|
|
||||||
if (gst_structure_validate_name (config))
|
|
||||||
confs = gst_caps_from_string (config);
|
|
||||||
|
|
||||||
if (confs) {
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
for (i = 0; i < gst_caps_get_size (confs); i++) {
|
|
||||||
GstStructure *structure = gst_caps_get_structure (confs, i);
|
|
||||||
|
|
||||||
if (gst_structure_has_name (structure, suffix))
|
|
||||||
plugin_conf =
|
|
||||||
g_list_append (plugin_conf, gst_structure_copy (structure));
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue