summaryrefslogtreecommitdiff
authorStefan Kost <ensonic@users.sf.net>2010-01-31 20:14:04 (GMT)
committer Stefan Kost <ensonic@users.sf.net>2010-01-31 20:25:51 (GMT)
commitb3ac421b96eacbd13c74c64f446247a3d553f4b5 (patch) (side-by-side diff)
tree6c0b2ca06d7daaa6ae28fe5caa14004666edb549
parent792c181edc1eebb4b452c776fd176d6a4a6983b7 (diff)
downloadgst-plugins-bad-b3ac421b96eacbd13c74c64f446247a3d553f4b5.zip
gst-plugins-bad-b3ac421b96eacbd13c74c64f446247a3d553f4b5.tar.gz
ladspa: simplify property registration
Don't do checking cast for each parameter. Use a running index.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ext/ladspa/gstladspa.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c
index d9bea18..e6dd148 100644
--- a/ext/ladspa/gstladspa.c
+++ b/ext/ladspa/gstladspa.c
@@ -436,7 +436,8 @@ gst_ladspa_class_init (GstLADSPAClass * klass, LADSPA_Descriptor * desc)
{
GObjectClass *gobject_class;
GstSignalProcessorClass *gsp_class;
- gint i;
+ GParamSpec *p;
+ gint i, ix;
GST_DEBUG ("class_init %p", klass);
@@ -451,25 +452,19 @@ gst_ladspa_class_init (GstLADSPAClass * klass, LADSPA_Descriptor * desc)
gsp_class->cleanup = gst_ladspa_cleanup;
gsp_class->process = gst_ladspa_process;
- /* register properties */
+ /* properties have an offset of 1 */
+ ix = 1;
- for (i = 0; i < gsp_class->num_control_in; i++) {
- GParamSpec *p;
+ /* register properties */
+ for (i = 0; i < gsp_class->num_control_in; i++, ix++) {
p = gst_ladspa_class_get_param_spec (klass, klass->control_in_portnums[i]);
-
- /* properties have an offset of 1 */
- g_object_class_install_property (G_OBJECT_CLASS (klass), i + 1, p);
+ g_object_class_install_property (gobject_class, ix, p);
}
- for (i = 0; i < gsp_class->num_control_out; i++) {
- GParamSpec *p;
-
+ for (i = 0; i < gsp_class->num_control_out; i++, ix++) {
p = gst_ladspa_class_get_param_spec (klass, klass->control_out_portnums[i]);
-
- /* properties have an offset of 1, and we already added num_control_in */
- g_object_class_install_property (G_OBJECT_CLASS (klass),
- gsp_class->num_control_in + i + 1, p);
+ g_object_class_install_property (gobject_class, ix, p);
}
}