mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
fix to new plugin system
Original commit message from CVS: fix to new plugin system
This commit is contained in:
parent
9c852c6349
commit
302cf767d9
2 changed files with 58 additions and 52 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <gstwavenc.h>
|
||||
#include <riff.h>
|
||||
|
||||
static void gst_wavenc_base_init (gpointer g_class);
|
||||
static void gst_wavenc_class_init (GstWavEncClass *klass);
|
||||
static void gst_wavenc_init (GstWavEnc *wavenc);
|
||||
static void gst_wavenc_chain (GstPad *pad, GstData *_data);
|
||||
|
@ -68,15 +69,12 @@ struct wave_header {
|
|||
struct chunk_struct data;
|
||||
};
|
||||
|
||||
static GstElementDetails gst_wavenc_details = {
|
||||
static GstElementDetails gst_wavenc_details = GST_ELEMENT_DETAILS (
|
||||
"WAV encoder",
|
||||
"Codec/Audio/Encoder",
|
||||
"LGPL",
|
||||
"Encode raw audio into WAV",
|
||||
VERSION,
|
||||
"Iain Holmes <iain@prettypeople.org>",
|
||||
"(C) 2002",
|
||||
};
|
||||
"Iain Holmes <iain@prettypeople.org>"
|
||||
);
|
||||
|
||||
static GstPadTemplate *srctemplate, *sinktemplate;
|
||||
|
||||
|
@ -128,7 +126,7 @@ gst_wavenc_get_type (void)
|
|||
if (type == 0) {
|
||||
static const GTypeInfo info = {
|
||||
sizeof (GstWavEncClass),
|
||||
NULL,
|
||||
gst_wavenc_base_init,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_wavenc_class_init,
|
||||
NULL,
|
||||
|
@ -185,6 +183,19 @@ set_property (GObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_wavenc_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details (element_class, &gst_wavenc_details);
|
||||
|
||||
srctemplate = src_factory ();
|
||||
gst_element_class_add_pad_template (element_class, srctemplate);
|
||||
|
||||
sinktemplate = sink_factory ();
|
||||
gst_element_class_add_pad_template (element_class, sinktemplate);
|
||||
}
|
||||
static void
|
||||
gst_wavenc_class_init (GstWavEncClass *klass)
|
||||
{
|
||||
|
@ -642,29 +653,21 @@ gst_wavenc_chain (GstPad *pad,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module,
|
||||
GstPlugin *plugin)
|
||||
plugin_init (GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
|
||||
factory = gst_element_factory_new ("wavenc", GST_TYPE_WAVENC,
|
||||
&gst_wavenc_details);
|
||||
|
||||
srctemplate = src_factory ();
|
||||
gst_element_factory_add_pad_template (factory, srctemplate);
|
||||
|
||||
sinktemplate = sink_factory ();
|
||||
gst_element_factory_add_pad_template (factory, sinktemplate);
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
return gst_element_register (plugin, "wavenc", GST_RANK_NONE, GST_TYPE_WAVENC);
|
||||
}
|
||||
|
||||
GstPluginDesc plugin_desc = {
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"wavenc",
|
||||
plugin_init
|
||||
};
|
||||
"Encode raw audio into WAV",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_COPYRIGHT,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <gstwavparse.h>
|
||||
|
||||
static void gst_wavparse_base_init (gpointer g_class);
|
||||
static void gst_wavparse_class_init (GstWavParseClass *klass);
|
||||
static void gst_wavparse_init (GstWavParse *wavparse);
|
||||
|
||||
|
@ -52,15 +53,12 @@ static gboolean gst_wavparse_srcpad_event (GstPad *pad, GstEvent *event);
|
|||
static void gst_wavparse_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_wavparse_details = {
|
||||
static GstElementDetails gst_wavparse_details = GST_ELEMENT_DETAILS (
|
||||
".wav parser",
|
||||
"Codec/Parser",
|
||||
"LGPL",
|
||||
"Parse a .wav file into raw audio",
|
||||
VERSION,
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>",
|
||||
"(C) 1999",
|
||||
};
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>"
|
||||
);
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
|
||||
"wavparse_sink",
|
||||
|
@ -138,7 +136,8 @@ gst_wavparse_get_type (void)
|
|||
|
||||
if (!wavparse_type) {
|
||||
static const GTypeInfo wavparse_info = {
|
||||
sizeof(GstWavParseClass), NULL,
|
||||
sizeof(GstWavParseClass),
|
||||
gst_wavparse_base_init,
|
||||
NULL,
|
||||
(GClassInitFunc) gst_wavparse_class_init,
|
||||
NULL,
|
||||
|
@ -152,6 +151,18 @@ gst_wavparse_get_type (void)
|
|||
return wavparse_type;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gst_wavparse_base_init (gpointer g_class)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_set_details (element_class, &gst_wavparse_details);
|
||||
|
||||
/* register src pads */
|
||||
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (sink_template_factory));
|
||||
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (src_template_factory));
|
||||
}
|
||||
static void
|
||||
gst_wavparse_class_init (GstWavParseClass *klass)
|
||||
{
|
||||
|
@ -1100,32 +1111,24 @@ gst_wavparse_change_state (GstElement *element)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
plugin_init (GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
|
||||
if (!gst_library_load ("gstbytestream")) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* create an elementfactory for the wavparse element */
|
||||
factory = gst_element_factory_new ("wavparse", GST_TYPE_WAVPARSE,
|
||||
&gst_wavparse_details);
|
||||
g_return_val_if_fail(factory != NULL, FALSE);
|
||||
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_SECONDARY);
|
||||
|
||||
/* register src pads */
|
||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_template_factory));
|
||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_template_factory));
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
return gst_element_register (plugin, "wavparse", GST_RANK_SECONDARY, GST_TYPE_WAVPARSE);
|
||||
}
|
||||
|
||||
GstPluginDesc plugin_desc = {
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"wavparse",
|
||||
plugin_init
|
||||
};
|
||||
"Parse a .wav file into raw audio",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_COPYRIGHT,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue