mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
Fix this too. Note that the per-plugin licensing is gone because of company's new per-plugin (rather than per-element...
Original commit message from CVS: Fix this too. Note that the per-plugin licensing is gone because of company's new per-plugin (rather than per-element) API. We basically need both... Ohwell, I just want this stuff to compile.
This commit is contained in:
parent
1b6b3af9bb
commit
bd4206da03
1 changed files with 83 additions and 62 deletions
|
@ -61,6 +61,7 @@ ladspa_src_factory (gchar *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_ladspa_class_init (GstLADSPAClass *klass);
|
static void gst_ladspa_class_init (GstLADSPAClass *klass);
|
||||||
|
static void gst_ladspa_base_init (GstLADSPAClass *klass);
|
||||||
static void gst_ladspa_init (GstLADSPA *ladspa);
|
static void gst_ladspa_init (GstLADSPA *ladspa);
|
||||||
|
|
||||||
static void gst_ladspa_update_int (const GValue *value, gpointer data);
|
static void gst_ladspa_update_int (const GValue *value, gpointer data);
|
||||||
|
@ -97,13 +98,73 @@ GST_DEBUG_CATEGORY_STATIC (ladspa_debug);
|
||||||
#define DEBUG_OBJ(obj,...) \
|
#define DEBUG_OBJ(obj,...) \
|
||||||
GST_CAT_LEVEL_LOG (ladspa_debug, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
|
GST_CAT_LEVEL_LOG (ladspa_debug, GST_LEVEL_DEBUG, obj, __VA_ARGS__)
|
||||||
|
|
||||||
|
static void
|
||||||
|
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)));
|
||||||
|
|
||||||
|
/* construct the element details struct */
|
||||||
|
details = g_new0(GstElementDetails,1);
|
||||||
|
details->longname = g_strdup(desc->Name);
|
||||||
|
details->klass = "Filter/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
|
static void
|
||||||
gst_ladspa_class_init (GstLADSPAClass *klass)
|
gst_ladspa_class_init (GstLADSPAClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
LADSPA_Descriptor *desc;
|
LADSPA_Descriptor *desc;
|
||||||
gint i,current_portnum,sinkcount,srccount,controlcount;
|
gint i,current_portnum,controlcount;
|
||||||
gint hintdesc;
|
gint hintdesc;
|
||||||
gint argtype,argperms;
|
gint argtype,argperms;
|
||||||
GParamSpec *paramspec = NULL;
|
GParamSpec *paramspec = NULL;
|
||||||
|
@ -118,23 +179,15 @@ gst_ladspa_class_init (GstLADSPAClass *klass)
|
||||||
gstelement_class->change_state = gst_ladspa_change_state;
|
gstelement_class->change_state = gst_ladspa_change_state;
|
||||||
|
|
||||||
/* look up and store the ladspa descriptor */
|
/* look up and store the ladspa descriptor */
|
||||||
klass->descriptor = g_hash_table_lookup(ladspa_descriptors,GINT_TO_POINTER(G_TYPE_FROM_CLASS(klass)));
|
desc = g_hash_table_lookup(ladspa_descriptors,
|
||||||
desc = klass->descriptor;
|
GINT_TO_POINTER(G_TYPE_FROM_CLASS(klass)));
|
||||||
|
|
||||||
klass->numports = desc->PortCount;
|
|
||||||
|
|
||||||
klass->numsinkpads = 0;
|
|
||||||
klass->numsrcpads = 0;
|
|
||||||
klass->numcontrols = 0;
|
klass->numcontrols = 0;
|
||||||
|
|
||||||
/* walk through the ports, count the input, output and control ports */
|
/* walk through the ports, count the input, output and control ports */
|
||||||
for (i=0; i<desc->PortCount; i++) {
|
for (i=0; i<desc->PortCount; i++) {
|
||||||
if (LADSPA_IS_PORT_AUDIO(desc->PortDescriptors[i]))
|
if (!LADSPA_IS_PORT_AUDIO(desc->PortDescriptors[i]) &&
|
||||||
if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[i]))
|
LADSPA_IS_PORT_INPUT(desc->PortDescriptors[i]))
|
||||||
klass->numsinkpads++;
|
|
||||||
else
|
|
||||||
klass->numsrcpads++;
|
|
||||||
else if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[i]))
|
|
||||||
klass->numcontrols++;
|
klass->numcontrols++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,22 +195,13 @@ gst_ladspa_class_init (GstLADSPAClass *klass)
|
||||||
g_type_name (G_TYPE_FROM_CLASS (klass)),
|
g_type_name (G_TYPE_FROM_CLASS (klass)),
|
||||||
klass->numsinkpads, klass->numsrcpads, klass->numcontrols);
|
klass->numsinkpads, klass->numsrcpads, klass->numcontrols);
|
||||||
|
|
||||||
klass->srcpad_portnums = g_new0(gint,klass->numsrcpads);
|
|
||||||
klass->sinkpad_portnums = g_new0(gint,klass->numsinkpads);
|
|
||||||
klass->control_portnums = g_new0(gint,klass->numcontrols);
|
klass->control_portnums = g_new0(gint,klass->numcontrols);
|
||||||
sinkcount = 0;
|
|
||||||
srccount = 0;
|
|
||||||
controlcount = 0;
|
controlcount = 0;
|
||||||
|
|
||||||
/* walk through the ports, note the portnums for srcpads, sinkpads and control
|
/* walk through the ports, note the portnums for control params */
|
||||||
params */
|
|
||||||
for (i=0; i<desc->PortCount; i++) {
|
for (i=0; i<desc->PortCount; i++) {
|
||||||
if (LADSPA_IS_PORT_AUDIO(desc->PortDescriptors[i]))
|
if (!LADSPA_IS_PORT_AUDIO(desc->PortDescriptors[i]) &&
|
||||||
if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[i]))
|
LADSPA_IS_PORT_INPUT(desc->PortDescriptors[i]))
|
||||||
klass->sinkpad_portnums[sinkcount++] = i;
|
|
||||||
else
|
|
||||||
klass->srcpad_portnums[srccount++] = i;
|
|
||||||
else if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[i]))
|
|
||||||
klass->control_portnums[controlcount++] = i;
|
klass->control_portnums[controlcount++] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,12 +956,10 @@ ladspa_describe_plugin(const char *pcFullFilename,
|
||||||
LADSPA_Descriptor_Function pfDescriptorFunction)
|
LADSPA_Descriptor_Function pfDescriptorFunction)
|
||||||
{
|
{
|
||||||
const LADSPA_Descriptor *desc;
|
const LADSPA_Descriptor *desc;
|
||||||
int i,j;
|
gint i;
|
||||||
|
|
||||||
GstElementDetails *details;
|
|
||||||
GTypeInfo typeinfo = {
|
GTypeInfo typeinfo = {
|
||||||
sizeof(GstLADSPAClass),
|
sizeof(GstLADSPAClass),
|
||||||
NULL,
|
(GBaseInitFunc)gst_ladspa_base_init,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc)gst_ladspa_class_init,
|
(GClassInitFunc)gst_ladspa_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -927,7 +969,6 @@ ladspa_describe_plugin(const char *pcFullFilename,
|
||||||
(GInstanceInitFunc)gst_ladspa_init,
|
(GInstanceInitFunc)gst_ladspa_init,
|
||||||
};
|
};
|
||||||
GType type;
|
GType type;
|
||||||
GstElementFactory *factory;
|
|
||||||
|
|
||||||
/* walk through all the plugins in this pluginlibrary */
|
/* walk through all the plugins in this pluginlibrary */
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -944,44 +985,18 @@ ladspa_describe_plugin(const char *pcFullFilename,
|
||||||
}
|
}
|
||||||
/* create the type now */
|
/* create the type now */
|
||||||
type = g_type_register_static(GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
type = g_type_register_static(GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
|
||||||
|
if (!gst_element_register (ladspa_plugin, type_name, GST_RANK_NONE, type))
|
||||||
/* construct the element details struct */
|
continue;
|
||||||
details = g_new0(GstElementDetails,1);
|
|
||||||
details->longname = g_strdup(desc->Name);
|
|
||||||
details->klass = "Filter/Audio/LADSPA";
|
|
||||||
details->license = g_strdup (desc->Copyright);
|
|
||||||
details->description = details->longname;
|
|
||||||
details->version = g_strdup_printf("%ld",desc->UniqueID);
|
|
||||||
details->author = g_strdup(desc->Maker);
|
|
||||||
details->copyright = g_strdup(desc->Copyright);
|
|
||||||
|
|
||||||
/* register the plugin with gstreamer */
|
|
||||||
factory = gst_element_factory_new(type_name,type,details);
|
|
||||||
g_return_if_fail(factory != NULL);
|
|
||||||
gst_plugin_add_feature (ladspa_plugin, GST_PLUGIN_FEATURE (factory));
|
|
||||||
|
|
||||||
/* add this plugin to the hash */
|
/* add this plugin to the hash */
|
||||||
g_hash_table_insert(ladspa_descriptors,
|
g_hash_table_insert(ladspa_descriptors,
|
||||||
GINT_TO_POINTER(type),
|
GINT_TO_POINTER(type),
|
||||||
(gpointer)desc);
|
(gpointer)desc);
|
||||||
|
|
||||||
|
|
||||||
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]))
|
|
||||||
gst_element_factory_add_pad_template (factory, ladspa_sink_factory (name));
|
|
||||||
else
|
|
||||||
gst_element_factory_add_pad_template (factory, ladspa_src_factory (name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GModule *module, GstPlugin *plugin)
|
plugin_init (GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
GST_DEBUG_CATEGORY_INIT (ladspa_debug, "ladspa",
|
GST_DEBUG_CATEGORY_INIT (ladspa_debug, "ladspa",
|
||||||
GST_DEBUG_FG_GREEN | GST_DEBUG_BG_BLACK | GST_DEBUG_BOLD,
|
GST_DEBUG_FG_GREEN | GST_DEBUG_BG_BLACK | GST_DEBUG_BOLD,
|
||||||
|
@ -1000,9 +1015,15 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPluginDesc plugin_desc = {
|
GST_PLUGIN_DEFINE (
|
||||||
GST_VERSION_MAJOR,
|
GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"ladspa",
|
"ladspa",
|
||||||
plugin_init
|
"All LADSPA plugins",
|
||||||
};
|
plugin_init,
|
||||||
|
LADSPA_VERSION,
|
||||||
|
"LGPL",
|
||||||
|
"(c) 2003 The LADSPA team",
|
||||||
|
"LADSPA",
|
||||||
|
"http://www.ladspa.org/"
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue