fix for new plugin system

Original commit message from CVS:
fix for new plugin system
This commit is contained in:
Benjamin Otte 2003-11-02 20:48:33 +00:00
parent 679866123c
commit 281738cef9
2 changed files with 113 additions and 106 deletions

View file

@ -28,15 +28,12 @@
/* elementfactory information */ /* elementfactory information */
static GstElementDetails videoscale_details = { static GstElementDetails videoscale_details = GST_ELEMENT_DETAILS (
"Video scaler", "Video scaler",
"Filter/Video", "Filter/Video",
"LGPL",
"Resizes video", "Resizes video",
VERSION, "Wim Taymans <wim.taymans@chello.be>"
"Wim Taymans <wim.taymans@chello.be>", );
"(C) 2000",
};
/* GstVideoscale signals and args */ /* GstVideoscale signals and args */
enum { enum {
@ -68,57 +65,25 @@ gst_videoscale_method_get_type (void)
return videoscale_method_type; return videoscale_method_type;
} }
static void gst_videoscale_class_init (GstVideoscaleClass *klass); static GstCaps *
static void gst_videoscale_init (GstVideoscale *videoscale); gst_videoscale_get_capslist(void)
static void gst_videoscale_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_videoscale_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void gst_videoscale_chain (GstPad *pad, GstData *_data);
static GstCaps * gst_videoscale_get_capslist(void);
static GstElementClass *parent_class = NULL;
/*static guint gst_videoscale_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_videoscale_get_type (void)
{ {
static GType videoscale_type = 0; static GstCaps *capslist = NULL;
GstCaps *caps;
int i;
if (!videoscale_type) { if (capslist){
static const GTypeInfo videoscale_info = { gst_caps_ref(capslist);
sizeof(GstVideoscaleClass), NULL, return capslist;
NULL,
(GClassInitFunc)gst_videoscale_class_init,
NULL,
NULL,
sizeof(GstVideoscale),
0,
(GInstanceInitFunc)gst_videoscale_init,
};
videoscale_type = g_type_register_static(GST_TYPE_ELEMENT, "GstVideoscale", &videoscale_info, 0);
} }
return videoscale_type;
}
static void for(i=0;i<videoscale_n_formats;i++){
gst_videoscale_class_init (GstVideoscaleClass *klass) caps = videoscale_get_caps(videoscale_formats + i);
{ capslist = gst_caps_append(capslist, caps);
GObjectClass *gobject_class; }
GstElementClass *gstelement_class;
gobject_class = (GObjectClass*)klass;
gstelement_class = (GstElementClass*)klass;
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_METHOD,
g_param_spec_enum("method","method","method",
GST_TYPE_VIDEOSCALE_METHOD,0,G_PARAM_READWRITE)); /* CHECKME! */
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
gobject_class->set_property = gst_videoscale_set_property;
gobject_class->get_property = gst_videoscale_get_property;
gst_caps_ref(capslist);
return capslist;
} }
static GstPadTemplate * static GstPadTemplate *
@ -179,25 +144,69 @@ gst_videoscale_sink_template_factory(void)
return templ; return templ;
} }
static GstCaps * static void gst_videoscale_base_init (gpointer g_class);
gst_videoscale_get_capslist(void) static void gst_videoscale_class_init (GstVideoscaleClass *klass);
static void gst_videoscale_init (GstVideoscale *videoscale);
static void gst_videoscale_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_videoscale_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void gst_videoscale_chain (GstPad *pad, GstData *_data);
static GstCaps * gst_videoscale_get_capslist(void);
static GstElementClass *parent_class = NULL;
/*static guint gst_videoscale_signals[LAST_SIGNAL] = { 0 }; */
GType
gst_videoscale_get_type (void)
{ {
static GstCaps *capslist = NULL; static GType videoscale_type = 0;
GstCaps *caps;
int i;
if (capslist){ if (!videoscale_type) {
gst_caps_ref(capslist); static const GTypeInfo videoscale_info = {
return capslist; sizeof(GstVideoscaleClass),
gst_videoscale_base_init,
NULL,
(GClassInitFunc)gst_videoscale_class_init,
NULL,
NULL,
sizeof(GstVideoscale),
0,
(GInstanceInitFunc)gst_videoscale_init,
};
videoscale_type = g_type_register_static(GST_TYPE_ELEMENT, "GstVideoscale", &videoscale_info, 0);
} }
return videoscale_type;
}
for(i=0;i<videoscale_n_formats;i++){ static void
caps = videoscale_get_caps(videoscale_formats + i); gst_videoscale_base_init (gpointer g_class)
capslist = gst_caps_append(capslist, caps); {
} GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &videoscale_details);
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoscale_sink_template_factory));
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoscale_src_template_factory));
}
static void
gst_videoscale_class_init (GstVideoscaleClass *klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass*)klass;
gstelement_class = (GstElementClass*)klass;
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_METHOD,
g_param_spec_enum("method","method","method",
GST_TYPE_VIDEOSCALE_METHOD,0,G_PARAM_READWRITE)); /* CHECKME! */
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
gobject_class->set_property = gst_videoscale_set_property;
gobject_class->get_property = gst_videoscale_get_property;
gst_caps_ref(capslist);
return capslist;
} }
static GstCaps * static GstCaps *
@ -485,26 +494,20 @@ gst_videoscale_get_property (GObject *object, guint prop_id, GValue *value, GPar
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
GstElementFactory *factory; return gst_element_register (plugin, "videoscale", GST_RANK_NONE, GST_TYPE_VIDEOSCALE);
/* create an elementfactory for the videoscale element */
factory = gst_element_factory_new("videoscale",GST_TYPE_VIDEOSCALE,
&videoscale_details);
g_return_val_if_fail(factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_videoscale_sink_template_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_videoscale_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,
"videoscale", "videoscale",
plugin_init "Resizes video",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View file

@ -31,15 +31,12 @@
/* elementfactory information */ /* elementfactory information */
static GstElementDetails videotestsrc_details = { static GstElementDetails videotestsrc_details = GST_ELEMENT_DETAILS (
"Video test source", "Video test source",
"Source/Video", "Source/Video",
"LGPL",
"Creates a test video stream", "Creates a test video stream",
VERSION, "David A. Schleef <ds@schleef.org>"
"David A. Schleef <ds@schleef.org>", );
"(C) 2002",
};
/* GstVideotestsrc signals and args */ /* GstVideotestsrc signals and args */
enum enum
@ -60,6 +57,7 @@ enum
/* FILL ME */ /* FILL ME */
}; };
static void gst_videotestsrc_base_init (gpointer g_class);
static void gst_videotestsrc_class_init (GstVideotestsrcClass * klass); static void gst_videotestsrc_class_init (GstVideotestsrcClass * klass);
static void gst_videotestsrc_init (GstVideotestsrc * videotestsrc); static void gst_videotestsrc_init (GstVideotestsrc * videotestsrc);
static GstElementStateReturn gst_videotestsrc_change_state (GstElement * element); static GstElementStateReturn gst_videotestsrc_change_state (GstElement * element);
@ -101,7 +99,8 @@ gst_videotestsrc_get_type (void)
if (!videotestsrc_type) { if (!videotestsrc_type) {
static const GTypeInfo videotestsrc_info = { static const GTypeInfo videotestsrc_info = {
sizeof (GstVideotestsrcClass), NULL, sizeof (GstVideotestsrcClass),
gst_videotestsrc_base_init,
NULL, NULL,
(GClassInitFunc) gst_videotestsrc_class_init, (GClassInitFunc) gst_videotestsrc_class_init,
NULL, NULL,
@ -136,6 +135,16 @@ gst_videotestsrc_pattern_get_type (void)
return videotestsrc_pattern_type; return videotestsrc_pattern_type;
} }
static void
gst_videotestsrc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &videotestsrc_details);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (videotestsrc_src_template_factory));
}
static void static void
gst_videotestsrc_class_init (GstVideotestsrcClass * klass) gst_videotestsrc_class_init (GstVideotestsrcClass * klass)
{ {
@ -568,28 +577,23 @@ gst_videotestsrc_get_property (GObject * object, guint prop_id, GValue * value,
static gboolean static gboolean
plugin_init (GModule * module, GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
GstElementFactory *factory; return gst_element_register (plugin, "videotestsrc", GST_RANK_NONE, GST_TYPE_VIDEOTESTSRC);
/* create an elementfactory for the videotestsrc element */
factory = gst_element_factory_new ("videotestsrc", GST_TYPE_VIDEOTESTSRC, &videotestsrc_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (videotestsrc_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,
"videotestsrc", "videotestsrc",
plugin_init "Creates a test video stream",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)