2 * gstvaapiimage.h - VA image abstraction
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
5 * Copyright (C) 2011-2012 Intel Corporation
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1
10 * of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA
23 #ifndef GST_VAAPI_IMAGE_H
24 #define GST_VAAPI_IMAGE_H
26 #include <gst/gstbuffer.h>
27 #include <gst/vaapi/gstvaapiobject.h>
28 #include <gst/vaapi/gstvaapidisplay.h>
29 #include <gst/vaapi/gstvaapiimageformat.h>
33 #define GST_VAAPI_TYPE_IMAGE \
34 (gst_vaapi_image_get_type())
36 #define GST_VAAPI_IMAGE(obj) \
37 (G_TYPE_CHECK_INSTANCE_CAST((obj), \
38 GST_VAAPI_TYPE_IMAGE, \
41 #define GST_VAAPI_IMAGE_CLASS(klass) \
42 (G_TYPE_CHECK_CLASS_CAST((klass), \
43 GST_VAAPI_TYPE_IMAGE, \
46 #define GST_VAAPI_IS_IMAGE(obj) \
47 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_IMAGE))
49 #define GST_VAAPI_IS_IMAGE_CLASS(klass) \
50 (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_IMAGE))
52 #define GST_VAAPI_IMAGE_GET_CLASS(obj) \
53 (G_TYPE_INSTANCE_GET_CLASS((obj), \
54 GST_VAAPI_TYPE_IMAGE, \
58 * GST_VAAPI_IMAGE_FORMAT:
59 * @image: a #GstVaapiImage
61 * Macro that evaluates to the #GstVaapiImageFormat of @image.
63 #define GST_VAAPI_IMAGE_FORMAT(image) gst_vaapi_image_get_format(image)
66 * GST_VAAPI_IMAGE_WIDTH:
67 * @image: a #GstVaapiImage
69 * Macro that evaluates to the width of @image.
71 #define GST_VAAPI_IMAGE_WIDTH(image) gst_vaapi_image_get_width(image)
74 * GST_VAAPI_IMAGE_HEIGHT:
75 * @image: a #GstVaapiImage
77 * Macro that evaluates to the height of @image.
79 #define GST_VAAPI_IMAGE_HEIGHT(image) gst_vaapi_image_get_height(image)
81 typedef struct _GstVaapiImage GstVaapiImage;
82 typedef struct _GstVaapiImagePrivate GstVaapiImagePrivate;
83 typedef struct _GstVaapiImageClass GstVaapiImageClass;
84 typedef struct _GstVaapiImageRaw GstVaapiImageRaw;
91 struct _GstVaapiImage {
93 GstVaapiObject parent_instance;
95 GstVaapiImagePrivate *priv;
101 * A VA image wrapper class
103 struct _GstVaapiImageClass {
105 GstVaapiObjectClass parent_class;
111 * A raw image wrapper. The caller is responsible for initializing all
112 * the fields with sensible values.
114 struct _GstVaapiImageRaw {
115 GstVaapiImageFormat format;
124 gst_vaapi_image_get_type(void) G_GNUC_CONST;
128 GstVaapiDisplay *display,
129 GstVaapiImageFormat format,
135 gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image);
138 gst_vaapi_image_get_id(GstVaapiImage *image);
141 gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
144 gst_vaapi_image_get_format(GstVaapiImage *image);
147 gst_vaapi_image_get_width(GstVaapiImage *image);
150 gst_vaapi_image_get_height(GstVaapiImage *image);
153 gst_vaapi_image_get_size(GstVaapiImage *image, guint *pwidth, guint *pheight);
156 gst_vaapi_image_is_linear(GstVaapiImage *image);
159 gst_vaapi_image_is_mapped(GstVaapiImage *image);
162 gst_vaapi_image_map(GstVaapiImage *image);
165 gst_vaapi_image_unmap(GstVaapiImage *image);
168 gst_vaapi_image_get_plane_count(GstVaapiImage *image);
171 gst_vaapi_image_get_plane(GstVaapiImage *image, guint plane);
174 gst_vaapi_image_get_pitch(GstVaapiImage *image, guint plane);
177 gst_vaapi_image_get_data_size(GstVaapiImage *image);
180 gst_vaapi_image_get_buffer(
181 GstVaapiImage *image,
183 GstVaapiRectangle *rect
187 gst_vaapi_image_get_raw(
188 GstVaapiImage *image,
189 GstVaapiImageRaw *dst_image,
190 GstVaapiRectangle *rect
194 gst_vaapi_image_update_from_buffer(
195 GstVaapiImage *image,
197 GstVaapiRectangle *rect
201 gst_vaapi_image_update_from_raw(
202 GstVaapiImage *image,
203 GstVaapiImageRaw *src_image,
204 GstVaapiRectangle *rect
208 gst_vaapi_convert_buffer_to_image(
209 GstVaapiImage *image,
216 #endif /* GST_VAAPI_IMAGE_H */