+gst_ladspa_base_init (GstLADSPAClass *klass)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstPadTemplate *templ;
+ GstElementDetails *details;
+ LADSPA_Descriptor *desc;
+ gint j, sinkcount,srccount;
+
+ desc = g_hash_table_lookup(ladspa_descriptors,
+ GINT_TO_POINTER(G_TYPE_FROM_CLASS(klass)));
+ if (!desc)
+ desc = g_hash_table_lookup(ladspa_descriptors, GINT_TO_POINTER(0));
+ g_assert (desc);
+
+ /* construct the element details struct */
+ details = g_new0(GstElementDetails,1);
+ details->longname = g_strdup(desc->Name);
+ details->klass = "Filter/Effect/Audio/LADSPA";
+ details->description = details->longname;
+ details->author = g_strdup(desc->Maker);
+ gst_element_class_set_details (element_class, details);
+
+ /* pad templates */
+ klass->numports = desc->PortCount;
+ klass->numsinkpads = 0;
+ klass->numsrcpads = 0;
+ for (j=0;j<desc->PortCount;j++) {
+ if (LADSPA_IS_PORT_AUDIO(desc->PortDescriptors[j])) {
+ gchar *name = g_strdup((gchar *)desc->PortNames[j]);
+ g_strcanon (name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
+
+ /* the factories take ownership of the name */
+ if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[j])) {
+ templ = ladspa_sink_factory (name);
+ klass->numsinkpads++;
+ } else {
+ templ = ladspa_src_factory (name);
+ klass->numsrcpads++;
+ }
+
+ gst_element_class_add_pad_template (element_class, templ);
+ }
+ }
+
+ klass->srcpad_portnums = g_new0(gint,klass->numsrcpads);
+ klass->sinkpad_portnums = g_new0(gint,klass->numsinkpads);
+ sinkcount = 0;
+ srccount = 0;
+
+ /* walk through the ports, note the portnums for srcpads, sinkpads */
+ for (j=0; j<desc->PortCount; j++) {
+ if (LADSPA_IS_PORT_AUDIO(desc->PortDescriptors[j])) {
+ if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[j]))
+ klass->sinkpad_portnums[sinkcount++] = j;
+ else
+ klass->srcpad_portnums[srccount++] = j;
+ }
+ }
+
+ klass->descriptor = desc;
+}
+
+static void