fix for new plugin system
authorBenjamin Otte <otte@gnome.org>
Sun, 2 Nov 2003 21:30:09 +0000 (21:30 +0000)
committerBenjamin Otte <otte@gnome.org>
Sun, 2 Nov 2003 21:30:09 +0000 (21:30 +0000)
Original commit message from CVS:
fix for new plugin system

gst/videocrop/gstvideocrop.c
gst/videoflip/gstvideoflip.c

index 4c73122..666e557 100644 (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,
@@ -150,6 +148,18 @@ gst_video_crop_get_type (void)
 }
 
 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)
 {
   GObjectClass *gobject_class;
@@ -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
+)
index d5013b8..3b4a545 100644 (file)
 
 
 /* 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,6 +83,43 @@ gst_videoflip_method_get_type(void)
   return videoflip_method_type;
 }
 
+static GstPadTemplate *
+gst_videoflip_src_template_factory(void)
+{
+  static GstPadTemplate *templ = NULL;
+
+  if(!templ){
+    /* well, actually RGB too, but since there's no RGB format anyway */
+    GstCaps *caps = GST_CAPS_NEW("src","video/x-raw-yuv",
+               "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+               "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+                "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+
+    caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
+
+    templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
+  }
+  return templ;
+}
+
+static GstPadTemplate *
+gst_videoflip_sink_template_factory(void)
+{
+  static GstPadTemplate *templ = NULL;
+
+  if(!templ){
+    GstCaps *caps = GST_CAPS_NEW("sink","video/x-raw-yuv",
+               "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+               "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+                "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+
+    caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
+
+    templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
+  }
+  return templ;
+}
+
 GType
 gst_videoflip_get_type (void)
 {
@@ -92,7 +127,8 @@ gst_videoflip_get_type (void)
 
   if (!videoflip_type) {
     static const GTypeInfo videoflip_info = {
-      sizeof(GstVideoflipClass),      NULL,
+      sizeof(GstVideoflipClass),
+      gst_videoflip_base_init,
       NULL,
       (GClassInitFunc)gst_videoflip_class_init,
       NULL,
@@ -107,6 +143,16 @@ gst_videoflip_get_type (void)
 }
 
 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;
@@ -127,43 +173,6 @@ gst_videoflip_class_init (GstVideoflipClass *klass)
 
 }
 
-static GstPadTemplate *
-gst_videoflip_src_template_factory(void)
-{
-  static GstPadTemplate *templ = NULL;
-
-  if(!templ){
-    /* well, actually RGB too, but since there's no RGB format anyway */
-    GstCaps *caps = GST_CAPS_NEW("src","video/x-raw-yuv",
-               "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
-               "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
-                "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
-
-    caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
-
-    templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
-  }
-  return templ;
-}
-
-static GstPadTemplate *
-gst_videoflip_sink_template_factory(void)
-{
-  static GstPadTemplate *templ = NULL;
-
-  if(!templ){
-    GstCaps *caps = GST_CAPS_NEW("sink","video/x-raw-yuv",
-               "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
-               "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
-                "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
-
-    caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
-
-    templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
-  }
-  return templ;
-}
-
 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
+)