From 0c45af7343dcb312cf80e1fb0f2452fe068fc78e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 2 Nov 2003 21:30:09 +0000 Subject: [PATCH] fix for new plugin system Original commit message from CVS: fix for new plugin system --- gst/videocrop/gstvideocrop.c | 54 +++++++------- gst/videoflip/gstvideoflip.c | 133 ++++++++++++++++++----------------- 2 files changed, 96 insertions(+), 91 deletions(-) diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c index 4c7312205b..666e557861 100644 --- a/gst/videocrop/gstvideocrop.c +++ b/gst/videocrop/gstvideocrop.c @@ -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 ", - "(C) 2002", -}; + "Wim Taymans " +); /* 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 +) diff --git a/gst/videoflip/gstvideoflip.c b/gst/videoflip/gstvideoflip.c index d5013b813d..3b4a54503b 100644 --- a/gst/videoflip/gstvideoflip.c +++ b/gst/videoflip/gstvideoflip.c @@ -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 ", - "(C) 2000", -}; + "Wim Taymans " +); /* 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 +)