mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Working multi-channel pads for LV2 plugins.
This commit is contained in:
parent
c076e7d34f
commit
403f58b562
5 changed files with 319 additions and 127 deletions
|
@ -125,10 +125,10 @@ gst_ladspa_base_init (gpointer g_class)
|
||||||
|
|
||||||
if (LADSPA_IS_PORT_INPUT (p))
|
if (LADSPA_IS_PORT_INPUT (p))
|
||||||
gst_signal_processor_class_add_pad_template (gsp_class, name,
|
gst_signal_processor_class_add_pad_template (gsp_class, name,
|
||||||
GST_PAD_SINK, gsp_class->num_audio_in++);
|
GST_PAD_SINK, gsp_class->num_audio_in++, 1);
|
||||||
else
|
else
|
||||||
gst_signal_processor_class_add_pad_template (gsp_class, name,
|
gst_signal_processor_class_add_pad_template (gsp_class, name,
|
||||||
GST_PAD_SRC, gsp_class->num_audio_out++);
|
GST_PAD_SRC, gsp_class->num_audio_out++, 1);
|
||||||
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
} else if (LADSPA_IS_PORT_CONTROL (p)) {
|
} else if (LADSPA_IS_PORT_CONTROL (p)) {
|
||||||
|
|
261
ext/lv2/gstlv2.c
261
ext/lv2/gstlv2.c
|
@ -54,6 +54,7 @@ SLV2Value integer_prop;
|
||||||
SLV2Value toggled_prop;
|
SLV2Value toggled_prop;
|
||||||
SLV2Value in_place_broken_pred;
|
SLV2Value in_place_broken_pred;
|
||||||
SLV2Value in_group_pred;
|
SLV2Value in_group_pred;
|
||||||
|
SLV2Value lv2_symbol_pred;
|
||||||
|
|
||||||
static GstSignalProcessorClass *parent_class;
|
static GstSignalProcessorClass *parent_class;
|
||||||
|
|
||||||
|
@ -62,12 +63,15 @@ static GstPlugin *gst_lv2_plugin;
|
||||||
GST_DEBUG_CATEGORY_STATIC (lv2_debug);
|
GST_DEBUG_CATEGORY_STATIC (lv2_debug);
|
||||||
#define GST_CAT_DEFAULT lv2_debug
|
#define GST_CAT_DEFAULT lv2_debug
|
||||||
|
|
||||||
static gint
|
/** Find and return the group @a uri in @a groups, or NULL if not found */
|
||||||
gst_lv2_value_cmp (gconstpointer a, gconstpointer b)
|
static GstLV2Group *
|
||||||
|
gst_lv2_class_find_group (GArray * groups, SLV2Value uri)
|
||||||
{
|
{
|
||||||
if (slv2_value_equals ((SLV2Value) a, (SLV2Value) b))
|
int i = 0;
|
||||||
return 0;
|
for (; i < groups->len; ++i)
|
||||||
return 1;
|
if (slv2_value_equals (g_array_index (groups, GstLV2Group, i).uri, uri))
|
||||||
|
return &g_array_index (groups, GstLV2Group, i);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -79,8 +83,9 @@ gst_lv2_base_init (gpointer g_class)
|
||||||
GstElementDetails *details;
|
GstElementDetails *details;
|
||||||
SLV2Plugin lv2plugin;
|
SLV2Plugin lv2plugin;
|
||||||
SLV2Value val;
|
SLV2Value val;
|
||||||
SLV2Values values;
|
SLV2Values values, sub_values;
|
||||||
guint j, audio_in_count, audio_out_count, control_in_count, control_out_count;
|
GstLV2Group *group = NULL;
|
||||||
|
guint j, in_pad_index = 0, out_pad_index = 0;
|
||||||
gchar *klass_tags;
|
gchar *klass_tags;
|
||||||
|
|
||||||
GST_DEBUG ("base_init %p", g_class);
|
GST_DEBUG ("base_init %p", g_class);
|
||||||
|
@ -90,89 +95,116 @@ gst_lv2_base_init (gpointer g_class)
|
||||||
|
|
||||||
g_assert (lv2plugin);
|
g_assert (lv2plugin);
|
||||||
|
|
||||||
/* audio ports (pads) */
|
gsp_class->num_group_in = 0;
|
||||||
gsp_class->num_audio_in = slv2_plugin_get_num_ports_of_class (lv2plugin,
|
gsp_class->num_group_out = 0;
|
||||||
audio_class, input_class, NULL);
|
gsp_class->num_audio_in = 0;
|
||||||
gsp_class->num_audio_out = slv2_plugin_get_num_ports_of_class (lv2plugin,
|
gsp_class->num_audio_out = 0;
|
||||||
audio_class, output_class, NULL);
|
gsp_class->num_control_in = 0;
|
||||||
|
gsp_class->num_control_out = 0;
|
||||||
|
|
||||||
/* control ports (properties) */
|
klass->in_groups = g_array_new (FALSE, TRUE, sizeof (GstLV2Group));
|
||||||
gsp_class->num_control_in = slv2_plugin_get_num_ports_of_class (lv2plugin,
|
klass->out_groups = g_array_new (FALSE, TRUE, sizeof (GstLV2Group));
|
||||||
control_class, input_class, NULL);
|
klass->audio_in_ports = g_array_new (FALSE, TRUE, sizeof (GstLV2Port));
|
||||||
gsp_class->num_control_out = slv2_plugin_get_num_ports_of_class (lv2plugin,
|
klass->audio_out_ports = g_array_new (FALSE, TRUE, sizeof (GstLV2Port));
|
||||||
control_class, output_class, NULL);
|
klass->control_in_ports = g_array_new (FALSE, TRUE, sizeof (GstLV2Port));
|
||||||
|
klass->control_out_ports = g_array_new (FALSE, TRUE, sizeof (GstLV2Port));
|
||||||
|
|
||||||
klass->audio_in_ports = g_new0 (struct _GstLV2Port, gsp_class->num_audio_in);
|
/* find ports and groups */
|
||||||
klass->audio_out_ports =
|
|
||||||
g_new0 (struct _GstLV2Port, gsp_class->num_audio_out);
|
|
||||||
klass->control_in_ports =
|
|
||||||
g_new0 (struct _GstLV2Port, gsp_class->num_control_in);
|
|
||||||
klass->control_out_ports =
|
|
||||||
g_new0 (struct _GstLV2Port, gsp_class->num_control_out);
|
|
||||||
|
|
||||||
klass->groups = NULL;
|
|
||||||
|
|
||||||
/* find port groups */
|
|
||||||
audio_in_count = audio_out_count = control_in_count = control_out_count = 0;
|
|
||||||
for (j = 0; j < slv2_plugin_get_num_ports (lv2plugin); j++) {
|
for (j = 0; j < slv2_plugin_get_num_ports (lv2plugin); j++) {
|
||||||
SLV2Port port = slv2_plugin_get_port_by_index (lv2plugin, j);
|
const SLV2Port port = slv2_plugin_get_port_by_index (lv2plugin, j);
|
||||||
gboolean is_input = slv2_port_is_a (lv2plugin, port, input_class);
|
const gboolean is_input = slv2_port_is_a (lv2plugin, port, input_class);
|
||||||
struct _GstLV2Port *desc = NULL;
|
struct _GstLV2Port desc = { j, 0 };
|
||||||
if (slv2_port_is_a (lv2plugin, port, audio_class)) {
|
|
||||||
if (is_input)
|
|
||||||
desc = &klass->audio_in_ports[audio_in_count++];
|
|
||||||
else
|
|
||||||
desc = &klass->audio_out_ports[audio_out_count++];
|
|
||||||
} else if (slv2_port_is_a (lv2plugin, port, control_class)) {
|
|
||||||
if (is_input)
|
|
||||||
desc = &klass->control_in_ports[control_in_count++];
|
|
||||||
else
|
|
||||||
desc = &klass->control_out_ports[control_out_count++];
|
|
||||||
} else {
|
|
||||||
/* unknown port type */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
desc->index = j;
|
|
||||||
values = slv2_port_get_value (lv2plugin, port, in_group_pred);
|
values = slv2_port_get_value (lv2plugin, port, in_group_pred);
|
||||||
|
|
||||||
if (slv2_values_size (values) > 0) {
|
if (slv2_values_size (values) > 0) {
|
||||||
SLV2Value v = slv2_values_get_at (values, 0);
|
/* port is part of a group */
|
||||||
desc->group = v;
|
SLV2Value group_uri = slv2_values_get_at (values, 0);
|
||||||
if (!g_slist_find_custom (klass->groups, v, gst_lv2_value_cmp)) {
|
GArray *groups = is_input ? klass->in_groups : klass->out_groups;
|
||||||
klass->groups =
|
GstLV2Group *group = gst_lv2_class_find_group (groups, group_uri);
|
||||||
g_slist_prepend (klass->groups, slv2_value_duplicate (v));
|
if (group == NULL) {
|
||||||
|
GstLV2Group g;
|
||||||
|
g.uri = slv2_value_duplicate (group_uri);
|
||||||
|
g.pad = is_input ? in_pad_index++ : out_pad_index++;
|
||||||
|
g.ports = g_array_new (FALSE, TRUE, sizeof (GstLV2Port));
|
||||||
|
sub_values = slv2_plugin_get_value_for_subject (lv2plugin, group_uri,
|
||||||
|
lv2_symbol_pred);
|
||||||
|
if (slv2_values_size (sub_values) > 0)
|
||||||
|
g.symbol = slv2_value_duplicate (slv2_values_get_at (sub_values, 0));
|
||||||
|
else
|
||||||
|
g.symbol = NULL;
|
||||||
|
slv2_values_free (sub_values);
|
||||||
|
|
||||||
|
g_array_append_val (groups, g);
|
||||||
|
group = &g_array_index (groups, GstLV2Group, groups->len - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_array_append_val (group->ports, desc);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* port is not part of a group */
|
||||||
|
if (slv2_port_is_a (lv2plugin, port, audio_class)) {
|
||||||
|
desc.pad = is_input ? in_pad_index++ : out_pad_index++;
|
||||||
|
if (is_input)
|
||||||
|
g_array_append_val (klass->audio_in_ports, desc);
|
||||||
|
else
|
||||||
|
g_array_append_val (klass->audio_out_ports, desc);
|
||||||
|
} else if (slv2_port_is_a (lv2plugin, port, control_class)) {
|
||||||
|
if (is_input)
|
||||||
|
g_array_append_val (klass->control_in_ports, desc);
|
||||||
|
else
|
||||||
|
g_array_append_val (klass->control_out_ports, desc);
|
||||||
|
} else {
|
||||||
|
/* unknown port type */
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
g_assert (g_slist_find_custom (klass->groups, v, gst_lv2_value_cmp));
|
|
||||||
}
|
}
|
||||||
slv2_values_free (values);
|
slv2_values_free (values);
|
||||||
}
|
}
|
||||||
g_assert (audio_in_count == gsp_class->num_audio_in);
|
|
||||||
g_assert (audio_out_count == gsp_class->num_audio_out);
|
|
||||||
g_assert (control_in_count == gsp_class->num_control_in);
|
|
||||||
g_assert (control_out_count == gsp_class->num_control_out);
|
|
||||||
|
|
||||||
/* add pad templates */
|
gsp_class->num_group_in = klass->in_groups->len;
|
||||||
audio_in_count = audio_out_count = 0;
|
gsp_class->num_group_out = klass->out_groups->len;
|
||||||
for (j = 0; j < slv2_plugin_get_num_ports (lv2plugin); j++) {
|
gsp_class->num_audio_in = klass->audio_in_ports->len;
|
||||||
SLV2Port port = slv2_plugin_get_port_by_index (lv2plugin, j);
|
gsp_class->num_audio_out = klass->audio_out_ports->len;
|
||||||
if (slv2_port_is_a (lv2plugin, port, audio_class)) {
|
gsp_class->num_control_in = klass->control_in_ports->len;
|
||||||
gchar *name =
|
gsp_class->num_control_out = klass->control_out_ports->len;
|
||||||
g_strdup (slv2_value_as_string (slv2_port_get_symbol (lv2plugin,
|
|
||||||
port)));
|
|
||||||
|
|
||||||
GST_DEBUG ("LV2 port name: \"%s\"", name);
|
/* add input group pad templates */
|
||||||
|
for (j = 0; j < gsp_class->num_group_in; ++j) {
|
||||||
if (slv2_port_is_a (lv2plugin, port, input_class))
|
group = &g_array_index (klass->in_groups, GstLV2Group, j);
|
||||||
gst_signal_processor_class_add_pad_template (gsp_class, name,
|
gst_signal_processor_class_add_pad_template (gsp_class,
|
||||||
GST_PAD_SINK, audio_in_count++);
|
slv2_value_as_string (group->symbol),
|
||||||
else if (slv2_port_is_a (lv2plugin, port, output_class))
|
GST_PAD_SINK, j, group->ports->len);
|
||||||
gst_signal_processor_class_add_pad_template (gsp_class, name,
|
}
|
||||||
GST_PAD_SRC, audio_out_count++);
|
|
||||||
|
/* add output group pad templates */
|
||||||
g_free (name);
|
for (j = 0; j < gsp_class->num_group_out; ++j) {
|
||||||
}
|
group = &g_array_index (klass->out_groups, GstLV2Group, j);
|
||||||
|
gst_signal_processor_class_add_pad_template (gsp_class,
|
||||||
|
slv2_value_as_string (group->symbol),
|
||||||
|
GST_PAD_SRC, j, group->ports->len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add non-grouped input port pad templates */
|
||||||
|
for (j = 0; j < gsp_class->num_audio_in; ++j) {
|
||||||
|
struct _GstLV2Port *desc =
|
||||||
|
&g_array_index (klass->audio_in_ports, GstLV2Port, j);
|
||||||
|
SLV2Port port = slv2_plugin_get_port_by_index (lv2plugin, desc->index);
|
||||||
|
const gchar *name =
|
||||||
|
slv2_value_as_string (slv2_port_get_symbol (lv2plugin, port));
|
||||||
|
gst_signal_processor_class_add_pad_template (gsp_class, name, GST_PAD_SINK,
|
||||||
|
j, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add non-grouped output port pad templates */
|
||||||
|
for (j = 0; j < gsp_class->num_audio_out; ++j) {
|
||||||
|
struct _GstLV2Port *desc =
|
||||||
|
&g_array_index (klass->audio_out_ports, GstLV2Port, j);
|
||||||
|
SLV2Port port = slv2_plugin_get_port_by_index (lv2plugin, desc->index);
|
||||||
|
const gchar *name =
|
||||||
|
slv2_value_as_string (slv2_port_get_symbol (lv2plugin, port));
|
||||||
|
gst_signal_processor_class_add_pad_template (gsp_class, name, GST_PAD_SINK,
|
||||||
|
j, 1);
|
||||||
}
|
}
|
||||||
g_assert (audio_in_count == gsp_class->num_audio_in);
|
|
||||||
g_assert (audio_out_count == gsp_class->num_audio_out);
|
|
||||||
|
|
||||||
/* construct the element details struct */
|
/* construct the element details struct */
|
||||||
details = g_new0 (GstElementDetails, 1);
|
details = g_new0 (GstElementDetails, 1);
|
||||||
|
@ -257,6 +289,10 @@ gst_lv2_class_get_param_spec (GstLV2Class * klass, gint portnum)
|
||||||
if (lv2max)
|
if (lv2max)
|
||||||
upper = slv2_value_as_float (lv2max);
|
upper = slv2_value_as_float (lv2max);
|
||||||
|
|
||||||
|
slv2_value_free (lv2def);
|
||||||
|
slv2_value_free (lv2min);
|
||||||
|
slv2_value_free (lv2max);
|
||||||
|
|
||||||
if (def < lower) {
|
if (def < lower) {
|
||||||
GST_WARNING ("%s has lower bound %f > default %f\n",
|
GST_WARNING ("%s has lower bound %f > default %f\n",
|
||||||
slv2_value_as_string (slv2_plugin_get_uri (lv2plugin)), lower, def);
|
slv2_value_as_string (slv2_plugin_get_uri (lv2plugin)), lower, def);
|
||||||
|
@ -306,7 +342,8 @@ gst_lv2_class_init (GstLV2Class * klass, SLV2Plugin lv2plugin)
|
||||||
for (i = 0; i < gsp_class->num_control_in; i++) {
|
for (i = 0; i < gsp_class->num_control_in; i++) {
|
||||||
GParamSpec *p;
|
GParamSpec *p;
|
||||||
|
|
||||||
p = gst_lv2_class_get_param_spec (klass, klass->control_in_ports[i].index);
|
p = gst_lv2_class_get_param_spec (klass,
|
||||||
|
g_array_index (klass->control_in_ports, GstLV2Port, i).index);
|
||||||
|
|
||||||
/* properties have an offset of 1 */
|
/* properties have an offset of 1 */
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), i + 1, p);
|
g_object_class_install_property (G_OBJECT_CLASS (klass), i + 1, p);
|
||||||
|
@ -315,7 +352,8 @@ gst_lv2_class_init (GstLV2Class * klass, SLV2Plugin lv2plugin)
|
||||||
for (i = 0; i < gsp_class->num_control_out; i++) {
|
for (i = 0; i < gsp_class->num_control_out; i++) {
|
||||||
GParamSpec *p;
|
GParamSpec *p;
|
||||||
|
|
||||||
p = gst_lv2_class_get_param_spec (klass, klass->control_out_ports[i].index);
|
p = gst_lv2_class_get_param_spec (klass,
|
||||||
|
g_array_index (klass->control_out_ports, GstLV2Port, i).index);
|
||||||
|
|
||||||
/* properties have an offset of 1, and we already added num_control_in */
|
/* properties have an offset of 1, and we already added num_control_in */
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||||
|
@ -425,10 +463,12 @@ gst_lv2_setup (GstSignalProcessor * gsp, guint sample_rate)
|
||||||
/* connect the control ports */
|
/* connect the control ports */
|
||||||
for (i = 0; i < gsp_class->num_control_in; i++)
|
for (i = 0; i < gsp_class->num_control_in; i++)
|
||||||
slv2_instance_connect_port (lv2->instance,
|
slv2_instance_connect_port (lv2->instance,
|
||||||
oclass->control_in_ports[i].index, &(gsp->control_in[i]));
|
g_array_index (oclass->control_in_ports, GstLV2Port, i).index,
|
||||||
|
&(gsp->control_in[i]));
|
||||||
for (i = 0; i < gsp_class->num_control_out; i++)
|
for (i = 0; i < gsp_class->num_control_out; i++)
|
||||||
slv2_instance_connect_port (lv2->instance,
|
slv2_instance_connect_port (lv2->instance,
|
||||||
oclass->control_out_ports[i].index, &(gsp->control_out[i]));
|
g_array_index (oclass->control_out_ports, GstLV2Port, i).index,
|
||||||
|
&(gsp->control_out[i]));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -486,18 +526,43 @@ gst_lv2_process (GstSignalProcessor * gsp, guint nframes)
|
||||||
GstSignalProcessorClass *gsp_class;
|
GstSignalProcessorClass *gsp_class;
|
||||||
GstLV2 *lv2;
|
GstLV2 *lv2;
|
||||||
GstLV2Class *oclass;
|
GstLV2Class *oclass;
|
||||||
guint i;
|
GstLV2Group *lv2_group;
|
||||||
|
GstLV2Port *lv2_port;
|
||||||
|
GstSignalProcessorGroup *gst_group;
|
||||||
|
guint i, j;
|
||||||
|
|
||||||
gsp_class = GST_SIGNAL_PROCESSOR_GET_CLASS (gsp);
|
gsp_class = GST_SIGNAL_PROCESSOR_GET_CLASS (gsp);
|
||||||
lv2 = (GstLV2 *) gsp;
|
lv2 = (GstLV2 *) gsp;
|
||||||
oclass = (GstLV2Class *) gsp_class;
|
oclass = (GstLV2Class *) gsp_class;
|
||||||
|
|
||||||
for (i = 0; i < gsp_class->num_audio_in; i++)
|
for (i = 0; i < gsp_class->num_group_in; i++) {
|
||||||
slv2_instance_connect_port (lv2->instance,
|
lv2_group = &g_array_index (oclass->in_groups, GstLV2Group, i);
|
||||||
oclass->audio_in_ports[i].index, gsp->audio_in[i]);
|
gst_group = &gsp->group_in[i];
|
||||||
for (i = 0; i < gsp_class->num_audio_out; i++)
|
for (j = 0; j < lv2_group->ports->len; ++j) {
|
||||||
slv2_instance_connect_port (lv2->instance,
|
lv2_port = &g_array_index (lv2_group->ports, GstLV2Port, j);
|
||||||
oclass->audio_out_ports[i].index, gsp->audio_out[i]);
|
slv2_instance_connect_port (lv2->instance, lv2_port->index,
|
||||||
|
gst_group->buffer + (j * nframes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0; i < gsp_class->num_audio_in; i++) {
|
||||||
|
lv2_port = &g_array_index (oclass->audio_in_ports, GstLV2Port, i);
|
||||||
|
slv2_instance_connect_port (lv2->instance, lv2_port->index,
|
||||||
|
gsp->audio_in[i]);
|
||||||
|
}
|
||||||
|
for (i = 0; i < gsp_class->num_group_out; i++) {
|
||||||
|
lv2_group = &g_array_index (oclass->out_groups, GstLV2Group, i);
|
||||||
|
gst_group = &gsp->group_out[i];
|
||||||
|
for (j = 0; j < lv2_group->ports->len; ++j) {
|
||||||
|
lv2_port = &g_array_index (lv2_group->ports, GstLV2Port, j);
|
||||||
|
slv2_instance_connect_port (lv2->instance, lv2_port->index,
|
||||||
|
gst_group->buffer + (j * nframes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0; i < gsp_class->num_audio_out; i++) {
|
||||||
|
lv2_port = &g_array_index (oclass->audio_out_ports, GstLV2Port, i);
|
||||||
|
slv2_instance_connect_port (lv2->instance, lv2_port->index,
|
||||||
|
gsp->audio_out[i]);
|
||||||
|
}
|
||||||
|
|
||||||
slv2_instance_run (lv2->instance, nframes);
|
slv2_instance_run (lv2->instance, nframes);
|
||||||
}
|
}
|
||||||
|
@ -565,15 +630,15 @@ plugin_init (GstPlugin * plugin)
|
||||||
control_class = slv2_value_new_uri (world, SLV2_PORT_CLASS_CONTROL);
|
control_class = slv2_value_new_uri (world, SLV2_PORT_CLASS_CONTROL);
|
||||||
input_class = slv2_value_new_uri (world, SLV2_PORT_CLASS_INPUT);
|
input_class = slv2_value_new_uri (world, SLV2_PORT_CLASS_INPUT);
|
||||||
output_class = slv2_value_new_uri (world, SLV2_PORT_CLASS_OUTPUT);
|
output_class = slv2_value_new_uri (world, SLV2_PORT_CLASS_OUTPUT);
|
||||||
integer_prop =
|
|
||||||
slv2_value_new_uri (world, "http://lv2plug.in/ns/lv2core#integer");
|
#define NS_LV2 "http://lv2plug.in/ns/lv2core#"
|
||||||
toggled_prop =
|
#define NS_PG "http://lv2plug.in/ns/dev/port-groups#"
|
||||||
slv2_value_new_uri (world, "http://lv2plug.in/ns/lv2core#toggled");
|
|
||||||
in_place_broken_pred = slv2_value_new_uri (world,
|
integer_prop = slv2_value_new_uri (world, NS_LV2 "integer");
|
||||||
"http://lv2plug.in/ns/lv2core#inPlaceBroken");
|
toggled_prop = slv2_value_new_uri (world, NS_LV2 "toggled");
|
||||||
in_group_pred =
|
in_place_broken_pred = slv2_value_new_uri (world, NS_LV2 "inPlaceBroken");
|
||||||
slv2_value_new_uri (world,
|
in_group_pred = slv2_value_new_uri (world, NS_PG "inGroup");
|
||||||
"http://lv2plug.in/ns/dev/port-groups#inGroup");
|
lv2_symbol_pred = slv2_value_new_string (world, NS_LV2 "symbol");
|
||||||
|
|
||||||
parent_class = g_type_class_ref (GST_TYPE_SIGNAL_PROCESSOR);
|
parent_class = g_type_class_ref (GST_TYPE_SIGNAL_PROCESSOR);
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ typedef struct _lv2_control_info {
|
||||||
|
|
||||||
typedef struct _GstLV2 GstLV2;
|
typedef struct _GstLV2 GstLV2;
|
||||||
typedef struct _GstLV2Class GstLV2Class;
|
typedef struct _GstLV2Class GstLV2Class;
|
||||||
|
typedef struct _GstLV2Group GstLV2Group;
|
||||||
|
typedef struct _GstLV2Port GstLV2Port;
|
||||||
|
|
||||||
|
|
||||||
struct _GstLV2 {
|
struct _GstLV2 {
|
||||||
|
@ -57,9 +59,16 @@ struct _GstLV2 {
|
||||||
gboolean activated;
|
gboolean activated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _GstLV2Group {
|
||||||
|
SLV2Value uri; /**< RDF resource (URI or blank node) */
|
||||||
|
guint pad; /**< Gst pad index */
|
||||||
|
SLV2Value symbol; /**< Gst pad name / LV2 group symbol */
|
||||||
|
GArray *ports; /**< Array of GstLV2Port */
|
||||||
|
};
|
||||||
|
|
||||||
struct _GstLV2Port {
|
struct _GstLV2Port {
|
||||||
gint index;
|
gint index; /**< LV2 port index (on LV2 plugin) */
|
||||||
SLV2Value group;
|
gint pad; /**< Gst pad index (iff not part of a group) */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstLV2Class {
|
struct _GstLV2Class {
|
||||||
|
@ -67,12 +76,13 @@ struct _GstLV2Class {
|
||||||
|
|
||||||
SLV2Plugin plugin;
|
SLV2Plugin plugin;
|
||||||
|
|
||||||
GSList *groups;
|
GArray *in_groups; /**< Array of GstLV2Group */
|
||||||
|
GArray *out_groups; /**< Array of GstLV2Group */
|
||||||
|
GArray *audio_in_ports; /**< Array of GstLV2Port */
|
||||||
|
GArray *audio_out_ports; /**< Array of GstLV2Port */
|
||||||
|
GArray *control_in_ports; /**< Array of GstLV2Port */
|
||||||
|
GArray *control_out_ports; /**< Array of GstLV2Port */
|
||||||
|
|
||||||
struct _GstLV2Port *audio_in_ports;
|
|
||||||
struct _GstLV2Port *audio_out_ports;
|
|
||||||
struct _GstLV2Port *control_in_ports;
|
|
||||||
struct _GstLV2Port *control_out_ports;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,14 @@
|
||||||
* 1. store each received buffer on the pad and decrement pending_in
|
* 1. store each received buffer on the pad and decrement pending_in
|
||||||
* 2. when pending_in==0, process as much as we can and push outputs
|
* 2. when pending_in==0, process as much as we can and push outputs
|
||||||
*
|
*
|
||||||
* In pull mode (gst_signal_processor_getrange) is operates as follows:
|
* In pull mode (gst_signal_processor_getrange) it operates as follows:
|
||||||
* 1. if there is an output ready, deliver
|
* 1. if there is an output ready, deliver
|
||||||
* 2. otherwise pull from each sink-pad, process requested frames and deliver
|
* 2. otherwise pull from each sink-pad, process requested frames and deliver
|
||||||
* the buffer
|
* the buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
@ -63,6 +64,7 @@ struct _GstSignalProcessorPadTemplate
|
||||||
GstPadTemplate parent;
|
GstPadTemplate parent;
|
||||||
|
|
||||||
guint index;
|
guint index;
|
||||||
|
guint channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GType
|
static GType
|
||||||
|
@ -92,11 +94,10 @@ gst_signal_processor_pad_template_get_type (void)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_signal_processor_class_add_pad_template (GstSignalProcessorClass * klass,
|
gst_signal_processor_class_add_pad_template (GstSignalProcessorClass * klass,
|
||||||
const gchar * name, GstPadDirection direction, guint index)
|
const gchar * name, GstPadDirection direction, guint index, guint channels)
|
||||||
{
|
{
|
||||||
GstPadTemplate *new;
|
GstPadTemplate *new;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
guint channels = 1;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_SIGNAL_PROCESSOR_CLASS (klass));
|
g_return_if_fail (GST_IS_SIGNAL_PROCESSOR_CLASS (klass));
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
|
@ -111,6 +112,7 @@ gst_signal_processor_class_add_pad_template (GstSignalProcessorClass * klass,
|
||||||
"direction", direction, "presence", GST_PAD_ALWAYS, "caps", caps, NULL);
|
"direction", direction, "presence", GST_PAD_ALWAYS, "caps", caps, NULL);
|
||||||
|
|
||||||
GST_SIGNAL_PROCESSOR_PAD_TEMPLATE (new)->index = index;
|
GST_SIGNAL_PROCESSOR_PAD_TEMPLATE (new)->index = index;
|
||||||
|
GST_SIGNAL_PROCESSOR_PAD_TEMPLATE (new)->channels = channels;
|
||||||
|
|
||||||
gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), new);
|
gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), new);
|
||||||
}
|
}
|
||||||
|
@ -132,6 +134,9 @@ struct _GstSignalProcessorPad
|
||||||
/* index for the pad per direction (starting from 0) */
|
/* index for the pad per direction (starting from 0) */
|
||||||
guint index;
|
guint index;
|
||||||
|
|
||||||
|
/* number of channels for the pad */
|
||||||
|
guint channels;
|
||||||
|
|
||||||
/* these are only used for sink pads */
|
/* these are only used for sink pads */
|
||||||
guint samples_avail; /* available mono sample frames */
|
guint samples_avail; /* available mono sample frames */
|
||||||
gfloat *data; /* data pointer to read from / write to */
|
gfloat *data; /* data pointer to read from / write to */
|
||||||
|
@ -208,6 +213,8 @@ gst_signal_processor_add_pad_from_template (GstSignalProcessor * self,
|
||||||
"template", templ, NULL);
|
"template", templ, NULL);
|
||||||
GST_SIGNAL_PROCESSOR_PAD (new)->index =
|
GST_SIGNAL_PROCESSOR_PAD (new)->index =
|
||||||
GST_SIGNAL_PROCESSOR_PAD_TEMPLATE (templ)->index;
|
GST_SIGNAL_PROCESSOR_PAD_TEMPLATE (templ)->index;
|
||||||
|
GST_SIGNAL_PROCESSOR_PAD (new)->channels =
|
||||||
|
GST_SIGNAL_PROCESSOR_PAD_TEMPLATE (templ)->channels;
|
||||||
|
|
||||||
gst_pad_set_setcaps_function (new,
|
gst_pad_set_setcaps_function (new,
|
||||||
GST_DEBUG_FUNCPTR (gst_signal_processor_setcaps));
|
GST_DEBUG_FUNCPTR (gst_signal_processor_setcaps));
|
||||||
|
@ -244,20 +251,21 @@ gst_signal_processor_init (GstSignalProcessor * self,
|
||||||
|
|
||||||
while (templates) {
|
while (templates) {
|
||||||
GstPadTemplate *templ = GST_PAD_TEMPLATE (templates->data);
|
GstPadTemplate *templ = GST_PAD_TEMPLATE (templates->data);
|
||||||
|
|
||||||
gst_signal_processor_add_pad_from_template (self, templ);
|
gst_signal_processor_add_pad_from_template (self, templ);
|
||||||
templates = templates->next;
|
templates = templates->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->state = GST_SIGNAL_PROCESSOR_STATE_NULL;
|
self->state = GST_SIGNAL_PROCESSOR_STATE_NULL;
|
||||||
|
|
||||||
|
self->group_in = g_new0 (GstSignalProcessorGroup, klass->num_group_in);
|
||||||
|
self->group_out = g_new0 (GstSignalProcessorGroup, klass->num_group_out);
|
||||||
self->audio_in = g_new0 (gfloat *, klass->num_audio_in);
|
self->audio_in = g_new0 (gfloat *, klass->num_audio_in);
|
||||||
self->control_in = g_new0 (gfloat, klass->num_control_in);
|
|
||||||
self->audio_out = g_new0 (gfloat *, klass->num_audio_out);
|
self->audio_out = g_new0 (gfloat *, klass->num_audio_out);
|
||||||
|
self->control_in = g_new0 (gfloat, klass->num_control_in);
|
||||||
self->control_out = g_new0 (gfloat, klass->num_control_out);
|
self->control_out = g_new0 (gfloat, klass->num_control_out);
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
self->pending_in = klass->num_audio_in;
|
self->pending_in = klass->num_group_in + klass->num_audio_in;
|
||||||
self->pending_out = 0;
|
self->pending_out = 0;
|
||||||
|
|
||||||
self->sample_rate = 0;
|
self->sample_rate = 0;
|
||||||
|
@ -268,12 +276,16 @@ gst_signal_processor_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GstSignalProcessor *self = GST_SIGNAL_PROCESSOR (object);
|
GstSignalProcessor *self = GST_SIGNAL_PROCESSOR (object);
|
||||||
|
|
||||||
|
g_free (self->group_in);
|
||||||
|
self->group_in = NULL;
|
||||||
|
g_free (self->group_out);
|
||||||
|
self->group_out = NULL;
|
||||||
g_free (self->audio_in);
|
g_free (self->audio_in);
|
||||||
self->audio_in = NULL;
|
self->audio_in = NULL;
|
||||||
g_free (self->control_in);
|
|
||||||
self->control_in = NULL;
|
|
||||||
g_free (self->audio_out);
|
g_free (self->audio_out);
|
||||||
self->audio_out = NULL;
|
self->audio_out = NULL;
|
||||||
|
g_free (self->control_in);
|
||||||
|
self->control_in = NULL;
|
||||||
g_free (self->control_out);
|
g_free (self->control_out);
|
||||||
self->control_out = NULL;
|
self->control_out = NULL;
|
||||||
|
|
||||||
|
@ -369,6 +381,7 @@ static void
|
||||||
gst_signal_processor_cleanup (GstSignalProcessor * self)
|
gst_signal_processor_cleanup (GstSignalProcessor * self)
|
||||||
{
|
{
|
||||||
GstSignalProcessorClass *klass;
|
GstSignalProcessorClass *klass;
|
||||||
|
gint i;
|
||||||
|
|
||||||
klass = GST_SIGNAL_PROCESSOR_GET_CLASS (self);
|
klass = GST_SIGNAL_PROCESSOR_GET_CLASS (self);
|
||||||
|
|
||||||
|
@ -379,6 +392,16 @@ gst_signal_processor_cleanup (GstSignalProcessor * self)
|
||||||
if (klass->cleanup)
|
if (klass->cleanup)
|
||||||
klass->cleanup (self);
|
klass->cleanup (self);
|
||||||
|
|
||||||
|
for (i = 0; i < klass->num_group_in; ++i) {
|
||||||
|
g_free (self->group_in[i].buffer);
|
||||||
|
memset (&self->group_in[i], '\0', sizeof (GstSignalProcessorGroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < klass->num_group_out; ++i) {
|
||||||
|
g_free (self->group_out[i].buffer);
|
||||||
|
memset (&self->group_in[i], '\0', sizeof (GstSignalProcessorGroup));
|
||||||
|
}
|
||||||
|
|
||||||
self->state = GST_SIGNAL_PROCESSOR_STATE_NULL;
|
self->state = GST_SIGNAL_PROCESSOR_STATE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,6 +526,36 @@ impossible:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** De-interleave a pad (gstreamer => plugin) */
|
||||||
|
static void
|
||||||
|
gst_signal_processor_deinterleave_group (GstSignalProcessorGroup * group,
|
||||||
|
guint nframes)
|
||||||
|
{
|
||||||
|
guint i, j;
|
||||||
|
g_assert (group->nframes == nframes);
|
||||||
|
g_assert (group->interleaved_buffer);
|
||||||
|
g_assert (group->buffer);
|
||||||
|
for (i = 0; i < nframes; ++i)
|
||||||
|
for (j = 0; j < group->channels; ++j)
|
||||||
|
group->buffer[(j * nframes) + i]
|
||||||
|
= group->interleaved_buffer[(i * group->channels) + j];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Interleave a pad (plugin => gstreamer) */
|
||||||
|
static void
|
||||||
|
gst_signal_processor_interleave_group (GstSignalProcessorGroup * group,
|
||||||
|
guint nframes)
|
||||||
|
{
|
||||||
|
guint i, j;
|
||||||
|
g_assert (group->nframes == nframes);
|
||||||
|
g_assert (group->interleaved_buffer);
|
||||||
|
g_assert (group->buffer);
|
||||||
|
for (i = 0; i < nframes; ++i)
|
||||||
|
for (j = 0; j < group->channels; ++j)
|
||||||
|
group->interleaved_buffer[(i * group->channels) + j]
|
||||||
|
= group->buffer[(j * nframes) + i];
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_signal_processor_event (GstPad * pad, GstEvent * event)
|
gst_signal_processor_event (GstPad * pad, GstEvent * event)
|
||||||
{
|
{
|
||||||
|
@ -543,18 +596,38 @@ gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes)
|
||||||
GstSignalProcessorClass *klass;
|
GstSignalProcessorClass *klass;
|
||||||
GList *sinks, *srcs;
|
GList *sinks, *srcs;
|
||||||
guint samples_avail = nframes;
|
guint samples_avail = nframes;
|
||||||
|
guint i, in_group_index = 0, out_group_index = 0;
|
||||||
|
|
||||||
klass = GST_SIGNAL_PROCESSOR_GET_CLASS (self);
|
klass = GST_SIGNAL_PROCESSOR_GET_CLASS (self);
|
||||||
|
|
||||||
/* first, assign audio_in pointers, and determine the number of samples that
|
/* first, assign audio_in pointers, and determine the number of samples that
|
||||||
* we can process */
|
* we can process */
|
||||||
for (sinks = elem->sinkpads; sinks; sinks = sinks->next) {
|
i = 0;
|
||||||
|
for (sinks = elem->sinkpads; sinks; sinks = sinks->next, ++i) {
|
||||||
GstSignalProcessorPad *sinkpad;
|
GstSignalProcessorPad *sinkpad;
|
||||||
|
|
||||||
sinkpad = (GstSignalProcessorPad *) sinks->data;
|
sinkpad = (GstSignalProcessorPad *) sinks->data;
|
||||||
g_assert (sinkpad->samples_avail > 0);
|
g_assert (sinkpad->samples_avail > 0);
|
||||||
samples_avail = MIN (samples_avail, sinkpad->samples_avail);
|
samples_avail = MIN (samples_avail, sinkpad->samples_avail);
|
||||||
self->audio_in[sinkpad->index] = sinkpad->data;
|
if (sinkpad->channels > 1) {
|
||||||
|
GstSignalProcessorGroup *group = &self->group_in[in_group_index++];
|
||||||
|
group->interleaved_buffer = sinkpad->data;
|
||||||
|
/* allocate buffer for de-interleaving */
|
||||||
|
if (!group->buffer || group->channels < sinkpad->channels
|
||||||
|
|| group->nframes < samples_avail) {
|
||||||
|
group->buffer =
|
||||||
|
(gfloat *) g_realloc (group->buffer,
|
||||||
|
samples_avail * sinkpad->channels * sizeof (gfloat));
|
||||||
|
memset (group->buffer, '\0',
|
||||||
|
samples_avail * sinkpad->channels * sizeof (gfloat));
|
||||||
|
}
|
||||||
|
g_assert (group->buffer);
|
||||||
|
group->channels = sinkpad->channels;
|
||||||
|
group->nframes = samples_avail;
|
||||||
|
gst_signal_processor_deinterleave_group (group, samples_avail);
|
||||||
|
} else {
|
||||||
|
self->audio_in[sinkpad->index] = sinkpad->data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: return if samples_avail==0 ? */
|
/* FIXME: return if samples_avail==0 ? */
|
||||||
|
@ -571,7 +644,9 @@ gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes)
|
||||||
sinkpad = (GstSignalProcessorPad *) sinks->data;
|
sinkpad = (GstSignalProcessorPad *) sinks->data;
|
||||||
srcpad = (GstSignalProcessorPad *) srcs->data;
|
srcpad = (GstSignalProcessorPad *) srcs->data;
|
||||||
|
|
||||||
if (GST_BUFFER_SIZE (sinkpad->pen) == samples_avail * sizeof (gfloat)) {
|
if (sinkpad->channels == 1 && sinkpad->channels == srcpad->channels
|
||||||
|
&& GST_BUFFER_SIZE (sinkpad->pen) ==
|
||||||
|
samples_avail * sizeof (gfloat)) {
|
||||||
/* reusable, yay */
|
/* reusable, yay */
|
||||||
g_assert (sinkpad->samples_avail == samples_avail);
|
g_assert (sinkpad->samples_avail == samples_avail);
|
||||||
srcpad->pen = sinkpad->pen;
|
srcpad->pen = sinkpad->pen;
|
||||||
|
@ -597,11 +672,24 @@ gst_signal_processor_prepare (GstSignalProcessor * self, guint nframes)
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
gst_pad_alloc_buffer_and_set_caps (GST_PAD (srcpad), -1,
|
gst_pad_alloc_buffer_and_set_caps (GST_PAD (srcpad), -1,
|
||||||
samples_avail * sizeof (gfloat), self->caps, &srcpad->pen);
|
samples_avail * srcpad->channels * sizeof (gfloat), self->caps,
|
||||||
|
&srcpad->pen);
|
||||||
|
|
||||||
if (ret != GST_FLOW_OK) {
|
if (ret != GST_FLOW_OK) {
|
||||||
self->flow_state = ret;
|
self->flow_state = ret;
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (srcpad->channels > 1) {
|
||||||
|
GstSignalProcessorGroup *group = &self->group_out[out_group_index++];
|
||||||
|
group->interleaved_buffer = (gfloat *) GST_BUFFER_DATA (srcpad->pen);
|
||||||
|
if (!group->buffer || group->channels < srcpad->channels
|
||||||
|
|| group->nframes < samples_avail)
|
||||||
|
group->buffer =
|
||||||
|
(gfloat *) g_realloc (group->buffer,
|
||||||
|
samples_avail * srcpad->channels * sizeof (gfloat));
|
||||||
|
g_assert (group->buffer);
|
||||||
|
group->channels = srcpad->channels;
|
||||||
|
group->nframes = samples_avail;
|
||||||
|
self->pending_out++;
|
||||||
} else {
|
} else {
|
||||||
self->audio_out[srcpad->index] = (gfloat *) GST_BUFFER_DATA (srcpad->pen);
|
self->audio_out[srcpad->index] = (gfloat *) GST_BUFFER_DATA (srcpad->pen);
|
||||||
self->pending_out++;
|
self->pending_out++;
|
||||||
|
@ -640,11 +728,21 @@ gst_signal_processor_update_inputs (GstSignalProcessor * self, guint nprocessed)
|
||||||
/* advance ->data pointers and decrement ->samples_avail, unreffing buffer
|
/* advance ->data pointers and decrement ->samples_avail, unreffing buffer
|
||||||
if no samples are left */
|
if no samples are left */
|
||||||
sinkpad->samples_avail -= nprocessed;
|
sinkpad->samples_avail -= nprocessed;
|
||||||
sinkpad->data += nprocessed; /* gfloat* arithmetic */
|
sinkpad->data += nprocessed * sinkpad->channels; /* gfloat* arithmetic */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_signal_processor_update_outputs (GstSignalProcessor * self,
|
||||||
|
guint nprocessed)
|
||||||
|
{
|
||||||
|
GstSignalProcessorClass *klass = GST_SIGNAL_PROCESSOR_GET_CLASS (self);
|
||||||
|
guint i;
|
||||||
|
for (i = 0; i < klass->num_group_out; ++i)
|
||||||
|
gst_signal_processor_interleave_group (&self->group_out[i], nprocessed);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_signal_processor_process (GstSignalProcessor * self, guint nframes)
|
gst_signal_processor_process (GstSignalProcessor * self, guint nframes)
|
||||||
{
|
{
|
||||||
|
@ -669,6 +767,7 @@ gst_signal_processor_process (GstSignalProcessor * self, guint nframes)
|
||||||
klass->process (self, nframes);
|
klass->process (self, nframes);
|
||||||
|
|
||||||
gst_signal_processor_update_inputs (self, nframes);
|
gst_signal_processor_update_inputs (self, nframes);
|
||||||
|
gst_signal_processor_update_outputs (self, nframes);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -692,7 +791,8 @@ gst_signal_processor_pen_buffer (GstSignalProcessor * self, GstPad * pad,
|
||||||
/* keep the reference */
|
/* keep the reference */
|
||||||
spad->pen = buffer;
|
spad->pen = buffer;
|
||||||
spad->data = (gfloat *) GST_BUFFER_DATA (buffer);
|
spad->data = (gfloat *) GST_BUFFER_DATA (buffer);
|
||||||
spad->samples_avail = GST_BUFFER_SIZE (buffer) / sizeof (float);
|
spad->samples_avail =
|
||||||
|
GST_BUFFER_SIZE (buffer) / sizeof (float) / spad->channels;
|
||||||
|
|
||||||
g_assert (self->pending_in != 0);
|
g_assert (self->pending_in != 0);
|
||||||
|
|
||||||
|
|
|
@ -62,10 +62,18 @@ typedef enum
|
||||||
#define GST_SIGNAL_PROCESSOR_IS_RUNNING(obj) \
|
#define GST_SIGNAL_PROCESSOR_IS_RUNNING(obj) \
|
||||||
(GST_SIGNAL_PROCESSOR (obj)->state == GST_SIGNAL_PROCESSOR_STATE_RUNNING)
|
(GST_SIGNAL_PROCESSOR (obj)->state == GST_SIGNAL_PROCESSOR_STATE_RUNNING)
|
||||||
|
|
||||||
|
typedef struct _GstSignalProcessorGroup GstSignalProcessorGroup;
|
||||||
typedef struct _GstSignalProcessor GstSignalProcessor;
|
typedef struct _GstSignalProcessor GstSignalProcessor;
|
||||||
typedef struct _GstSignalProcessorClass GstSignalProcessorClass;
|
typedef struct _GstSignalProcessorClass GstSignalProcessorClass;
|
||||||
|
|
||||||
|
|
||||||
|
struct _GstSignalProcessorGroup {
|
||||||
|
guint channels; /**< Number of channels in buffers */
|
||||||
|
guint nframes; /**< Number of frames currently allocated per channel */
|
||||||
|
gfloat *interleaved_buffer; /**< Interleaved buffer (c1c2c1c2...)*/
|
||||||
|
gfloat *buffer; /**< De-interleaved buffer (c1c1...c2c2...) */
|
||||||
|
};
|
||||||
|
|
||||||
struct _GstSignalProcessor {
|
struct _GstSignalProcessor {
|
||||||
GstElement element;
|
GstElement element;
|
||||||
|
|
||||||
|
@ -81,23 +89,32 @@ struct _GstSignalProcessor {
|
||||||
|
|
||||||
/* pending inputs before processing can take place */
|
/* pending inputs before processing can take place */
|
||||||
guint pending_in;
|
guint pending_in;
|
||||||
/* panding outputs to be filled */
|
/* pending outputs to be filled */
|
||||||
guint pending_out;
|
guint pending_out;
|
||||||
|
|
||||||
gfloat *control_in;
|
/* multi-channel signal pads */
|
||||||
|
GstSignalProcessorGroup *group_in;
|
||||||
|
GstSignalProcessorGroup *group_out;
|
||||||
|
|
||||||
|
/* single channel signal pads */
|
||||||
gfloat **audio_in;
|
gfloat **audio_in;
|
||||||
gfloat *control_out;
|
|
||||||
gfloat **audio_out;
|
gfloat **audio_out;
|
||||||
|
|
||||||
|
/* controls */
|
||||||
|
gfloat *control_in;
|
||||||
|
gfloat *control_out;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstSignalProcessorClass {
|
struct _GstSignalProcessorClass {
|
||||||
GstElementClass parent_class;
|
GstElementClass parent_class;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
guint num_control_in;
|
guint num_group_in;
|
||||||
|
guint num_group_out;
|
||||||
guint num_audio_in;
|
guint num_audio_in;
|
||||||
guint num_control_out;
|
|
||||||
guint num_audio_out;
|
guint num_audio_out;
|
||||||
|
guint num_control_in;
|
||||||
|
guint num_control_out;
|
||||||
|
|
||||||
guint flags;
|
guint flags;
|
||||||
|
|
||||||
|
@ -114,7 +131,7 @@ struct _GstSignalProcessorClass {
|
||||||
|
|
||||||
GType gst_signal_processor_get_type (void);
|
GType gst_signal_processor_get_type (void);
|
||||||
void gst_signal_processor_class_add_pad_template (GstSignalProcessorClass *klass,
|
void gst_signal_processor_class_add_pad_template (GstSignalProcessorClass *klass,
|
||||||
const gchar *name, GstPadDirection direction, guint index);
|
const gchar *name, GstPadDirection direction, guint index, guint channels);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue