diff options
author | Thiago Santos <thiago.sousa.santos@collabora.com> | 2012-04-13 10:16:38 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.com> | 2012-04-13 14:13:36 -0300 |
commit | d5f2feb8ec2b1bbd0f443e7281d680441dc6529a (patch) | |
tree | a656c506328ee5ec8d1a172570dcea342227bd21 /gst | |
parent | c31d275affd49718f2b4bc655bdd9b3e5aa09df9 (diff) | |
download | gstreamer-plugins-bad-d5f2feb8ec2b1bbd0f443e7281d680441dc6529a.tar.gz |
geometrictransform: port to 1.0
Straightforward port of geometrictransform plugin
Diffstat (limited to 'gst')
-rw-r--r-- | gst/geometrictransform/gstbulge.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gstcircle.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gstdiffuse.c | 26 | ||||
-rw-r--r-- | gst/geometrictransform/gstfisheye.c | 27 | ||||
-rw-r--r-- | gst/geometrictransform/gstgeometrictransform.c | 78 | ||||
-rw-r--r-- | gst/geometrictransform/gstkaleidoscope.c | 27 | ||||
-rw-r--r-- | gst/geometrictransform/gstmarble.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gstmirror.c | 26 | ||||
-rw-r--r-- | gst/geometrictransform/gstpinch.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gstrotate.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gstsphere.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gstsquare.c | 27 | ||||
-rw-r--r-- | gst/geometrictransform/gststretch.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gsttunnel.c | 26 | ||||
-rw-r--r-- | gst/geometrictransform/gsttwirl.c | 28 | ||||
-rw-r--r-- | gst/geometrictransform/gstwaterripple.c | 27 |
16 files changed, 200 insertions, 288 deletions
diff --git a/gst/geometrictransform/gstbulge.c b/gst/geometrictransform/gstbulge.c index abfc00963..674f401ed 100644 --- a/gst/geometrictransform/gstbulge.c +++ b/gst/geometrictransform/gstbulge.c @@ -62,8 +62,8 @@ enum #define DEFAULT_ZOOM 3.0 -GST_BOILERPLATE (GstBulge, gst_bulge, GstCircleGeometricTransform, - GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +#define gst_bulge_parent_class parent_class +G_DEFINE_TYPE (GstBulge, gst_bulge, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void gst_bulge_set_property (GObject * object, guint prop_id, const GValue * value, @@ -117,20 +117,6 @@ gst_bulge_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_bulge_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "bulge", - "Transform/Effect/Video", - "Adds a protuberance in the center point", - "Filippo Argiolas <filippo.argiolas@gmail.com>"); -} - static gboolean bulge_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -181,13 +167,21 @@ static void gst_bulge_class_init (GstBulgeClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "bulge", + "Transform/Effect/Video", + "Adds a protuberance in the center point", + "Filippo Argiolas <filippo.argiolas@gmail.com>"); + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_bulge_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_bulge_get_property); @@ -204,7 +198,7 @@ gst_bulge_class_init (GstBulgeClass * klass) } static void -gst_bulge_init (GstBulge * filter, GstBulgeClass * gclass) +gst_bulge_init (GstBulge * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstcircle.c b/gst/geometrictransform/gstcircle.c index 7cfe67c2b..72d8bcb41 100644 --- a/gst/geometrictransform/gstcircle.c +++ b/gst/geometrictransform/gstcircle.c @@ -74,8 +74,8 @@ enum #define DEFAULT_HEIGHT 20 #define DEFAULT_SPREAD_ANGLE G_PI -GST_BOILERPLATE (GstCircle, gst_circle, GstCircleGeometricTransform, - GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +#define gst_circle_parent_class parent_class +G_DEFINE_TYPE (GstCircle, gst_circle, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void gst_circle_set_property (GObject * object, guint prop_id, const GValue * value, @@ -150,20 +150,6 @@ gst_circle_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_circle_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "circle", - "Transform/Effect/Video", - "Warps the picture into an arc shaped form", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean circle_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -196,13 +182,21 @@ static void gst_circle_class_init (GstCircleClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "circle", + "Transform/Effect/Video", + "Warps the picture into an arc shaped form", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_circle_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_circle_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_circle_get_property); @@ -227,7 +221,7 @@ gst_circle_class_init (GstCircleClass * klass) } static void -gst_circle_init (GstCircle * filter, GstCircleClass * gclass) +gst_circle_init (GstCircle * filter) { filter->angle = DEFAULT_ANGLE; filter->spread_angle = DEFAULT_SPREAD_ANGLE; diff --git a/gst/geometrictransform/gstdiffuse.c b/gst/geometrictransform/gstdiffuse.c index 5f43a2b17..16d277499 100644 --- a/gst/geometrictransform/gstdiffuse.c +++ b/gst/geometrictransform/gstdiffuse.c @@ -68,8 +68,8 @@ enum #define DEFAULT_SCALE 4 -GST_BOILERPLATE (GstDiffuse, gst_diffuse, GstGeometricTransform, - GST_TYPE_GEOMETRIC_TRANSFORM); +#define gst_diffuse_parent_class parent_class +G_DEFINE_TYPE (GstDiffuse, gst_diffuse, GST_TYPE_GEOMETRIC_TRANSFORM); static void gst_diffuse_set_property (GObject * object, guint prop_id, const GValue * value, @@ -130,18 +130,6 @@ gst_diffuse_finalize (GObject * obj) /* GObject vmethod implementations */ -static void -gst_diffuse_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "diffuse", - "Transform/Effect/Video", - "Diffuses the image by moving its pixels in random directions", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean diffuse_prepare (GstGeometricTransform * trans) { @@ -187,13 +175,21 @@ static void gst_diffuse_class_init (GstDiffuseClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "diffuse", + "Transform/Effect/Video", + "Diffuses the image by moving its pixels in random directions", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_diffuse_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_diffuse_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_diffuse_get_property); @@ -209,7 +205,7 @@ gst_diffuse_class_init (GstDiffuseClass * klass) } static void -gst_diffuse_init (GstDiffuse * filter, GstDiffuseClass * gclass) +gst_diffuse_init (GstDiffuse * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstfisheye.c b/gst/geometrictransform/gstfisheye.c index 46318b043..2227aab32 100644 --- a/gst/geometrictransform/gstfisheye.c +++ b/gst/geometrictransform/gstfisheye.c @@ -53,22 +53,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_fisheye_debug); #define GST_CAT_DEFAULT gst_fisheye_debug -GST_BOILERPLATE (GstFisheye, gst_fisheye, GstGeometricTransform, - GST_TYPE_GEOMETRIC_TRANSFORM); - -/* GObject vmethod implementations */ - -static void -gst_fisheye_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "fisheye", - "Transform/Effect/Video", - "Split the image into two halves and reflect one over each other", - "Filippo Argiolas <filippo.argiolas@gmail.com>"); -} +#define gst_fisheye_parent_class parent_class +G_DEFINE_TYPE (GstFisheye, gst_fisheye, GST_TYPE_GEOMETRIC_TRANSFORM); static gboolean fisheye_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, @@ -123,17 +109,24 @@ fisheye_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, static void gst_fisheye_class_init (GstFisheyeClass * klass) { + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "fisheye", + "Transform/Effect/Video", + "Split the image into two halves and reflect one over each other", + "Filippo Argiolas <filippo.argiolas@gmail.com>"); gstgt_class->map_func = fisheye_map; } static void -gst_fisheye_init (GstFisheye * filter, GstFisheyeClass * gclass) +gst_fisheye_init (GstFisheye * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstgeometrictransform.c b/gst/geometrictransform/gstgeometrictransform.c index 4fceaef52..a2a3a15ac 100644 --- a/gst/geometrictransform/gstgeometrictransform.c +++ b/gst/geometrictransform/gstgeometrictransform.c @@ -23,52 +23,25 @@ #include "gstgeometrictransform.h" #include "geometricmath.h" -#include <gst/controller/gstcontroller.h> #include <string.h> GST_DEBUG_CATEGORY_STATIC (geometric_transform_debug); #define GST_CAT_DEFAULT geometric_transform_debug static GstStaticPadTemplate gst_geometric_transform_src_template = - GST_STATIC_PAD_TEMPLATE ("src", +GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_ABGR "; " - GST_VIDEO_CAPS_ARGB "; " - GST_VIDEO_CAPS_BGR "; " - GST_VIDEO_CAPS_BGRA "; " - GST_VIDEO_CAPS_BGRx "; " - GST_VIDEO_CAPS_RGB "; " - GST_VIDEO_CAPS_RGBA "; " - GST_VIDEO_CAPS_RGBx "; " - GST_VIDEO_CAPS_YUV ("AYUV") "; " - GST_VIDEO_CAPS_xBGR "; " - GST_VIDEO_CAPS_xRGB "; " - GST_VIDEO_CAPS_GRAY8 "; " - GST_VIDEO_CAPS_GRAY16 ("BIG_ENDIAN") "; " - GST_VIDEO_CAPS_GRAY16 ("LITTLE_ENDIAN") - ) + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ ARGB, BGR, BGRA, BGRx, RGB, " + "RGBA, RGBx, AYUV, xBGR, xRGB, GRAY8, GRAY16_BE, GRAY16_LE }")) ); static GstStaticPadTemplate gst_geometric_transform_sink_template = - GST_STATIC_PAD_TEMPLATE ("sink", +GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_ABGR "; " - GST_VIDEO_CAPS_ARGB "; " - GST_VIDEO_CAPS_BGR "; " - GST_VIDEO_CAPS_BGRA "; " - GST_VIDEO_CAPS_BGRx "; " - GST_VIDEO_CAPS_RGB "; " - GST_VIDEO_CAPS_RGBA "; " - GST_VIDEO_CAPS_RGBx "; " - GST_VIDEO_CAPS_YUV ("AYUV") "; " - GST_VIDEO_CAPS_xBGR "; " - GST_VIDEO_CAPS_xRGB "; " - GST_VIDEO_CAPS_GRAY8 "; " - GST_VIDEO_CAPS_GRAY16 ("BIG_ENDIAN") "; " - GST_VIDEO_CAPS_GRAY16 ("LITTLE_ENDIAN") - ) + GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ ARGB, BGR, BGRA, BGRx, RGB, " + "RGBA, RGBx, AYUV, xBGR, xRGB, GRAY8, GRAY16_BE, GRAY16_LE }")) ); static GstVideoFilterClass *parent_class = NULL; @@ -163,6 +136,7 @@ gst_geometric_transform_set_caps (GstBaseTransform * btrans, GstCaps * incaps, gint old_width; gint old_height; GstGeometricTransformClass *klass; + GstVideoInfo vinfo; gt = GST_GEOMETRIC_TRANSFORM_CAST (btrans); klass = GST_GEOMETRIC_TRANSFORM_GET_CLASS (gt); @@ -170,11 +144,12 @@ gst_geometric_transform_set_caps (GstBaseTransform * btrans, GstCaps * incaps, old_width = gt->width; old_height = gt->height; - ret = gst_video_format_parse_caps (incaps, >->format, >->width, - >->height); + ret = gst_video_info_from_caps (&vinfo, incaps); if (ret) { - gt->row_stride = gst_video_format_get_row_stride (gt->format, 0, gt->width); - gt->pixel_stride = gst_video_format_get_pixel_stride (gt->format, 0); + gt->width = vinfo.width; + gt->height = vinfo.height; + gt->row_stride = vinfo.stride[0]; + gt->pixel_stride = GST_VIDEO_INFO_COMP_PSTRIDE (&vinfo, 0); /* regenerate the map */ GST_OBJECT_LOCK (gt); @@ -228,10 +203,26 @@ gst_geometric_transform_do_map (GstGeometricTransform * gt, GstBuffer * inbuf, /* only set the values if the values are valid */ if (trunc_x >= 0 && trunc_x < gt->width && trunc_y >= 0 && trunc_y < gt->height) { + GstMapInfo in_info; + GstMapInfo out_info; + + if (!gst_buffer_map (outbuf, &out_info, GST_MAP_WRITE)) { + GST_WARNING_OBJECT (gt, "Failed to map output buffer"); + return; + } + if (!gst_buffer_map (inbuf, &in_info, GST_MAP_READ)) { + GST_WARNING_OBJECT (gt, "Failed to map input buffer"); + gst_buffer_unmap (outbuf, &out_info); + return; + } + in_offset = trunc_y * gt->row_stride + trunc_x * gt->pixel_stride; - memcpy (GST_BUFFER_DATA (outbuf) + out_offset, - GST_BUFFER_DATA (inbuf) + in_offset, gt->pixel_stride); + memcpy (out_info.data + out_offset, + in_info.data + in_offset, gt->pixel_stride); + + gst_buffer_unmap (outbuf, &out_info); + gst_buffer_unmap (inbuf, &in_info); } } } @@ -262,19 +253,21 @@ gst_geometric_transform_transform (GstBaseTransform * trans, GstBuffer * buf, gint x, y; GstFlowReturn ret = GST_FLOW_OK; gdouble *ptr; + GstMapInfo out_info; gt = GST_GEOMETRIC_TRANSFORM_CAST (trans); klass = GST_GEOMETRIC_TRANSFORM_GET_CLASS (gt); - memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf)); + gst_buffer_map (outbuf, &out_info, GST_MAP_WRITE); + memset (out_info.data, 0, out_info.size); GST_OBJECT_LOCK (gt); if (gt->precalc_map) { if (gt->needs_remap) { if (klass->prepare_func) if (!klass->prepare_func (gt)) { - GST_OBJECT_UNLOCK (gt); - return FALSE; + ret = FALSE; + goto end; } gst_geometric_transform_generate_map (gt); } @@ -304,6 +297,7 @@ gst_geometric_transform_transform (GstBaseTransform * trans, GstBuffer * buf, } end: GST_OBJECT_UNLOCK (gt); + gst_buffer_unmap (outbuf, &out_info); return ret; } diff --git a/gst/geometrictransform/gstkaleidoscope.c b/gst/geometrictransform/gstkaleidoscope.c index 384037b32..71cdcefec 100644 --- a/gst/geometrictransform/gstkaleidoscope.c +++ b/gst/geometrictransform/gstkaleidoscope.c @@ -73,7 +73,8 @@ enum #define DEFAULT_ANGLE2 0 #define DEFAULT_SIDES 3 -GST_BOILERPLATE (GstKaleidoscope, gst_kaleidoscope, GstCircleGeometricTransform, +#define gst_kaleidoscope_parent_class parent_class +G_DEFINE_TYPE (GstKaleidoscope, gst_kaleidoscope, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void @@ -149,20 +150,6 @@ gst_kaleidoscope_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_kaleidoscope_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "kaleidoscope", - "Transform/Effect/Video", - "Applies 'kaleidoscope' geometric transform to the image", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean kaleidoscope_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -200,13 +187,21 @@ static void gst_kaleidoscope_class_init (GstKaleidoscopeClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "kaleidoscope", + "Transform/Effect/Video", + "Applies 'kaleidoscope' geometric transform to the image", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_kaleidoscope_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_kaleidoscope_set_property); @@ -233,7 +228,7 @@ gst_kaleidoscope_class_init (GstKaleidoscopeClass * klass) } static void -gst_kaleidoscope_init (GstKaleidoscope * filter, GstKaleidoscopeClass * gclass) +gst_kaleidoscope_init (GstKaleidoscope * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstmarble.c b/gst/geometrictransform/gstmarble.c index 2c2ab64ae..4efbbfea6 100644 --- a/gst/geometrictransform/gstmarble.c +++ b/gst/geometrictransform/gstmarble.c @@ -74,8 +74,8 @@ enum #define DEFAULT_AMOUNT 1 #define DEFAULT_TURBULENCE 1 -GST_BOILERPLATE (GstMarble, gst_marble, GstGeometricTransform, - GST_TYPE_GEOMETRIC_TRANSFORM); +#define gst_marble_parent_class parent_class +G_DEFINE_TYPE (GstMarble, gst_marble, GST_TYPE_GEOMETRIC_TRANSFORM); static void gst_marble_set_property (GObject * object, guint prop_id, const GValue * value, @@ -165,20 +165,6 @@ gst_marble_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_marble_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "marble", - "Transform/Effect/Video", - "Applies a marbling effect to the image", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean marble_prepare (GstGeometricTransform * trans) { @@ -228,13 +214,21 @@ static void gst_marble_class_init (GstMarbleClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "marble", + "Transform/Effect/Video", + "Applies a marbling effect to the image", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_marble_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_marble_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_marble_get_property); @@ -265,7 +259,7 @@ gst_marble_class_init (GstMarbleClass * klass) } static void -gst_marble_init (GstMarble * filter, GstMarbleClass * gclass) +gst_marble_init (GstMarble * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstmirror.c b/gst/geometrictransform/gstmirror.c index a06adf082..85df121da 100644 --- a/gst/geometrictransform/gstmirror.c +++ b/gst/geometrictransform/gstmirror.c @@ -61,8 +61,8 @@ enum #define DEFAULT_PROP_MODE GST_MIRROR_MODE_LEFT -GST_BOILERPLATE (GstMirror, gst_mirror, GstGeometricTransform, - GST_TYPE_GEOMETRIC_TRANSFORM); +#define gst_mirror_parent_class parent_class +G_DEFINE_TYPE (GstMirror, gst_mirror, GST_TYPE_GEOMETRIC_TRANSFORM); #define GST_TYPE_MIRROR_MODE (gst_mirror_mode_get_type()) static GType @@ -123,18 +123,6 @@ gst_mirror_get_property (GObject * object, guint prop_id, } } -static void -gst_mirror_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "mirror", - "Transform/Effect/Video", - "Split the image into two halves and reflect one over each other", - "Filippo Argiolas <filippo.argiolas@gmail.com>"); -} - static gboolean mirror_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -187,11 +175,19 @@ static void gst_mirror_class_init (GstMirrorClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; + gst_element_class_set_details_simple (gstelement_class, + "mirror", + "Transform/Effect/Video", + "Split the image into two halves and reflect one over each other", + "Filippo Argiolas <filippo.argiolas@gmail.com>"); + gobject_class->set_property = gst_mirror_set_property; gobject_class->get_property = gst_mirror_get_property; @@ -207,7 +203,7 @@ gst_mirror_class_init (GstMirrorClass * klass) } static void -gst_mirror_init (GstMirror * filter, GstMirrorClass * gclass) +gst_mirror_init (GstMirror * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstpinch.c b/gst/geometrictransform/gstpinch.c index 9a6ae9ca5..537997d83 100644 --- a/gst/geometrictransform/gstpinch.c +++ b/gst/geometrictransform/gstpinch.c @@ -68,8 +68,8 @@ enum #define DEFAULT_INTENSITY 0.5 -GST_BOILERPLATE (GstPinch, gst_pinch, GstCircleGeometricTransform, - GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +#define gst_pinch_parent_class parent_class +G_DEFINE_TYPE (GstPinch, gst_pinch, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void gst_pinch_set_property (GObject * object, guint prop_id, const GValue * value, @@ -123,20 +123,6 @@ gst_pinch_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_pinch_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "pinch", - "Transform/Effect/Video", - "Applies 'pinch' geometric transform to the image", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean pinch_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -182,13 +168,21 @@ static void gst_pinch_class_init (GstPinchClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "pinch", + "Transform/Effect/Video", + "Applies 'pinch' geometric transform to the image", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_pinch_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_pinch_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_pinch_get_property); @@ -204,7 +198,7 @@ gst_pinch_class_init (GstPinchClass * klass) } static void -gst_pinch_init (GstPinch * filter, GstPinchClass * gclass) +gst_pinch_init (GstPinch * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstrotate.c b/gst/geometrictransform/gstrotate.c index 764feb56a..cf4cf0ef7 100644 --- a/gst/geometrictransform/gstrotate.c +++ b/gst/geometrictransform/gstrotate.c @@ -69,8 +69,8 @@ enum #define DEFAULT_ANGLE 0 -GST_BOILERPLATE (GstRotate, gst_rotate, GstGeometricTransform, - GST_TYPE_GEOMETRIC_TRANSFORM); +#define gst_rotate_parent_class parent_class +G_DEFINE_TYPE (GstRotate, gst_rotate, GST_TYPE_GEOMETRIC_TRANSFORM); static void gst_rotate_set_property (GObject * object, guint prop_id, const GValue * value, @@ -124,20 +124,6 @@ gst_rotate_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_rotate_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "rotate", - "Transform/Effect/Video", - "Rotates the picture by an arbitrary angle", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean rotate_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -190,13 +176,21 @@ static void gst_rotate_class_init (GstRotateClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "rotate", + "Transform/Effect/Video", + "Rotates the picture by an arbitrary angle", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_rotate_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_rotate_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_rotate_get_property); @@ -211,7 +205,7 @@ gst_rotate_class_init (GstRotateClass * klass) } static void -gst_rotate_init (GstRotate * filter, GstRotateClass * gclass) +gst_rotate_init (GstRotate * filter) { filter->angle = DEFAULT_ANGLE; } diff --git a/gst/geometrictransform/gstsphere.c b/gst/geometrictransform/gstsphere.c index b398e6d1d..7d5d5e670 100644 --- a/gst/geometrictransform/gstsphere.c +++ b/gst/geometrictransform/gstsphere.c @@ -68,8 +68,8 @@ enum #define DEFAULT_REFRACTION 1.5 -GST_BOILERPLATE (GstSphere, gst_sphere, GstCircleGeometricTransform, - GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +#define gst_sphere_parent_class parent_class +G_DEFINE_TYPE (GstSphere, gst_sphere, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void gst_sphere_set_property (GObject * object, guint prop_id, const GValue * value, @@ -123,20 +123,6 @@ gst_sphere_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_sphere_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "sphere", - "Transform/Effect/Video", - "Applies 'sphere' geometric transform to the image", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - /* TODO we could have horizontal and vertical 'radius' */ static gboolean sphere_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, @@ -194,13 +180,21 @@ static void gst_sphere_class_init (GstSphereClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "sphere", + "Transform/Effect/Video", + "Applies 'sphere' geometric transform to the image", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_sphere_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_sphere_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_sphere_get_property); @@ -215,7 +209,7 @@ gst_sphere_class_init (GstSphereClass * klass) } static void -gst_sphere_init (GstSphere * filter, GstSphereClass * gclass) +gst_sphere_init (GstSphere * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstsquare.c b/gst/geometrictransform/gstsquare.c index a7b2fc59b..86ecf58fd 100644 --- a/gst/geometrictransform/gstsquare.c +++ b/gst/geometrictransform/gstsquare.c @@ -65,8 +65,8 @@ enum #define DEFAULT_HEIGHT 0.5 #define DEFAULT_ZOOM 2.0 -GST_BOILERPLATE (GstSquare, gst_square, GstGeometricTransform, - GST_TYPE_GEOMETRIC_TRANSFORM); +#define gst_square_parent_class parent_class +G_DEFINE_TYPE (GstSquare, gst_square, GST_TYPE_GEOMETRIC_TRANSFORM); /* GObject vmethod implementations */ @@ -137,18 +137,6 @@ gst_square_get_property (GObject * object, guint prop_id, } } -static void -gst_square_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "square", - "Transform/Effect/Video", - "Distort center part of the image into a square", - "Filippo Argiolas <filippo.argiolas@gmail.com>"); -} - static gboolean square_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -190,12 +178,21 @@ static void gst_square_class_init (GstSquareClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + + gst_element_class_set_details_simple (gstelement_class, + "square", + "Transform/Effect/Video", + "Distort center part of the image into a square", + "Filippo Argiolas <filippo.argiolas@gmail.com>"); + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_square_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_square_get_property); @@ -219,7 +216,7 @@ gst_square_class_init (GstSquareClass * klass) } static void -gst_square_init (GstSquare * filter, GstSquareClass * gclass) +gst_square_init (GstSquare * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gststretch.c b/gst/geometrictransform/gststretch.c index cc92c783e..e9c1f9d35 100644 --- a/gst/geometrictransform/gststretch.c +++ b/gst/geometrictransform/gststretch.c @@ -63,8 +63,8 @@ enum #define DEFAULT_INTENSITY 0.5 #define MAX_SHRINK_AMOUNT 3.0 -GST_BOILERPLATE (GstStretch, gst_stretch, GstCircleGeometricTransform, - GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +#define gst_stretch_parent_class parent_class +G_DEFINE_TYPE (GstStretch, gst_stretch, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void gst_stretch_set_property (GObject * object, guint prop_id, const GValue * value, @@ -118,20 +118,6 @@ gst_stretch_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_stretch_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "stretch", - "Transform/Effect/Video", - "Stretch the image in a circle around the center point", - "Filippo Argiolas <filippo.argiolas@gmail.com>"); -} - static gboolean stretch_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -183,13 +169,21 @@ static void gst_stretch_class_init (GstStretchClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "stretch", + "Transform/Effect/Video", + "Stretch the image in a circle around the center point", + "Filippo Argiolas <filippo.argiolas@gmail.com>"); + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_stretch_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_stretch_get_property); @@ -206,7 +200,7 @@ gst_stretch_class_init (GstStretchClass * klass) } static void -gst_stretch_init (GstStretch * filter, GstStretchClass * gclass) +gst_stretch_init (GstStretch * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gsttunnel.c b/gst/geometrictransform/gsttunnel.c index 3bda98a6a..27ea1b812 100644 --- a/gst/geometrictransform/gsttunnel.c +++ b/gst/geometrictransform/gsttunnel.c @@ -54,8 +54,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_tunnel_debug); #define GST_CAT_DEFAULT gst_tunnel_debug -GST_BOILERPLATE (GstTunnel, gst_tunnel, GstCircleGeometricTransform, - GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +#define gst_tunnel_parent_class parent_class +G_DEFINE_TYPE (GstTunnel, gst_tunnel, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); /* Clean up */ static void @@ -64,19 +64,6 @@ gst_tunnel_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_tunnel_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "tunnel", - "Transform/Effect/Video", - "Light tunnel effect", "Filippo Argiolas <filippo.argiolas@gmail.com>"); -} - static gboolean tunnel_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -120,20 +107,27 @@ static void gst_tunnel_class_init (GstTunnelClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "tunnel", + "Transform/Effect/Video", + "Light tunnel effect", "Filippo Argiolas <filippo.argiolas@gmail.com>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tunnel_finalize); gstgt_class->map_func = tunnel_map; } static void -gst_tunnel_init (GstTunnel * filter, GstTunnelClass * gclass) +gst_tunnel_init (GstTunnel * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gsttwirl.c b/gst/geometrictransform/gsttwirl.c index 8d31d8ee5..f41da660b 100644 --- a/gst/geometrictransform/gsttwirl.c +++ b/gst/geometrictransform/gsttwirl.c @@ -68,8 +68,8 @@ enum #define DEFAULT_ANGLE (G_PI) -GST_BOILERPLATE (GstTwirl, gst_twirl, GstCircleGeometricTransform, - GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); +#define gst_twirl_parent_class parent_class +G_DEFINE_TYPE (GstTwirl, gst_twirl, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void gst_twirl_set_property (GObject * object, guint prop_id, const GValue * value, @@ -123,20 +123,6 @@ gst_twirl_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_twirl_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "twirl", - "Transform/Effect/Video", - "Twists the image from the center out", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean twirl_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -172,13 +158,21 @@ static void gst_twirl_class_init (GstTwirlClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "twirl", + "Transform/Effect/Video", + "Twists the image from the center out", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_twirl_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_twirl_set_property); gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_twirl_get_property); @@ -194,7 +188,7 @@ gst_twirl_class_init (GstTwirlClass * klass) } static void -gst_twirl_init (GstTwirl * filter, GstTwirlClass * gclass) +gst_twirl_init (GstTwirl * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); diff --git a/gst/geometrictransform/gstwaterripple.c b/gst/geometrictransform/gstwaterripple.c index 7e911df7a..a8d694c18 100644 --- a/gst/geometrictransform/gstwaterripple.c +++ b/gst/geometrictransform/gstwaterripple.c @@ -72,7 +72,8 @@ enum #define DEFAULT_PHASE 0.0 #define DEFAULT_WAVELENGTH 16.0 -GST_BOILERPLATE (GstWaterRipple, gst_water_ripple, GstCircleGeometricTransform, +#define gst_water_ripple_parent_class parent_class +G_DEFINE_TYPE (GstWaterRipple, gst_water_ripple, GST_TYPE_CIRCLE_GEOMETRIC_TRANSFORM); static void @@ -147,20 +148,6 @@ gst_water_ripple_finalize (GObject * obj) G_OBJECT_CLASS (parent_class)->finalize (obj); } -/* GObject vmethod implementations */ - -static void -gst_water_ripple_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_set_details_simple (element_class, - "waterripple", - "Transform/Effect/Video", - "Creates a water ripple effect on the image", - "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); -} - static gboolean water_ripple_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, gdouble * in_y) @@ -201,13 +188,21 @@ static void gst_water_ripple_class_init (GstWaterRippleClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstGeometricTransformClass *gstgt_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); + gst_element_class_set_details_simple (gstelement_class, + "waterripple", + "Transform/Effect/Video", + "Creates a water ripple effect on the image", + "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_water_ripple_finalize); gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_water_ripple_set_property); @@ -231,7 +226,7 @@ gst_water_ripple_class_init (GstWaterRippleClass * klass) } static void -gst_water_ripple_init (GstWaterRipple * filter, GstWaterRippleClass * gclass) +gst_water_ripple_init (GstWaterRipple * filter) { GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM (filter); |