mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
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.
This commit is contained in:
parent
2d778881cb
commit
3101fe78f9
3 changed files with 40 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue