clapper: enhancers-loader: Support loading extra enhancers

Allow setting an additional dir(s) with "CLAPPER_ENHANCERS_EXTRA_PATH" env.

This should allow to add other enhancers without removing default ones.
If app/user needs to remove default ones, "CLAPPER_ENHANCERS_PATH" env
can be set to empty.
This commit is contained in:
Rafał Dzięgiel
2025-01-19 15:45:55 +01:00
parent 8752d08113
commit 4df812066f

View File

@@ -84,6 +84,7 @@ clapper_enhancers_loader_initialize (void)
peas_engine_enable_loader (_engine, "python");
peas_engine_enable_loader (_engine, "gjs");
load_enhancers:
dir_paths = g_strsplit (enhancers_path, G_SEARCHPATH_SEPARATOR_S, 0);
for (i = 0; dir_paths[i]; ++i)
@@ -91,6 +92,11 @@ clapper_enhancers_loader_initialize (void)
g_strfreev (dir_paths);
/* Support loading additional enhancers from non-default directory */
enhancers_path = g_getenv ("CLAPPER_ENHANCERS_EXTRA_PATH");
if (enhancers_path && *enhancers_path != '\0')
goto load_enhancers;
if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >= GST_LEVEL_INFO) {
GListModel *list = (GListModel *) _engine;
guint n_items = g_list_model_get_n_items (list);