summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-06-16 21:34:56 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-06-19 11:03:16 +0200
commit29aa30d9a05bf6c408160de108f2486a0c08bd48 (patch)
treedc3ac77773ef0a8b023e6aea16843212f6f9723c
parentb30ebf01080eb6def50207b3b595b7fb188b24c7 (diff)
downloadgst-plugins-bad-29aa30d9a05bf6c408160de108f2486a0c08bd48.tar.gz
gst-plugins-bad-29aa30d9a05bf6c408160de108f2486a0c08bd48.tar.bz2
gst-plugins-bad-29aa30d9a05bf6c408160de108f2486a0c08bd48.zip
frei0r: Make plugin scanning more robust
-rw-r--r--gst/frei0r/gstfrei0r.c20
-rw-r--r--gst/frei0r/gstfrei0rfilter.c5
-rw-r--r--gst/frei0r/gstfrei0rmixer.c5
-rw-r--r--gst/frei0r/gstfrei0rsrc.c5
4 files changed, 20 insertions, 15 deletions
diff --git a/gst/frei0r/gstfrei0r.c b/gst/frei0r/gstfrei0r.c
index f90f1d6f..0f7ba5c5 100644
--- a/gst/frei0r/gstfrei0r.c
+++ b/gst/frei0r/gstfrei0r.c
@@ -426,6 +426,7 @@ register_plugin (GstPlugin * plugin, const gchar * filename)
GstFrei0rFuncTable ftable = { NULL, };
gint i;
f0r_plugin_info_t info = { NULL, };
+ f0r_instance_t *instance = NULL;
GST_DEBUG ("Registering plugin '%s'", filename);
@@ -460,6 +461,12 @@ register_plugin (GstPlugin * plugin, const gchar * filename)
g_module_symbol (module, "f0r_update", (gpointer *) & ftable.update);
g_module_symbol (module, "f0r_update2", (gpointer *) & ftable.update2);
+ if (!ftable.init ()) {
+ GST_WARNING ("Failed to initialize plugin");
+ g_module_close (module);
+ return FALSE;
+ }
+
if (!ftable.update && !ftable.update2)
goto invalid_frei0r_plugin;
@@ -467,12 +474,14 @@ register_plugin (GstPlugin * plugin, const gchar * filename)
if (info.frei0r_version > 1) {
GST_WARNING ("Unsupported frei0r version %d", info.frei0r_version);
+ ftable.deinit ();
g_module_close (module);
return FALSE;
}
if (info.color_model > F0R_COLOR_MODEL_PACKED32) {
GST_WARNING ("Unsupported color model %d", info.color_model);
+ ftable.deinit ();
g_module_close (module);
return FALSE;
}
@@ -483,11 +492,21 @@ register_plugin (GstPlugin * plugin, const gchar * filename)
ftable.get_param_info (&pinfo, i);
if (pinfo.type > F0R_PARAM_STRING) {
GST_WARNING ("Unsupported parameter type %d", pinfo.type);
+ ftable.deinit ();
g_module_close (module);
return FALSE;
}
}
+ instance = ftable.construct (640, 480);
+ if (!instance) {
+ GST_WARNING ("Failed to instanciate plugin '%s'", info.name);
+ ftable.deinit ();
+ g_module_close (module);
+ return FALSE;
+ }
+ ftable.destruct (instance);
+
switch (info.plugin_type) {
case F0R_PLUGIN_TYPE_FILTER:
ret = gst_frei0r_filter_register (plugin, &info, &ftable);
@@ -510,6 +529,7 @@ register_plugin (GstPlugin * plugin, const gchar * filename)
invalid_frei0r_plugin:
GST_ERROR ("Invalid frei0r plugin");
+ ftable.deinit ();
g_module_close (module);
return FALSE;
diff --git a/gst/frei0r/gstfrei0rfilter.c b/gst/frei0r/gstfrei0rfilter.c
index a7aa3808..43d8fc67 100644
--- a/gst/frei0r/gstfrei0rfilter.c
+++ b/gst/frei0r/gstfrei0rfilter.c
@@ -227,11 +227,6 @@ gst_frei0r_filter_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
return FALSE;
}
- if (!ftable->init ()) {
- GST_ERROR ("Initializing plugin failed");
- return FALSE;
- }
-
class_data = g_new0 (GstFrei0rFilterClassData, 1);
memcpy (&class_data->info, info, sizeof (f0r_plugin_info_t));
memcpy (&class_data->ftable, ftable, sizeof (GstFrei0rFuncTable));
diff --git a/gst/frei0r/gstfrei0rmixer.c b/gst/frei0r/gstfrei0rmixer.c
index e3c022f5..745c330e 100644
--- a/gst/frei0r/gstfrei0rmixer.c
+++ b/gst/frei0r/gstfrei0rmixer.c
@@ -769,11 +769,6 @@ gst_frei0r_mixer_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
return FALSE;
}
- if (!ftable->init ()) {
- GST_ERROR ("Initializing plugin failed");
- return FALSE;
- }
-
class_data = g_new0 (GstFrei0rMixerClassData, 1);
memcpy (&class_data->info, info, sizeof (f0r_plugin_info_t));
memcpy (&class_data->ftable, ftable, sizeof (GstFrei0rFuncTable));
diff --git a/gst/frei0r/gstfrei0rsrc.c b/gst/frei0r/gstfrei0rsrc.c
index 2dae11cf..a713e1e9 100644
--- a/gst/frei0r/gstfrei0rsrc.c
+++ b/gst/frei0r/gstfrei0rsrc.c
@@ -398,11 +398,6 @@ gst_frei0r_src_register (GstPlugin * plugin, const f0r_plugin_info_t * info,
return FALSE;
}
- if (!ftable->init ()) {
- GST_ERROR ("Initializing plugin failed");
- return FALSE;
- }
-
class_data = g_new0 (GstFrei0rSrcClassData, 1);
memcpy (&class_data->info, info, sizeof (f0r_plugin_info_t));
memcpy (&class_data->ftable, ftable, sizeof (GstFrei0rFuncTable));