mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
frei0r: Use correct order of directories to search for plugins
And don't fail if a plugin was already registered. Frei0r allows plugins in directories with higher importance to override plugins from directories with lower importance.
This commit is contained in:
parent
2dba63a19c
commit
7d4fcdc5cf
8 changed files with 49 additions and 26 deletions
|
@ -460,7 +460,7 @@ static gboolean
|
||||||
register_plugin (GstPlugin * plugin, const gchar * filename)
|
register_plugin (GstPlugin * plugin, const gchar * filename)
|
||||||
{
|
{
|
||||||
GModule *module;
|
GModule *module;
|
||||||
gboolean ret = FALSE;
|
GstFrei0rPluginRegisterReturn ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED;
|
||||||
GstFrei0rFuncTable ftable = { NULL, };
|
GstFrei0rFuncTable ftable = { NULL, };
|
||||||
gint i;
|
gint i;
|
||||||
f0r_plugin_info_t info = { NULL, };
|
f0r_plugin_info_t info = { NULL, };
|
||||||
|
@ -560,10 +560,24 @@ register_plugin (GstPlugin * plugin, const gchar * filename)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ret)
|
switch (ret) {
|
||||||
goto invalid_frei0r_plugin;
|
case GST_FREI0R_PLUGIN_REGISTER_RETURN_OK:
|
||||||
|
return TRUE;
|
||||||
|
case GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED:
|
||||||
|
GST_ERROR ("Failed to register frei0r plugin");
|
||||||
|
ftable.deinit ();
|
||||||
|
g_module_close (module);
|
||||||
|
return FALSE;
|
||||||
|
case GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED:
|
||||||
|
GST_DEBUG ("frei0r plugin already registered");
|
||||||
|
ftable.deinit ();
|
||||||
|
g_module_close (module);
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
g_return_val_if_reached (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
g_return_val_if_reached (FALSE);
|
||||||
|
|
||||||
invalid_frei0r_plugin:
|
invalid_frei0r_plugin:
|
||||||
GST_ERROR ("Invalid frei0r plugin");
|
GST_ERROR ("Invalid frei0r plugin");
|
||||||
|
@ -620,14 +634,14 @@ plugin_init (GstPlugin * plugin)
|
||||||
"/usr/lib/frei0r-1:/usr/local/lib/frei0r-1",
|
"/usr/lib/frei0r-1:/usr/local/lib/frei0r-1",
|
||||||
NULL, GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
|
NULL, GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
|
||||||
|
|
||||||
register_plugins (plugin, "/usr/lib/frei0r-1");
|
|
||||||
register_plugins (plugin, "/usr/local/lib/frei0r-1");
|
|
||||||
|
|
||||||
homedir = g_get_home_dir ();
|
homedir = g_get_home_dir ();
|
||||||
path = g_build_filename (homedir, ".frei0r-1", NULL);
|
path = g_build_filename (homedir, ".frei0r-1", NULL);
|
||||||
register_plugins (plugin, path);
|
register_plugins (plugin, path);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
|
register_plugins (plugin, "/usr/local/lib/frei0r-1");
|
||||||
|
register_plugins (plugin, "/usr/lib/frei0r-1");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,12 @@ struct _GstFrei0rFuncTable {
|
||||||
uint32_t* outframe);
|
uint32_t* outframe);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GST_FREI0R_PLUGIN_REGISTER_RETURN_OK,
|
||||||
|
GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED,
|
||||||
|
GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED
|
||||||
|
} GstFrei0rPluginRegisterReturn;
|
||||||
|
|
||||||
void gst_frei0r_klass_install_properties (GObjectClass *gobject_class, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties);
|
void gst_frei0r_klass_install_properties (GObjectClass *gobject_class, GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties);
|
||||||
|
|
||||||
f0r_instance_t * gst_frei0r_instance_construct (GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, gint width, gint height);
|
f0r_instance_t * gst_frei0r_instance_construct (GstFrei0rFuncTable *ftable, GstFrei0rProperty *properties, gint n_properties, GstFrei0rPropertyValue *property_cache, gint width, gint height);
|
||||||
|
|
|
@ -226,7 +226,7 @@ gst_frei0r_filter_init (GstFrei0rFilter * self, GstFrei0rFilterClass * klass)
|
||||||
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SRC_PAD (self));
|
gst_pad_use_fixed_caps (GST_BASE_TRANSFORM_SRC_PAD (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
GstFrei0rPluginRegisterReturn
|
||||||
gst_frei0r_filter_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
gst_frei0r_filter_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
const GstFrei0rFuncTable * ftable)
|
const GstFrei0rFuncTable * ftable)
|
||||||
{
|
{
|
||||||
|
@ -244,7 +244,7 @@ gst_frei0r_filter_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
GType type;
|
GType type;
|
||||||
gchar *type_name, *tmp;
|
gchar *type_name, *tmp;
|
||||||
GstFrei0rFilterClassData *class_data;
|
GstFrei0rFilterClassData *class_data;
|
||||||
gboolean ret = FALSE;
|
GstFrei0rPluginRegisterReturn ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED;
|
||||||
|
|
||||||
tmp = g_strdup_printf ("frei0r-filter-%s", info->name);
|
tmp = g_strdup_printf ("frei0r-filter-%s", info->name);
|
||||||
type_name = g_ascii_strdown (tmp, -1);
|
type_name = g_ascii_strdown (tmp, -1);
|
||||||
|
@ -252,8 +252,8 @@ gst_frei0r_filter_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-');
|
g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-');
|
||||||
|
|
||||||
if (g_type_from_name (type_name)) {
|
if (g_type_from_name (type_name)) {
|
||||||
GST_WARNING ("Type '%s' already exists", type_name);
|
GST_DEBUG ("Type '%s' already exists", type_name);
|
||||||
return FALSE;
|
return GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
class_data = g_new0 (GstFrei0rFilterClassData, 1);
|
class_data = g_new0 (GstFrei0rFilterClassData, 1);
|
||||||
|
@ -263,7 +263,8 @@ gst_frei0r_filter_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
|
|
||||||
type =
|
type =
|
||||||
g_type_register_static (GST_TYPE_VIDEO_FILTER, type_name, &typeinfo, 0);
|
g_type_register_static (GST_TYPE_VIDEO_FILTER, type_name, &typeinfo, 0);
|
||||||
ret = gst_element_register (plugin, type_name, GST_RANK_NONE, type);
|
if (gst_element_register (plugin, type_name, GST_RANK_NONE, type))
|
||||||
|
ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_OK;
|
||||||
|
|
||||||
g_free (type_name);
|
g_free (type_name);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct _GstFrei0rFilterClass {
|
||||||
gint n_properties;
|
gint n_properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean gst_frei0r_filter_register (GstPlugin *plugin, const f0r_plugin_info_t *info, const GstFrei0rFuncTable *ftable);
|
GstFrei0rPluginRegisterReturn gst_frei0r_filter_register (GstPlugin *plugin, const f0r_plugin_info_t *info, const GstFrei0rFuncTable *ftable);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -767,7 +767,7 @@ gst_frei0r_mixer_init (GstFrei0rMixer * self, GstFrei0rMixerClass * klass)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
GstFrei0rPluginRegisterReturn
|
||||||
gst_frei0r_mixer_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
gst_frei0r_mixer_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
const GstFrei0rFuncTable * ftable)
|
const GstFrei0rFuncTable * ftable)
|
||||||
{
|
{
|
||||||
|
@ -785,10 +785,10 @@ gst_frei0r_mixer_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
GType type;
|
GType type;
|
||||||
gchar *type_name, *tmp;
|
gchar *type_name, *tmp;
|
||||||
GstFrei0rMixerClassData *class_data;
|
GstFrei0rMixerClassData *class_data;
|
||||||
gboolean ret = FALSE;
|
GstFrei0rPluginRegisterReturn ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED;
|
||||||
|
|
||||||
if (ftable->update2 == NULL)
|
if (ftable->update2 == NULL)
|
||||||
return FALSE;
|
return GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED;
|
||||||
|
|
||||||
tmp = g_strdup_printf ("frei0r-mixer-%s", info->name);
|
tmp = g_strdup_printf ("frei0r-mixer-%s", info->name);
|
||||||
type_name = g_ascii_strdown (tmp, -1);
|
type_name = g_ascii_strdown (tmp, -1);
|
||||||
|
@ -796,8 +796,8 @@ gst_frei0r_mixer_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-');
|
g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-');
|
||||||
|
|
||||||
if (g_type_from_name (type_name)) {
|
if (g_type_from_name (type_name)) {
|
||||||
GST_WARNING ("Type '%s' already exists", type_name);
|
GST_DEBUG ("Type '%s' already exists", type_name);
|
||||||
return FALSE;
|
return GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
class_data = g_new0 (GstFrei0rMixerClassData, 1);
|
class_data = g_new0 (GstFrei0rMixerClassData, 1);
|
||||||
|
@ -806,7 +806,8 @@ gst_frei0r_mixer_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
typeinfo.class_data = class_data;
|
typeinfo.class_data = class_data;
|
||||||
|
|
||||||
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
||||||
ret = gst_element_register (plugin, type_name, GST_RANK_NONE, type);
|
if (gst_element_register (plugin, type_name, GST_RANK_NONE, type))
|
||||||
|
ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_OK;
|
||||||
|
|
||||||
g_free (type_name);
|
g_free (type_name);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct _GstFrei0rMixerClass {
|
||||||
gint n_properties;
|
gint n_properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean gst_frei0r_mixer_register (GstPlugin *plugin, const f0r_plugin_info_t *info, const GstFrei0rFuncTable *ftable);
|
GstFrei0rPluginRegisterReturn gst_frei0r_mixer_register (GstPlugin *plugin, const f0r_plugin_info_t *info, const GstFrei0rFuncTable *ftable);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ gst_frei0r_src_init (GstFrei0rSrc * self, GstFrei0rSrcClass * klass)
|
||||||
gst_base_src_set_format (GST_BASE_SRC_CAST (self), GST_FORMAT_TIME);
|
gst_base_src_set_format (GST_BASE_SRC_CAST (self), GST_FORMAT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
GstFrei0rPluginRegisterReturn
|
||||||
gst_frei0r_src_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
gst_frei0r_src_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
const GstFrei0rFuncTable * ftable)
|
const GstFrei0rFuncTable * ftable)
|
||||||
{
|
{
|
||||||
|
@ -409,7 +409,7 @@ gst_frei0r_src_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
GType type;
|
GType type;
|
||||||
gchar *type_name, *tmp;
|
gchar *type_name, *tmp;
|
||||||
GstFrei0rSrcClassData *class_data;
|
GstFrei0rSrcClassData *class_data;
|
||||||
gboolean ret = FALSE;
|
GstFrei0rPluginRegisterReturn ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_FAILED;
|
||||||
|
|
||||||
tmp = g_strdup_printf ("frei0r-src-%s", info->name);
|
tmp = g_strdup_printf ("frei0r-src-%s", info->name);
|
||||||
type_name = g_ascii_strdown (tmp, -1);
|
type_name = g_ascii_strdown (tmp, -1);
|
||||||
|
@ -417,8 +417,8 @@ gst_frei0r_src_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-');
|
g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-');
|
||||||
|
|
||||||
if (g_type_from_name (type_name)) {
|
if (g_type_from_name (type_name)) {
|
||||||
GST_WARNING ("Type '%s' already exists", type_name);
|
GST_DEBUG ("Type '%s' already exists", type_name);
|
||||||
return FALSE;
|
return GST_FREI0R_PLUGIN_REGISTER_RETURN_ALREADY_REGISTERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
class_data = g_new0 (GstFrei0rSrcClassData, 1);
|
class_data = g_new0 (GstFrei0rSrcClassData, 1);
|
||||||
|
@ -427,7 +427,8 @@ gst_frei0r_src_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
|
||||||
typeinfo.class_data = class_data;
|
typeinfo.class_data = class_data;
|
||||||
|
|
||||||
type = g_type_register_static (GST_TYPE_PUSH_SRC, type_name, &typeinfo, 0);
|
type = g_type_register_static (GST_TYPE_PUSH_SRC, type_name, &typeinfo, 0);
|
||||||
ret = gst_element_register (plugin, type_name, GST_RANK_NONE, type);
|
if (gst_element_register (plugin, type_name, GST_RANK_NONE, type))
|
||||||
|
ret = GST_FREI0R_PLUGIN_REGISTER_RETURN_OK;
|
||||||
|
|
||||||
g_free (type_name);
|
g_free (type_name);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct _GstFrei0rSrcClass {
|
||||||
gint n_properties;
|
gint n_properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean gst_frei0r_src_register (GstPlugin *plugin, const f0r_plugin_info_t *info, const GstFrei0rFuncTable *ftable);
|
GstFrei0rPluginRegisterReturn gst_frei0r_src_register (GstPlugin *plugin, const f0r_plugin_info_t *info, const GstFrei0rFuncTable *ftable);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue