summaryrefslogtreecommitdiff
path: root/ext/lv2
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2016-05-14 12:34:10 -0700
committerStefan Sauer <ensonic@users.sf.net>2016-05-15 14:47:22 -0700
commit3101fe78f9f4020b4e44ffaf0b4bdcadffe61790 (patch)
tree638e74e3e505ff2578bde85fda7a50e0e946f9e2 /ext/lv2
parent2d778881cb023013d0a4e47cba1183d6a95568e9 (diff)
lvs: add require_feature checks
Plugins can report what host features they need. Since we start to implement host feature check which plugins we can no suuport.
Diffstat (limited to 'ext/lv2')
-rw-r--r--ext/lv2/gstlv2.c7
-rw-r--r--ext/lv2/gstlv2utils.c37
-rw-r--r--ext/lv2/gstlv2utils.h2
3 files changed, 40 insertions, 6 deletions
diff --git a/ext/lv2/gstlv2.c b/ext/lv2/gstlv2.c
index e64c04843..733318762 100644
--- a/ext/lv2/gstlv2.c
+++ b/ext/lv2/gstlv2.c
@@ -39,6 +39,7 @@
#include <string.h>
#include "gstlv2.h"
+#include "gstlv2utils.h"
#include <gst/audio/audio-channels.h>
#include <lv2/lv2plug.in/ns/ext/port-groups/port-groups.h>
@@ -64,7 +65,6 @@ lv2_plugin_discover (GstPlugin * plugin)
i = lilv_plugins_next (plugins, i)) {
const LilvPlugin *lv2plugin = lilv_plugins_get (plugins, i);
const gchar *plugin_uri, *p;
- LilvNodes *required_features;
gchar *type_name;
GHashTable *port_groups = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
@@ -84,11 +84,8 @@ lv2_plugin_discover (GstPlugin * plugin)
goto next;
/* check if we support the required host features */
- required_features = lilv_plugin_get_required_features (lv2plugin);
- if (required_features) {
+ if (!gst_lv2_check_required_features (lv2plugin)) {
GST_FIXME ("lv2 plugin %s needs host features", plugin_uri);
- // TODO: implement host features, will be passed to
- // lilv_plugin_instantiate()
goto next;
}
diff --git a/ext/lv2/gstlv2utils.c b/ext/lv2/gstlv2utils.c
index 44700c6fd..638aef34e 100644
--- a/ext/lv2/gstlv2utils.c
+++ b/ext/lv2/gstlv2utils.c
@@ -22,6 +22,8 @@
#include "config.h"
#endif
+#include "string.h"
+
#include "gstlv2.h"
#include "gstlv2utils.h"
@@ -67,6 +69,41 @@ static const LV2_Feature *lv2_features[] = {
NULL
};
+gboolean
+gst_lv2_check_required_features (const LilvPlugin * lv2plugin)
+{
+ LilvNodes *required_features = lilv_plugin_get_required_features (lv2plugin);
+ if (required_features) {
+ LilvIter *i;
+ gint j;
+ gboolean missing = FALSE;
+
+ for (i = lilv_nodes_begin (required_features);
+ !lilv_nodes_is_end (required_features, i);
+ i = lilv_nodes_next (required_features, i)) {
+ const LilvNode *required_feature = lilv_nodes_get (required_features, i);
+ const char *required_feature_uri = lilv_node_as_uri (required_feature);
+ missing = TRUE;
+
+ for (j = 0; lv2_features[j]; j++) {
+ if (!strcmp (lv2_features[j]->URI, required_feature_uri)) {
+ missing = FALSE;
+ break;
+ }
+ }
+ if (missing) {
+ GST_FIXME ("lv2 plugin %s needs host feature: %s",
+ lilv_node_as_uri (lilv_plugin_get_uri (lv2plugin)),
+ required_feature_uri);
+ break;
+ }
+ }
+ lilv_nodes_free (required_features);
+ return (!missing);
+ }
+ return TRUE;
+}
+
/* api helpers */
void
diff --git a/ext/lv2/gstlv2utils.h b/ext/lv2/gstlv2utils.h
index c23e115bc..b012ec376 100644
--- a/ext/lv2/gstlv2utils.h
+++ b/ext/lv2/gstlv2utils.h
@@ -85,6 +85,7 @@ struct _GstLV2Class
GArray *control_out_ports; /**< Array of GstLV2Port */
};
+gboolean gst_lv2_check_required_features (const LilvPlugin *lv2plugin);
void gst_lv2_init (GstLV2 * lv2, GstLV2Class * lv2_class);
void gst_lv2_finalize (GstLV2 * lv2);
@@ -92,7 +93,6 @@ void gst_lv2_finalize (GstLV2 * lv2);
gboolean gst_lv2_setup (GstLV2 * lv2, unsigned long rate);
gboolean gst_lv2_cleanup (GstLV2 * lv2, GstObject *obj);
-
void gst_lv2_object_set_property (GstLV2 * lv2, GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
void gst_lv2_object_get_property (GstLV2 * lv2, GObject * object,