Original commit message from CVS:
hmm...
This commit is contained in:
Ronald S. Bultje 2003-11-02 17:02:51 +00:00
parent e1b127543d
commit 1b570ee7b8
5 changed files with 51 additions and 67 deletions

View file

@ -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
)

View file

@ -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 <rbultje@ronald.bitfreak.net>",
"(C) 2002",
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
};
/* 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;
}

View file

@ -97,6 +97,4 @@ struct _GstV4l2ElementClass {
GType gst_v4l2element_get_type (void);
gboolean gst_v4l2element_factory_init (GstPlugin *plugin);
#endif /* __GST_V4L2ELEMENT_H__ */

View file

@ -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 <rbultje@ronald.bitfreak.net>",
"(C) 2002",
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
};
/* 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;
}

View file

@ -98,6 +98,4 @@ struct _GstV4l2SrcClass {
GType gst_v4l2src_get_type(void);
gboolean gst_v4l2src_factory_init (GstPlugin *plugin);
#endif /* __GST_V4L2SRC_H__ */