mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +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 <gstwavenc.h>
|
||||||
#include <riff.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_class_init (GstWavEncClass *klass);
|
||||||
static void gst_wavenc_init (GstWavEnc *wavenc);
|
static void gst_wavenc_init (GstWavEnc *wavenc);
|
||||||
static void gst_wavenc_chain (GstPad *pad, GstData *_data);
|
static void gst_wavenc_chain (GstPad *pad, GstData *_data);
|
||||||
|
@ -68,15 +69,12 @@ struct wave_header {
|
||||||
struct chunk_struct data;
|
struct chunk_struct data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstElementDetails gst_wavenc_details = {
|
static GstElementDetails gst_wavenc_details = GST_ELEMENT_DETAILS (
|
||||||
"WAV encoder",
|
"WAV encoder",
|
||||||
"Codec/Audio/Encoder",
|
"Codec/Audio/Encoder",
|
||||||
"LGPL",
|
|
||||||
"Encode raw audio into WAV",
|
"Encode raw audio into WAV",
|
||||||
VERSION,
|
"Iain Holmes <iain@prettypeople.org>"
|
||||||
"Iain Holmes <iain@prettypeople.org>",
|
);
|
||||||
"(C) 2002",
|
|
||||||
};
|
|
||||||
|
|
||||||
static GstPadTemplate *srctemplate, *sinktemplate;
|
static GstPadTemplate *srctemplate, *sinktemplate;
|
||||||
|
|
||||||
|
@ -128,7 +126,7 @@ gst_wavenc_get_type (void)
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
static const GTypeInfo info = {
|
static const GTypeInfo info = {
|
||||||
sizeof (GstWavEncClass),
|
sizeof (GstWavEncClass),
|
||||||
NULL,
|
gst_wavenc_base_init,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc) gst_wavenc_class_init,
|
(GClassInitFunc) gst_wavenc_class_init,
|
||||||
NULL,
|
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
|
static void
|
||||||
gst_wavenc_class_init (GstWavEncClass *klass)
|
gst_wavenc_class_init (GstWavEncClass *klass)
|
||||||
{
|
{
|
||||||
|
@ -642,29 +653,21 @@ gst_wavenc_chain (GstPad *pad,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GModule *module,
|
plugin_init (GstPlugin *plugin)
|
||||||
GstPlugin *plugin)
|
|
||||||
{
|
{
|
||||||
GstElementFactory *factory;
|
return gst_element_register (plugin, "wavenc", GST_RANK_NONE, GST_TYPE_WAVENC);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPluginDesc plugin_desc = {
|
GST_PLUGIN_DEFINE (
|
||||||
GST_VERSION_MAJOR,
|
GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"wavenc",
|
"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>
|
#include <gstwavparse.h>
|
||||||
|
|
||||||
|
static void gst_wavparse_base_init (gpointer g_class);
|
||||||
static void gst_wavparse_class_init (GstWavParseClass *klass);
|
static void gst_wavparse_class_init (GstWavParseClass *klass);
|
||||||
static void gst_wavparse_init (GstWavParse *wavparse);
|
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);
|
static void gst_wavparse_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
static GstElementDetails gst_wavparse_details = {
|
static GstElementDetails gst_wavparse_details = GST_ELEMENT_DETAILS (
|
||||||
".wav parser",
|
".wav parser",
|
||||||
"Codec/Parser",
|
"Codec/Parser",
|
||||||
"LGPL",
|
|
||||||
"Parse a .wav file into raw audio",
|
"Parse a .wav file into raw audio",
|
||||||
VERSION,
|
"Erik Walthinsen <omega@cse.ogi.edu>"
|
||||||
"Erik Walthinsen <omega@cse.ogi.edu>",
|
);
|
||||||
"(C) 1999",
|
|
||||||
};
|
|
||||||
|
|
||||||
GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
|
GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
|
||||||
"wavparse_sink",
|
"wavparse_sink",
|
||||||
|
@ -138,7 +136,8 @@ gst_wavparse_get_type (void)
|
||||||
|
|
||||||
if (!wavparse_type) {
|
if (!wavparse_type) {
|
||||||
static const GTypeInfo wavparse_info = {
|
static const GTypeInfo wavparse_info = {
|
||||||
sizeof(GstWavParseClass), NULL,
|
sizeof(GstWavParseClass),
|
||||||
|
gst_wavparse_base_init,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc) gst_wavparse_class_init,
|
(GClassInitFunc) gst_wavparse_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -152,6 +151,18 @@ gst_wavparse_get_type (void)
|
||||||
return wavparse_type;
|
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
|
static void
|
||||||
gst_wavparse_class_init (GstWavParseClass *klass)
|
gst_wavparse_class_init (GstWavParseClass *klass)
|
||||||
{
|
{
|
||||||
|
@ -1100,32 +1111,24 @@ gst_wavparse_change_state (GstElement *element)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GModule *module, GstPlugin *plugin)
|
plugin_init (GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
GstElementFactory *factory;
|
|
||||||
|
|
||||||
if (!gst_library_load ("gstbytestream")) {
|
if (!gst_library_load ("gstbytestream")) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create an elementfactory for the wavparse element */
|
return gst_element_register (plugin, "wavparse", GST_RANK_SECONDARY, GST_TYPE_WAVPARSE);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPluginDesc plugin_desc = {
|
GST_PLUGIN_DEFINE (
|
||||||
GST_VERSION_MAJOR,
|
GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"wavparse",
|
"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