plugin: Add prefix support to dependencies

This adds a new flags, GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX,
which allow using the names as prefix for plugin depencies.

https://bugzilla.gnome.org/show_bug.cgi?id=758083
This commit is contained in:
Nicolas Dufresne 2015-11-13 17:32:57 -05:00
parent 79b935b304
commit c47e1383ca
2 changed files with 13 additions and 3 deletions

View file

@ -1513,6 +1513,9 @@ gst_plugin_ext_dep_direntry_matches (GstPlugin * plugin, const gchar * entry,
if (((flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX)) &&
g_str_has_suffix (entry, *filenames)) {
return TRUE;
} else if (((flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX)) &&
g_str_has_prefix (entry, *filenames)) {
return TRUE;
/* else it's an exact match that's needed */
} else if (strcmp (entry, *filenames) == 0) {
return TRUE;
@ -1589,7 +1592,7 @@ gst_plugin_ext_dep_scan_path_with_filenames (GstPlugin * plugin,
GstPluginDependencyFlags flags)
{
const gchar *empty_filenames[] = { "", NULL };
gboolean recurse_into_dirs, partial_names;
gboolean recurse_into_dirs, partial_names = FALSE;
guint i, hash = 0;
/* to avoid special-casing below (FIXME?) */
@ -1597,7 +1600,10 @@ gst_plugin_ext_dep_scan_path_with_filenames (GstPlugin * plugin,
filenames = empty_filenames;
recurse_into_dirs = ! !(flags & GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
partial_names = ! !(flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX);
if ((flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX) ||
(flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX))
partial_names = TRUE;
/* if we can construct the exact paths to check with the data we have, just
* stat them one by one; this is more efficient than opening the directory

View file

@ -93,6 +93,9 @@ typedef enum
* @GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX : interpret
* filename argument as filter suffix and check all matching files in
* the directory
* @GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX : interpret
* filename argument as filter prefix and check all matching files in
* the directory. Since 1.8.
*
* Flags used in connection with gst_plugin_add_dependency().
*/
@ -100,7 +103,8 @@ typedef enum {
GST_PLUGIN_DEPENDENCY_FLAG_NONE = 0,
GST_PLUGIN_DEPENDENCY_FLAG_RECURSE = (1 << 0),
GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY = (1 << 1),
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX = (1 << 2)
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX = (1 << 2),
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX = (1 << 3)
} GstPluginDependencyFlags;
/**