2 * Copyright (C) <2010> Thiago Santos <thiago.sousa.santos@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_GEOMETRIC_TRANSFORM_H__
21 #define __GST_GEOMETRIC_TRANSFORM_H__
23 #include <gst/video/gstvideofilter.h>
24 #include <gst/video/video.h>
28 #define GST_TYPE_GEOMETRIC_TRANSFORM \
29 (gst_geometric_transform_get_type())
30 #define GST_GEOMETRIC_TRANSFORM(obj) \
31 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GEOMETRIC_TRANSFORM,GstGeometricTransform))
32 #define GST_GEOMETRIC_TRANSFORM_CAST(obj) ((GstGeometricTransform *)(obj))
33 #define GST_GEOMETRIC_TRANSFORM_CLASS(klass) \
34 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GEOMETRIC_TRANSFORM,GstGeometricTransformClass))
35 #define GST_IS_GEOMETRIC_TRANSFORM(obj) \
36 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GEOMETRIC_TRANSFORM))
37 #define GST_IS_GEOMETRIC_TRANSFORM_CLASS(klass) \
38 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GEOMETRIC_TRANSFORM))
39 #define GST_GEOMETRIC_TRANSFORM_GET_CLASS(obj) \
40 (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_GEOMETRIC_TRANSFORM,GstGeometricTransformClass))
44 GST_GT_OFF_EDGES_PIXELS_IGNORE = 0,
45 GST_GT_OFF_EDGES_PIXELS_CLAMP,
46 GST_GT_OFF_EDGES_PIXELS_WRAP
49 typedef struct _GstGeometricTransform GstGeometricTransform;
50 typedef struct _GstGeometricTransformClass GstGeometricTransformClass;
53 * GstGeometricTransformMapFunc:
55 * Given the output pixel position, this function calculates the input pixel
56 * position. The element using this function will then copy the input pixel
57 * data to the output pixel.
59 * @gt: The #GstGeometricTransform
60 * @x: The output pixel x coordinate
61 * @y: The output pixel y coordinate
62 * @_input_x: The input pixel x coordinate
63 * @_input_y: The input pixel y coordinate
64 * Returns: True on success, false otherwise
66 typedef gboolean (*GstGeometricTransformMapFunc) (GstGeometricTransform * gt,
67 gint x, gint y, gdouble * _input_x, gdouble *_input_y);
70 * GstGeometricTransformPrepareFunc:
72 * Called right before starting to calculate the mapping so that
73 * instances might precalculate some values.
75 * Called with the object lock
77 typedef gboolean (*GstGeometricTransformPrepareFunc) (
78 GstGeometricTransform * gt);
81 * GstGeometricTransform:
83 * Opaque datastructure.
85 struct _GstGeometricTransform {
86 GstVideoFilter videofilter;
89 GstVideoFormat format;
93 /* Must be set on NULL state.
94 * Useful for subclasses that use don't want to use a fixed precalculated
95 * pixel mapping table. Like 'diffuse' that uses random values for each pic.
101 gint off_edge_pixels;
106 struct _GstGeometricTransformClass {
107 GstVideoFilterClass parent_class;
109 GstGeometricTransformMapFunc map_func;
110 GstGeometricTransformPrepareFunc prepare_func;
113 GType gst_geometric_transform_get_type (void);
115 void gst_geometric_transform_set_need_remap (GstGeometricTransform * gt);
119 #endif /* __GST_GEOMETRIC_TRANSFORM_H__ */