From 679866123ccea8eeece3576b211ce175eb0f9e60 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 2 Nov 2003 14:47:52 +0000 Subject: [PATCH] fix most of sys dir. v4l2 and dxr3 pending, as I don't have them Original commit message from CVS: fix most of sys dir. v4l2 and dxr3 pending, as I don't have them --- sys/v4l/gstv4l.c | 33 ++++++++++++------- sys/v4l/gstv4lelement.c | 39 +++++++--------------- sys/v4l/gstv4lelement.h | 10 ++---- sys/v4l/gstv4lmjpegsink.c | 68 ++++++++++++++++---------------------- sys/v4l/gstv4lmjpegsink.h | 10 ++---- sys/v4l/gstv4lmjpegsrc.c | 69 ++++++++++++++++----------------------- sys/v4l/gstv4lmjpegsrc.h | 9 ++--- sys/v4l/gstv4lsrc.c | 49 +++++++++++---------------- sys/v4l/gstv4lsrc.h | 9 ++--- 9 files changed, 119 insertions(+), 177 deletions(-) diff --git a/sys/v4l/gstv4l.c b/sys/v4l/gstv4l.c index 096887220..014f4976b 100644 --- a/sys/v4l/gstv4l.c +++ b/sys/v4l/gstv4l.c @@ -29,23 +29,34 @@ #include "gstv4lmjpegsink.h" static gboolean -plugin_init (GModule *module, - GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - if (!gst_v4lelement_factory_init (plugin) || - !gst_v4lsrc_factory_init (plugin) || - !gst_v4lmjpegsrc_factory_init (plugin) || - !gst_v4lmjpegsink_factory_init (plugin)) { + /* actually, we can survive without it, but I'll create + * that handling later on. */ + if (!gst_library_load ("xwindowlistener")) return FALSE; - } - return TRUE; + if (!gst_element_register (plugin, "v4lelement", GST_RANK_NONE, GST_TYPE_V4LELEMENT)) + return FALSE; + if (!gst_element_register (plugin, "v4lsrc", GST_RANK_NONE, GST_TYPE_V4LSRC)) + return FALSE; + if (!gst_element_register (plugin, "v4lmjpegsrc", GST_RANK_NONE, GST_TYPE_V4LMJPEGSRC)) + return FALSE; + if (!gst_element_register (plugin, "v4lmjpegsink", GST_RANK_NONE, GST_TYPE_V4LMJPEGSINK)) + return FALSE; + return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "video4linux", - plugin_init -}; + "elements for Video 4 Linux", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/sys/v4l/gstv4lelement.c b/sys/v4l/gstv4lelement.c index 4144def34..4b106581a 100644 --- a/sys/v4l/gstv4lelement.c +++ b/sys/v4l/gstv4lelement.c @@ -28,15 +28,12 @@ #include "gstv4lcolorbalance.h" /* elementfactory information */ -static GstElementDetails gst_v4lelement_details = { +static GstElementDetails gst_v4lelement_details = GST_ELEMENT_DETAILS ( "Generic video4linux Element", "Generic/Video", - "LGPL", "Generic plugin for handling common video4linux calls", - VERSION, - "Ronald Bultje ", - "(C) 2001", -}; + "Ronald Bultje " +); /* V4lElement signals and args */ enum { @@ -54,6 +51,7 @@ enum { }; +static void gst_v4lelement_base_init (gpointer g_class); static void gst_v4lelement_class_init (GstV4lElementClass *klass); static void gst_v4lelement_init (GstV4lElement *v4lelement); static void gst_v4lelement_dispose (GObject *object); @@ -134,7 +132,7 @@ gst_v4lelement_get_type (void) if (!v4lelement_type) { static const GTypeInfo v4lelement_info = { sizeof(GstV4lElementClass), - NULL, + gst_v4lelement_base_init, NULL, (GClassInitFunc)gst_v4lelement_class_init, NULL, @@ -187,6 +185,13 @@ gst_v4lelement_get_type (void) } +static void +gst_v4lelement_base_init (gpointer g_class) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (gstelement_class, &gst_v4lelement_details); +} static void gst_v4lelement_class_init (GstV4lElementClass *klass) { @@ -377,23 +382,3 @@ gst_v4lelement_change_state (GstElement *element) return GST_STATE_SUCCESS; } - - -gboolean -gst_v4lelement_factory_init (GstPlugin *plugin) -{ - GstElementFactory *factory; - - /* actually, we can survive without it, but I'll create - * that handling later on. */ - if (!gst_library_load ("xwindowlistener")) - return FALSE; - - /* create an elementfactory for the v4lelement */ - factory = gst_element_factory_new("v4lelement", GST_TYPE_V4LELEMENT, - &gst_v4lelement_details); - g_return_val_if_fail(factory != NULL, FALSE); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - return TRUE; -} diff --git a/sys/v4l/gstv4lelement.h b/sys/v4l/gstv4lelement.h index 4b6ecfca9..45a5d424f 100644 --- a/sys/v4l/gstv4lelement.h +++ b/sys/v4l/gstv4lelement.h @@ -38,10 +38,9 @@ #include #define _LINUX_TIME_H #include +#include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS #define GST_TYPE_V4LELEMENT \ (gst_v4lelement_get_type()) @@ -108,10 +107,7 @@ struct _GstV4lElementClass { GType gst_v4lelement_get_type(void); -gboolean gst_v4lelement_factory_init (GstPlugin *plugin); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* __GST_V4LELEMENT_H__ */ diff --git a/sys/v4l/gstv4lmjpegsink.c b/sys/v4l/gstv4lmjpegsink.c index 683107d5a..4f237bdb8 100644 --- a/sys/v4l/gstv4lmjpegsink.c +++ b/sys/v4l/gstv4lmjpegsink.c @@ -31,11 +31,8 @@ static GstElementDetails gst_v4lmjpegsink_details = { "Video (video4linux/MJPEG) sink", "Sink/Video", - "LGPL", "Writes MJPEG-encoded frames to a zoran MJPEG/video4linux device", - VERSION, - "Ronald Bultje ", - "(C) 2001", + "Ronald Bultje " }; /* v4lmjpegsink signals and args */ @@ -57,6 +54,7 @@ enum { /* init functions */ +static void gst_v4lmjpegsink_base_init (gpointer g_class); static void gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass *klass); static void gst_v4lmjpegsink_init (GstV4lMjpegSink *v4lmjpegsink); @@ -100,7 +98,7 @@ gst_v4lmjpegsink_get_type (void) if (!v4lmjpegsink_type) { static const GTypeInfo v4lmjpegsink_info = { sizeof(GstV4lMjpegSinkClass), - NULL, + gst_v4lmjpegsink_base_init, NULL, (GClassInitFunc)gst_v4lmjpegsink_class_init, NULL, @@ -114,7 +112,32 @@ gst_v4lmjpegsink_get_type (void) return v4lmjpegsink_type; } +static void +gst_v4lmjpegsink_base_init (gpointer g_class) +{ + GstCaps *caps; + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (gstelement_class, &gst_v4lmjpegsink_details); + + caps = gst_caps_new ("v4lmjpegsink_caps", + "video/x-jpeg", + gst_props_new ( + "width", GST_PROPS_INT_RANGE (0, G_MAXINT), + "height", GST_PROPS_INT_RANGE (0, G_MAXINT), + "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT), + NULL ) + ); + capslist = gst_caps_append(capslist, caps); + + sink_template = gst_pad_template_new ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + capslist, NULL); + gst_element_class_add_pad_template (gstelement_class, sink_template); +} static void gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass *klass) { @@ -459,38 +482,3 @@ gst_v4lmjpegsink_change_state (GstElement *element) return GST_STATE_SUCCESS; } - - -gboolean -gst_v4lmjpegsink_factory_init (GstPlugin *plugin) -{ - GstElementFactory *factory; - GstCaps *caps; - - /* create an elementfactory for the v4lmjpegsink element */ - factory = gst_element_factory_new("v4lmjpegsink",GST_TYPE_V4LMJPEGSINK, - &gst_v4lmjpegsink_details); - g_return_val_if_fail(factory != NULL, FALSE); - - caps = gst_caps_new ("v4lmjpegsink_caps", - "video/x-jpeg", - gst_props_new ( - "width", GST_PROPS_INT_RANGE (0, G_MAXINT), - "height", GST_PROPS_INT_RANGE (0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT), - NULL ) - ); - capslist = gst_caps_append(capslist, caps); - - sink_template = gst_pad_template_new ( - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - capslist, NULL); - - gst_element_factory_add_pad_template (factory, sink_template); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - return TRUE; -} diff --git a/sys/v4l/gstv4lmjpegsink.h b/sys/v4l/gstv4lmjpegsink.h index d8ed50a37..9bc9b171b 100644 --- a/sys/v4l/gstv4lmjpegsink.h +++ b/sys/v4l/gstv4lmjpegsink.h @@ -25,9 +25,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS #define GST_TYPE_V4LMJPEGSINK \ @@ -94,11 +92,7 @@ struct _GstV4lMjpegSinkClass { GType gst_v4lmjpegsink_get_type(void); -gboolean gst_v4lmjpegsink_factory_init (GstPlugin *plugin); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* __GST_SDLVIDEOSINK_H__ */ diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c index 8bd58a1d2..2766bc370 100644 --- a/sys/v4l/gstv4lmjpegsrc.c +++ b/sys/v4l/gstv4lmjpegsrc.c @@ -31,11 +31,8 @@ static GstElementDetails gst_v4lmjpegsrc_details = { "Video (video4linux/MJPEG) Source", "Source/Video", - "LGPL", "Reads MJPEG-encoded frames from a zoran MJPEG/video4linux device", - VERSION, - "Ronald Bultje ", - "(C) 2001", + "Ronald Bultje " }; /* V4lMjpegSrc signals and args */ @@ -66,6 +63,7 @@ enum { /* init functions */ +static void gst_v4lmjpegsrc_base_init (gpointer g_class); static void gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass *klass); static void gst_v4lmjpegsrc_init (GstV4lMjpegSrc *v4lmjpegsrc); @@ -123,7 +121,7 @@ gst_v4lmjpegsrc_get_type (void) if (!v4lmjpegsrc_type) { static const GTypeInfo v4lmjpegsrc_info = { sizeof(GstV4lMjpegSrcClass), - NULL, + gst_v4lmjpegsrc_base_init, NULL, (GClassInitFunc)gst_v4lmjpegsrc_class_init, NULL, @@ -139,6 +137,32 @@ gst_v4lmjpegsrc_get_type (void) } +static void +gst_v4lmjpegsrc_base_init (gpointer g_class) +{ + GstCaps *caps; + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (gstelement_class, &gst_v4lmjpegsrc_details); + + caps = gst_caps_new ("v4lmjpegsrc_caps", + "video/x-jpeg", + gst_props_new ( + "width", GST_PROPS_INT_RANGE (0, G_MAXINT), + "height", GST_PROPS_INT_RANGE (0, G_MAXINT), + "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT), + NULL ) + ); + capslist = gst_caps_append(capslist, caps); + + src_template = gst_pad_template_new ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + capslist, NULL); + + gst_element_class_add_pad_template (gstelement_class, src_template); +} static void gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass *klass) { @@ -814,38 +838,3 @@ gst_v4lmjpegsrc_buffer_free (GstBufferPool *pool, GstBuffer *buf, gpointer user_ /* free the buffer struct et all */ gst_buffer_default_free(buf); } - - -gboolean -gst_v4lmjpegsrc_factory_init (GstPlugin *plugin) -{ - GstElementFactory *factory; - GstCaps *caps; - - /* create an elementfactory for the v4lmjpegsrcparse element */ - factory = gst_element_factory_new("v4lmjpegsrc",GST_TYPE_V4LMJPEGSRC, - &gst_v4lmjpegsrc_details); - g_return_val_if_fail(factory != NULL, FALSE); - - caps = gst_caps_new ("v4lmjpegsrc_caps", - "video/x-jpeg", - gst_props_new ( - "width", GST_PROPS_INT_RANGE (0, G_MAXINT), - "height", GST_PROPS_INT_RANGE (0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT), - NULL ) - ); - capslist = gst_caps_append(capslist, caps); - - src_template = gst_pad_template_new ( - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - capslist, 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/v4l/gstv4lmjpegsrc.h b/sys/v4l/gstv4lmjpegsrc.h index ad923cae2..db2c37d24 100644 --- a/sys/v4l/gstv4lmjpegsrc.h +++ b/sys/v4l/gstv4lmjpegsrc.h @@ -24,9 +24,7 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS #define GST_TYPE_V4LMJPEGSRC \ (gst_v4lmjpegsrc_get_type()) @@ -112,10 +110,7 @@ struct _GstV4lMjpegSrcClass { GType gst_v4lmjpegsrc_get_type(void); -gboolean gst_v4lmjpegsrc_factory_init (GstPlugin *plugin); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* __GST_V4LMJPEGSRC_H__ */ diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c index 11ba8bbaf..d425f6194 100644 --- a/sys/v4l/gstv4lsrc.c +++ b/sys/v4l/gstv4lsrc.c @@ -30,15 +30,12 @@ #include /* elementfactory information */ -static GstElementDetails gst_v4lsrc_details = { +static GstElementDetails gst_v4lsrc_details = GST_ELEMENT_DETAILS ( "Video (video4linux/raw) Source", "Source/Video", - "LGPL", "Reads raw frames from a video4linux (BT8x8) device", - VERSION, - "Ronald Bultje ", - "(C) 2001", -}; + "Ronald Bultje " +); /* V4lSrc signals and args */ enum { @@ -59,6 +56,7 @@ enum { /* init functions */ +static void gst_v4lsrc_base_init (gpointer g_class); static void gst_v4lsrc_class_init (GstV4lSrcClass *klass); static void gst_v4lsrc_init (GstV4lSrc *v4lsrc); @@ -114,7 +112,7 @@ gst_v4lsrc_get_type (void) if (!v4lsrc_type) { static const GTypeInfo v4lsrc_info = { sizeof(GstV4lSrcClass), - NULL, + gst_v4lsrc_base_init, NULL, (GClassInitFunc)gst_v4lsrc_class_init, NULL, @@ -129,7 +127,21 @@ gst_v4lsrc_get_type (void) return v4lsrc_type; } +static void +gst_v4lsrc_base_init (gpointer g_class) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (gstelement_class, &gst_v4lsrc_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_v4lsrc_class_init (GstV4lSrcClass *klass) { @@ -826,26 +838,3 @@ gst_v4lsrc_set_clock (GstElement *element, GST_V4LSRC(element)->clock = clock; } - -gboolean -gst_v4lsrc_factory_init (GstPlugin *plugin) -{ - GstElementFactory *factory; - - /* create an elementfactory for the v4lsrc */ - factory = gst_element_factory_new("v4lsrc",GST_TYPE_V4LSRC, - &gst_v4lsrc_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/v4l/gstv4lsrc.h b/sys/v4l/gstv4lsrc.h index c48be7afb..91e01a7c6 100644 --- a/sys/v4l/gstv4lsrc.h +++ b/sys/v4l/gstv4lsrc.h @@ -22,9 +22,7 @@ #include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS #define GST_TYPE_V4LSRC \ (gst_v4lsrc_get_type()) @@ -94,10 +92,7 @@ struct _GstV4lSrcClass { GType gst_v4lsrc_get_type(void); -gboolean gst_v4lsrc_factory_init (GstPlugin *plugin); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* __GST_V4LSRC_H__ */ -- 2.34.1