Merge branch 'move_subdir_editing-services' into tizen_gst_1.19.2_mono
[platform/upstream/gstreamer.git] / subprojects / gstreamer-vaapi / gst-libs / gst / vaapi / gstvaapiimage.h
1 /*
2  *  gstvaapiimage.h - VA image abstraction
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6  *  Copyright (C) 2011-2013 Intel Corporation
7  *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public License
11  *  as published by the Free Software Foundation; either version 2.1
12  *  of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free
21  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  *  Boston, MA 02110-1301 USA
23  */
24
25 #ifndef GST_VAAPI_IMAGE_H
26 #define GST_VAAPI_IMAGE_H
27
28 #include <gst/gstbuffer.h>
29 #include <gst/vaapi/gstvaapidisplay.h>
30 #include <gst/vaapi/video-format.h>
31
32 G_BEGIN_DECLS
33
34 #define GST_VAAPI_IMAGE(obj) \
35     ((GstVaapiImage *)(obj))
36
37 /**
38  * GST_VAAPI_IMAGE_FORMAT:
39  * @image: a #GstVaapiImage
40  *
41  * Macro that evaluates to the #GstVideoFormat of @image.
42  */
43 #define GST_VAAPI_IMAGE_FORMAT(image)   gst_vaapi_image_get_format(image)
44
45 /**
46  * GST_VAAPI_IMAGE_WIDTH:
47  * @image: a #GstVaapiImage
48  *
49  * Macro that evaluates to the width of @image.
50  */
51 #define GST_VAAPI_IMAGE_WIDTH(image)    gst_vaapi_image_get_width(image)
52
53 /**
54  * GST_VAAPI_IMAGE_HEIGHT:
55  * @image: a #GstVaapiImage
56  *
57  * Macro that evaluates to the height of @image.
58  */
59 #define GST_VAAPI_IMAGE_HEIGHT(image)   gst_vaapi_image_get_height(image)
60
61 /**
62  * GST_VAAPI_IMAGE_DISPLAY:
63  * @image: a #GstVaapiImage
64  *
65  * Macro that evaluates to the display of @image
66  */
67 #define GST_VAAPI_IMAGE_DISPLAY(image)  gst_vaapi_image_get_display(image)
68
69 /**
70  * GST_VAAPI_IMAGE_ID:
71  * @image: a #GstVaapiImage
72  *
73  * Macro that evaluates to the ID of @image
74  */
75 #define GST_VAAPI_IMAGE_ID(image)       gst_vaapi_image_get_id(image)
76
77 #define GST_TYPE_VAAPI_IMAGE            (gst_vaapi_image_get_type ())
78
79 typedef struct _GstVaapiImage                   GstVaapiImage;
80
81 GType
82 gst_vaapi_image_get_type (void) G_GNUC_CONST;
83
84 GstVaapiDisplay *
85 gst_vaapi_image_get_display (GstVaapiImage * image);
86
87 GstVaapiImage *
88 gst_vaapi_image_new(
89     GstVaapiDisplay    *display,
90     GstVideoFormat      format,
91     guint               width,
92     guint               height
93 );
94
95 GstVaapiImage *
96 gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image);
97
98 /**
99  * gst_vaapi_image_unref: (skip)
100  * @image: (transfer full): a #GstVaapiImage.
101  *
102  * Decreases the refcount of the image. If the refcount reaches 0, the
103  * image will be freed.
104  */
105 static inline void
106 gst_vaapi_image_unref (GstVaapiImage * image)
107 {
108   gst_mini_object_unref (GST_MINI_OBJECT_CAST (image));
109 }
110
111 GstVaapiID
112 gst_vaapi_image_get_id(GstVaapiImage *image);
113
114 gboolean
115 gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
116
117 GstVideoFormat
118 gst_vaapi_image_get_format(GstVaapiImage *image);
119
120 guint
121 gst_vaapi_image_get_width(GstVaapiImage *image);
122
123 guint
124 gst_vaapi_image_get_height(GstVaapiImage *image);
125
126 void
127 gst_vaapi_image_get_size(GstVaapiImage *image, guint *pwidth, guint *pheight);
128
129 gboolean
130 gst_vaapi_image_is_linear(GstVaapiImage *image);
131
132 gboolean
133 gst_vaapi_image_is_mapped(GstVaapiImage *image);
134
135 gboolean
136 gst_vaapi_image_map(GstVaapiImage *image);
137
138 gboolean
139 gst_vaapi_image_unmap(GstVaapiImage *image);
140
141 guint
142 gst_vaapi_image_get_plane_count(GstVaapiImage *image);
143
144 guchar *
145 gst_vaapi_image_get_plane(GstVaapiImage *image, guint plane);
146
147 guint
148 gst_vaapi_image_get_pitch(GstVaapiImage *image, guint plane);
149
150 guint
151 gst_vaapi_image_get_data_size(GstVaapiImage *image);
152
153 gboolean
154 gst_vaapi_image_get_buffer(
155     GstVaapiImage     *image,
156     GstBuffer         *buffer,
157     GstVaapiRectangle *rect
158 );
159
160 gboolean
161 gst_vaapi_image_update_from_buffer(
162     GstVaapiImage     *image,
163     GstBuffer         *buffer,
164     GstVaapiRectangle *rect
165 );
166
167 gboolean
168 gst_vaapi_image_copy(GstVaapiImage *dst_image, GstVaapiImage *src_image);
169
170 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiImage, gst_vaapi_image_unref)
171
172 G_END_DECLS
173
174 #endif /* GST_VAAPI_IMAGE_H */