deactivate and remove dparams (libgstcontrol)

Original commit message from CVS:
deactivate and remove dparams (libgstcontrol)
This commit is contained in:
Stefan Kost 2005-08-01 16:22:31 +00:00
parent 0e6ea270ef
commit 4227b442c6
5 changed files with 40 additions and 132 deletions

View file

@ -1,3 +1,14 @@
2005-08-01 Stefan Kost <ensonic@users.sf.net>
reviewed by: <delete if not using a buddy>
* configure.ac:
* ext/ladspa/Makefile.am:
* ext/ladspa/gstladspa.c: (gst_ladspa_init), (gst_ladspa_loop),
(gst_ladspa_chain), (gst_ladspa_get), (plugin_init):
* ext/ladspa/gstladspa.h:
deactivate and remove dparams (libgstcontrol)
2005-07-27 Wim Taymans <wim@fluendo.com> 2005-07-27 Wim Taymans <wim@fluendo.com>
* ext/faad/gstfaad.c: (gst_faad_event): * ext/faad/gstfaad.c: (gst_faad_event):

View file

@ -228,16 +228,6 @@ if test -z $GST_TOOLS_DIR; then
fi fi
AC_SUBST(GST_TOOLS_DIR) AC_SUBST(GST_TOOLS_DIR)
dnl check for gstreamer-control; uninstalled is selected preferentially
PKG_CHECK_MODULES(GST_CONTROL, gstreamer-control-$GST_MAJORMINOR >= $GST_REQ,
HAVE_GST_CONTROL="yes", HAVE_GST_CONTROL="no")
if test "x$HAVE_GST_CONTROL" = "xno"; then
AC_MSG_ERROR(no GStreamer Control Libs found)
fi
AC_SUBST(GST_CONTROL_LIBS)
dnl check for gstreamer-base; uninstalled is selected preferentially dnl check for gstreamer-base; uninstalled is selected preferentially
PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQ, PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQ,
HAVE_GST_BASE="yes", HAVE_GST_BASE="no") HAVE_GST_BASE="yes", HAVE_GST_BASE="no")

View file

@ -3,7 +3,7 @@ plugin_LTLIBRARIES = libgstladspa.la
libgstladspa_la_SOURCES = gstladspa.c search.c load.c libgstladspa_la_SOURCES = gstladspa.c search.c load.c
libgstladspa_la_CFLAGS = $(GST_CFLAGS) libgstladspa_la_CFLAGS = $(GST_CFLAGS)
libgstladspa_la_LIBADD = $(GST_LIBS) $(GST_CONTROL_LIBS) libgstladspa_la_LIBADD = $(GST_LIBS)
libgstladspa_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstladspa_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = gstladspa.h utils.h noinst_HEADERS = gstladspa.h utils.h

View file

@ -414,7 +414,6 @@ gst_ladspa_init (GstLADSPA * ladspa)
ladspa->srcpads = g_new0 (GstPad *, oclass->numsrcpads); ladspa->srcpads = g_new0 (GstPad *, oclass->numsrcpads);
ladspa->sinkpads = g_new0 (GstPad *, oclass->numsinkpads); ladspa->sinkpads = g_new0 (GstPad *, oclass->numsinkpads);
ladspa->controls = g_new (gfloat, oclass->numcontrols); ladspa->controls = g_new (gfloat, oclass->numcontrols);
ladspa->dpman = gst_dpman_new ("ladspa_dpman", GST_ELEMENT (ladspa));
/* set up pads */ /* set up pads */
sinkcount = 0; sinkcount = 0;
@ -432,43 +431,6 @@ gst_ladspa_init (GstLADSPA * ladspa)
ladspa->srcpads[srccount++] = pad; ladspa->srcpads[srccount++] = pad;
} }
/* set up dparams */
for (i = 0; i < oclass->numcontrols; i++) {
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i])) {
cinfo = oclass->control_info[i];
ladspa->controls[i] = cinfo.def;
if (cinfo.toggled) {
gst_dpman_add_required_dparam_callback (ladspa->dpman,
g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
0, 1, (gint) (ladspa->controls[i]), G_PARAM_READWRITE),
"int", gst_ladspa_update_int, &(ladspa->controls[i])
);
} else if (cinfo.integer) {
gst_dpman_add_required_dparam_callback (ladspa->dpman,
g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
(gint) cinfo.lowerbound, (gint) cinfo.upperbound,
(gint) ladspa->controls[i], G_PARAM_READWRITE),
"int", gst_ladspa_update_int, &(ladspa->controls[i])
);
} else if (cinfo.samplerate) {
gst_dpman_add_required_dparam_direct (ladspa->dpman,
g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
cinfo.lowerbound, cinfo.upperbound,
ladspa->controls[i], G_PARAM_READWRITE),
"hertz-rate-bound", &(ladspa->controls[i])
);
} else {
gst_dpman_add_required_dparam_direct (ladspa->dpman,
g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
cinfo.lowerbound, cinfo.upperbound,
ladspa->controls[i], G_PARAM_READWRITE),
"float", &(ladspa->controls[i])
);
}
}
}
/* nonzero default needed to instantiate() some plugins */ /* nonzero default needed to instantiate() some plugins */
ladspa->samplerate = 44100; ladspa->samplerate = 44100;
@ -729,8 +691,7 @@ static void
gst_ladspa_loop (GstElement * element) gst_ladspa_loop (GstElement * element)
{ {
guint i, j, numsrcpads, numsinkpads; guint i, j, numsrcpads, numsinkpads;
guint num_processed, num_to_process; glong num_samples;
gint largest_buffer;
LADSPA_Data **data_in, **data_out; LADSPA_Data **data_in, **data_out;
GstBuffer **buffers_in, **buffers_out; GstBuffer **buffers_in, **buffers_out;
@ -747,7 +708,8 @@ gst_ladspa_loop (GstElement * element)
buffers_in = g_new0 (GstBuffer *, numsinkpads); buffers_in = g_new0 (GstBuffer *, numsinkpads);
buffers_out = g_new0 (GstBuffer *, numsrcpads); buffers_out = g_new0 (GstBuffer *, numsrcpads);
largest_buffer = -1; /* determine largest buffer */
num_samples = -1;
/* first get all the necessary data from the input ports */ /* first get all the necessary data from the input ports */
for (i = 0; i < numsinkpads; i++) { for (i = 0; i < numsinkpads; i++) {
@ -768,12 +730,11 @@ gst_ladspa_loop (GstElement * element)
} }
} }
if (largest_buffer < 0) if (num_samples < 0)
largest_buffer = GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat); num_samples = GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat);
else else
largest_buffer = num_samples =
MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat), MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat), num_samples);
largest_buffer);
data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_in[i]); data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_in[i]);
GST_BUFFER_TIMESTAMP (buffers_in[i]) = ladspa->timestamp; GST_BUFFER_TIMESTAMP (buffers_in[i]) = ladspa->timestamp;
} }
@ -793,32 +754,15 @@ gst_ladspa_loop (GstElement * element)
data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]); data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]);
} }
GST_DPMAN_PREPROCESS (ladspa->dpman, largest_buffer, ladspa->timestamp); /* process chunk */
num_processed = 0; for (i = 0; i < numsinkpads; i++)
desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[i],
data_in[i]);
for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
data_out[i]);
/* split up processing of the buffer into chunks so that dparams can desc->run (ladspa->handle, num_samples);
* be updated when required.
* In many cases the buffer will be processed in one chunk anyway.
*/
while (GST_DPMAN_PROCESS (ladspa->dpman, num_processed)) {
num_to_process = GST_DPMAN_FRAMES_TO_PROCESS (ladspa->dpman);
for (i = 0; i < numsinkpads; i++)
desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[i],
data_in[i]);
for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
data_out[i]);
desc->run (ladspa->handle, num_to_process);
for (i = 0; i < numsinkpads; i++)
data_in[i] += num_to_process;
for (i = 0; i < numsrcpads; i++)
data_out[i] += num_to_process;
num_processed += num_to_process;
}
for (i = 0; i < numsinkpads; i++) { for (i = 0; i < numsinkpads; i++) {
if (i >= numsrcpads || buffers_out[i] != buffers_in[i]) if (i >= numsrcpads || buffers_out[i] != buffers_in[i])
@ -852,8 +796,8 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
LADSPA_Descriptor *desc; LADSPA_Descriptor *desc;
LADSPA_Data *data_in, **data_out = NULL; LADSPA_Data *data_in, **data_out = NULL;
GstBuffer **buffers_out = NULL; GstBuffer **buffers_out = NULL;
unsigned long num_samples; gulong num_samples;
guint num_to_process, num_processed, i, numsrcpads; guint i, numsrcpads;
GstLADSPA *ladspa; GstLADSPA *ladspa;
GstLADSPAClass *oclass; GstLADSPAClass *oclass;
@ -888,30 +832,13 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]); data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]);
} }
GST_DPMAN_PREPROCESS (ladspa->dpman, num_samples, /* process chunk */
GST_BUFFER_TIMESTAMP (buffer_in)); desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[0], data_in);
num_processed = 0; for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
data_out[i]);
/* split up processing of the buffer into chunks so that dparams can desc->run (ladspa->handle, num_samples);
* be updated when required.
* In many cases the buffer will be processed in one chunk anyway.
*/
while (GST_DPMAN_PROCESS (ladspa->dpman, num_processed)) {
num_to_process = GST_DPMAN_FRAMES_TO_PROCESS (ladspa->dpman);
desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[0], data_in);
for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
data_out[i]);
desc->run (ladspa->handle, num_to_process);
data_in += num_to_process;
for (i = 0; i < numsrcpads; i++)
data_out[i] += num_to_process;
num_processed += num_to_process;
}
if (!numsrcpads || buffers_out[0] != buffer_in) if (!numsrcpads || buffers_out[0] != buffer_in)
gst_buffer_unref (buffer_in); gst_buffer_unref (buffer_in);
@ -937,7 +864,6 @@ gst_ladspa_get (GstPad * pad)
GstBuffer *buf; GstBuffer *buf;
LADSPA_Data *data; LADSPA_Data *data;
LADSPA_Descriptor *desc; LADSPA_Descriptor *desc;
guint num_to_process, num_processed;
ladspa = (GstLADSPA *) gst_pad_get_parent (pad); ladspa = (GstLADSPA *) gst_pad_get_parent (pad);
oclass = (GstLADSPAClass *) (G_OBJECT_GET_CLASS (ladspa)); oclass = (GstLADSPAClass *) (G_OBJECT_GET_CLASS (ladspa));
@ -948,27 +874,13 @@ gst_ladspa_get (GstPad * pad)
GST_BUFFER_TIMESTAMP (buf) = ladspa->timestamp; GST_BUFFER_TIMESTAMP (buf) = ladspa->timestamp;
data = (LADSPA_Data *) GST_BUFFER_DATA (buf); data = (LADSPA_Data *) GST_BUFFER_DATA (buf);
GST_DPMAN_PREPROCESS (ladspa->dpman, ladspa->buffer_frames, /* update timestamp */
ladspa->timestamp); ladspa->timestamp += num_to_process * GST_SECOND / ladspa->samplerate;
num_processed = 0;
/* split up processing of the buffer into chunks so that dparams can /* process chunk */
* be updated when required. desc->connect_port (ladspa->handle, oclass->srcpad_portnums[0], data);
* In many cases the buffer will be processed in one chunk anyway.
*/
while (GST_DPMAN_PROCESS (ladspa->dpman, num_processed)) {
num_to_process = GST_DPMAN_FRAMES_TO_PROCESS (ladspa->dpman);
/* update timestamp */ desc->run (ladspa->handle, ladspa->buffer_frames);
ladspa->timestamp += num_to_process * GST_SECOND / ladspa->samplerate;
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[0], data);
desc->run (ladspa->handle, num_to_process);
data += num_to_process;
num_processed = num_to_process;
}
return GST_DATA (buf); return GST_DATA (buf);
} }
@ -1036,9 +948,6 @@ plugin_init (GstPlugin * plugin)
LADSPAPluginSearch (ladspa_describe_plugin); LADSPAPluginSearch (ladspa_describe_plugin);
/* initialize dparam support library */
gst_control_init (NULL, NULL);
return TRUE; return TRUE;
} }

View file

@ -52,8 +52,6 @@ struct _GstLADSPA {
LADSPA_Descriptor *descriptor; LADSPA_Descriptor *descriptor;
LADSPA_Handle *handle; LADSPA_Handle *handle;
GstDParamManager *dpman;
gfloat *controls; gfloat *controls;
GstPad **sinkpads, GstPad **sinkpads,