Updated for the new plugin loading code

Original commit message from CVS:
Updated for the new plugin loading code
This commit is contained in:
Jan Schmidt 2003-11-02 06:46:57 +00:00
parent 87d8e8b181
commit 01a9ce9134

View file

@ -61,30 +61,24 @@ GST_DEBUG_CATEGORY_STATIC (alsa_debug);
}G_STMT_END }G_STMT_END
#endif #endif
/* elementfactory information */ /* elementfactory information */
static GstElementDetails gst_alsa_sink_details = { static GstElementDetails gst_alsa_sink_details = GST_ELEMENT_DETAILS (
"Alsa Sink", "Alsa Sink",
"Sink/Audio", "Sink/Audio",
"LGPL",
"Output to a sound card via ALSA", "Output to a sound card via ALSA",
VERSION,
"Thomas Nyberg <thomas@codefactory.se>, " "Thomas Nyberg <thomas@codefactory.se>, "
"Andy Wingo <apwingo@eos.ncsu.edu>, " "Andy Wingo <apwingo@eos.ncsu.edu>, "
"Benjamin Otte <in7y118@public.uni-hamburg.de>", "Benjamin Otte <in7y118@public.uni-hamburg.de>"
"(C) 2001-2003" );
};
/* elementfactory information */ /* elementfactory information */
static GstElementDetails gst_alsa_src_details = { static GstElementDetails gst_alsa_src_details = GST_ELEMENT_DETAILS (
"Alsa Src", "Alsa Src",
"Source/Audio", "Source/Audio",
"LGPL",
"Read from a sound card via ALSA", "Read from a sound card via ALSA",
VERSION,
"Thomas Nyberg <thomas@codefactory.se>, " "Thomas Nyberg <thomas@codefactory.se>, "
"Andy Wingo <apwingo@eos.ncsu.edu>, " "Andy Wingo <apwingo@eos.ncsu.edu>, "
"Benjamin Otte <in7y118@public.uni-hamburg.de>", "Benjamin Otte <in7y118@public.uni-hamburg.de>"
"(C) 2001-2003" );
};
/* GObject functions */ /* GObject functions */
static void gst_alsa_class_init (GstAlsaClass * klass); static void gst_alsa_class_init (GstAlsaClass * klass);
@ -102,6 +96,7 @@ static void gst_alsa_get_property (GObject * object,
/* GstAlsaSink functions */ /* GstAlsaSink functions */
static GstPadTemplate * gst_alsa_sink_pad_factory (void); static GstPadTemplate * gst_alsa_sink_pad_factory (void);
static GstPadTemplate * gst_alsa_sink_request_pad_factory (void); static GstPadTemplate * gst_alsa_sink_request_pad_factory (void);
static void gst_alsa_sink_base_init (gpointer g_class);
static void gst_alsa_sink_class_init (GstAlsaSinkClass * klass); static void gst_alsa_sink_class_init (GstAlsaSinkClass * klass);
static void gst_alsa_sink_init (GstAlsaSink * this); static void gst_alsa_sink_init (GstAlsaSink * this);
static inline void gst_alsa_sink_flush_one_pad (GstAlsaSink * sink, static inline void gst_alsa_sink_flush_one_pad (GstAlsaSink * sink,
@ -119,6 +114,7 @@ static GstElementStateReturn gst_alsa_sink_change_state (GstElement * element);
/* GstAlsaSrc functions */ /* GstAlsaSrc functions */
static GstPadTemplate * gst_alsa_src_pad_factory (void); static GstPadTemplate * gst_alsa_src_pad_factory (void);
static GstPadTemplate * gst_alsa_src_request_pad_factory (void); static GstPadTemplate * gst_alsa_src_request_pad_factory (void);
static void gst_alsa_src_base_init (gpointer g_class);
static void gst_alsa_src_class_init (GstAlsaSrcClass * klass); static void gst_alsa_src_class_init (GstAlsaSrcClass * klass);
static void gst_alsa_src_init (GstAlsaSrc * this); static void gst_alsa_src_init (GstAlsaSrc * this);
static int gst_alsa_src_mmap (GstAlsa * this, static int gst_alsa_src_mmap (GstAlsa * this,
@ -451,7 +447,7 @@ gst_alsa_sink_get_type (void)
if (!alsa_sink_type) { if (!alsa_sink_type) {
static const GTypeInfo alsa_sink_info = { static const GTypeInfo alsa_sink_info = {
sizeof (GstAlsaSinkClass), sizeof (GstAlsaSinkClass),
NULL, gst_alsa_sink_base_init,
NULL, NULL,
(GClassInitFunc) gst_alsa_sink_class_init, (GClassInitFunc) gst_alsa_sink_class_init,
NULL, NULL,
@ -465,6 +461,18 @@ gst_alsa_sink_get_type (void)
} }
return alsa_sink_type; return alsa_sink_type;
} }
static void
gst_alsa_sink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class, gst_alsa_sink_pad_factory ());
gst_element_class_add_pad_template (element_class, gst_alsa_sink_request_pad_factory ());
gst_element_class_set_details (element_class, &gst_alsa_sink_details);
}
static void static void
gst_alsa_sink_class_init (GstAlsaSinkClass *klass) gst_alsa_sink_class_init (GstAlsaSinkClass *klass)
{ {
@ -865,7 +873,7 @@ gst_alsa_src_get_type (void)
if (!alsa_src_type) { if (!alsa_src_type) {
static const GTypeInfo alsa_src_info = { static const GTypeInfo alsa_src_info = {
sizeof (GstAlsaSrcClass), sizeof (GstAlsaSrcClass),
NULL, gst_alsa_src_base_init,
NULL, NULL,
(GClassInitFunc) gst_alsa_src_class_init, (GClassInitFunc) gst_alsa_src_class_init,
NULL, NULL,
@ -879,6 +887,18 @@ gst_alsa_src_get_type (void)
} }
return alsa_src_type; return alsa_src_type;
} }
static void
gst_alsa_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class, gst_alsa_src_pad_factory ());
gst_element_class_add_pad_template (element_class, gst_alsa_src_request_pad_factory ());
gst_element_class_set_details (element_class, &gst_alsa_src_details);
}
static void static void
gst_alsa_src_class_init (GstAlsaSrcClass *klass) gst_alsa_src_class_init (GstAlsaSrcClass *klass)
{ {
@ -2350,32 +2370,27 @@ gst_alsa_timestamp_to_bytes (GstAlsa *this, GstClockTime time)
/*** GSTREAMER PLUGIN *********************************************************/ /*** GSTREAMER PLUGIN *********************************************************/
static gboolean static gboolean
plugin_init (GModule * module, GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
GstElementFactory *factory;
GST_DEBUG_CATEGORY_INIT (alsa_debug, "alsa", 0, "alsa plugins"); GST_DEBUG_CATEGORY_INIT (alsa_debug, "alsa", 0, "alsa plugins");
factory = gst_element_factory_new ("alsasrc", GST_TYPE_ALSA_SRC, &gst_alsa_src_details); if (!gst_element_register (plugin, "alsasrc", GST_RANK_NONE, GST_TYPE_ALSA_SRC))
g_return_val_if_fail (factory != NULL, FALSE); return FALSE;
gst_element_factory_add_pad_template (factory, gst_alsa_src_pad_factory ()); if (!gst_element_register (plugin, "alsasink", GST_RANK_NONE, GST_TYPE_ALSA_SINK))
gst_element_factory_add_pad_template (factory, gst_alsa_src_request_pad_factory ()); return FALSE;
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
factory = gst_element_factory_new ("alsasink", GST_TYPE_ALSA_SINK, &gst_alsa_sink_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, gst_alsa_sink_pad_factory ());
gst_element_factory_add_pad_template (factory, gst_alsa_sink_request_pad_factory ());
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
gst_plugin_set_longname (plugin, "ALSA plugin library");
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"alsa", "alsa",
plugin_init "ALSA plugin library",
}; plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)