Changes for new plugin init code

Original commit message from CVS:
Changes for new plugin init code
This commit is contained in:
David Schleef 2003-11-01 01:32:29 +00:00
parent dcab47e405
commit 7f1f22c35a

View file

@ -30,15 +30,12 @@
#include <gstauparse.h> #include <gstauparse.h>
/* elementfactory information */ /* elementfactory information */
static GstElementDetails gst_auparse_details = { static GstElementDetails gst_auparse_details = GST_ELEMENT_DETAILS (
".au parser", ".au parser",
"Codec/Parser", "Codec/Parser",
"LGPL",
"Parse an .au file into raw audio", "Parse an .au file into raw audio",
VERSION, "Erik Walthinsen <omega@cse.ogi.edu>"
"Erik Walthinsen <omega@cse.ogi.edu>", );
"(C) 1999",
};
GST_PAD_TEMPLATE_FACTORY (sink_factory_templ, GST_PAD_TEMPLATE_FACTORY (sink_factory_templ,
"sink", "sink",
@ -51,7 +48,6 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory_templ,
) )
) )
GST_PAD_TEMPLATE_FACTORY (src_factory_templ, GST_PAD_TEMPLATE_FACTORY (src_factory_templ,
"src", "src",
GST_PAD_SRC, GST_PAD_SRC,
@ -94,6 +90,7 @@ enum {
/* FILL ME */ /* FILL ME */
}; };
static void gst_auparse_base_init (gpointer g_class);
static void gst_auparse_class_init (GstAuParseClass *klass); static void gst_auparse_class_init (GstAuParseClass *klass);
static void gst_auparse_init (GstAuParse *auparse); static void gst_auparse_init (GstAuParse *auparse);
@ -109,7 +106,8 @@ gst_auparse_get_type (void)
if (!auparse_type) { if (!auparse_type) {
static const GTypeInfo auparse_info = { static const GTypeInfo auparse_info = {
sizeof(GstAuParseClass), NULL, sizeof(GstAuParseClass),
gst_auparse_base_init,
NULL, NULL,
(GClassInitFunc) gst_auparse_class_init, (GClassInitFunc) gst_auparse_class_init,
NULL, NULL,
@ -123,6 +121,19 @@ gst_auparse_get_type (void)
return auparse_type; return auparse_type;
} }
static void
gst_auparse_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_factory_templ));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory_templ));
gst_element_class_set_details (element_class, &gst_auparse_details);
}
static void static void
gst_auparse_class_init (GstAuParseClass *klass) gst_auparse_class_init (GstAuParseClass *klass)
{ {
@ -284,29 +295,26 @@ gst_auparse_chain (GstPad *pad, GstData *_data)
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
GstElementFactory *factory; if (!gst_element_register (plugin, "auparse", GST_RANK_SECONDARY,
GST_TYPE_AUPARSE)) {
/* create the plugin structure */ return FALSE;
/* create an elementfactory for the auparse element and list it */ }
factory = gst_element_factory_new ("auparse", GST_TYPE_AUPARSE,
&gst_auparse_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_SECONDARY);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory_templ));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_factory_templ));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"auparse", "auparse",
plugin_init "parses au streams",
}; plugin_init,
VERSION,
"GPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)