Restore the gst_vaapi_{surface,image,subpicture}_get_id() interfaces.
[platform/upstream/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapiimage.h
1 /*
2  *  gstvaapiimage.h - VA image abstraction
3  *
4  *  gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program 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
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19  */
20
21 #ifndef GST_VAAPI_IMAGE_H
22 #define GST_VAAPI_IMAGE_H
23
24 #include <gst/gstbuffer.h>
25 #include <gst/vaapi/gstvaapiobject.h>
26 #include <gst/vaapi/gstvaapidisplay.h>
27 #include <gst/vaapi/gstvaapiimageformat.h>
28
29 G_BEGIN_DECLS
30
31 #define GST_VAAPI_TYPE_IMAGE \
32     (gst_vaapi_image_get_type())
33
34 #define GST_VAAPI_IMAGE(obj)                            \
35     (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
36                                 GST_VAAPI_TYPE_IMAGE,   \
37                                 GstVaapiImage))
38
39 #define GST_VAAPI_IMAGE_CLASS(klass)                    \
40     (G_TYPE_CHECK_CLASS_CAST((klass),                   \
41                              GST_VAAPI_TYPE_IMAGE,      \
42                              GstVaapiImageClass))
43
44 #define GST_VAAPI_IS_IMAGE(obj) \
45     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_IMAGE))
46
47 #define GST_VAAPI_IS_IMAGE_CLASS(klass) \
48     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_IMAGE))
49
50 #define GST_VAAPI_IMAGE_GET_CLASS(obj)                  \
51     (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
52                                GST_VAAPI_TYPE_IMAGE,    \
53                                GstVaapiImageClass))
54
55 /**
56  * GST_VAAPI_IMAGE_FORMAT:
57  * @image: a #GstVaapiImage
58  *
59  * Macro that evaluates to the #GstVaapiImageFormat of @image.
60  */
61 #define GST_VAAPI_IMAGE_FORMAT(image)   gst_vaapi_image_get_format(image)
62
63 /**
64  * GST_VAAPI_IMAGE_WIDTH:
65  * @image: a #GstVaapiImage
66  *
67  * Macro that evaluates to the width of @image.
68  */
69 #define GST_VAAPI_IMAGE_WIDTH(image)    gst_vaapi_image_get_width(image)
70
71 /**
72  * GST_VAAPI_IMAGE_HEIGHT:
73  * @image: a #GstVaapiImage
74  *
75  * Macro that evaluates to the height of @image.
76  */
77 #define GST_VAAPI_IMAGE_HEIGHT(image)   gst_vaapi_image_get_height(image)
78
79 typedef struct _GstVaapiImage                   GstVaapiImage;
80 typedef struct _GstVaapiImagePrivate            GstVaapiImagePrivate;
81 typedef struct _GstVaapiImageClass              GstVaapiImageClass;
82
83 /**
84  * GstVaapiImage:
85  *
86  * A VA image wrapper
87  */
88 struct _GstVaapiImage {
89     /*< private >*/
90     GstVaapiObject parent_instance;
91
92     GstVaapiImagePrivate *priv;
93 };
94
95 /**
96  * GstVaapiImageClass:
97  *
98  * A VA image wrapper class
99  */
100 struct _GstVaapiImageClass {
101     /*< private >*/
102     GstVaapiObjectClass parent_class;
103 };
104
105 GType
106 gst_vaapi_image_get_type(void);
107
108 GstVaapiImage *
109 gst_vaapi_image_new(
110     GstVaapiDisplay    *display,
111     GstVaapiImageFormat format,
112     guint               width,
113     guint               height
114 );
115
116 GstVaapiImage *
117 gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image);
118
119 VAImageID
120 gst_vaapi_image_get_id(GstVaapiImage *image);
121
122 gboolean
123 gst_vaapi_image_get_image(GstVaapiImage *image, VAImage *va_image);
124
125 GstVaapiImageFormat
126 gst_vaapi_image_get_format(GstVaapiImage *image);
127
128 guint
129 gst_vaapi_image_get_width(GstVaapiImage *image);
130
131 guint
132 gst_vaapi_image_get_height(GstVaapiImage *image);
133
134 void
135 gst_vaapi_image_get_size(GstVaapiImage *image, guint *pwidth, guint *pheight);
136
137 gboolean
138 gst_vaapi_image_is_linear(GstVaapiImage *image);
139
140 gboolean
141 gst_vaapi_image_is_mapped(GstVaapiImage *image);
142
143 gboolean
144 gst_vaapi_image_map(GstVaapiImage *image);
145
146 gboolean
147 gst_vaapi_image_unmap(GstVaapiImage *image);
148
149 guint
150 gst_vaapi_image_get_plane_count(GstVaapiImage *image);
151
152 guchar *
153 gst_vaapi_image_get_plane(GstVaapiImage *image, guint plane);
154
155 guint
156 gst_vaapi_image_get_pitch(GstVaapiImage *image, guint plane);
157
158 guint
159 gst_vaapi_image_get_data_size(GstVaapiImage *image);
160
161 gboolean
162 gst_vaapi_image_update_from_buffer(GstVaapiImage *image, GstBuffer *buffer);
163
164 G_END_DECLS
165
166 #endif /* GST_VAAPI_IMAGE_H */