1 /* GStreamer
2  * Copyright (C) Collabora Ltd.
3  *   Author: Matthieu Bouron <matthieu.bouron@collabora.com>
4  * Copyright (C) 2015, Matthew Waters <matthew@centricular.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef __GST_VIDEO_AFFINE_TRANSFORMATION_META_H__
23 #define __GST_VIDEO_AFFINE_TRANSFORMATION_META_H__
24 
25 #include <gst/gst.h>
26 #include <gst/video/video.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GST_VIDEO_AFFINE_TRANSFORMATION_META_API_TYPE (gst_video_affine_transformation_meta_api_get_type())
31 #define GST_VIDEO_AFFINE_TRANSFORMATION_META_INFO  (gst_video_affine_transformation_meta_get_info())
32 
33 typedef struct _GstVideoAffineTransformationMeta GstVideoAffineTransformationMeta;
34 typedef gboolean (*GstVideoAffineTransformationGetMatrix) (GstVideoAffineTransformationMeta * meta, gfloat * matrix);
35 
36 #define GST_CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META "meta:GstVideoAffineTransformation"
37 #define GST_BUFFER_POOL_OPTION_VIDEO_AFFINE_TRANSFORMATION_META "GstBufferPoolOptionVideoAffineTransformation"
38 
39 /**
40  * GstVideoAffineTransformationMeta:
41  * @meta: parent #GstMeta
42  * @matrix: the column-major 4x4 transformation matrix
43  *
44  * Extra buffer metadata for performing an affine transformation using a 4x4
45  * matrix. The transformation matrix can be composed with
46  * gst_video_affine_transformation_meta_apply_matrix().
47  *
48  * The vertices operated on are all in the range 0 to 1, not in
49  * Normalized Device Coordinates (-1 to +1). Transforming points in this space
50  * are assumed to have an origin at (0.5, 0.5, 0.5) in a left-handed coordinate
51  * system with the x-axis moving horizontally (positive values to the right),
52  * the y-axis moving vertically (positive values up the screen) and the z-axis
53  * perpendicular to the screen (positive values into the screen).
54  *
55  * Since: 1.8
56  */
57 struct _GstVideoAffineTransformationMeta
58 {
59   GstMeta meta;
60 
61   gfloat matrix[16];
62 };
63 
64 GST_VIDEO_API
65 GType gst_video_affine_transformation_meta_api_get_type          (void);
66 
67 GST_VIDEO_API
68 const GstMetaInfo *gst_video_affine_transformation_meta_get_info (void);
69 
70 #define gst_buffer_get_video_affine_transformation_meta(b) \
71     ((GstVideoAffineTransformationMeta *)gst_buffer_get_meta((b),GST_VIDEO_AFFINE_TRANSFORMATION_META_API_TYPE))
72 GST_VIDEO_API
73 GstVideoAffineTransformationMeta *gst_buffer_add_video_affine_transformation_meta (GstBuffer * buffer);
74 
75 GST_VIDEO_API
76 void gst_video_affine_transformation_meta_apply_matrix                           (GstVideoAffineTransformationMeta * meta,
77                                                                                   const gfloat matrix[16]);
78 
79 G_END_DECLS
80 
81 #endif /* __GST_VIDEO_AFFINE_TRANSFORMATION_META_H__ */
82