mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
lv2: Namespace global variables and explicitly make them private
And fix a LV2_PORT_GROUPS__rearLeft/LV2_PORT_GROUPS__rearRight typo Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1125>
This commit is contained in:
parent
a0cd455dd0
commit
a3595f7e0f
4 changed files with 207 additions and 177 deletions
219
ext/lv2/gstlv2.c
219
ext/lv2/gstlv2.c
|
@ -69,38 +69,37 @@ GST_DEBUG_CATEGORY (lv2_debug);
|
|||
#error "Unsupported OS"
|
||||
#endif
|
||||
|
||||
LilvWorld *world = NULL;
|
||||
LilvNode *atom_class = NULL;
|
||||
LilvNode *audio_class = NULL;
|
||||
LilvNode *control_class = NULL;
|
||||
LilvNode *cv_class = NULL;
|
||||
LilvNode *event_class = NULL;
|
||||
LilvNode *input_class = NULL;
|
||||
LilvNode *output_class = NULL;
|
||||
LilvNode *preset_class = NULL;
|
||||
LilvNode *state_iface = NULL;
|
||||
LilvNode *state_uri = NULL;
|
||||
LilvWorld *gst_lv2_world_node = NULL;
|
||||
LilvNode *gst_lv2_audio_node = NULL;
|
||||
LilvNode *gst_lv2_control_node = NULL;
|
||||
LilvNode *gst_lv2_cv_node = NULL;
|
||||
LilvNode *gst_lv2_event_node = NULL;
|
||||
LilvNode *gst_lv2_input_node = NULL;
|
||||
LilvNode *gst_lv2_output_node = NULL;
|
||||
LilvNode *gst_lv2_preset_node = NULL;
|
||||
LilvNode *gst_lv2_state_iface_node = NULL;
|
||||
LilvNode *gst_lv2_state_uri_node = NULL;
|
||||
|
||||
LilvNode *integer_prop = NULL;
|
||||
LilvNode *toggled_prop = NULL;
|
||||
LilvNode *designation_pred = NULL;
|
||||
LilvNode *in_place_broken_pred = NULL;
|
||||
LilvNode *optional_pred = NULL;
|
||||
LilvNode *group_pred = NULL;
|
||||
LilvNode *supports_event_pred = NULL;
|
||||
LilvNode *label_pred = NULL;
|
||||
LilvNode *gst_lv2_integer_prop_node = NULL;
|
||||
LilvNode *gst_lv2_toggled_prop_node = NULL;
|
||||
LilvNode *gst_lv2_designation_pred_node = NULL;
|
||||
LilvNode *gst_lv2_in_place_broken_pred_node = NULL;
|
||||
LilvNode *gst_lv2_optional_pred_node = NULL;
|
||||
LilvNode *gst_lv2_group_pred_node = NULL;
|
||||
LilvNode *gst_lv2_supports_event_pred_node = NULL;
|
||||
LilvNode *gst_lv2_label_pred_node = NULL;
|
||||
|
||||
LilvNode *center_role = NULL;
|
||||
LilvNode *left_role = NULL;
|
||||
LilvNode *right_role = NULL;
|
||||
LilvNode *rear_center_role = NULL;
|
||||
LilvNode *rear_left_role = NULL;
|
||||
LilvNode *rear_right_role = NULL;
|
||||
LilvNode *lfe_role = NULL;
|
||||
LilvNode *center_left_role = NULL;
|
||||
LilvNode *center_right_role = NULL;
|
||||
LilvNode *side_left_role = NULL;
|
||||
LilvNode *side_right_role = NULL;
|
||||
LilvNode *gst_lv2_center_role_node = NULL;
|
||||
LilvNode *gst_lv2_left_role_node = NULL;
|
||||
LilvNode *gst_lv2_right_role_node = NULL;
|
||||
LilvNode *gst_lv2_rear_center_role_node = NULL;
|
||||
LilvNode *gst_lv2_rear_left_role_node = NULL;
|
||||
LilvNode *gst_lv2_rear_right_role_node = NULL;
|
||||
LilvNode *gst_lv2_lfe_role_node = NULL;
|
||||
LilvNode *gst_lv2_center_left_role_node = NULL;
|
||||
LilvNode *gst_lv2_center_right_role_node = NULL;
|
||||
LilvNode *gst_lv2_side_left_role_node = NULL;
|
||||
LilvNode *gst_lv2_side_right_role_node = NULL;
|
||||
|
||||
GstStructure *lv2_meta_all = NULL;
|
||||
|
||||
|
@ -131,9 +130,11 @@ lv2_count_ports (const LilvPlugin * lv2plugin, guint * audio_in,
|
|||
for (i = 0; i < lilv_plugin_get_num_ports (lv2plugin); i++) {
|
||||
const LilvPort *port = lilv_plugin_get_port_by_index (lv2plugin, i);
|
||||
|
||||
if (lilv_port_is_a (lv2plugin, port, audio_class)) {
|
||||
const gboolean is_input = lilv_port_is_a (lv2plugin, port, input_class);
|
||||
LilvNodes *lv2group = lilv_port_get (lv2plugin, port, group_pred);
|
||||
if (lilv_port_is_a (lv2plugin, port, gst_lv2_audio_node)) {
|
||||
const gboolean is_input =
|
||||
lilv_port_is_a (lv2plugin, port, gst_lv2_input_node);
|
||||
LilvNodes *lv2group =
|
||||
lilv_port_get (lv2plugin, port, gst_lv2_group_pred_node);
|
||||
|
||||
if (lv2group) {
|
||||
const gchar *uri = lilv_node_as_uri (lv2group);
|
||||
|
@ -149,8 +150,8 @@ lv2_count_ports (const LilvPlugin * lv2plugin, guint * audio_in,
|
|||
(*audio_in)++;
|
||||
else
|
||||
(*audio_out)++;
|
||||
} else if (lilv_port_is_a (lv2plugin, port, control_class) ||
|
||||
lilv_port_is_a (lv2plugin, port, cv_class)) {
|
||||
} else if (lilv_port_is_a (lv2plugin, port, gst_lv2_control_node) ||
|
||||
lilv_port_is_a (lv2plugin, port, gst_lv2_cv_node)) {
|
||||
(*control)++;
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +164,7 @@ lv2_plugin_discover (GstPlugin * plugin)
|
|||
{
|
||||
guint audio_in, audio_out, control;
|
||||
LilvIter *i;
|
||||
const LilvPlugins *plugins = lilv_world_get_all_plugins (world);
|
||||
const LilvPlugins *plugins = lilv_world_get_all_plugins (gst_lv2_world_node);
|
||||
|
||||
for (i = lilv_plugins_begin (plugins); !lilv_plugins_is_end (plugins, i);
|
||||
i = lilv_plugins_next (plugins, i)) {
|
||||
|
@ -220,8 +221,9 @@ lv2_plugin_discover (GstPlugin * plugin)
|
|||
}
|
||||
|
||||
/* check supported extensions */
|
||||
can_do_presets = lilv_plugin_has_extension_data (lv2plugin, state_iface)
|
||||
|| lilv_plugin_has_feature (lv2plugin, state_uri)
|
||||
can_do_presets =
|
||||
lilv_plugin_has_extension_data (lv2plugin, gst_lv2_state_iface_node)
|
||||
|| lilv_plugin_has_feature (lv2plugin, gst_lv2_state_uri_node)
|
||||
|| (control > 0);
|
||||
GST_INFO ("plugin %s can%s do presets", type_name,
|
||||
(can_do_presets ? "" : "'t"));
|
||||
|
@ -257,8 +259,8 @@ plugin_init (GstPlugin * plugin)
|
|||
GST_DEBUG_CATEGORY_INIT (lv2_debug, "lv2",
|
||||
GST_DEBUG_FG_GREEN | GST_DEBUG_BG_BLACK | GST_DEBUG_BOLD, "LV2");
|
||||
|
||||
world = lilv_world_new ();
|
||||
lilv_world_load_all (world);
|
||||
gst_lv2_world_node = lilv_world_new ();
|
||||
lilv_world_load_all (gst_lv2_world_node);
|
||||
gst_lv2_host_init ();
|
||||
|
||||
/* have been added after lilv-0.22.0, which is the last release */
|
||||
|
@ -269,37 +271,57 @@ plugin_init (GstPlugin * plugin)
|
|||
#define LILV_URI_CV_PORT "http://lv2plug.in/ns/lv2core#CVPort"
|
||||
#endif
|
||||
|
||||
atom_class = lilv_new_uri (world, LILV_URI_ATOM_PORT);
|
||||
audio_class = lilv_new_uri (world, LILV_URI_AUDIO_PORT);
|
||||
control_class = lilv_new_uri (world, LILV_URI_CONTROL_PORT);
|
||||
cv_class = lilv_new_uri (world, LILV_URI_CV_PORT);
|
||||
event_class = lilv_new_uri (world, LILV_URI_EVENT_PORT);
|
||||
input_class = lilv_new_uri (world, LILV_URI_INPUT_PORT);
|
||||
output_class = lilv_new_uri (world, LILV_URI_OUTPUT_PORT);
|
||||
preset_class = lilv_new_uri (world, LV2_PRESETS__Preset);
|
||||
state_iface = lilv_new_uri (world, LV2_STATE__interface);
|
||||
state_uri = lilv_new_uri (world, LV2_STATE_URI);
|
||||
gst_lv2_audio_node = lilv_new_uri (gst_lv2_world_node, LILV_URI_AUDIO_PORT);
|
||||
gst_lv2_control_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LILV_URI_CONTROL_PORT);
|
||||
gst_lv2_cv_node = lilv_new_uri (gst_lv2_world_node, LILV_URI_CV_PORT);
|
||||
gst_lv2_event_node = lilv_new_uri (gst_lv2_world_node, LILV_URI_EVENT_PORT);
|
||||
gst_lv2_input_node = lilv_new_uri (gst_lv2_world_node, LILV_URI_INPUT_PORT);
|
||||
gst_lv2_output_node = lilv_new_uri (gst_lv2_world_node, LILV_URI_OUTPUT_PORT);
|
||||
gst_lv2_preset_node = lilv_new_uri (gst_lv2_world_node, LV2_PRESETS__Preset);
|
||||
gst_lv2_state_iface_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_STATE__interface);
|
||||
gst_lv2_state_uri_node = lilv_new_uri (gst_lv2_world_node, LV2_STATE_URI);
|
||||
|
||||
integer_prop = lilv_new_uri (world, LV2_CORE__integer);
|
||||
toggled_prop = lilv_new_uri (world, LV2_CORE__toggled);
|
||||
designation_pred = lilv_new_uri (world, LV2_CORE__designation);
|
||||
in_place_broken_pred = lilv_new_uri (world, LV2_CORE__inPlaceBroken);
|
||||
optional_pred = lilv_new_uri (world, LV2_CORE__optionalFeature);
|
||||
group_pred = lilv_new_uri (world, LV2_PORT_GROUPS__group);
|
||||
supports_event_pred = lilv_new_uri (world, LV2_EVENT__supportsEvent);
|
||||
label_pred = lilv_new_uri (world, LILV_NS_RDFS "label");
|
||||
gst_lv2_integer_prop_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_CORE__integer);
|
||||
gst_lv2_toggled_prop_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_CORE__toggled);
|
||||
gst_lv2_designation_pred_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_CORE__designation);
|
||||
gst_lv2_in_place_broken_pred_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_CORE__inPlaceBroken);
|
||||
gst_lv2_optional_pred_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_CORE__optionalFeature);
|
||||
gst_lv2_group_pred_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__group);
|
||||
gst_lv2_supports_event_pred_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_EVENT__supportsEvent);
|
||||
gst_lv2_label_pred_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LILV_NS_RDFS "label");
|
||||
|
||||
center_role = lilv_new_uri (world, LV2_PORT_GROUPS__center);
|
||||
left_role = lilv_new_uri (world, LV2_PORT_GROUPS__left);
|
||||
right_role = lilv_new_uri (world, LV2_PORT_GROUPS__right);
|
||||
rear_center_role = lilv_new_uri (world, LV2_PORT_GROUPS__rearCenter);
|
||||
rear_left_role = lilv_new_uri (world, LV2_PORT_GROUPS__rearLeft);
|
||||
rear_right_role = lilv_new_uri (world, LV2_PORT_GROUPS__rearLeft);
|
||||
lfe_role = lilv_new_uri (world, LV2_PORT_GROUPS__lowFrequencyEffects);
|
||||
center_left_role = lilv_new_uri (world, LV2_PORT_GROUPS__centerLeft);
|
||||
center_right_role = lilv_new_uri (world, LV2_PORT_GROUPS__centerRight);
|
||||
side_left_role = lilv_new_uri (world, LV2_PORT_GROUPS__sideLeft);
|
||||
side_right_role = lilv_new_uri (world, LV2_PORT_GROUPS__sideRight);
|
||||
gst_lv2_center_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__center);
|
||||
gst_lv2_left_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__left);
|
||||
gst_lv2_right_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__right);
|
||||
gst_lv2_rear_center_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__rearCenter);
|
||||
gst_lv2_rear_left_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__rearLeft);
|
||||
gst_lv2_rear_right_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__rearRight);
|
||||
gst_lv2_lfe_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__lowFrequencyEffects);
|
||||
gst_lv2_center_left_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__centerLeft);
|
||||
gst_lv2_center_right_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__centerRight);
|
||||
gst_lv2_side_left_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__sideLeft);
|
||||
gst_lv2_side_right_role_node =
|
||||
lilv_new_uri (gst_lv2_world_node, LV2_PORT_GROUPS__sideRight);
|
||||
|
||||
gst_plugin_add_dependency_simple (plugin,
|
||||
"LV2_PATH:" GST_LV2_ENVVARS, GST_LV2_DEFAULT_PATH, NULL,
|
||||
|
@ -356,39 +378,38 @@ __attribute__ ((destructor))
|
|||
#endif
|
||||
static void plugin_cleanup (GstPlugin * plugin)
|
||||
{
|
||||
lilv_node_free (atom_class);
|
||||
lilv_node_free (audio_class);
|
||||
lilv_node_free (control_class);
|
||||
lilv_node_free (cv_class);
|
||||
lilv_node_free (event_class);
|
||||
lilv_node_free (input_class);
|
||||
lilv_node_free (output_class);
|
||||
lilv_node_free (preset_class);
|
||||
lilv_node_free (state_iface);
|
||||
lilv_node_free (state_uri);
|
||||
lilv_node_free (gst_lv2_audio_node);
|
||||
lilv_node_free (gst_lv2_control_node);
|
||||
lilv_node_free (gst_lv2_cv_node);
|
||||
lilv_node_free (gst_lv2_event_node);
|
||||
lilv_node_free (gst_lv2_input_node);
|
||||
lilv_node_free (gst_lv2_output_node);
|
||||
lilv_node_free (gst_lv2_preset_node);
|
||||
lilv_node_free (gst_lv2_state_iface_node);
|
||||
lilv_node_free (gst_lv2_state_uri_node);
|
||||
|
||||
lilv_node_free (integer_prop);
|
||||
lilv_node_free (toggled_prop);
|
||||
lilv_node_free (designation_pred);
|
||||
lilv_node_free (in_place_broken_pred);
|
||||
lilv_node_free (optional_pred);
|
||||
lilv_node_free (group_pred);
|
||||
lilv_node_free (supports_event_pred);
|
||||
lilv_node_free (label_pred);
|
||||
lilv_node_free (gst_lv2_integer_prop_node);
|
||||
lilv_node_free (gst_lv2_toggled_prop_node);
|
||||
lilv_node_free (gst_lv2_designation_pred_node);
|
||||
lilv_node_free (gst_lv2_in_place_broken_pred_node);
|
||||
lilv_node_free (gst_lv2_optional_pred_node);
|
||||
lilv_node_free (gst_lv2_group_pred_node);
|
||||
lilv_node_free (gst_lv2_supports_event_pred_node);
|
||||
lilv_node_free (gst_lv2_label_pred_node);
|
||||
|
||||
lilv_node_free (center_role);
|
||||
lilv_node_free (left_role);
|
||||
lilv_node_free (right_role);
|
||||
lilv_node_free (rear_center_role);
|
||||
lilv_node_free (rear_left_role);
|
||||
lilv_node_free (rear_right_role);
|
||||
lilv_node_free (lfe_role);
|
||||
lilv_node_free (center_left_role);
|
||||
lilv_node_free (center_right_role);
|
||||
lilv_node_free (side_left_role);
|
||||
lilv_node_free (side_right_role);
|
||||
lilv_node_free (gst_lv2_center_role_node);
|
||||
lilv_node_free (gst_lv2_left_role_node);
|
||||
lilv_node_free (gst_lv2_right_role_node);
|
||||
lilv_node_free (gst_lv2_rear_center_role_node);
|
||||
lilv_node_free (gst_lv2_rear_left_role_node);
|
||||
lilv_node_free (gst_lv2_rear_right_role_node);
|
||||
lilv_node_free (gst_lv2_lfe_role_node);
|
||||
lilv_node_free (gst_lv2_center_left_role_node);
|
||||
lilv_node_free (gst_lv2_center_right_role_node);
|
||||
lilv_node_free (gst_lv2_side_left_role_node);
|
||||
lilv_node_free (gst_lv2_side_right_role_node);
|
||||
|
||||
lilv_world_free (world);
|
||||
lilv_world_free (gst_lv2_world_node);
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
|
|
|
@ -28,40 +28,39 @@
|
|||
|
||||
#include "gstlv2utils.h"
|
||||
|
||||
extern LilvWorld *world;
|
||||
extern LilvNode *atom_class;
|
||||
extern LilvNode *audio_class;
|
||||
extern LilvNode *control_class;
|
||||
extern LilvNode *cv_class;
|
||||
extern LilvNode *event_class;
|
||||
extern LilvNode *input_class;
|
||||
extern LilvNode *output_class;
|
||||
extern LilvNode *preset_class;
|
||||
extern LilvNode *state_iface;
|
||||
extern LilvNode *state_uri;
|
||||
G_GNUC_INTERNAL extern LilvWorld *gst_lv2_world_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_audio_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_control_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_cv_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_event_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_input_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_output_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_preset_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_state_iface_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_state_uri_node;
|
||||
|
||||
extern LilvNode *integer_prop;
|
||||
extern LilvNode *toggled_prop;
|
||||
extern LilvNode *designation_pred;
|
||||
extern LilvNode *in_place_broken_pred;
|
||||
extern LilvNode *optional_pred;
|
||||
extern LilvNode *group_pred;
|
||||
extern LilvNode *supports_event_pred;
|
||||
extern LilvNode *label_pred;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_integer_prop_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_toggled_prop_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_designation_pred_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_in_place_broken_pred_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_optional_pred_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_group_pred_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_supports_event_pred_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_label_pred_node;
|
||||
|
||||
extern LilvNode *center_role;
|
||||
extern LilvNode *left_role;
|
||||
extern LilvNode *right_role;
|
||||
extern LilvNode *rear_center_role;
|
||||
extern LilvNode *rear_left_role;
|
||||
extern LilvNode *rear_right_role;
|
||||
extern LilvNode *lfe_role;
|
||||
extern LilvNode *center_left_role;
|
||||
extern LilvNode *center_right_role;
|
||||
extern LilvNode *side_left_role;
|
||||
extern LilvNode *side_right_role;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_center_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_left_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_right_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_rear_center_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_rear_left_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_rear_right_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_lfe_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_center_left_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_center_right_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_side_left_role_node;
|
||||
G_GNUC_INTERNAL extern LilvNode *gst_lv2_side_right_role_node;
|
||||
|
||||
extern GstStructure *lv2_meta_all;
|
||||
G_GNUC_INTERNAL extern GstStructure *lv2_meta_all;
|
||||
|
||||
void gst_lv2_filter_register_element (GstPlugin *plugin,
|
||||
GstStructure * lv2_meta);
|
||||
|
|
|
@ -183,37 +183,37 @@ static GstAudioChannelPosition
|
|||
gst_lv2_filter_role_to_position (LilvNode * role)
|
||||
{
|
||||
/* Front. Mono and left/right are mututally exclusive */
|
||||
if (lilv_node_equals (role, center_role)) {
|
||||
if (lilv_node_equals (role, gst_lv2_center_role_node)) {
|
||||
|
||||
return GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
|
||||
} else if (lilv_node_equals (role, left_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_left_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
||||
} else if (lilv_node_equals (role, right_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_right_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
||||
|
||||
/* Rear. Left/right and center are mututally exclusive */
|
||||
} else if (lilv_node_equals (role, rear_center_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_rear_center_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_REAR_CENTER;
|
||||
} else if (lilv_node_equals (role, rear_left_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_rear_left_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_REAR_LEFT;
|
||||
} else if (lilv_node_equals (role, rear_right_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_rear_right_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT;
|
||||
|
||||
/* Subwoofer/low-frequency-effects */
|
||||
} else if (lilv_node_equals (role, lfe_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_lfe_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_LFE1;
|
||||
|
||||
/* Center front speakers. Center and left/right_of_center
|
||||
* are mutually exclusive */
|
||||
} else if (lilv_node_equals (role, center_left_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_center_left_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER;
|
||||
} else if (lilv_node_equals (role, center_right_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_center_right_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER;
|
||||
|
||||
/* sides */
|
||||
} else if (lilv_node_equals (role, side_left_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_side_left_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT;
|
||||
} else if (lilv_node_equals (role, side_right_role)) {
|
||||
} else if (lilv_node_equals (role, gst_lv2_side_right_role_node)) {
|
||||
return GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT;
|
||||
}
|
||||
|
||||
|
@ -531,7 +531,8 @@ gst_lv2_filter_init (GstLV2Filter * self, GstLV2FilterClass * klass)
|
|||
{
|
||||
gst_lv2_init (&self->lv2, &klass->lv2);
|
||||
|
||||
if (!lilv_plugin_has_feature (klass->lv2.plugin, in_place_broken_pred))
|
||||
if (!lilv_plugin_has_feature (klass->lv2.plugin,
|
||||
gst_lv2_in_place_broken_pred_node))
|
||||
gst_base_transform_set_in_place (GST_BASE_TRANSFORM (self), TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,9 @@ gst_lv2_get_preset_names (GstLV2 * lv2, GstObject * obj)
|
|||
if (!lv2->presets) {
|
||||
LilvNodes *presets;
|
||||
|
||||
if ((presets = lilv_plugin_get_related (lv2->klass->plugin, preset_class))) {
|
||||
if ((presets =
|
||||
lilv_plugin_get_related (lv2->klass->plugin,
|
||||
gst_lv2_preset_node))) {
|
||||
LilvIter *j;
|
||||
|
||||
lv2->presets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
||||
|
@ -188,8 +190,10 @@ gst_lv2_get_preset_names (GstLV2 * lv2, GstObject * obj)
|
|||
const LilvNode *preset = lilv_nodes_get (presets, j);
|
||||
LilvNodes *titles;
|
||||
|
||||
lilv_world_load_resource (world, preset);
|
||||
titles = lilv_world_find_nodes (world, preset, label_pred, NULL);
|
||||
lilv_world_load_resource (gst_lv2_world_node, preset);
|
||||
titles =
|
||||
lilv_world_find_nodes (gst_lv2_world_node, preset,
|
||||
gst_lv2_label_pred_node, NULL);
|
||||
if (titles) {
|
||||
const LilvNode *title = lilv_nodes_get_first (titles);
|
||||
g_hash_table_insert (lv2->presets,
|
||||
|
@ -253,7 +257,8 @@ gboolean
|
|||
gst_lv2_load_preset (GstLV2 * lv2, GstObject * obj, const gchar * name)
|
||||
{
|
||||
LilvNode *preset = g_hash_table_lookup (lv2->presets, name);
|
||||
LilvState *state = lilv_state_new_from_world (world, &lv2_map, preset);
|
||||
LilvState *state =
|
||||
lilv_state_new_from_world (gst_lv2_world_node, &lv2_map, preset);
|
||||
gpointer user_data[] = { lv2->klass, obj };
|
||||
|
||||
GST_INFO_OBJECT (obj, "loading preset <%s>", lilv_node_as_string (preset));
|
||||
|
@ -295,7 +300,7 @@ gst_lv2_save_preset (GstLV2 * lv2, GstObject * obj, const gchar * name)
|
|||
gpointer user_data[] = { lv2->klass, obj };
|
||||
LilvState *state;
|
||||
LilvNode *bundle_dir;
|
||||
const LilvNode *state_uri;
|
||||
const LilvNode *gst_lv2_state_uri_node;
|
||||
LilvInstance *instance = lv2->instance;
|
||||
gboolean res;
|
||||
#ifndef HAVE_LILV_0_22
|
||||
|
@ -323,27 +328,27 @@ gst_lv2_save_preset (GstLV2 * lv2, GstObject * obj, const gchar * name)
|
|||
|
||||
lilv_state_set_label (state, name);
|
||||
|
||||
res = lilv_state_save (world, &lv2_map, &lv2_unmap, state, /*uri */ NULL, dir,
|
||||
filename) != 0;
|
||||
res = lilv_state_save (gst_lv2_world_node, &lv2_map, &lv2_unmap, state, /*uri */
|
||||
NULL, dir, filename) != 0;
|
||||
|
||||
/* reload bundle into the world */
|
||||
bundle_dir = lilv_new_file_uri (world, NULL, dir);
|
||||
lilv_world_unload_bundle (world, bundle_dir);
|
||||
lilv_world_load_bundle (world, bundle_dir);
|
||||
/* reload bundle into the gst_lv2_world_node */
|
||||
bundle_dir = lilv_new_file_uri (gst_lv2_world_node, NULL, dir);
|
||||
lilv_world_unload_bundle (gst_lv2_world_node, bundle_dir);
|
||||
lilv_world_load_bundle (gst_lv2_world_node, bundle_dir);
|
||||
lilv_node_free (bundle_dir);
|
||||
|
||||
#ifdef HAVE_LILV_0_22
|
||||
state_uri = lilv_state_get_uri (state);
|
||||
gst_lv2_state_uri_node = lilv_state_get_uri (state);
|
||||
#else
|
||||
filepath = g_build_filename (dir, filename, NULL);
|
||||
state_uri = lilv_new_uri (world, filepath);
|
||||
gst_lv2_state_uri_node = lilv_new_uri (gst_lv2_world_node, filepath);
|
||||
g_free (filepath);
|
||||
#endif
|
||||
lilv_world_load_resource (world, state_uri);
|
||||
lilv_world_load_resource (gst_lv2_world_node, gst_lv2_state_uri_node);
|
||||
g_hash_table_insert (lv2->presets, g_strdup (name),
|
||||
lilv_node_duplicate (state_uri));
|
||||
lilv_node_duplicate (gst_lv2_state_uri_node));
|
||||
#ifndef HAVE_LILV_0_22
|
||||
lilv_node_free ((LilvNode *) state_uri);
|
||||
lilv_node_free ((LilvNode *) gst_lv2_state_uri_node);
|
||||
#endif
|
||||
|
||||
lilv_state_free (state);
|
||||
|
@ -374,10 +379,11 @@ gst_lv2_delete_preset (GstLV2 * lv2, GstObject * obj, const gchar * name)
|
|||
{
|
||||
#ifdef HAVE_LILV_0_22
|
||||
LilvNode *preset = g_hash_table_lookup (lv2->presets, name);
|
||||
LilvState *state = lilv_state_new_from_world (world, &lv2_map, preset);
|
||||
LilvState *state =
|
||||
lilv_state_new_from_world (gst_lv2_world_node, &lv2_map, preset);
|
||||
|
||||
lilv_world_unload_resource (world, lilv_state_get_uri (state));
|
||||
lilv_state_delete (world, state);
|
||||
lilv_world_unload_resource (gst_lv2_world_node, lilv_state_get_uri (state));
|
||||
lilv_state_delete (gst_lv2_world_node, state);
|
||||
lilv_state_free (state);
|
||||
#endif
|
||||
g_hash_table_remove (lv2->presets, name);
|
||||
|
@ -624,13 +630,13 @@ gst_lv2_class_get_param_spec (GstLV2Class * klass, GObjectClass * object_class,
|
|||
lilv_node_as_string (lilv_plugin_get_uri (lv2plugin)), name, nick);
|
||||
|
||||
perms = G_PARAM_READABLE;
|
||||
if (lilv_port_is_a (lv2plugin, port, input_class))
|
||||
if (lilv_port_is_a (lv2plugin, port, gst_lv2_input_node))
|
||||
perms |= G_PARAM_WRITABLE | G_PARAM_CONSTRUCT;
|
||||
if (lilv_port_is_a (lv2plugin, port, control_class) ||
|
||||
lilv_port_is_a (lv2plugin, port, cv_class))
|
||||
if (lilv_port_is_a (lv2plugin, port, gst_lv2_control_node) ||
|
||||
lilv_port_is_a (lv2plugin, port, gst_lv2_cv_node))
|
||||
perms |= GST_PARAM_CONTROLLABLE;
|
||||
|
||||
if (lilv_port_has_property (lv2plugin, port, toggled_prop)) {
|
||||
if (lilv_port_has_property (lv2plugin, port, gst_lv2_toggled_prop_node)) {
|
||||
ret = g_param_spec_boolean (name, nick, nick, FALSE, perms);
|
||||
goto done;
|
||||
}
|
||||
|
@ -726,7 +732,8 @@ gst_lv2_class_get_param_spec (GstLV2Class * klass, GObjectClass * object_class,
|
|||
|
||||
if (enum_type != G_TYPE_INVALID) {
|
||||
ret = g_param_spec_enum (name, nick, nick, enum_type, def, perms);
|
||||
} else if (lilv_port_has_property (lv2plugin, port, integer_prop))
|
||||
} else if (lilv_port_has_property (lv2plugin, port,
|
||||
gst_lv2_integer_prop_node))
|
||||
ret = g_param_spec_int (name, nick, nick, lower, upper, def, perms);
|
||||
else
|
||||
ret = g_param_spec_float (name, nick, nick, lower, upper, def, perms);
|
||||
|
@ -818,14 +825,14 @@ gst_lv2_class_init (GstLV2Class * lv2_class, GType type)
|
|||
GstStructure *lv2_meta = g_value_get_boxed (value);
|
||||
const LilvPlugin *lv2plugin;
|
||||
guint j, in_pad_index = 0, out_pad_index = 0;
|
||||
const LilvPlugins *plugins = lilv_world_get_all_plugins (world);
|
||||
const LilvPlugins *plugins = lilv_world_get_all_plugins (gst_lv2_world_node);
|
||||
LilvNode *plugin_uri;
|
||||
const gchar *element_uri;
|
||||
|
||||
GST_DEBUG ("LV2 initializing class");
|
||||
|
||||
element_uri = gst_structure_get_string (lv2_meta, "element-uri");
|
||||
plugin_uri = lilv_new_uri (world, element_uri);
|
||||
plugin_uri = lilv_new_uri (gst_lv2_world_node, element_uri);
|
||||
g_assert (plugin_uri);
|
||||
lv2plugin = lilv_plugins_get_by_uri (plugins, plugin_uri);
|
||||
g_assert (lv2plugin);
|
||||
|
@ -842,11 +849,13 @@ gst_lv2_class_init (GstLV2Class * lv2_class, GType type)
|
|||
/* find ports and groups */
|
||||
for (j = 0; j < lilv_plugin_get_num_ports (lv2plugin); j++) {
|
||||
const LilvPort *port = lilv_plugin_get_port_by_index (lv2plugin, j);
|
||||
const gboolean is_input = lilv_port_is_a (lv2plugin, port, input_class);
|
||||
const gboolean is_input =
|
||||
lilv_port_is_a (lv2plugin, port, gst_lv2_input_node);
|
||||
const gboolean is_optional = lilv_port_has_property (lv2plugin, port,
|
||||
optional_pred);
|
||||
gst_lv2_optional_pred_node);
|
||||
GstLV2Port desc = { j, GST_LV2_PORT_AUDIO, -1, };
|
||||
LilvNodes *lv2group = lilv_port_get (lv2plugin, port, group_pred);
|
||||
LilvNodes *lv2group =
|
||||
lilv_port_get (lv2plugin, port, gst_lv2_group_pred_node);
|
||||
/* FIXME Handle channels positioning
|
||||
* GstAudioChannelPosition position = GST_AUDIO_CHANNEL_POSITION_INVALID; */
|
||||
|
||||
|
@ -864,7 +873,7 @@ gst_lv2_class_init (GstLV2Class * lv2_class, GType type)
|
|||
|
||||
/* FIXME Handle channels positioning
|
||||
position = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
||||
sub_values = lilv_port_get_value (lv2plugin, port, designation_pred);
|
||||
sub_values = lilv_port_get_value (lv2plugin, port, gst_lv2_designation_pred_node);
|
||||
if (lilv_nodes_size (sub_values) > 0) {
|
||||
LilvNode *role = lilv_nodes_get_at (sub_values, 0);
|
||||
position = gst_lv2_filter_role_to_position (role);
|
||||
|
@ -879,7 +888,7 @@ gst_lv2_class_init (GstLV2Class * lv2_class, GType type)
|
|||
} else {
|
||||
/* port is not part of a group, or it is part of a group but that group
|
||||
* is illegal so we just ignore it */
|
||||
if (lilv_port_is_a (lv2plugin, port, audio_class)) {
|
||||
if (lilv_port_is_a (lv2plugin, port, gst_lv2_audio_node)) {
|
||||
if (is_input) {
|
||||
desc.pad = in_pad_index++;
|
||||
g_array_append_val (lv2_class->in_group.ports, desc);
|
||||
|
@ -887,7 +896,7 @@ gst_lv2_class_init (GstLV2Class * lv2_class, GType type)
|
|||
desc.pad = out_pad_index++;
|
||||
g_array_append_val (lv2_class->out_group.ports, desc);
|
||||
}
|
||||
} else if (lilv_port_is_a (lv2plugin, port, control_class)) {
|
||||
} else if (lilv_port_is_a (lv2plugin, port, gst_lv2_control_node)) {
|
||||
desc.type = GST_LV2_PORT_CONTROL;
|
||||
if (is_input) {
|
||||
lv2_class->num_control_in++;
|
||||
|
@ -896,7 +905,7 @@ gst_lv2_class_init (GstLV2Class * lv2_class, GType type)
|
|||
lv2_class->num_control_out++;
|
||||
g_array_append_val (lv2_class->control_out_ports, desc);
|
||||
}
|
||||
} else if (lilv_port_is_a (lv2plugin, port, cv_class)) {
|
||||
} else if (lilv_port_is_a (lv2plugin, port, gst_lv2_cv_node)) {
|
||||
desc.type = GST_LV2_PORT_CV;
|
||||
if (is_input) {
|
||||
lv2_class->num_cv_in++;
|
||||
|
@ -905,9 +914,9 @@ gst_lv2_class_init (GstLV2Class * lv2_class, GType type)
|
|||
lv2_class->num_cv_out++;
|
||||
g_array_append_val (lv2_class->control_out_ports, desc);
|
||||
}
|
||||
} else if (lilv_port_is_a (lv2plugin, port, event_class)) {
|
||||
} else if (lilv_port_is_a (lv2plugin, port, gst_lv2_event_node)) {
|
||||
LilvNodes *supported = lilv_port_get_value (lv2plugin, port,
|
||||
supports_event_pred);
|
||||
gst_lv2_supports_event_pred_node);
|
||||
|
||||
GST_INFO ("%s: unhandled event port %d: %s, optional=%d, input=%d",
|
||||
element_uri, j,
|
||||
|
|
Loading…
Reference in a new issue