From c75664e083f7dbf183d2ff1e80139775fb2b7711 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 2 Nov 2003 17:02:51 +0000 Subject: [PATCH] hmm... Original commit message from CVS: hmm... --- sys/v4l2/gstv4l2.c | 33 ++++++++++++++++++++++----------- sys/v4l2/gstv4l2element.c | 35 +++++++++++------------------------ sys/v4l2/gstv4l2element.h | 2 -- sys/v4l2/gstv4l2src.c | 46 ++++++++++++++++++---------------------------- sys/v4l2/gstv4l2src.h | 2 -- 5 files changed, 51 insertions(+), 67 deletions(-) diff --git a/sys/v4l2/gstv4l2.c b/sys/v4l2/gstv4l2.c index 8ad7b31..59ab419 100644 --- a/sys/v4l2/gstv4l2.c +++ b/sys/v4l2/gstv4l2.c @@ -27,20 +27,31 @@ #include "gstv4l2src.h" gboolean -plugin_init (GModule *module, - GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - if (!gst_v4l2element_factory_init (plugin) || - !gst_v4l2src_factory_init (plugin)) { + /* actually, we can survive without it, but I'll create + * that handling later on. */ + if (!gst_library_load ("xwindowlistener")) + return FALSE; + + if (!gst_element_register (plugin, "v4l2element", + GST_RANK_NONE, GST_TYPE_V4L2ELEMENT) || + !gst_element_register (plugin, "v4l2src", + GST_RANK_NONE, GST_TYPE_V4L2SRC)) return FALSE; - } return TRUE; } -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "video4linux2", - plugin_init -}; +GST_PLUGIN_DEFINE ( + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "video4linux2", + "elements for Video 4 Linux 2", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/sys/v4l2/gstv4l2element.c b/sys/v4l2/gstv4l2element.c index 35f0629..45ae11c 100644 --- a/sys/v4l2/gstv4l2element.c +++ b/sys/v4l2/gstv4l2element.c @@ -30,11 +30,8 @@ static GstElementDetails gst_v4l2element_details = { "Generic video4linux2 Element", "Generic/Video", - "LGPL", "Generic plugin for handling common video4linux2 calls", - VERSION, - "Ronald Bultje ", - "(C) 2002", + "Ronald Bultje " }; /* V4l2Element signals and args */ @@ -54,6 +51,7 @@ enum { static void gst_v4l2element_class_init (GstV4l2ElementClass *klass); +static void gst_v4l2element_base_init (GstV4l2ElementClass *klass); static void gst_v4l2element_init (GstV4l2Element *v4lelement); static void gst_v4l2element_dispose (GObject *object); static void gst_v4l2element_set_property (GObject *object, @@ -109,7 +107,7 @@ gst_v4l2element_get_type (void) if (!v4l2element_type) { static const GTypeInfo v4l2element_info = { sizeof(GstV4l2ElementClass), - NULL, + (GBaseInitFunc) gst_v4l2element_base_init, NULL, (GClassInitFunc) gst_v4l2element_class_init, NULL, @@ -191,6 +189,14 @@ gst_v4l2_device_get_type (void) return v4l2_device_type; } +static void +gst_v4l2element_base_init (GstV4l2ElementClass *klass) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_set_details (gstelement_class, + &gst_v4l2element_details); +} static void gst_v4l2element_class_init (GstV4l2ElementClass *klass) @@ -381,22 +387,3 @@ gst_v4l2element_change_state (GstElement *element) return GST_STATE_SUCCESS; } - - -gboolean -gst_v4l2element_factory_init (GstPlugin *plugin) -{ - GstElementFactory *factory; - - /* we can run without... But not yet. ;). */ - if (!gst_library_load ("xwindowlistener")) - return FALSE; - - /* create an elementfactory for the v4l2element */ - factory = gst_element_factory_new("v4l2element", GST_TYPE_V4L2ELEMENT, - &gst_v4l2element_details); - g_return_val_if_fail(factory != NULL, FALSE); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - return TRUE; -} diff --git a/sys/v4l2/gstv4l2element.h b/sys/v4l2/gstv4l2element.h index f6e19e7..23d379e 100644 --- a/sys/v4l2/gstv4l2element.h +++ b/sys/v4l2/gstv4l2element.h @@ -97,6 +97,4 @@ struct _GstV4l2ElementClass { GType gst_v4l2element_get_type (void); -gboolean gst_v4l2element_factory_init (GstPlugin *plugin); - #endif /* __GST_V4L2ELEMENT_H__ */ diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 67b683e..c006dbc 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -30,11 +30,8 @@ static GstElementDetails gst_v4l2src_details = { "Video (video4linux2) Source", "Source/Video", - "LGPL", "Reads frames (compressed or uncompressed) from a video4linux2 device", - VERSION, - "Ronald Bultje ", - "(C) 2002", + "Ronald Bultje " }; /* V4l2Src signals and args */ @@ -57,6 +54,7 @@ enum { /* init functions */ static void gst_v4l2src_class_init (GstV4l2SrcClass *klass); +static void gst_v4l2src_base_init (GstV4l2SrcClass *klass); static void gst_v4l2src_init (GstV4l2Src *v4l2src); /* signal functions */ @@ -119,7 +117,7 @@ gst_v4l2src_get_type (void) if (!v4l2src_type) { static const GTypeInfo v4l2src_info = { sizeof(GstV4l2SrcClass), - NULL, + (GBaseInitFunc) gst_v4l2src_base_init, NULL, (GClassInitFunc) gst_v4l2src_class_init, NULL, @@ -135,6 +133,21 @@ gst_v4l2src_get_type (void) return v4l2src_type; } +static void +gst_v4l2src_base_init (GstV4l2SrcClass *klass) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_set_details (gstelement_class, + &gst_v4l2src_details); + + src_template = gst_pad_template_new ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + NULL); + + gst_element_class_add_pad_template (gstelement_class, src_template); +} static void gst_v4l2src_class_init (GstV4l2SrcClass *klass) @@ -1062,26 +1075,3 @@ gst_v4l2src_buffer_free (GstBufferPool *pool, /* free the buffer itself */ gst_buffer_default_free(buf); } - - -gboolean -gst_v4l2src_factory_init (GstPlugin *plugin) -{ - GstElementFactory *factory; - - /* create an elementfactory for the v4l2src */ - factory = gst_element_factory_new("v4l2src", GST_TYPE_V4L2SRC, - &gst_v4l2src_details); - g_return_val_if_fail(factory != NULL, FALSE); - - src_template = gst_pad_template_new("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - NULL); - - gst_element_factory_add_pad_template(factory, src_template); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE(factory)); - - return TRUE; -} diff --git a/sys/v4l2/gstv4l2src.h b/sys/v4l2/gstv4l2src.h index da9664c..1b4ab09 100644 --- a/sys/v4l2/gstv4l2src.h +++ b/sys/v4l2/gstv4l2src.h @@ -98,6 +98,4 @@ struct _GstV4l2SrcClass { GType gst_v4l2src_get_type(void); -gboolean gst_v4l2src_factory_init (GstPlugin *plugin); - #endif /* __GST_V4L2SRC_H__ */ -- 2.7.4