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 7a34944aa9
commit 0c45af7343
2 changed files with 96 additions and 91 deletions

View file

@ -57,15 +57,12 @@ struct _GstVideoCropClass {
};
/* elementfactory information */
static GstElementDetails gst_video_crop_details = {
static GstElementDetails gst_video_crop_details = GST_ELEMENT_DETAILS (
"video crop filter",
"Filter/Video",
"LGPL",
"Crops video into a user defined region",
VERSION,
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2002",
};
"Wim Taymans <wim.taymans@chello.be>"
);
/* 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_init (GstVideoCrop *video_crop);
@ -135,7 +133,7 @@ gst_video_crop_get_type (void)
if (!video_crop_type) {
static const GTypeInfo video_crop_info = {
sizeof(GstVideoCropClass),
NULL,
gst_video_crop_base_init,
NULL,
(GClassInitFunc)gst_video_crop_class_init,
NULL,
@ -149,6 +147,18 @@ gst_video_crop_get_type (void)
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
gst_video_crop_class_init (GstVideoCropClass *klass)
{
@ -423,28 +433,20 @@ gst_video_crop_change_state (GstElement *element)
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
plugin_init (GstPlugin *plugin)
{
GstElementFactory *factory;
/* 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;
return gst_element_register (plugin, "videocrop", GST_RANK_PRIMARY, GST_TYPE_VIDEO_CROP);
}
GstPluginDesc plugin_desc = {
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"videocrop",
plugin_init
};
"Crops video into a user defined region",
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View file

@ -28,15 +28,12 @@
/* elementfactory information */
static GstElementDetails videoflip_details = {
static GstElementDetails videoflip_details = GST_ELEMENT_DETAILS (
"Video scaler",
"Filter/Video",
"LGPL",
"Resizes video",
VERSION,
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2000",
};
"Wim Taymans <wim.taymans@chello.be>"
);
/* GstVideoflip signals and args */
enum {
@ -50,6 +47,7 @@ enum {
/* FILL ME */
};
static void gst_videoflip_base_init (gpointer g_class);
static void gst_videoflip_class_init (GstVideoflipClass *klass);
static void gst_videoflip_init (GstVideoflip *videoflip);
@ -85,48 +83,6 @@ gst_videoflip_method_get_type(void)
return videoflip_method_type;
}
GType
gst_videoflip_get_type (void)
{
static GType videoflip_type = 0;
if (!videoflip_type) {
static const GTypeInfo videoflip_info = {
sizeof(GstVideoflipClass), NULL,
NULL,
(GClassInitFunc)gst_videoflip_class_init,
NULL,
NULL,
sizeof(GstVideoflip),
0,
(GInstanceInitFunc)gst_videoflip_init,
};
videoflip_type = g_type_register_static(GST_TYPE_ELEMENT, "GstVideoflip", &videoflip_info, 0);
}
return videoflip_type;
}
static void
gst_videoflip_class_init (GstVideoflipClass *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_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
G_PARAM_READWRITE));
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
gobject_class->set_property = gst_videoflip_set_property;
gobject_class->get_property = gst_videoflip_get_property;
}
static GstPadTemplate *
gst_videoflip_src_template_factory(void)
{
@ -164,6 +120,59 @@ gst_videoflip_sink_template_factory(void)
return templ;
}
GType
gst_videoflip_get_type (void)
{
static GType videoflip_type = 0;
if (!videoflip_type) {
static const GTypeInfo videoflip_info = {
sizeof(GstVideoflipClass),
gst_videoflip_base_init,
NULL,
(GClassInitFunc)gst_videoflip_class_init,
NULL,
NULL,
sizeof(GstVideoflip),
0,
(GInstanceInitFunc)gst_videoflip_init,
};
videoflip_type = g_type_register_static(GST_TYPE_ELEMENT, "GstVideoflip", &videoflip_info, 0);
}
return videoflip_type;
}
static void
gst_videoflip_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &videoflip_details);
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory));
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory));
}
static void
gst_videoflip_class_init (GstVideoflipClass *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_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
G_PARAM_READWRITE));
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
gobject_class->set_property = gst_videoflip_set_property;
gobject_class->get_property = gst_videoflip_get_property;
}
static GstCaps *
gst_videoflip_get_capslist(void)
{
@ -438,26 +447,20 @@ gst_videoflip_get_property (GObject *object, guint prop_id, GValue *value, GPara
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
plugin_init (GstPlugin *plugin)
{
GstElementFactory *factory;
/* create an elementfactory for the videoflip element */
factory = gst_element_factory_new("videoflip",GST_TYPE_VIDEOFLIP,
&videoflip_details);
g_return_val_if_fail(factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
return gst_element_register (plugin, "videoflip", GST_RANK_NONE, GST_TYPE_VIDEOFLIP);
}
GstPluginDesc plugin_desc = {
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"videoflip",
plugin_init
};
"Resizes video",
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)