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 21:30:09 +00:00
parent 0498722c8a
commit fb9500ea5e
2 changed files with 57 additions and 53 deletions

View file

@ -57,15 +57,12 @@ struct _GstVideoCropClass {
}; };
/* elementfactory information */ /* elementfactory information */
static GstElementDetails gst_video_crop_details = { static GstElementDetails gst_video_crop_details = GST_ELEMENT_DETAILS (
"video crop filter", "video crop filter",
"Filter/Video", "Filter/Video",
"LGPL",
"Crops video into a user defined region", "Crops video into a user defined region",
VERSION, "Wim Taymans <wim.taymans@chello.be>"
"Wim Taymans <wim.taymans@chello.be>", );
"(C) 2002",
};
/* VideoCrop signals and args */ /* VideoCrop signals and args */
@ -108,6 +105,7 @@ GST_PAD_TEMPLATE_FACTORY (video_crop_sink_template_factory,
) )
static void gst_video_crop_base_init (gpointer g_class);
static void gst_video_crop_class_init (GstVideoCropClass *klass); static void gst_video_crop_class_init (GstVideoCropClass *klass);
static void gst_video_crop_init (GstVideoCrop *video_crop); static void gst_video_crop_init (GstVideoCrop *video_crop);
@ -135,7 +133,7 @@ gst_video_crop_get_type (void)
if (!video_crop_type) { if (!video_crop_type) {
static const GTypeInfo video_crop_info = { static const GTypeInfo video_crop_info = {
sizeof(GstVideoCropClass), sizeof(GstVideoCropClass),
NULL, gst_video_crop_base_init,
NULL, NULL,
(GClassInitFunc)gst_video_crop_class_init, (GClassInitFunc)gst_video_crop_class_init,
NULL, NULL,
@ -149,6 +147,18 @@ gst_video_crop_get_type (void)
return video_crop_type; return video_crop_type;
} }
static void
gst_video_crop_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_video_crop_details);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (video_crop_sink_template_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (video_crop_src_template_factory));
}
static void static void
gst_video_crop_class_init (GstVideoCropClass *klass) gst_video_crop_class_init (GstVideoCropClass *klass)
{ {
@ -423,28 +433,20 @@ gst_video_crop_change_state (GstElement *element)
} }
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
GstElementFactory *factory; return gst_element_register (plugin, "videocrop", GST_RANK_PRIMARY, GST_TYPE_VIDEO_CROP);
/* create an elementfactory for the videocrop element */
factory = gst_element_factory_new ("videocrop", GST_TYPE_VIDEO_CROP, &gst_video_crop_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (video_crop_sink_template_factory));
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (video_crop_src_template_factory));
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
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,
"videocrop", "videocrop",
plugin_init "Crops video into a user defined region",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View file

@ -24,15 +24,12 @@
#include <gstvideodrop.h> #include <gstvideodrop.h>
/* elementfactory information */ /* elementfactory information */
static GstElementDetails videodrop_details = { static GstElementDetails videodrop_details = GST_ELEMENT_DETAILS (
"Video frame dropper", "Video frame dropper",
"Filter/Video", "Filter/Video",
"LGPL",
"Re-FPS'es video", "Re-FPS'es video",
VERSION, "Ronald Bultje <rbultje@ronald.bitfreak.net>"
"Ronald Bultje <rbultje@ronald.bitfreak.net>", );
"(C) 2003",
};
/* GstVideodrop signals and args */ /* GstVideodrop signals and args */
enum { enum {
@ -85,6 +82,7 @@ GST_PAD_TEMPLATE_FACTORY(sink_template,
) )
) )
static void gst_videodrop_base_init (gpointer g_class);
static void gst_videodrop_class_init (GstVideodropClass *klass); static void gst_videodrop_class_init (GstVideodropClass *klass);
static void gst_videodrop_init (GstVideodrop *videodrop); static void gst_videodrop_init (GstVideodrop *videodrop);
static void gst_videodrop_chain (GstPad *pad, GstData *_data); static void gst_videodrop_chain (GstPad *pad, GstData *_data);
@ -100,7 +98,7 @@ gst_videodrop_get_type (void)
if (!videodrop_type) { if (!videodrop_type) {
static const GTypeInfo videodrop_info = { static const GTypeInfo videodrop_info = {
sizeof (GstVideodropClass), sizeof (GstVideodropClass),
NULL, gst_videodrop_base_init,
NULL, NULL,
(GClassInitFunc) gst_videodrop_class_init, (GClassInitFunc) gst_videodrop_class_init,
NULL, NULL,
@ -118,10 +116,22 @@ gst_videodrop_get_type (void)
return videodrop_type; return videodrop_type;
} }
static void
gst_videodrop_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &videodrop_details);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_template));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_template));
}
static void static void
gst_videodrop_class_init (GstVideodropClass *klass) gst_videodrop_class_init (GstVideodropClass *klass)
{ {
parent_class = g_type_class_ref (GST_TYPE_ELEMENT); parent_class = g_type_class_peek_parent (klass);
} }
#define gst_caps_get_float_range(caps, name, min, max) \ #define gst_caps_get_float_range(caps, name, min, max) \
@ -229,28 +239,20 @@ gst_videodrop_chain (GstPad *pad, GstData *_data)
} }
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
GstElementFactory *factory; return gst_element_register (plugin, "videodrop", GST_RANK_NONE, GST_TYPE_VIDEODROP);
/* create an elementfactory for the videodrop element */
factory = gst_element_factory_new ("videodrop", GST_TYPE_VIDEODROP,
&videodrop_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (sink_template));
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (src_template));
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,
"videodrop", "videodrop",
plugin_init "Re-FPS'es video",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)